annotate runtreepkg.py @ 58:39b2deea8481

make the status files are world readable
author Bernhard Herzog <bh@intevation.de>
date Tue, 10 Apr 2007 17:42:46 +0200
parents 78cf5f6778ec
children
rev   line source
0
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
1 #! /usr/bin/python2.4
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
2 # Copyright (C) 2007 by Intevation GmbH
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
3 # Authors:
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
4 # Bernhard Herzog <bh@intevation.de>
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
5 #
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
6 # This program is free software under the GPL (>=v2)
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
7 # Read the file COPYING coming with the software for details.
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
8
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
9 """Starts the tree packager"""
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
10
27
206d63ee310e cope with unknown packager names in runtreepkg.py
Bernhard Herzog <bh@intevation.de>
parents: 25
diff changeset
11 import sys
0
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
12 import os
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
13 import logging
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
14 from optparse import OptionParser
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
15
52
78cf5f6778ec Rename 'packagel ine' -> 'package track'
Bernhard Herzog <bh@intevation.de>
parents: 27
diff changeset
16 from treepkg.packager import create_package_track, PackagerGroup
0
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
17 from treepkg.readconfig import read_config
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
18
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
19 def initialize_logging():
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
20 """Initializes the logging system"""
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
21 root = logging.getLogger()
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
22 root.setLevel(logging.DEBUG)
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
23 hdlr = logging.StreamHandler()
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
24 fmt = logging.Formatter("%(asctime)s %(levelname)s %(message)s")
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
25 hdlr.setFormatter(fmt)
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
26 root.addHandler(hdlr)
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
27
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
28 def parse_commandline():
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
29 parser = OptionParser()
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
30 parser.set_defaults(config_file=os.path.join(os.path.dirname(__file__),
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
31 "treepkg.cfg"))
25
2bfb84bc4350 runtreepkg.py: add option --once and a way to run specific packagers
Bernhard Herzog <bh@intevation.de>
parents: 8
diff changeset
32 parser.add_option("--config-file",
2bfb84bc4350 runtreepkg.py: add option --once and a way to run specific packagers
Bernhard Herzog <bh@intevation.de>
parents: 8
diff changeset
33 help=("The tree packager config file."
2bfb84bc4350 runtreepkg.py: add option --once and a way to run specific packagers
Bernhard Herzog <bh@intevation.de>
parents: 8
diff changeset
34 " Default treepkg.cfg"))
2bfb84bc4350 runtreepkg.py: add option --once and a way to run specific packagers
Bernhard Herzog <bh@intevation.de>
parents: 8
diff changeset
35 parser.add_option("--once", action="store_true",
2bfb84bc4350 runtreepkg.py: add option --once and a way to run specific packagers
Bernhard Herzog <bh@intevation.de>
parents: 8
diff changeset
36 help=("Check the packagers only once and exit afterwards."
2bfb84bc4350 runtreepkg.py: add option --once and a way to run specific packagers
Bernhard Herzog <bh@intevation.de>
parents: 8
diff changeset
37 " Without this option, the tree packager will"
2bfb84bc4350 runtreepkg.py: add option --once and a way to run specific packagers
Bernhard Herzog <bh@intevation.de>
parents: 8
diff changeset
38 " check periodically."))
0
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
39 return parser.parse_args()
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
40
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
41 def main():
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
42 options, args = parse_commandline()
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
43
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
44 initialize_logging()
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
45
4
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents: 0
diff changeset
46 treepkg_opts, packager_opts = read_config(options.config_file)
27
206d63ee310e cope with unknown packager names in runtreepkg.py
Bernhard Herzog <bh@intevation.de>
parents: 25
diff changeset
47
25
2bfb84bc4350 runtreepkg.py: add option --once and a way to run specific packagers
Bernhard Herzog <bh@intevation.de>
parents: 8
diff changeset
48 if args:
2bfb84bc4350 runtreepkg.py: add option --once and a way to run specific packagers
Bernhard Herzog <bh@intevation.de>
parents: 8
diff changeset
49 packager_opts = [opts for opts in packager_opts if opts["name"] in args]
2bfb84bc4350 runtreepkg.py: add option --once and a way to run specific packagers
Bernhard Herzog <bh@intevation.de>
parents: 8
diff changeset
50 # check whether we got all of the names in args:
2bfb84bc4350 runtreepkg.py: add option --once and a way to run specific packagers
Bernhard Herzog <bh@intevation.de>
parents: 8
diff changeset
51 for opts in packager_opts:
2bfb84bc4350 runtreepkg.py: add option --once and a way to run specific packagers
Bernhard Herzog <bh@intevation.de>
parents: 8
diff changeset
52 name = opts["name"]
2bfb84bc4350 runtreepkg.py: add option --once and a way to run specific packagers
Bernhard Herzog <bh@intevation.de>
parents: 8
diff changeset
53 if name in args:
2bfb84bc4350 runtreepkg.py: add option --once and a way to run specific packagers
Bernhard Herzog <bh@intevation.de>
parents: 8
diff changeset
54 args.remove(name)
2bfb84bc4350 runtreepkg.py: add option --once and a way to run specific packagers
Bernhard Herzog <bh@intevation.de>
parents: 8
diff changeset
55 for name in args:
52
78cf5f6778ec Rename 'packagel ine' -> 'package track'
Bernhard Herzog <bh@intevation.de>
parents: 27
diff changeset
56 print >>sys.stderr, "No package tracks found named %r" % name
27
206d63ee310e cope with unknown packager names in runtreepkg.py
Bernhard Herzog <bh@intevation.de>
parents: 25
diff changeset
57
206d63ee310e cope with unknown packager names in runtreepkg.py
Bernhard Herzog <bh@intevation.de>
parents: 25
diff changeset
58 if packager_opts:
52
78cf5f6778ec Rename 'packagel ine' -> 'package track'
Bernhard Herzog <bh@intevation.de>
parents: 27
diff changeset
59 group = PackagerGroup([create_package_track(**opts)
27
206d63ee310e cope with unknown packager names in runtreepkg.py
Bernhard Herzog <bh@intevation.de>
parents: 25
diff changeset
60 for opts in packager_opts],
206d63ee310e cope with unknown packager names in runtreepkg.py
Bernhard Herzog <bh@intevation.de>
parents: 25
diff changeset
61 **treepkg_opts)
206d63ee310e cope with unknown packager names in runtreepkg.py
Bernhard Herzog <bh@intevation.de>
parents: 25
diff changeset
62 if options.once:
52
78cf5f6778ec Rename 'packagel ine' -> 'package track'
Bernhard Herzog <bh@intevation.de>
parents: 27
diff changeset
63 group.check_package_tracks()
27
206d63ee310e cope with unknown packager names in runtreepkg.py
Bernhard Herzog <bh@intevation.de>
parents: 25
diff changeset
64 else:
206d63ee310e cope with unknown packager names in runtreepkg.py
Bernhard Herzog <bh@intevation.de>
parents: 25
diff changeset
65 group.run()
0
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
66
f78a02e79c84 initial checkin
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
67 main()
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)