annotate bin/reportstatus.py @ 542:dc17b62d3cdd

contrib: Added copy-latest-pkgs.py to copy/hardlink latest packages from the mill to the next higher attention level.
author Sascha Teichmann <teichmann@intevation.de>
date Tue, 11 Jan 2011 17:20:02 +0000
parents 1fcdffbeb9de
children
rev   line source
287
1fcdffbeb9de Make the #! line in the commands more portable. Use /usr/bin/python
Bernhard Herzog <bh@intevation.de>
parents: 237
diff changeset
1 #! /usr/bin/python
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)