qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2] scripts/archive-source: Use GNU tar on Darwin


From: Philippe Mathieu-Daudé
Subject: [PATCH v2] scripts/archive-source: Use GNU tar on Darwin
Date: Fri, 9 Dec 2022 12:33:42 +0100

When using the archive-source.sh script on Darwin we get:

  tar: Option --concatenate is not supported
  Usage:
    List:    tar -tf <archive-filename>
    Extract: tar -xf <archive-filename>
    Create:  tar -cf <archive-filename> [filenames...]
    Help:    tar --help

'tar' default to the BSD implementation:

  $ tar --version
  bsdtar 3.5.3 - libarchive 3.5.3 zlib/1.2.11 liblzma/5.0.5 bz2lib/1.0.8

Try to use the GNU implementation if it is available (from homebrew).

Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
Supersedes: <20221208162051.29509-1-philmd@linaro.org>
---
 scripts/archive-source.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/archive-source.sh b/scripts/archive-source.sh
index 23e042dacd..e3d0c23fe5 100755
--- a/scripts/archive-source.sh
+++ b/scripts/archive-source.sh
@@ -18,6 +18,7 @@ if test $# -lt 1; then
     error "Usage: $0 <output tarball>"
 fi
 
+test $(uname -s) = "Darwin" && tar=gtar || tar=tar
 tar_file=$(realpath "$1")
 sub_tdir=$(mktemp -d "${tar_file%.tar}.sub.XXXXXXXX")
 sub_file="${sub_tdir}/submodule.tar"
@@ -67,7 +68,7 @@ for sm in $submodules; do
     esac
     (cd $sm; git archive --format tar --prefix "$sm/" $(tree_ish)) > 
"$sub_file"
     test $? -ne 0 && error "failed to archive submodule $sm ($smhash)"
-    tar --concatenate --file "$tar_file" "$sub_file"
+    $tar --concatenate --file "$tar_file" "$sub_file"
     test $? -ne 0 && error "failed append submodule $sm to $tar_file"
 done
 exit 0
-- 
2.38.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]