Hi,

I added a minor change to base.bbclass to accept a 'nounpack=1'
parameter to stop bitbake from unpacking a file that has a bz2, tar...
extension; this is useful if you actually want to include such an
archive file in a package.  I'm not familiar with the policies for
submitting patches however I thought other people might find it useful
so I've included it below:
==================================
diff --git a/classes/base.bbclass b/classes/base.bbclass
index 4d5d73d..387a066 100644
--- a/classes/base.bbclass
+++ b/classes/base.bbclass
@@ -171,21 +171,29 @@ def oe_unpack_file(file, data, url = None):
        else:
                efile = file
        cmd = None
-       if file.endswith('.tar'):
+
+        # allow a 'nounpack=1' url parameter to prevent unpacking of archives
+        unpack = True
+        (type, host, path, user, pswd, parm) = bb.decodeurl(url)
+        if 'nounpack' in parm:
+                if parm['nounpack']:
+                        unpack = False
+
+       if unpack and file.endswith('.tar'):
                cmd = 'tar x --no-same-owner -f %s' % file
-       elif file.endswith('.tgz') or file.endswith('.tar.gz') or
file.endswith('.tar.Z'):
+       elif unpack and (file.endswith('.tgz') or
file.endswith('.tar.gz') or file.endswith('.tar.Z')):
                cmd = 'tar xz --no-same-owner -f %s' % file
-       elif file.endswith('.tbz') or file.endswith('.tbz2') or
file.endswith('.tar.bz2'):
+       elif unpack and (file.endswith('.tbz') or
file.endswith('.tbz2') or file.endswith('.tar.bz2')):
                cmd = 'bzip2 -dc %s | tar x --no-same-owner -f -' % file
-       elif file.endswith('.gz') or file.endswith('.Z') or file.endswith('.z'):
+       elif unpack and (file.endswith('.gz') or file.endswith('.Z')
or file.endswith('.z')):
                cmd = 'gzip -dc %s > %s' % (file, efile)
-       elif file.endswith('.bz2'):
+       elif unpack and file.endswith('.bz2'):
                cmd = 'bzip2 -dc %s > %s' % (file, efile)
-       elif file.endswith('.tar.xz'):
+       elif unpack and file.endswith('.tar.xz'):
                cmd = 'xz -dc %s | tar x --no-same-owner -f -' % file
-       elif file.endswith('.xz'):
+       elif unpack and file.endswith('.xz'):
                cmd = 'xz -dc %s > %s' % (file, efile)
-       elif file.endswith('.zip') or file.endswith('.jar'):
+       elif unpack and (file.endswith('.zip') or file.endswith('.jar')):
                cmd = 'unzip -q -o'
                (type, host, path, user, pswd, parm) = bb.decodeurl(url)
                if 'dos' in parm:
==================================

This is a learning experience for me so comments on how to submit
patches properly are very welcome :).

-Ash
diff --git a/classes/base.bbclass b/classes/base.bbclass
index 4d5d73d..5b3d92e 100644
--- a/classes/base.bbclass
+++ b/classes/base.bbclass
@@ -171,21 +171,29 @@ def oe_unpack_file(file, data, url = None):
 	else:
 		efile = file
 	cmd = None
-	if file.endswith('.tar'):
+
+        # allow a 'nounpack=1' url parameter to prevent unpacking of archives
+        unpack = True
+        (type, host, path, user, pswd, parm) = bb.decodeurl(url)
+        if 'nounpack' in parm:
+                if parm['nounpack']:
+                        unpack = False
+
+	if unpack and file.endswith('.tar'):
 		cmd = 'tar x --no-same-owner -f %s' % file
-	elif file.endswith('.tgz') or file.endswith('.tar.gz') or file.endswith('.tar.Z'):
+	elif unpack and (file.endswith('.tgz') or file.endswith('.tar.gz') or file.endswith('.tar.Z')):
 		cmd = 'tar xz --no-same-owner -f %s' % file
-	elif file.endswith('.tbz') or file.endswith('.tbz2') or file.endswith('.tar.bz2'):
+	elif unpack and (file.endswith('.tbz') or file.endswith('.tbz2') or file.endswith('.tar.bz2')):
 		cmd = 'bzip2 -dc %s | tar x --no-same-owner -f -' % file
-	elif file.endswith('.gz') or file.endswith('.Z') or file.endswith('.z'):
+	elif unpack and (file.endswith('.gz') or file.endswith('.Z') or file.endswith('.z')):
 		cmd = 'gzip -dc %s > %s' % (file, efile)
-	elif file.endswith('.bz2'):
+	elif unpack and file.endswith('.bz2'):
 		cmd = 'bzip2 -dc %s > %s' % (file, efile)
-	elif file.endswith('.tar.xz'):
+	elif unpack and file.endswith('.tar.xz'):
 		cmd = 'xz -dc %s | tar x --no-same-owner -f -' % file
-	elif file.endswith('.xz'):
+	elif unpack and file.endswith('.xz'):
 		cmd = 'xz -dc %s > %s' % (file, efile)
-	elif file.endswith('.zip') or file.endswith('.jar'):
+	elif unpack and (file.endswith('.zip') or file.endswith('.jar')):
 		cmd = 'unzip -q -o'
 		(type, host, path, user, pswd, parm) = bb.decodeurl(url)
 		if 'dos' in parm:
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel

Reply via email to