comparison bin/listpackages.py @ 89:3caf4a5ecbf0

Add scripts that help publish the packages produced by the tree packager
author Bernhard Herzog <bh@intevation.de>
date Tue, 11 Sep 2007 13:48:18 +0000
parents
children 24d119c27150
comparison
equal deleted inserted replaced
88:3ae54f99db26 89:3caf4a5ecbf0
1 #! /usr/bin/python2.4
2 # Copyright (C) 2007 by Intevation GmbH
3 # Authors:
4 # Bernhard Herzog <bh@intevation.de>
5 #
6 # This program is free software under the GPL (>=v2)
7 # Read the file COPYING coming with the software for details.
8
9 """List the absolute filenames of packages created by treepkg"""
10
11 import sys
12
13 import treepkgcmd
14 from treepkg.options import create_parser
15 from treepkg.report import get_packager_group
16
17 def parse_commandline():
18 parser = create_parser()
19 parser.set_defaults(binary=False, source=False)
20 parser.add_option("--revision", type="int",
21 help=("The revision whose files are to be listed."
22 " If not given, the latest revision is used"))
23 parser.add_option("--track",
24 help=("The package track whose files are to be listed"))
25 parser.add_option("--source", action="store_true",
26 help=("List source packages"))
27 parser.add_option("--binary", action="store_true",
28 help=("List binary packages"))
29 return parser.parse_args()
30
31
32 def list_track_packages(track, revision, source, binary):
33 revisions = track.get_revisions()
34 if not revisions:
35 print >>sys.stderr, "No revisions have been packaged"
36 sys.exit(1)
37
38 if revision is None:
39 revpkg = revisions[-1]
40 else:
41 for revpkg in revisions:
42 if revpkg.revision == revision:
43 break
44 else:
45 revpkg = None
46
47 if revpkg is not None:
48 if source:
49 for filename in revpkg.list_source_files():
50 print filename
51 if binary:
52 for filename in revpkg.list_binary_files():
53 print filename
54 else:
55 print >>sys.stderr, "No revision", repr(revision)
56 sys.exit(1)
57
58 def list_packages(config_file, trackname, revision, source, binary):
59 group = get_packager_group(config_file)
60 for track in group.get_package_tracks():
61 if track.name == trackname:
62 list_track_packages(track, revision, source, binary)
63 break
64 else:
65 print >>sys.stderr, "no track named", trackname
66 sys.exit(1)
67
68 def main():
69 options, args = parse_commandline()
70 list_packages(options.config_file, options.track, options.revision,
71 source=options.source, binary=options.binary)
72
73 main()
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)