scripts/archive-source: Use GNU tar on Darwin
PATCH v2 1/1 scripts/archive-source: Use GNU tar on Darwin
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).
---
Supersedes: <[email protected]>
--- scripts/archive-source.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/archive-source.sh +2 -1
@@ -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
Signature · 1 line
2.38.1
ping?
Quoted 45 lines · Philippe Mathieu-Daudé
When using the
archive-source.shscript 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.8Try to use the GNU implementation if it is available (from homebrew).
Suggested-by Daniel P. Berrangé <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
Supersedes: <[email protected]>--- scripts/archive-source.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)scripts/archive-source.sh +2
-1@@ -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
Quoted 1 line · Philippe Mathieu-Daudé
ping?
Who's supposed to take this?
Quoted 25 lines · Philippe Mathieu-Daudé
Quoted 24 lines
When using the
archive-source.shscript 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.8Try to use the GNU implementation if it is available (from homebrew).
Suggested-by Daniel P. Berrangé <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
Supersedes: <[email protected]>
---
scripts/archive-source.sh| 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 8 lines
Quoted 8 lines
scripts/archive-source.sh +0
-0@@ -18,6 +18,7 @@ if test $# -lt 1; thenerror "Usage: $0 <output tarball>"
fi
+test $(uname -s) = "Darwin" && tar=gtar || tar=tar
I wonder whether this script works on other *BSDs ... maybe it would be better to test "tar --version | grep -q GNU" to make this even work on non-Darwin systems where "tar" is not GNU's tar?
Thomas
Quoted 13 lines
Quoted 12 lines
tar_file=$(realpath "$1")
sub_tdir=$(mktemp -d "${tar_file%.tar}.sub.XXXXXXXX") sub_file="${sub_tdir}/submodule.tar"scripts/archive-source.sh +0
-0@@ -67,7 +68,7 @@ for sm in $submodules; doesac
(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
Quoted 30 lines · Thomas Huth
Quoted 1 line · Philippe Mathieu-Daudé
ping?
Who's supposed to take this?
Quoted 25 lines · Philippe Mathieu-Daudé
Quoted 24 lines
When using the
archive-source.shscript 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.8Try to use the GNU implementation if it is available (from homebrew).
Suggested-by Daniel P. Berrangé <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
Supersedes: <[email protected]>
---
scripts/archive-source.sh| 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 12 lines
Quoted 8 lines
Quoted 8 lines
scripts/archive-source.sh +0
-0@@ -18,6 +18,7 @@ if test $# -lt 1; thenerror "Usage: $0 <output tarball>"
fi
+test $(uname -s) = "Darwin" && tar=gtar || tar=tarI wonder whether this script works on other *BSDs ... maybe it would be better to test "tar --version | grep -q GNU" to make this even work on non-Darwin systems where "tar" is not GNU's tar?
Perhaps something like
tar=$(which gtar >/dev/null 2>&1 && echo gtar || echo tar)
$tar --version | grep GNU >/dev/null 2>&1 || { echo "$tar does not appear to be GNU tar" ; exit 1 }With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Quoted 4 lines · Thomas Huth
Quoted 1 line · Philippe Mathieu-Daudé
ping?
Who's supposed to take this?
Alex Bennée? I'll precise in v3.
Quoted 25 lines
Quoted 25 lines · Philippe Mathieu-Daudé
Quoted 24 lines
When using the
archive-source.shscript 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.8Try to use the GNU implementation if it is available (from homebrew).
Suggested-by Daniel P. Berrangé <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
Supersedes: <[email protected]>
---
scripts/archive-source.sh| 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 10 lines
Quoted 8 lines
Quoted 8 lines
scripts/archive-source.sh +0
-0@@ -18,6 +18,7 @@ if test $# -lt 1; thenerror "Usage: $0 <output tarball>"
fi
+test $(uname -s) = "Darwin" && tar=gtar || tar=tarI wonder whether this script works on other *BSDs ... maybe it would be better to test "tar --version | grep -q GNU" to make this even work on non-Darwin systems where "tar" is not GNU's tar?
Clever, I like it!