X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=rose;h=d462ca486533829a3d16ba9d103a96e28cc247fa;hb=de3991e803cc6f69d5eee0fbf75daf95b0f9969d;hp=f127a781370a763e65d24e3b11ec2967d459ec46;hpb=2c9e82a8abc15a7cbbf197c3922e5a36ccb27f98;p=dak.git diff --git a/rose b/rose index f127a781..d462ca48 100755 --- a/rose +++ b/rose @@ -1,8 +1,8 @@ #!/usr/bin/env python # Initial setup of an archive -# Copyright (C) 2002 James Troup -# $Id: rose,v 1.1 2002-10-16 02:45:12 troup Exp $ +# Copyright (C) 2002, 2004 James Troup +# $Id: rose,v 1.4 2004-03-11 00:20:51 troup Exp $ # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -27,9 +27,18 @@ import apt_pkg; ################################################################################ Cnf = None; +AptCnf = None; ################################################################################ +def usage(exit_code=0): + print """Usage: rose +Creates directories for an archive based on katie.conf configuration file. + + -h, --help show this help and exit.""" + sys.exit(exit_code) + +################################################################################ def do_dir(target, config_name): if os.path.exists(target): @@ -48,7 +57,7 @@ def process_tree(config, tree): for entry in config.SubTree(tree).List(): entry = entry.lower(); if tree == "Dir": - if entry == "poolroot" or entry == "queue" or entry == "morguereject": + if entry in [ "poolroot", "queue" , "morguereject" ]: continue; config_name = "%s::%s" % (tree, entry); target = config[config_name]; @@ -90,10 +99,19 @@ def create_directories(): ################################################################################ def main (): - global Cnf, projectB; + global AptCnf, Cnf, projectB; Cnf = utils.get_conf() - apt_pkg.ParseCommandLine(Cnf,[],sys.argv); + Arguments = [('h',"help","Rose::Options::Help")]; + for i in [ "help" ]: + if not Cnf.has_key("Rose::Options::%s" % (i)): + Cnf["Rose::Options::%s" % (i)] = ""; + + apt_pkg.ParseCommandLine(Cnf, Arguments, sys.argv); + + Options = Cnf.SubTree("Rose::Options") + if Options["Help"]: + usage(); AptCnf = apt_pkg.newConfiguration(); apt_pkg.ReadConfigFileISC(AptCnf,utils.which_apt_conf_file());