Package: ftp.debian.org On Sun, Nov 15, 2009 at 08:06:32PM +0000, Mark Hymers wrote: > Just for the record, at the moment dak only allows data.tar.gz and > data.tar.bz2 (although I had to check that myself in the source code, > I've got documenting what is and isn't supported someone more sane on my > TODO list). > > As I said on -devel recently, the data.tar.bz2 support in dak seems to > date from 2005, so it's been around for a while. lzma/xz on the other > hand hasn't even been asked for yet as far as I know.
I'll ask for xz support. This won't work until http://bugs.python.org/issue6715 is resolved. diff --git a/daklib/binary.py b/daklib/binary.py index c6ee96f..09ae36c 100644 --- a/daklib/binary.py +++ b/daklib/binary.py @@ -141,7 +141,7 @@ class Binary(object): Check deb contents making sure the .deb contains: 1. debian-binary 2. control.tar.gz - 3. data.tar.gz or data.tar.bz2 + 3. data.tar.gz or data.tar.bz2 or data.tar.xz in that order, and nothing else. """ self.__scan_ar() @@ -160,9 +160,9 @@ class Binary(object): if not rejected and self.chunks[1] != "control.tar.gz": rejected = True self.reject("%s: second chunk is '%s', expected 'control.tar.gz'." % (self.filename, self.chunks[1])) - if not rejected and self.chunks[2] not in [ "data.tar.bz2", "data.tar.gz" ]: + if not rejected and self.chunks[2] not in [ "data.tar.xz", "data.tar.bz2", "data.tar.gz" ]: rejected = True - self.reject("%s: third chunk is '%s', expected 'data.tar.gz' or 'data.tar.bz2'." % (self.filename, self.chunks[2])) + self.reject("%s: third chunk is '%s', expected 'data.tar.gz' or 'data.tar.bz2' or 'data.tar.xz'." % (self.filename, self.chunks[2])) return not rejected @@ -198,6 +198,8 @@ class Binary(object): data = tarfile.open(os.path.join(self.tmpdir, "data.tar.gz"), "r:gz") elif self.chunks[2] == "data.tar.bz2": data = tarfile.open(os.path.join(self.tmpdir, "data.tar.bz2" ), "r:bz2") + elif self.chunks[2] == "data.tar.xz": + data = tarfile.open(os.path.join(self.tmpdir, "data.tar.xz" ), "r:xz") if bootstrap_id: result = insert_content_paths(bootstrap_id, [tarinfo.name for tarinfo in data if not tarinfo.isdir()], session) @@ -241,6 +243,8 @@ class Binary(object): data = tarfile.open(os.path.join(self.tmpdir, "data.tar.gz"), "r:gz") elif self.chunks[2] == "data.tar.bz2": data = tarfile.open(os.path.join(self.tmpdir, "data.tar.bz2" ), "r:bz2") + elif self.chunks[2] == "data.tar.xz": + data = tarfile.open(os.path.join(self.tmpdir, "data.tar.xz" ), "r:xz") for tarinfo in data: try: diff --git a/daklib/queue.py b/daklib/queue.py index d97b99f..66d7d5a 100644 --- a/daklib/queue.py +++ b/daklib/queue.py @@ -1358,10 +1358,17 @@ class Upload(object): apt_inst.debExtract(deb_file, tar.callback, "data.tar.gz") except SystemError, e: # If we can't find a data.tar.gz, look for data.tar.bz2 instead. - if not re.search(r"Cannot f[ui]nd chunk data.tar.gz$", str(e)): - raise - deb_file.seek(0) - apt_inst.debExtract(deb_file,tar.callback,"data.tar.bz2") + try: + if not re.search(r"Cannot f[ui]nd chunk data.tar.gz$", str(e)): + raise + deb_file.seek(0) + apt_inst.debExtract(deb_file,tar.callback,"data.tar.bz2") + except SystemError, e: + # If we can't find a data.tar.bz2, look for data.tar.xz instead. + if not re.search(r"Cannot f[ui]nd chunk data.tar.bz2$", str(e)): + raise + deb_file.seek(0) + apt_inst.debExtract(deb_file,tar.callback,"data.tar.xz") deb_file.close() diff --git a/daklib/utils.py b/daklib/utils.py index 3cc4053..80ac74d 100644 --- a/daklib/utils.py +++ b/daklib/utils.py @@ -387,10 +387,10 @@ def check_dsc_files(dsc_filename, dsc=None, dsc_files=None): (r'orig.tar.gz', ('orig_tar_gz', 'orig_tar')), (r'diff.gz', ('debian_diff',)), (r'tar.gz', ('native_tar_gz', 'native_tar')), - (r'debian\.tar\.(gz|bz2)', ('debian_tar',)), - (r'orig\.tar\.(gz|bz2)', ('orig_tar',)), + (r'debian\.tar\.(gz|bz2|xz)', ('debian_tar',)), + (r'orig\.tar\.(gz|bz2|xz)', ('orig_tar',)), (r'tar\.(gz|bz2)', ('native_tar',)), - (r'orig-.+\.tar\.(gz|bz2)', ('more_orig_tar',)), + (r'orig-.+\.tar\.(gz|bz2|xz)', ('more_orig_tar',)), ) for f in dsc_files.keys(): -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected]

