All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] opkg-build: add detection if using GNU tar.
@ 2014-06-03 10:25 tom
  2014-06-05 19:56 ` Paul Barker
  0 siblings, 1 reply; 3+ messages in thread
From: tom @ 2014-06-03 10:25 UTC (permalink / raw)
  To: opkg-devel, yocto; +Cc: brendan.le.foll, paul.eggleton, Thomas Ingleby

From: Thomas Ingleby <thomas.c.ingleby@intel.com>

* Some options of GNU tar do not exist on other implementations

Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
---
 opkg-build | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/opkg-build b/opkg-build
index e314712..ed1c93b 100755
--- a/opkg-build
+++ b/opkg-build
@@ -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
-- 
1.9.2



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH V2] opkg-build: add detection if using GNU tar.
  2014-06-03 10:25 [PATCH V2] opkg-build: add detection if using GNU tar tom
@ 2014-06-05 19:56 ` Paul Barker
  2014-06-05 20:09   ` Tom Ingleby
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Barker @ 2014-06-05 19:56 UTC (permalink / raw)
  To: tom; +Cc: brendan.le.foll, yocto, opkg-devel, Thomas Ingleby, paul.eggleton

[-- Attachment #1: Type: text/plain, Size: 1243 bytes --]

On Tue, Jun 03, 2014 at 11:25:35AM +0100, tom@ewsting.org wrote:
> From: Thomas Ingleby <thomas.c.ingleby@intel.com>
> 
> * Some options of GNU tar do not exist on other implementations
> 
> Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>

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,

-- 
Paul Barker

Email: paul@paulbarker.me.uk
http://www.paulbarker.me.uk

[-- Attachment #2: Type: application/pgp-signature, Size: 501 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH V2] opkg-build: add detection if using GNU tar.
  2014-06-05 19:56 ` Paul Barker
@ 2014-06-05 20:09   ` Tom Ingleby
  0 siblings, 0 replies; 3+ messages in thread
From: Tom Ingleby @ 2014-06-05 20:09 UTC (permalink / raw)
  To: Paul Barker
  Cc: Le Foll, Brendan, yocto, opkg-devel, Thomas Ingleby,
	paul.eggleton

Great!,

Have a good evening,
Tom

On 5 June 2014 20:56, Paul Barker <paul@paulbarker.me.uk> wrote:
> On Tue, Jun 03, 2014 at 11:25:35AM +0100, tom@ewsting.org wrote:
>> From: Thomas Ingleby <thomas.c.ingleby@intel.com>
>>
>> * Some options of GNU tar do not exist on other implementations
>>
>> Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
>
> 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,
>
> --
> Paul Barker
>
> Email: paul@paulbarker.me.uk
> http://www.paulbarker.me.uk


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-06-05 20:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-03 10:25 [PATCH V2] opkg-build: add detection if using GNU tar tom
2014-06-05 19:56 ` Paul Barker
2014-06-05 20:09   ` Tom Ingleby

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.