Mercurial > treepkg
comparison bin/initbuilder.py @ 344:f06f707d9fda
merged branches/scratchbox into trunk
#### IMPORTANT FOR ALL TREEPKGS #####
pbuilderrc config variable name changed to builderconfig
author | Bjoern Ricks <bricks@intevation.de> |
---|---|
date | Fri, 23 Apr 2010 07:43:29 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
343:c0808837fc64 | 344:f06f707d9fda |
---|---|
1 #! /usr/bin/python | |
2 # Copyright (C) 2007, 2008, 2009 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 """Script to initialize the builder environment for the tree packager | |
10 | |
11 The script assumes that the config file for the tree packager already | |
12 contains the builder settings. Also, this script assumes that there is | |
13 only one builder setting for all packagers. | |
14 """ | |
15 | |
16 import sys | |
17 | |
18 import treepkgcmd | |
19 from treepkg.options import create_parser | |
20 from treepkg.packager import create_package_track, PackagerGroup | |
21 from treepkg.readconfig import read_config | |
22 | |
23 | |
24 def parse_commandline(): | |
25 parser = create_parser() | |
26 parser.set_defaults(distribution="etch") | |
27 parser.add_option("--mirrorsite", | |
28 help=("The debian mirror site" | |
29 " (pbuilder MIRRORSITE setting). Required.")) | |
30 parser.add_option("--othermirror", | |
31 help=("Extra contents of the OTHERMIRROR setting." | |
32 " See the pbuilder documentation for the format.")) | |
33 parser.add_option("--distribution", | |
34 help=("The debian distribution for the pbuilder chroot." | |
35 " Default is etch.")) | |
36 return parser.parse_args() | |
37 | |
38 | |
39 def main(): | |
40 options, args = parse_commandline() | |
41 | |
42 if options.mirrorsite is None: | |
43 print >>sys.stderr, "Missing required option --mirrorsite" | |
44 sys.exit(1) | |
45 | |
46 treepkg_opts, packager_opts = read_config(options.config_file) | |
47 group = PackagerGroup([create_package_track(**opts) | |
48 for opts in packager_opts], | |
49 **treepkg_opts) | |
50 track = group.get_package_tracks()[0] | |
51 track.builder.init_builder(distribution=options.distribution, | |
52 mirrorsite=options.mirrorsite, | |
53 extramirrors=options.othermirror) | |
54 | |
55 main() |