thomas@78: #! /usr/bin/python2.4 bh@102: # Copyright (C) 2007, 2008 by Intevation GmbH thomas@78: # Authors: thomas@78: # Bernhard Herzog thomas@78: # thomas@78: # This program is free software under the GPL (>=v2) thomas@78: # Read the file COPYING coming with the software for details. thomas@78: thomas@78: """Script to initialize the pbuilder environment for the tree packager thomas@78: thomas@78: The script assumes that the config file for the tree packager already thomas@78: contains the pbuilder settings. Also, this script assumes that there is thomas@78: only one pbuilder setting for all packagers. thomas@78: """ thomas@78: thomas@78: import sys thomas@78: thomas@78: import treepkgcmd thomas@78: from treepkg.options import create_parser thomas@78: from treepkg.packager import create_package_track, PackagerGroup thomas@78: from treepkg.readconfig import read_config thomas@78: thomas@78: thomas@78: def parse_commandline(): thomas@78: parser = create_parser() thomas@78: parser.set_defaults(distribution="etch") thomas@78: parser.add_option("--mirrorsite", thomas@78: help=("The debian mirror site" thomas@78: " (pbuilder MIRRORSITE setting). Required.")) thomas@78: parser.add_option("--othermirror", thomas@78: help=("Extra contents of the OTHERMIRROR setting." thomas@78: " See the pbuilder documentation for the format.")) thomas@78: parser.add_option("--distribution", thomas@78: help=("The debian distribution for the pbuilder chroot." thomas@78: " Default is etch.")) thomas@78: return parser.parse_args() thomas@78: thomas@78: thomas@78: def main(): thomas@78: options, args = parse_commandline() thomas@78: thomas@78: if options.mirrorsite is None: thomas@78: print >>sys.stderr, "Missing required option --mirrorsite" thomas@78: sys.exit(1) thomas@78: thomas@78: treepkg_opts, packager_opts = read_config(options.config_file) thomas@78: group = PackagerGroup([create_package_track(**opts) thomas@78: for opts in packager_opts], thomas@78: **treepkg_opts) thomas@78: track = group.get_package_tracks()[0] bh@170: track.builder.init_pbuilder(distribution=options.distribution, bh@170: mirrorsite=options.mirrorsite, bh@170: extramirrors=options.othermirror) thomas@78: thomas@78: main()