From 477e6a943016ef72d3722a147fdc89a0738bb02d Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Wed, 28 Jul 2010 16:25:35 +0200 Subject: [PATCH] syncpackage: Fix extraction of upstream version for debian versions that contain more than one dash. --- debian/changelog | 4 +++- syncpackage | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index c2c7b5c..54ea3cc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,6 +13,8 @@ ubuntu-dev-tools (0.101) UNRELEASED; urgency=low [ Benjamin Drung ] * Bump Standards-Version to 3.9.0 (no changes required). * Switch to dpkg-source 3.0 (native) format. + * syncpackage: Fix extraction of upstream version for debian versions that + contain more than one dash. [ Michael Bienia ] * Add "import-bug-from-debian" written by James Westby. @@ -20,7 +22,7 @@ ubuntu-dev-tools (0.101) UNRELEASED; urgency=low * requestsync: Fix bug where the variable 'hasLP' is not always set (lp: #607874). - -- Michael Bienia Tue, 20 Jul 2010 19:44:18 +0200 + -- Benjamin Drung Wed, 28 Jul 2010 16:23:58 +0200 ubuntu-dev-tools (0.100) maverick; urgency=low diff --git a/syncpackage b/syncpackage index c3a4955..65efd5b 100755 --- a/syncpackage +++ b/syncpackage @@ -151,6 +151,21 @@ def add_fixed_bugs(changes, bugs, verbose=False): return "\n".join(changes + [""]) +def extract_upstream_version(debian_version): + # remove last part separated by a dash (1.0-2 -> 1.0) + parts = debian_version.split('-') + if len(parts) > 1: + del parts[-1] + upstream_version = '-'.join(parts) + + # remove epoch + parts = upstream_version.split(':') + if len(parts) > 1: + del parts[0] + upstream_version = ':'.join(parts) + + return upstream_version + def sync_dsc(dscurl, debian_dist, release, name, email, bugs, keyid=None, verbose=False): assert dscurl.endswith(".dsc") dscname = os.path.basename(dscurl) @@ -238,7 +253,7 @@ def sync_dsc(dscurl, debian_dist, release, name, email, bugs, keyid=None, verbos map(lambda f: f.download(verbose), fakesync_files) # change into package directory - directory = srcpkg + '-' + strip_epoch(new_ver).split('-')[0] + directory = srcpkg + '-' + extract_upstream_version(new_ver) if verbose: print "cd " + directory os.chdir(directory)