summaryrefslogtreecommitdiffstats
path: root/lib/bb/fetch2/__init__.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-05-25 16:46:44 +1200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-06-02 22:13:14 +0100
commit17ff08d225a8fa7faffd683c028369574954fba9 (patch)
tree57a3055d5e0d383817d148ba43da5aabfcb02565 /lib/bb/fetch2/__init__.py
parente5986c78a6108fd7578989c20efcbf0b81c97e03 (diff)
downloadbitbake-contrib-17ff08d225a8fa7faffd683c028369574954fba9.tar.gz
fetch2: fix unpacking of deb packages
deb packages in modern Debian versions have the data tarball compressed with xz rather than gzip, and thus explicitly extracting data.tar.gz fails. Unfortunately ar doesn't support wildcards matching items to extract, so we have to find out what the name of the file is first and then extract it, relying on tar to figure out how to unpack it based on the filename rather than doing it with pipes and making that determination ourselves. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/fetch2/__init__.py')
-rw-r--r--lib/bb/fetch2/__init__.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py
index be01bdbb3..f612318cc 100644
--- a/lib/bb/fetch2/__init__.py
+++ b/lib/bb/fetch2/__init__.py
@@ -1392,7 +1392,18 @@ class FetchMethod(object):
else:
cmd = 'rpm2cpio.sh %s | cpio -id' % (file)
elif file.endswith('.deb') or file.endswith('.ipk'):
- cmd = 'ar -p %s data.tar.gz | zcat | tar --no-same-owner -xpf -' % file
+ output = subprocess.check_output('ar -t %s' % file, preexec_fn=subprocess_setup, shell=True)
+ datafile = None
+ if output:
+ for line in output.splitlines():
+ if line.startswith('data.tar.'):
+ datafile = line
+ break
+ else:
+ raise UnpackError("Unable to unpack deb/ipk package - does not contain data.tar.* file", urldata.url)
+ else:
+ raise UnpackError("Unable to unpack deb/ipk package - could not list contents", urldata.url)
+ cmd = 'ar x %s %s && tar --no-same-owner -xpf %s && rm %s' % (file, datafile, datafile, datafile)
elif file.endswith('.tar.7z'):
cmd = '7z x -so %s | tar xf - ' % file
elif file.endswith('.7z'):