Make lgp tag not require pbuilder base tarballs (closes #66580)

Drop the 'architecture' attribute from setupinfo, and the $arch variable for tags. There doesn't seem to be any reason to include a list of architectures in tag names, and the function to get that list wants to look at the pbuilder tarballs, which might not exist if we just want to tag.

authorJulien Cristau <julien.cristau@logilab.fr>
changeset6fe71d25f460
branchdefault
phasepublic
hiddenno
parent revision#df73a2e4a5b9 Kill the lgp project command (closes #67315)
child revision#d4e83d06c669 Fix a couple typos in comments
files modified by this revision
doc/lgp/tag.rst
etc/lgp/lgprc
lgp/build.py
lgp/login.py
lgp/script.py
lgp/setup.py
lgp/setupinfo.py
lgp/tag.py
# HG changeset patch
# User Julien Cristau <julien.cristau@logilab.fr>
# Date 1306155360 -7200
# Mon May 23 14:56:00 2011 +0200
# Node ID 6fe71d25f460240f2ca204065f0c0e2c7fab8f15
# Parent df73a2e4a5b99745e0bb578345070af1bbc61454
Make lgp tag not require pbuilder base tarballs (closes #66580)

Drop the 'architecture' attribute from setupinfo, and the $arch variable
for tags. There doesn't seem to be any reason to include a list of
architectures in tag names, and the function to get that list wants to
look at the pbuilder tarballs, which might not exist if we just want to
tag.

diff --git a/doc/lgp/tag.rst b/doc/lgp/tag.rst
@@ -9,11 +9,10 @@
1  - $project : project name
2  - $version : current upstream version
3  - $debian_revision : current increment of the Debian version
4  - $debian_version : full Debian version (upstream version + $debian_revision)
5  - $distrib : Debian-compatible distribution name
6 -- $arch : Debian-compatible architecture
7 
8  Example
9  '''''''
10 
11  ::
diff --git a/etc/lgp/lgprc b/etc/lgp/lgprc
@@ -50,11 +50,11 @@
12 
13  [TAG]
14  # A basic template system can be used in configuration
15  # (please refer to the documentation for this usage)
16  # Some tag templates are already provided by Lgp:
17 -# $project, $version, $debian_version, $debian_revision, $distrib, $arch
18 +# $project, $version, $debian_version, $debian_revision, $distrib
19 
20  # Definition of some extra templates
21  upstream=$project-version-$version
22  debian=$project-debian-version-$debian_version
23  debian_revision=debrevision-$debian_revision
diff --git a/lgp/build.py b/lgp/build.py
@@ -367,11 +367,11 @@
24                                                  options['arch'])
25              series.append(options)
26              logging.info('this build is arch-independent. Lgp will only build on '
27                           'current architecture (%s)' % options['arch'])
28          else:
29 -            for rank, arch in enumerate(self.architectures):
30 +            for rank, arch in enumerate(self.get_architectures()):
31                  options = dict()
32                  options['distrib'] = self.current_distrib
33                  options['buildopts'] = _build_options(arch, rank)
34                  options['arch'] = arch
35                  options['image'] = self.get_basetgz(options['distrib'],
diff --git a/lgp/login.py b/lgp/login.py
@@ -64,11 +64,11 @@
36          if self.config.distrib is None or 'changelog' in self.config.distrib:
37              self.config.distrib = 'changelog'
38          super(Login, self).guess_environment()
39 
40      def run(self, args):
41 -        for arch in self.architectures:
42 +        for arch in self.get_architectures():
43              for distrib in self.distributions:
44                  image = self.get_basetgz(distrib, arch)
45 
46                  cmd = self.cmd % (image, distrib, arch, self.sudo_cmd,
47                                    self.pbuilder_cmd, CONFIG_FILE, HOOKS_DIR,
diff --git a/lgp/script.py b/lgp/script.py
@@ -71,11 +71,11 @@
48              raise LGPException("command '%s' not found. Please check commands in %s"
49                                 % (self.config.command, SCRIPTS_DIR))
50          if len(self.arguments)==0:
51              sys.exit()
52 
53 -        for arch in self.architectures:
54 +        for arch in self.get_architectures():
55              for distrib in self.distributions:
56                  for command in commands:
57                      image = self.get_basetgz(distrib, arch)
58 
59                      cmd = self.cmd % (image, distrib, arch, self.setarch_cmd, self.sudo_cmd,
diff --git a/lgp/setup.py b/lgp/setup.py
@@ -115,11 +115,11 @@
60          elif self.config.command == "clean":
61              logging.debug("cleans up directory specified by configuration BUILDPLACE and APTCACHE")
62          elif self.config.command == "dumpconfig":
63              sys.stdout = sys.__stdout__
64 
65 -        for arch in self.architectures:
66 +        for arch in self.get_architectures():
67              for distrib in self.distributions:
68                  self.arch = arch # see setarch_cmd()
69 
70                  image = self.get_basetgz(distrib, arch, check=False)
71 
diff --git a/lgp/setupinfo.py b/lgp/setupinfo.py
@@ -235,16 +235,13 @@
72                           'to force the build on all architectures or let lgp finds '
73                           'the value in debian/changelog by itself in doubt.')
74              logging.warn('lgp replaces "all" with "current" architecture value for this command')
75 
76          # Define mandatory attributes for lgp commands
77 -        self.architectures = utils.get_architectures(self.config.archi,
78 -                                                     self.config.basetgz)
79          self.distributions = utils.get_distributions(self.config.distrib,
80                                                       self.config.basetgz)
81          logging.debug("guessing distribution(s): %s" % ', '.join(self.distributions))
82 -        logging.debug("guessing architecture(s): %s" % ', '.join(self.architectures))
83 
84      def _set_package_format(self):
85          """set the package format to be able to run COMMANDS
86 
87          setup_file must not be redefine since we can call this
@@ -356,11 +353,13 @@
88              if osp.isdir(osp.join(self.config.pkg_dir, override_dir)):
89                  debiandir = override_dir
90 
91          return debiandir
92 
93 -    get_architectures = staticmethod(utils.get_architectures)
94 +    def get_architectures(self, archi=None, basetgz=None):
95 +        return utils.get_architectures(archi or self.config.archi, basetgz or self.config.basetgz)
96 +
97      get_debian_name = staticmethod(utils.get_debian_name)
98 
99      @utils.cached
100      def get_debian_version(self):
101          """get upstream and debian versions depending of the last changelog entry found in Debian changelog
diff --git a/lgp/tag.py b/lgp/tag.py
@@ -32,11 +32,11 @@
102 
103      A basic template system can be used in configuration
104      (please refer to the documentation for this usage)
105      Some tag templates are already provided by Lgp:
106 
107 -      $project, $version, $debian_version, $debian_revision, $distrib, $arch
108 +      $project, $version, $debian_version, $debian_revision, $distrib
109      """
110      name = "tag"
111      arguments = "[-f | --force] [-t | --template <tag template>] [project directory]"
112      options = SetupInfo.options + [
113                 ('template',
@@ -61,11 +61,10 @@
114          tag = Template(tag)
115          tag = tag.substitute(version=self.version,
116                               debian_version=self.debian_version,
117                               debian_revision=self.debian_revision,
118                               distrib=self.distrib,
119 -                             arch=self.archi,
120                               project=self.project)
121 
122          command = self.vcs_agent.tag(self.config.pkg_dir, tag,
123                                       force=bool(self.config.force))
124          self.logger.debug('run command: %s' % command)
@@ -87,11 +86,10 @@
125              # can be a false positive due to native package
126              self.logger.warn('Debian version info cannot be retrieved')
127 
128          # poor cleaning for having unique string
129          self.distrib = '+'.join(self.distributions)
130 -        self.archi   = '+'.join(self.architectures)
131 
132          config = ConfigParser.ConfigParser()
133          if osp.isfile(LGP_CONFIG_FILE):
134              config.readfp(open(LGP_CONFIG_FILE))
135