[checker] make lgp checker use hglib and add the node id as apycot package suffix

in the context of checking draft changesets, the revision number is not guaranteed to be increasing, so let's build packages with a reasonably confident unique name.

authorDavid Douard <david.douard@logilab.fr>
changeset6063a2a6ee8c
branchdefault
phasedraft
hiddenno
parent revision#651a4a4dc1dd [checker] run the pycoverage xml generation in a subprocess
child revision<not specified>
files modified by this revision
_narval/checkers/apycot/lgp.py
# HG changeset patch
# User David Douard <david.douard@logilab.fr>
# Date 1453479244 -3600
# Fri Jan 22 17:14:04 2016 +0100
# Node ID 6063a2a6ee8cdb1cc1cb0e1efe872a931a3ef4fa
# Parent 651a4a4dc1dd6185f5ce056c04676e3d2b978e59
[checker] make lgp checker use hglib and add the node id as apycot package suffix

in the context of checking draft changesets, the revision number is not
guaranteed to be increasing, so let's build packages with a reasonably
confident unique name.

diff --git a/_narval/checkers/apycot/lgp.py b/_narval/checkers/apycot/lgp.py
@@ -1,8 +1,9 @@
1  import os
2  import logging
3  from glob import glob
4 +import hglib
5 
6  import apycotlib as apycot
7  from checkers.apycot import BaseChecker, AbstractFilteredFileChecker
8 
9  from logilab.packaging.lgp import *
@@ -95,20 +96,20 @@
10          sign = self.options.get('lgp_sign')
11          suffix = self.options.get('lgp_suffix')
12          build_folder = os.path.join(test.project_path(), '..')
13          cwd = os.getcwd()
14          os.chdir(test.project_path())
15 -        repo = test.apycot_repository()
16          try:
17              handler = LgpLogHandler(self.writer)
18              cmd = LGP.get_command(self.command)
19              cmd.logger.addHandler(handler)
20              args = ['-v', '-s', sign, '-r', build_folder]
21              if dist:
22                  args += ['-d', ','.join(dist)]
23              if suffix:
24 -                args += ['--suffix', '~rev%s' % repo.revision()]
25 +                revision = hglib.open('.').parents()[0].node[:12]
26 +                args += ['--suffix', '~rev%s' % revision]
27              exit_status = cmd.main_run(args, LGP.rcfile)
28              self.debian_changes = [f for f in cmd.packages if f.endswith('.changes')]
29              self.rpms = [f for f in cmd.packages if f.endswith('.rpm')]
30              if exit_status:
31                  self.writer.fatal('lgp %s exited with status %s', self.command, exit_status)