* [PATCH v2] scripts/archive-source: Use GNU tar on Darwin
@ 2022-12-09 11:33 Philippe Mathieu-Daudé
2023-01-12 11:58 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-12-09 11:33 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Bennée, Wainer dos Santos Moschetta, Beraldo Leal,
Philippe Mathieu-Daudé, Gerd Hoffmann, qemu-trivial,
Daniel P . Berrangé, Eric Blake, Thomas Huth
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] scripts/archive-source: Use GNU tar on Darwin
2022-12-09 11:33 [PATCH v2] scripts/archive-source: Use GNU tar on Darwin Philippe Mathieu-Daudé
@ 2023-01-12 11:58 ` Philippe Mathieu-Daudé
2023-01-12 12:07 ` Thomas Huth
0 siblings, 1 reply; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-12 11:58 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Bennée, Wainer dos Santos Moschetta, Beraldo Leal,
Gerd Hoffmann, qemu-trivial, Daniel P . Berrangé, Eric Blake,
Thomas Huth, Marc-André Lureau
ping?
On 9/12/22 12:33, Philippe Mathieu-Daudé wrote:
> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] scripts/archive-source: Use GNU tar on Darwin
2023-01-12 11:58 ` Philippe Mathieu-Daudé
@ 2023-01-12 12:07 ` Thomas Huth
2023-01-12 12:16 ` Daniel P. Berrangé
2023-01-12 12:20 ` Philippe Mathieu-Daudé
0 siblings, 2 replies; 5+ messages in thread
From: Thomas Huth @ 2023-01-12 12:07 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Alex Bennée, Wainer dos Santos Moschetta, Beraldo Leal,
Gerd Hoffmann, qemu-trivial, Daniel P . Berrangé, Eric Blake,
Marc-André Lureau
On 12/01/2023 12.58, Philippe Mathieu-Daudé wrote:
> ping?
Who's supposed to take this?
> On 9/12/22 12:33, Philippe Mathieu-Daudé wrote:
>> 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
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
>> 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
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] scripts/archive-source: Use GNU tar on Darwin
2023-01-12 12:07 ` Thomas Huth
@ 2023-01-12 12:16 ` Daniel P. Berrangé
2023-01-12 12:20 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 5+ messages in thread
From: Daniel P. Berrangé @ 2023-01-12 12:16 UTC (permalink / raw)
To: Thomas Huth
Cc: Philippe Mathieu-Daudé, qemu-devel, Alex Bennée,
Wainer dos Santos Moschetta, Beraldo Leal, Gerd Hoffmann,
qemu-trivial, Eric Blake, Marc-André Lureau
On Thu, Jan 12, 2023 at 01:07:08PM +0100, Thomas Huth wrote:
> On 12/01/2023 12.58, Philippe Mathieu-Daudé wrote:
> > ping?
>
> Who's supposed to take this?
>
> > On 9/12/22 12:33, Philippe Mathieu-Daudé wrote:
> > > 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
>
> 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?
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
--
|: 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 :|
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] scripts/archive-source: Use GNU tar on Darwin
2023-01-12 12:07 ` Thomas Huth
2023-01-12 12:16 ` Daniel P. Berrangé
@ 2023-01-12 12:20 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-12 12:20 UTC (permalink / raw)
To: Thomas Huth, qemu-devel
Cc: Alex Bennée, Wainer dos Santos Moschetta, Beraldo Leal,
Gerd Hoffmann, qemu-trivial, Daniel P . Berrangé, Eric Blake,
Marc-André Lureau
On 12/1/23 13:07, Thomas Huth wrote:
> On 12/01/2023 12.58, Philippe Mathieu-Daudé wrote:
>> ping?
>
> Who's supposed to take this?
Alex Bennée? I'll precise in v3.
>> On 9/12/22 12:33, Philippe Mathieu-Daudé wrote:
>>> 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
>
> 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?
Clever, I like it!
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-01-12 13:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-09 11:33 [PATCH v2] scripts/archive-source: Use GNU tar on Darwin Philippe Mathieu-Daudé
2023-01-12 11:58 ` Philippe Mathieu-Daudé
2023-01-12 12:07 ` Thomas Huth
2023-01-12 12:16 ` Daniel P. Berrangé
2023-01-12 12:20 ` Philippe Mathieu-Daudé
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).