Add xz support, thanks to Sedat Dilek

svn path=/dists/trunk/linux-tools/; revision=19351
This commit is contained in:
Ben Hutchings 2012-08-21 04:49:15 +00:00
parent efa1770509
commit e27b6aeb07
4 changed files with 19 additions and 12 deletions

18
debian/bin/genorig.py vendored
View File

@ -66,7 +66,7 @@ class Main(object):
self.log('Using source name %s, version %s, dfsg %s\n' % (source, version.upstream, self.version_dfsg))
self.orig = '%s-%s' % (source, version.upstream)
self.orig_tar = '%s_%s.orig.tar.gz' % (source, version.upstream)
self.orig_tar = '%s_%s.orig.tar.xz' % (source, version.upstream)
self.tag = 'v' + re.sub(r"^(\d+\.\d+)\.0", r"\1",
version.upstream.replace('~', '-'))
@ -92,7 +92,7 @@ class Main(object):
'--prefix=temp/', self.tag],
cwd=input_repo,
stdout=subprocess.PIPE)
extract_proc = subprocess.Popen(['tar', '-xf', '-'], cwd=self.dir,
extract_proc = subprocess.Popen(['tar', '-xaf', '-'], cwd=self.dir,
stdin=archive_proc.stdout)
ret1 = archive_proc.wait()
@ -102,15 +102,11 @@ class Main(object):
def upstream_extract(self, input_tar):
self.log("Extracting tarball %s\n" % input_tar)
match = re.match(r'(^|.*/)(?P<dir>linux-\d+\.\d+(\.\d+)?(-\S+)?)\.tar(\.(?P<extension>(bz2|gz)))?$', input_tar)
match = re.match(r'(^|.*/)(?P<dir>linux-\d+\.\d+(\.\d+)?(-\S+)?)\.tar(\.(?P<extension>(bz2|gz|xz)))?$', input_tar)
if not match:
raise RuntimeError("Can't identify name of tarball")
cmdline = ['tar', '-xf', input_tar, '-C', self.dir]
if match.group('extension') == 'bz2':
cmdline.append('-j')
elif match.group('extension') == 'gz':
cmdline.append('-z')
cmdline = ['tar', '-xaf', input_tar, '-C', self.dir]
if subprocess.Popen(cmdline).wait():
raise RuntimeError("Can't extract tarball")
@ -119,7 +115,7 @@ class Main(object):
def upstream_patch(self, input_patch):
self.log("Patching source with %s\n" % input_patch)
match = re.match(r'(^|.*/)patch-\d+\.\d+\.\d+(-\S+?)?(\.(?P<extension>(bz2|gz)))?$', input_patch)
match = re.match(r'(^|.*/)patch-\d+\.\d+\.\d+(-\S+?)?(\.(?P<extension>(bz2|gz|xz)))?$', input_patch)
if not match:
raise RuntimeError("Can't identify name of patch")
cmdline = []
@ -127,6 +123,8 @@ class Main(object):
cmdline.append('bzcat')
elif match.group('extension') == 'gz':
cmdline.append('zcat')
elif match.group('extension') == 'xz':
cmdline.append('xzcat')
else:
cmdline.append('cat')
cmdline.append(input_patch)
@ -177,7 +175,7 @@ class Main(object):
except OSError:
pass
self.log("Generate tarball %s\n" % out)
cmdline = ['tar -czf', out, '-C', self.dir, self.orig]
cmdline = ['tar -caf', out, '-C', self.dir, self.orig]
try:
if os.spawnv(os.P_WAIT, '/bin/sh', ['sh', '-c', ' '.join(cmdline)]):
raise RuntimeError("Can't patch source")

8
debian/changelog vendored
View File

@ -1,3 +1,11 @@
linux-tools (3.5-1~experimental.2) UNRELEASED; urgency=low
* genorig: Accept xz-compressed upstream tarballs and patches, and
generate an xz-compressed orig tarball, thanks to Sedat Dilek
* source: Enable xz-compression for debian directory tarball
-- Ben Hutchings <ben@decadent.org.uk> Tue, 21 Aug 2012 05:05:42 +0100
linux-tools (3.5-1~experimental.1) experimental; urgency=low
* New upstream release

4
debian/rules vendored
View File

@ -20,7 +20,7 @@ $(STAMPS_DIR):
@[ -d $@ ] || mkdir $@
DIR_ORIG = ../orig/$(SOURCE)-$(VERSION)
TAR_ORIG_NAME = $(SOURCE)_$(VERSION).orig.tar.gz
TAR_ORIG_NAME = $(SOURCE)_$(VERSION).orig.tar.xz
TAR_ORIG = $(firstword $(wildcard ../$(TAR_ORIG_NAME)) $(wildcard ../orig/$(TAR_ORIG_NAME)))
orig: $(DIR_ORIG)
@ -31,7 +31,7 @@ ifeq ($(TAR_ORIG),)
$(error Cannot find orig tarball $(TAR_ORIG_NAME))
else
mkdir -p ../orig
tar -C ../orig -xzf $(TAR_ORIG)
tar -C ../orig -xaf $(TAR_ORIG)
endif
maintainerclean:

1
debian/source/options vendored Normal file
View File

@ -0,0 +1 @@
compression = "xz"