Manage correctly second revision of debian package (Closes: #6499)

authorJulien Jehannet <julien.jehannet@logilab.fr>
changeset4068740705b9
branchdefault
phasepublic
hiddenno
parent revision#97149ecb6776 fix deprecated post_treatments option value
child revision#86b45c15cd80 Added tag 0.13.3 for changeset 4068740705b9
files modified by this revision
lgp/setupinfo.py
# HG changeset patch
# User Julien Jehannet <julien.jehannet@logilab.fr>
# Date 1235667905 -3600
# Thu Feb 26 18:05:05 2009 +0100
# Node ID 4068740705b98a065afd42dcc009facb61bc156c
# Parent 97149ecb67766445ffaec5e91f9ed0cf151b06ad
Manage correctly second revision of debian package (Closes: #6499)

diff --git a/lgp/setupinfo.py b/lgp/setupinfo.py
@@ -271,15 +271,23 @@
1          tarball = os.path.join(tmpdir, '%s_%s.orig.tar.gz' %
2                      (self.get_upstream_name(), self.get_upstream_version()))
3          if self.config.orig_tarball is None:
4              logging.debug("creating a new source archive (tarball)...")
5              dist_dir = os.path.dirname(self.get_distrib_dir())
6 -            # FIXME This is no correct since '-0' is a valid revision as well
7 +
8              # http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version
9 -            debian_version = self.get_debian_version()
10 -            debian_revision = debian_version[-2:]
11 -            if debian_revision != '-1':
12 +            try:
13 +                debian_revision = self.get_debian_version().rsplit('-', 1)[1]
14 +            except IndexError:
15 +                logging.warn("The absence of a debian_revision is equivalent to a debian_revision of 0.")
16 +                debian_revision = "0"
17 +
18 +            if debian_revision == '0':
19 +                logging.info("It is conventional to restart the debian_revision"
20 +                             " at 1 each time the upstream_version is increased.")
21 +
22 +            if debian_revision not in ['0', '1']:
23                  logging.critical('unable to build %s package for the Debian revision "%s"'
24                                   % (self.get_debian_name(), debian_revision))
25                  raise LGPException('--orig-tarball option is required when '\
26                                     'not building the first revision of a debian package.\n' \
27                                     'If you haven\'t the original tarball version, ' \