narval: optionally include the hg revision in the package version (closes #75988)

authorJulien Cristau <julien.cristau@logilab.fr>
changesetd68cd232b230
branchdefault
phasepublic
hiddenno
parent revision#ead02cbc9d7b Use debian.changelog to add a suffix to the package version
child revision#6ff13b1be80c Revert to modifying the distribution directly in the debian changelog
files modified by this revision
narval/lgp.py
# HG changeset patch
# User Julien Cristau <julien.cristau@logilab.fr>
# Date 1316446654 -7200
# Mon Sep 19 17:37:34 2011 +0200
# Node ID d68cd232b230d151120473473aed405dd0ed369b
# Parent ead02cbc9d7b7c3eb8c0af09edbadad826c85074
narval: optionally include the hg revision in the package version (closes #75988)

diff --git a/narval/lgp.py b/narval/lgp.py
@@ -84,24 +84,32 @@
1              'type': 'csv',
2              'help': ('comma-separated list of distributions to build against'),
3          },
4          'lgp_sign': {
5              'help': ('whether to sign packages'),
6 -            'default': 'no'
7 +            'default': 'no',
8 +        },
9 +        'lgp_suffix': {
10 +            'help': ('append vcs revision to the package version'),
11          },
12      }
13 
14      def do_check(self, test):
15          dist = self.options.get('lgp_build_distrib') or ['all']
16          sign = self.options.get('lgp_sign')
17 +        suffix = self.options.get('lgp_suffix')
18          cwd = os.getcwd()
19          os.chdir(test.project_path())
20 +        repo = test.apycot_repository()
21          try:
22                  handler = LgpLogHandler(self.writer)
23                  cmd = LGP.get_command(self.command)
24                  cmd.logger.addHandler(handler)
25 -                exit_status = cmd.main_run(['-v', '-s', sign, '-d', ','.join(dist), '-r', os.path.join(test.project_path(), '..')], LGP.rcfile)
26 +                args = ['-v', '-s', sign, '-d', ','.join(dist), '-r', os.path.join(test.project_path(), '..')]
27 +                if suffix:
28 +                    args += ['--suffix', '~rev' + repo.revision()]
29 +                exit_status = cmd.main_run(args, LGP.rcfile)
30                  self.debian_changes = [FilePath(changes, type='debian.changes', distribution=os.path.basename(os.path.dirname(changes)))
31                                         for changes in cmd.packages if changes.endswith('.changes')]
32                  if exit_status:
33                      self.writer.fatal('lgp %s exited with status %s', self.command, exit_status)
34                      self.set_status(apycot.ERROR)