comparison bin/listpackages.py @ 248:5dd710b167d2

Make bin/listpackages.py handle corner cases like no revisions built or --revision referring to non-exisiting revisions better. Add tests for this.
author Bernhard Herzog <bh@intevation.de>
date Fri, 06 Mar 2009 19:57:04 +0000
parents 59e2d8e26635
children 243f206574cb
comparison
equal deleted inserted replaced
247:55337021fe5b 248:5dd710b167d2
46 else: 46 else:
47 rulesrev = int(split_revision[1]) 47 rulesrev = int(split_revision[1])
48 48
49 return revision, rulesrev 49 return revision, rulesrev
50 50
51 def format_revision(main_rev, rules_rev):
52 formatted = str(main_rev)
53 if rules_rev is not None:
54 formatted += "-" + str(rules_rev)
55 return formatted
56
51 57
52 def list_track_packages(track, revision, source, binary): 58 def list_track_packages(track, revision, source, binary):
53 main_rev, rules_rev = revision 59 main_rev, rules_rev = revision
54 60
55 revisions = track.get_revisions() 61 revisions = track.get_revisions()
56 if not revisions: 62 if not revisions and main_rev is None:
57 print >>sys.stderr, "No revisions have been packaged" 63 return
58 sys.exit(1)
59 64
60 if main_rev is None: 65 if main_rev is None:
61 revpkg = revisions[-1] 66 revpkg = revisions[-1]
62 else: 67 else:
63 # iterate in reverse, so that we pick up the newest revision 68 # iterate in reverse, so that we pick up the newest revision
75 print filename 80 print filename
76 if binary: 81 if binary:
77 for filename in revpkg.list_binary_files(): 82 for filename in revpkg.list_binary_files():
78 print filename 83 print filename
79 else: 84 else:
80 print >>sys.stderr, "No revision", repr(revision) 85 print >>sys.stderr, "No revision", format_revision(main_rev, rules_rev)
81 sys.exit(1) 86 sys.exit(1)
82 87
83 def list_packages(config_file, trackname, revision, source, binary): 88 def list_packages(config_file, trackname, revision, source, binary):
84 group = get_packager_group(config_file) 89 group = get_packager_group(config_file)
85 tracks = group.get_package_tracks() 90 tracks = group.get_package_tracks()
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)