Mercurial > treepkg
view bin/listpackages.py @ 441:eadcb1bb54e2
Merged revisions 388-399 via svnmerge from
svn+ssh://svn.wald.intevation.org/treepkg/branches/treepkg-status
........
r388 | bricks | 2010-07-28 10:38:50 +0200 (Mi, 28 Jul 2010) | 3 lines
fix if statement
upload hook should be called if it's not empty
........
r389 | bricks | 2010-07-28 13:38:00 +0200 (Mi, 28 Jul 2010) | 2 lines
only rsync specified architectures from cachedir to publishdir
........
r390 | bricks | 2010-07-29 14:07:57 +0200 (Do, 29 Jul 2010) | 2 lines
introduced after_copy_hook and made rsync upload to publishdir optional
........
r391 | bricks | 2010-07-29 15:43:39 +0200 (Do, 29 Jul 2010) | 3 lines
publish package must be default to get original behaviour
be more verbose at publishing
........
r392 | bricks | 2010-07-29 16:50:53 +0200 (Do, 29 Jul 2010) | 2 lines
fix handling of showing only successfull builds together with num packages
........
r393 | bricks | 2010-07-29 16:52:42 +0200 (Do, 29 Jul 2010) | 2 lines
fixed typo
........
r394 | bricks | 2010-07-29 16:59:10 +0200 (Do, 29 Jul 2010) | 2 lines
fixed another typo
........
r395 | bricks | 2010-07-29 18:05:54 +0200 (Do, 29 Jul 2010) | 3 lines
fixed another typo
treepkg is really slow with many revisions
........
r396 | bricks | 2010-08-02 12:41:55 +0200 (Mo, 02 Aug 2010) | 2 lines
fixed typos
........
r397 | bricks | 2010-08-02 17:36:12 +0200 (Mo, 02 Aug 2010) | 3 lines
be more error prone in listing different files
not checking if a dir exists caused several errors if a build wasn't successful
........
r398 | bricks | 2010-08-05 18:21:47 +0200 (Do, 05 Aug 2010) | 2 lines
review changes
........
r399 | bricks | 2010-08-06 13:06:08 +0200 (Fr, 06 Aug 2010) | 4 lines
cleanup modules
fix test_info testcases
added testcases for remove_trailingslashes and expand_filename
........
author | Bjoern Ricks <bricks@intevation.de> |
---|---|
date | Fri, 06 Aug 2010 13:41:54 +0000 |
parents | dd2bd0ccd674 |
children |
line wrap: on
line source
#! /usr/bin/python # Copyright (C) 2007, 2008, 2009 by Intevation GmbH # Authors: # Bernhard Herzog <bh@intevation.de> # # This program is free software under the GPL (>=v2) # Read the file COPYING coming with the software for details. """List the absolute filenames of packages created by treepkg""" import sys import treepkgcmd from treepkg.options import create_parser from treepkg.report import get_packager_group def parse_commandline(): parser = create_parser() parser.set_defaults(binary=False, source=False, newest=1) parser.add_option("--revision", help=("The revision whose files are to be listed." " If not given, the latest revision is used." " The value may be given as REV-RULESREV to specify" " both the main source revision and the revision of" " the packaging rules")) parser.add_option("--track", help=("The package track whose files are to be listed." " If not given, files of all tracks are listed.")) parser.add_option("--source", action="store_true", help=("List source packages")) parser.add_option("--binary", action="store_true", help=("List binary packages")) parser.add_option("--newest", type="int", help=("Number of newest revisions to list." " Defaults to 1.")) return parser.parse_args() def parse_revision(raw_revision): if raw_revision is None: return None, None split_revision = raw_revision.split("-") if len(split_revision) > 2: raise ValueError("Cannot parse revision %r; too many '-' signs" % raw_revision) revision = split_revision[0] if len(split_revision) == 1: rulesrev = None else: rulesrev = split_revision[1] return revision, rulesrev def format_revision(main_rev, rules_rev): formatted = str(main_rev) if rules_rev is not None: formatted += "-" + str(rules_rev) return formatted def list_track_packages(track, revision, num_newest, source, binary): main_rev, rules_rev = revision revisions = track.get_revisions() if not revisions and main_rev is None: return revisions = sorted(revisions, key=lambda r: r.status.start, reverse=True) candidates = [] if main_rev is None: candidates = [revpkg for revpkg in revisions if revpkg.status.status.finished and not revpkg.status.status.error] candidates = candidates[:num_newest] else: for revpkg in revisions: if revpkg.revision == main_rev: if rules_rev is None or revpkg.rules_revision == rules_rev: candidates = [revpkg] break else: print >>sys.stderr, "No revision", format_revision(main_rev, rules_rev) sys.exit(1) for revpkg in candidates: if source: for filename in revpkg.list_source_files(): print filename if binary: for filename in revpkg.list_binary_files(): print filename def list_packages(config_file, trackname, revision, num_newest, source, binary): group = get_packager_group(config_file) tracks = group.get_package_tracks() if trackname is not None: tracks = [track for track in tracks if track.name == trackname] if not tracks: print >>sys.stderr, "no track named", trackname sys.exit(1) for track in tracks: list_track_packages(track, revision, num_newest, source, binary) def main(): options, args = parse_commandline() options.revision = parse_revision(options.revision) list_packages(options.config_file, options.track, options.revision, num_newest=options.newest, source=options.source, binary=options.binary) main()