Commit 313305fd authored by Nirbheek Chauhan's avatar Nirbheek Chauhan 🐜

cerbero/unpack: Use tarfile module for xz tarballs too

Since Python 3.3, the tarfile module also supports lzma compression
and the implementation is less buggy than the MSYS tar:

1. It does not error out on uids that are out of range
2. Handles symlinks correctly by coping the file on extract
3. Better error reporting
parent ad42e2a7
......@@ -95,10 +95,7 @@ class WindowsBootstrapper(BootstrapperBase):
tarfile = os.path.join(self.prefix, tarball)
tarfile = os.path.abspath(tarfile)
shell.download("%s/%s" % (MINGW_DOWNLOAD_SOURCE, tarball), tarfile, check_cert=False)
try:
shell.unpack(tarfile, self.prefix)
except Exception:
pass
shell.unpack(tarfile, self.prefix)
self.fix_lib_paths()
if self.arch == Architecture.X86:
try:
......@@ -116,10 +113,7 @@ class WindowsBootstrapper(BootstrapperBase):
tarfile = os.path.join(self.perl_prefix, os.path.basename(url))
tarfile = os.path.abspath(tarfile)
shell.download(url, tarfile, check_cert=False)
try:
shell.unpack(tarfile, self.perl_prefix)
except Exception:
pass
shell.unpack(tarfile, self.perl_prefix)
# Move perl installation from perl-5.xx.y to perl
perldir = os.path.join(self.perl_prefix, 'perl-' + PERL_VERSION)
for d in os.listdir(perldir):
......
......@@ -212,7 +212,8 @@ def unpack(filepath, output_dir):
tf = tarfile.open(filepath, mode='r:bz2')
tf.extractall(path=output_dir)
elif filepath.endswith('tar.xz'):
call("%s -Jxf %s" % (TAR, to_unixpath(filepath)), output_dir)
tf = tarfile.open(filepath, mode='r:xz')
tf.extractall(path=output_dir)
elif filepath.endswith('.zip'):
zf = zipfile.ZipFile(filepath, "r")
zf.extractall(path=output_dir)
......
......@@ -5,12 +5,9 @@ class Recipe(recipe.Recipe):
version = '1.27'
stype = SourceType.TARBALL
tarball_dirname = 'gtk-doc-%(version)s'
# url = 'https://ftp.acc.umu.se/pub/GNOME/sources/gtk-doc/%(version)s/gtk-doc-%(version)s.tar.xz'
# !!! gtk-doc 1.27 doesn't unpack on MingW, because the uid of the packager is out of range 1..65535
# So mirror our own re-tarballed version.
# See https://bugzilla.gnome.org/show_bug.cgi?id=722621
url = 'https://gstreamer.freedesktop.org/src/mirror/gtk-doc-%(version)s.tar.xz'
tarball_checksum = 'd00d589e68d0820bb1ab07291a24914f0c1b594040843baccce0489c33052601'
maj_ver = '.'.join(version.split('.')[0:2])
url = 'https://download.gnome.org/sources/{0}/{1}/{0}-{2}.tar.xz'.format('gtk-doc', maj_ver, version)
tarball_checksum = 'e26bd3f7080c749b1cb66c46c6bf8239e2f320a949964fb9c6d56e1b0c6d9a6f'
# TODO: check license - source files are GPLv2+ and COPYING is GPLv3
licenses = [License.GPLv2Plus]
btype = BuildType.CUSTOM
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment