annotate bin/initpbuilder.py @ 185:e1c7cd896310

Rework test/filesupport.py so that test cases always use their own temporary directory. Before, the test cases had to ensure this themselves. Adapt the test cases.
author Bernhard Herzog <bh@intevation.de>
date Thu, 26 Jun 2008 16:23:26 +0000
parents bfcb2bbf9a52
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
102
e6cfe3b80956 fix typos
Bernhard Herzog <bh@intevation.de>
parents: 78
diff changeset
2 # Copyright (C) 2007, 2008 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 """Script to initialize the pbuilder environment for 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 The script assumes that the config file for the tree packager already
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
12 contains the pbuilder settings. Also, this script assumes that there is
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
13 only one pbuilder setting for all packagers.
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
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
16 import sys
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
17
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
18 import treepkgcmd
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
19 from treepkg.options import create_parser
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
20 from treepkg.packager import create_package_track, PackagerGroup
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
21 from treepkg.readconfig import read_config
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
22
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
23
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
24 def parse_commandline():
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
25 parser = create_parser()
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
26 parser.set_defaults(distribution="etch")
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
27 parser.add_option("--mirrorsite",
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
28 help=("The debian mirror site"
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
29 " (pbuilder MIRRORSITE setting). Required."))
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
30 parser.add_option("--othermirror",
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
31 help=("Extra contents of the OTHERMIRROR setting."
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
32 " See the pbuilder documentation for the format."))
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
33 parser.add_option("--distribution",
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
34 help=("The debian distribution for the pbuilder chroot."
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
35 " Default is etch."))
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
36 return parser.parse_args()
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
37
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
38
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
39 def main():
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
40 options, args = parse_commandline()
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
41
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
42 if options.mirrorsite is None:
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
43 print >>sys.stderr, "Missing required option --mirrorsite"
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
44 sys.exit(1)
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 treepkg_opts, packager_opts = read_config(options.config_file)
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
47 group = PackagerGroup([create_package_track(**opts)
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
48 for opts in packager_opts],
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
49 **treepkg_opts)
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
50 track = group.get_package_tracks()[0]
170
bfcb2bbf9a52 Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents: 105
diff changeset
51 track.builder.init_pbuilder(distribution=options.distribution,
bfcb2bbf9a52 Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents: 105
diff changeset
52 mirrorsite=options.mirrorsite,
bfcb2bbf9a52 Move the pbuilder initialization code from bin/initpbuilder.py to
Bernhard Herzog <bh@intevation.de>
parents: 105
diff changeset
53 extramirrors=options.othermirror)
78
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
54
9a602d8eaa60 initial revision of the subversion repository
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
55 main()
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)