[bitbake-devel] [master][PATCH] fetch2: fix unpack of .xz files

André Draszik andre.draszik at linaro.org
Tue Jul 30 12:56:22 UTC 2013


If a file ends with .xz, it currently gets overwritten during unpack:
The decompress command for .xz files is:
  'xz -dc %s > %s' % (file, efile)
and as efile == file, we end up overwriting file (the source).

Fix this by adding .xz to the list of suffixes that that need to
be removed from a file name for an extract command, leaving the
bare file name. Now, for a given file foo.xz,
file == foo.xz and efile == foo, similar to how .gz .bz2 and .Z
files are treated.

Signed-off-by: André Draszik <andre.draszik at linaro.org>
---
 lib/bb/fetch2/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py
index 6211cd7..451d104 100644
--- a/lib/bb/fetch2/__init__.py
+++ b/lib/bb/fetch2/__init__.py
@@ -1157,7 +1157,7 @@ class FetchMethod(object):
                      (file, urldata.parm.get('unpack')))
 
         dots = file.split(".")
-        if dots[-1] in ['gz', 'bz2', 'Z']:
+        if dots[-1] in ['gz', 'bz2', 'Z', 'xz']:
             efile = os.path.join(rootdir, os.path.basename('.'.join(dots[0:-1])))
         else:
             efile = file
-- 
1.8.2




More information about the bitbake-devel mailing list