comparison bin/listpackages.py @ 199:24d119c27150

listpackages command: if --track is omitted, list files of all tracks.
author Bernhard Herzog <bh@intevation.de>
date Wed, 20 Aug 2008 13:05:57 +0000
parents 3caf4a5ecbf0
children 59e2d8e26635
comparison
equal deleted inserted replaced
198:edd20598be27 199:24d119c27150
1 #! /usr/bin/python2.4 1 #! /usr/bin/python2.4
2 # Copyright (C) 2007 by Intevation GmbH 2 # Copyright (C) 2007, 2008 by Intevation GmbH
3 # Authors: 3 # Authors:
4 # Bernhard Herzog <bh@intevation.de> 4 # Bernhard Herzog <bh@intevation.de>
5 # 5 #
6 # This program is free software under the GPL (>=v2) 6 # This program is free software under the GPL (>=v2)
7 # Read the file COPYING coming with the software for details. 7 # Read the file COPYING coming with the software for details.
19 parser.set_defaults(binary=False, source=False) 19 parser.set_defaults(binary=False, source=False)
20 parser.add_option("--revision", type="int", 20 parser.add_option("--revision", type="int",
21 help=("The revision whose files are to be listed." 21 help=("The revision whose files are to be listed."
22 " If not given, the latest revision is used")) 22 " If not given, the latest revision is used"))
23 parser.add_option("--track", 23 parser.add_option("--track",
24 help=("The package track whose files are to be listed")) 24 help=("The package track whose files are to be listed."
25 " If not given, files of all tracks are listed."))
25 parser.add_option("--source", action="store_true", 26 parser.add_option("--source", action="store_true",
26 help=("List source packages")) 27 help=("List source packages"))
27 parser.add_option("--binary", action="store_true", 28 parser.add_option("--binary", action="store_true",
28 help=("List binary packages")) 29 help=("List binary packages"))
29 return parser.parse_args() 30 return parser.parse_args()
55 print >>sys.stderr, "No revision", repr(revision) 56 print >>sys.stderr, "No revision", repr(revision)
56 sys.exit(1) 57 sys.exit(1)
57 58
58 def list_packages(config_file, trackname, revision, source, binary): 59 def list_packages(config_file, trackname, revision, source, binary):
59 group = get_packager_group(config_file) 60 group = get_packager_group(config_file)
60 for track in group.get_package_tracks(): 61 tracks = group.get_package_tracks()
61 if track.name == trackname: 62 if trackname is not None:
62 list_track_packages(track, revision, source, binary) 63 tracks = [track for track in tracks if track.name == trackname]
63 break 64 if not tracks:
64 else: 65 print >>sys.stderr, "no track named", trackname
65 print >>sys.stderr, "no track named", trackname 66 sys.exit(1)
66 sys.exit(1) 67 for track in tracks:
68 list_track_packages(track, revision, source, binary)
67 69
68 def main(): 70 def main():
69 options, args = parse_commandline() 71 options, args = parse_commandline()
70 list_packages(options.config_file, options.track, options.revision, 72 list_packages(options.config_file, options.track, options.revision,
71 source=options.source, binary=options.binary) 73 source=options.source, binary=options.binary)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)