new incoming command (closes #88751)

Add a new incoming command that display repositories in which there are incoming packages to publish.

authorDavid Douard <david.douard@logilab.fr>
changeset842da0bcd94e
branchdefault
phasepublic
hiddenno
parent revision#661074a7dc11 Set umask to 002, not 006
child revision#2e1cffdaf60e Look at checksums before processing a changes file (closes #88374)
files modified by this revision
ldi.py
# HG changeset patch
# User David Douard <david.douard@logilab.fr>
# Date 1329206058 -3600
# Tue Feb 14 08:54:18 2012 +0100
# Node ID 842da0bcd94e312908d944f7b7a337556f1f6fe7
# Parent 661074a7dc117b4689edaf18a41bd794e82298c4
new incoming command (closes #88751)

Add a new *incoming* command that display repositories in which there are
incoming packages to publish.

diff --git a/ldi.py b/ldi.py
@@ -405,10 +405,57 @@
1                      repo.sign(distdir, self.config.gpg_keyid)
2 
3  LDI.register(Publish)
4 
5 
6 +class Incoming(Upload):
7 +    """check repositories for incoming packages"""
8 +    name = "incoming"
9 +    min_args = 0
10 +    arguments = ""
11 +    options = OPTIONS[1:] + [
12 +                 ('verbose',
13 +                   {'dest': 'verbose',
14 +                    'action': 'store_true',
15 +                    'short': 'v',
16 +                    'default': False,
17 +                    'help': 'list every changes files',
18 +                   }), ]
19 +
20 +    def run(self, args):
21 +        repodir = osp.normpath(_repo_path(self.config, '.'))
22 +        for path in os.listdir(repodir):
23 +            try:
24 +                repo = self._check_repository(osp.join(repodir, path))
25 +            except cli.CommandError:
26 +                continue
27 +
28 +            distribs = set()
29 +            # we have to launch the publication sequentially
30 +            lockfile = osp.join(repo.directory, 'ldi.lock')
31 +            sht.acquire_lock(lockfile, max_try=3, delay=5)
32 +            self.debian_changes = {}
33 +            try:
34 +                changes_files = repo.incoming_changes_files(args)
35 +                if changes_files:
36 +                    self.logger.warning('There are incoming packages in %s', path)
37 +                    if self.config.verbose:
38 +                        self.logger.debug('The following changes files are ready '
39 +                                          'to be published:\n%s', '\n'.join(changes_files))
40 +            finally:
41 +                sht.release_lock(lockfile)
42 +
43 +    def _apt_refresh(self, repo, distrib="*"):
44 +        for distdir in glob(osp.join(repo.dists_directory, distrib)):
45 +            if osp.isdir(distdir) and not osp.islink(distdir):
46 +                repo.dist_publish(osp.basename(distdir))
47 +                if self.config.gpg_keyid:
48 +                    self.logger.info('signing release')
49 +                    repo.sign(distdir, self.config.gpg_keyid)
50 +
51 +LDI.register(Incoming)
52 +
53  class List(Upload):
54      """list all repositories and their distributions"""
55      name = "list"
56      min_args = 0
57      arguments = "[repository [-d | --distribution <dist>] [package.changes ...]]"
@@ -600,11 +647,11 @@
58                          if answer == 'yes':
59                              for distarch in missing[version]:
60                                  dist, arch = distarch.split('-')
61                                  changes = osp.join(repo.directory, 'dists', dist,
62                                                     debrepo.changesfile(package, version, arch))
63 -                                # -C" " to disable checkers, packages are 
64 +                                # -C" " to disable checkers, packages are
65                                  # already in, don't check them agin
66                                  os.system('ldi upload -C" " %s %s' % (trepo.directory, changes))
67 
68  LDI.register(Diff)
69