opkg-build: add detection if using GNU tar.
PATCH v2 1/1 opkg-build: add detection if using GNU tar.
From: Thomas Ingleby <[email protected]>
* Some options of GNU tar do not exist on other implementations
--- opkg-build | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
opkg-build +10 -3
@@ -159,6 +159,13 @@ ogargs="" outer=ar noclean=0 opkext=0 + +tarformat="" +if tar --help 2>&1 | grep -- "--format" > /dev/null; +then + tarformat="--format=gnu" +fi + usage="Usage: $0 [-c] [-C] [-O] [-o owner] [-g group] <pkg_directory> [<destination_directory>]" while getopts "cCg:ho:vO" opt; do case $opt in
@@ -233,8 +240,8 @@ tmp_dir=$dest_dir/IPKG_BUILD.$$ mkdir $tmp_dir echo $CONTROL > $tmp_dir/tarX -( cd $pkg_dir && tar $ogargs -X $tmp_dir/tarX -cz --format=gnu -f $tmp_dir/data.tar.gz . ) -( cd $pkg_dir/$CONTROL && tar $ogargs -cz --format=gnu -f $tmp_dir/control.tar.gz . ) +( cd $pkg_dir && tar $ogargs -X $tmp_dir/tarX -cz $tarformat -f $tmp_dir/data.tar.gz . ) +( cd $pkg_dir/$CONTROL && tar $ogargs -cz $tarformat -f $tmp_dir/control.tar.gz . ) rm $tmp_dir/tarX echo "2.0" > $tmp_dir/debian-binary
@@ -249,7 +256,7 @@ rm -f $pkg_file if [ "$outer" = "ar" ] ; then ( cd $tmp_dir && ar -crf $pkg_file ./debian-binary ./control.tar.gz ./data.tar.gz ) else - ( cd $tmp_dir && tar -cz --format=gnu -f $pkg_file ./debian-binary ./control.tar.gz ./data.tar.gz ) + ( cd $tmp_dir && tar -cz $tarformat -f $pkg_file ./debian-binary ./control.tar.gz ./data.tar.gz ) fi rm $tmp_dir/debian-binary $tmp_dir/data.tar.gz $tmp_dir/control.tar.gz
Signature · 1 line
1.9.2
Quoted 5 lines · On Tue, Jun 03, 2014 at 11:25:35AM +0100, [email protected] wrote:
From: Thomas Ingleby <[email protected]>
* Some options of GNU tar do not exist on other implementations
Signed-off-by Thomas Ingleby <[email protected]>
I've made a couple of slight further changes, hope you don't mind.
I've changed the subject to:
opkg-build: Detect if tar supports '--format' option
I've also added a comment before the block of code which sets tarformat:
+# Determine if tar supports the --format argument by checking the help output. +#
+# This is needed because:
+# - Busybox tar doesn't support '--format'
+# - On some Linux distros, tar now defaults to posix format if '--format'
+# isn't explictly specified
+# - Opkg doesn't currently support posix format archives
+#
+# It's easier to check for mention of the '--format' option than to detect the +# tar implementation and maintain a list of which support '--format'.
I've merged this to master with those changes. Sadly I made an error writing the comment and pushed too soon so I've pushed another commit to fix that.
Many thanks,
Signature · 4 lines
Paul Barker Email: [email protected] http://www.paulbarker.me.uk
Great!,
Have a good evening,
Tom
Quoted 36 lines · Paul Barker
Quoted 5 lines · On Tue, Jun 03, 2014 at 11:25:35AM +0100, [email protected] wrote:
From: Thomas Ingleby <[email protected]>
* Some options of GNU tar do not exist on other implementations
Signed-off-by Thomas Ingleby <[email protected]>I've made a couple of slight further changes, hope you don't mind.
I've changed the subject to:
opkg-build: Detect if tar supports '--format' option
I've also added a comment before the block of code which sets tarformat:
(quoted diff) +10
-0+# Determine if tar supports the --format argument by checking the help output. +# +# This is needed because: +# - Busybox tar doesn't support '--format' +# - On some Linux distros, tar now defaults to posix format if '--format' +# isn't explictly specified +# - Opkg doesn't currently support posix format archives +# +# It's easier to check for mention of the '--format' option than to detect the +# tar implementation and maintain a list of which support '--format'.I've merged this to master with those changes. Sadly I made an error writing the comment and pushed too soon so I've pushed another commit to fix that.
Many thanks,
--
Paul Barker