From 145141217950d95f5f78c42f038b904a4d7611df Mon Sep 17 00:00:00 2001 From: Hans van Kranenburg Date: Wed, 20 Dec 2017 17:01:56 +0100 Subject: [PATCH] debian/bin/genorig.py: create orig tar for pre/rc When using versions like 4.9.2~pre+1.32e364c4e7, I want to have an archive made from commit 32e364c4e7. Same holds for 4.10~rc8+1.3e11e302a8 --- debian/bin/genorig.py | 15 +++++++++++---- debian/lib/python/debian_xen/debian.py | 7 ++++--- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/debian/bin/genorig.py b/debian/bin/genorig.py index 74aacd8fdc..8b4614028d 100755 --- a/debian/bin/genorig.py +++ b/debian/bin/genorig.py @@ -32,13 +32,21 @@ class Main(object): else: self.orig_dir = '%s-%s' % (self.source, self.version.upstream) self.orig_tar = '%s_%s.orig.tar.xz' % (self.source, self.version.upstream) - if options.tag is None: - options.tag = 'RELEASE-' + self.version.upstream def __call__(self): out = "../orig/%s" % self.orig_tar self.log("Generate tarball %s\n" % out) + if self.options.tag: + treeish = self.options.tag + else: + if self.changelog_entry.version.pre_commit: + treeish = self.changelog_entry.version.pre_commit + elif self.changelog_entry.version.rc_commit: + treeish = self.changelog_entry.version.rc_commit + else: + treeish = 'RELEASE-%s' % self.version.upstream + try: os.stat(out) raise RuntimeError("Destination already exists") @@ -46,8 +54,7 @@ class Main(object): try: with open(out, 'wb') as f: - tag = self.options.tag or 'HEAD' - _cmd = ('git', 'archive', '--prefix', '%s/' % self.orig_dir, tag) + _cmd = ('git', 'archive', '--prefix', '%s/' % self.orig_dir, treeish) p1 = subprocess.Popen(_cmd, stdout=subprocess.PIPE, cwd=self.repo) subprocess.check_call(('xz', ), stdin=p1.stdout, stdout=f) if p1.wait(): diff --git a/debian/lib/python/debian_xen/debian.py b/debian/lib/python/debian_xen/debian.py index 069d9b2ef5..8dfef71b51 100644 --- a/debian/lib/python/debian_xen/debian.py +++ b/debian/lib/python/debian_xen/debian.py @@ -7,9 +7,9 @@ class VersionXen(Version): ^ (?P\d+\.\d+) (?: - \.\d+(?:~pre(?:\+\d+\.[0-9a-f]{10}))? + \.\d+(?:~pre(?:\+\d+\.(?P[0-9a-f]{10})))? | - ~rc\d+(?:\+\d+\.[0-9a-f]{10})? + ~rc\d+(?:\+\d+\.(?P[0-9a-f]{10}))? ) - (?:[^-]+) @@ -24,4 +24,5 @@ class VersionXen(Version): raise ValueError("Invalid debian xen version") d = match.groupdict() self.xen_version = d['version'] - + self.pre_commit = d['pre_commit'] + self.rc_commit = d['rc_commit'] -- 2.30.2