annotate bin/reportstatus.py @ 274:2676abfc0e1d

Refactoring: Implement do_package in treepkg.packager.SourcePackager. The actual implementation in the derived classes is almost identical in all cases so it's better to have as much of the implementation in the base class. The update_version_numbers method is not called directly by the base class code so is removed from the base class. OTOH, prepare_sources_for_tarball has been added as a more general variant of update_version_numbers that is actually called by the default implementation of do_package.
author Bernhard Herzog <bh@intevation.de>
date Thu, 07 May 2009 15:19:15 +0000
parents 15de52d55432
children 1fcdffbeb9de
rev   line source
78
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
1 #! /usr/bin/python2.4
237
15de52d55432 Show the rules revision in the reports generated by bin/reportstatus.py
Bernhard Herzog <bh@intevation.de>
parents: 147
diff changeset
2 # Copyright (C) 2007, 2008, 2009 by Intevation GmbH
78
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
3 # Authors:
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
4 # Bernhard Herzog <bh@intevation.de>
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
5 #
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
6 # This program is free software under the GPL (>=v2)
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
7 # Read the file COPYING coming with the software for details.
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
8
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
9 """Reports the current status of the tree packager"""
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
10
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
11 import sys
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
12 import os
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
13 from optparse import OptionParser
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
14
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
15 import treepkgcmd
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
16 from treepkg.options import create_parser
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
17 from treepkg.report import get_packager_group, prepare_report
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
18
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
19 def parse_commandline():
147
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
20 parser = create_parser()
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
21 parser.set_defaults(sort_on="start-date")
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
22 parser.add_option("--sort-on",
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
23 help=("Field to sort on;"
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
24 " either start-date (the default) or revision"))
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
25 return parser.parse_args()
78
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
26
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
27
147
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
28 def report_text(group, sort_on):
78
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
29 report = prepare_report(group)
147
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
30 if sort_on == "revision":
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
31 sorted = (col for revno, row in report.revisions.sorted_by_revision()
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
32 for col in row
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
33 if col)
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
34 elif sort_on == "start-date":
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
35 sorted = (row for start, row in report.revisions.sorted_by_startdate())
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
36 else:
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
37 raise ValueError("Unknown sort field %r" % sort_on)
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
38
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
39 for item in sorted:
237
15de52d55432 Show the rules revision in the reports generated by bin/reportstatus.py
Bernhard Herzog <bh@intevation.de>
parents: 147
diff changeset
40 print "%s %s-%s: %s" % (item.name, item.revno, item.rulesrev,
15de52d55432 Show the rules revision in the reports generated by bin/reportstatus.py
Bernhard Herzog <bh@intevation.de>
parents: 147
diff changeset
41 item.status.desc)
147
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
42 print " Start:", item.status.start
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
43 print " Stop:", item.status.stop
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
44 print
78
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
45
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
46 def main():
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
47 options, args = parse_commandline()
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
48 group = get_packager_group(options.config_file)
147
cfeb0251055b Add reportstatus.py flag --sort-on= to let the user choose the sort field.
Bernhard Herzog <bh@intevation.de>
parents: 145
diff changeset
49 report_text(group, options.sort_on)
78
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
50
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
51
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
52 main()
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)