X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=jenna;h=a88718e07aaa009ba64d9e4a87cf495289e6e47c;hb=434ec3a6423fd589b21eff825f6bc58aa8587550;hp=0854de6c5920394699f20008e7cd9eed63c4e6a8;hpb=255afc6897de5182050ff49f9dde28bbba4902e8;p=dak.git diff --git a/jenna b/jenna index 0854de6c..a88718e0 100755 --- a/jenna +++ b/jenna @@ -1,8 +1,8 @@ #!/usr/bin/env python # Generate file list which is then fed to apt-ftparchive to generate Packages and Sources files -# Copyright (C) 2000, 2001 James Troup -# $Id: jenna,v 1.13 2001-08-21 15:47:47 troup Exp $ +# Copyright (C) 2000, 2001, 2002 James Troup +# $Id: jenna,v 1.17 2002-05-14 15:34:02 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 @@ -18,22 +18,41 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -####################################################################################### +################################################################################ # BTAF: "GOD *DAMMIT*!! What the FUCK happened to my free will??" # # -- http://www.angryflower.com/timelo.gif -####################################################################################### +################################################################################ import pg, string, os, sys import apt_pkg import db_access, utils, claire, logging +################################################################################ + projectB = None Cnf = None Logger = None; +################################################################################ + +def usage (exit_code=0): + print """Usage: jenna [OPTION] +Write out file lists suitable for use with apt-ftparchive. + + -a, --architecture=ARCH only write file lists for this architecture + -c, --component=COMPONENT only write file lists for this component + -s, --suite=SUITE only write file lists for this suite + -h, --help show this help and exit + +ARCH, COMPONENT and SUITE can be space seperated lists, e.g. + --architecture=\"m68k i386\"""" + sys.exit(exit_code) + +################################################################################ + def generate_src_list(suite, component, output, dislocated_files): sources = {} @@ -198,28 +217,30 @@ def main(): global Cnf, projectB, Logger; dislocated_files = {}; - apt_pkg.init(); - - Cnf = apt_pkg.newConfiguration(); - apt_pkg.ReadConfigFileISC(Cnf,utils.which_conf_file()); + Cnf = utils.get_conf() Arguments = [('a',"architecture","Jenna::Options::Architecture", "HasArg"), ('c',"component","Jenna::Options::Component", "HasArg"), - ('d',"debug","Jenna::Options::Debug", "IntVal"), ('h',"help","Jenna::Options::Help"), - ('s',"suite", "Jenna::Options::Suite", "HasArg"), - ('v',"verbose","Jenna::Options::Verbose"), - ('V',"version","Jenna::Options::Version")]; + ('s',"suite", "Jenna::Options::Suite", "HasArg")]; + + for i in ["architecture", "component", "help", "suite" ]: + if not Cnf.has_key("Jenna::Options::%s" % (i)): + Cnf["Jenna::Options::%s" % (i)] = ""; apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv); + Options = Cnf.SubTree("Jenna::Options"); + + if Options["Help"]: + usage(); projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"])); db_access.init(Cnf, projectB); Logger = logging.Logger(Cnf, "jenna"); - if Cnf["Jenna::Options::Suite"] == "": - Cnf["Jenna::Options::Suite"] = string.join(Cnf.SubTree("Suite").List()); - for suite in string.split(Cnf["Jenna::Options::Suite"]): + if Options["Suite"] == "": + Options["Suite"] = string.join(Cnf.SubTree("Suite").List()); + for suite in string.split(Options["Suite"]): suite = string.lower(suite); if suite == 'stable': dislocated_files = claire.find_dislocated_stable(Cnf, projectB); @@ -227,33 +248,33 @@ def main(): dislocated_files = {}; clean_suite(suite); clean_duplicate_packages(suite) - components = Cnf["Jenna::Options::Component"]; + components = Options["Component"]; if not Cnf.has_key("Suite::%s::Components" % (suite)): components = "-"; if components == "": - components = string.join(Cnf.SubTree("Suite::%s::Components" % (suite)).List()); + components = string.join(Cnf.ValueList("Suite::%s::Components" % (suite))); for component in string.split(components): component = string.lower(component) - architectures = Cnf["Jenna::Options::Architecture"]; + architectures = Options["Architecture"]; if architectures == "": - architectures = string.join(Cnf.SubTree("Suite::%s::Architectures" % (suite)).List()); + architectures = string.join(Cnf.ValueList("Suite::%s::Architectures" % (suite))); for architecture in string.split(architectures): architecture = string.lower(architecture) if architecture == "all": continue if architecture == "source": Logger.log(["Processing dists/%s/%s/%s..." % (suite, component, architecture)]); - output = utils.open_file("%s/%s_%s_%s.list" % (Cnf["Dir::ListsDir"], suite, component, architecture), "w") + output = utils.open_file("%s/%s_%s_%s.list" % (Cnf["Dir::Lists"], suite, component, architecture), "w") generate_src_list(suite, component, output, dislocated_files); output.close(); else: Logger.log(["Processing dists/%s/%s/binary-%s..." % (suite, component, architecture)]); - output = utils.open_file("%s/%s_%s_binary-%s.list" % (Cnf["Dir::ListsDir"], suite, component, architecture), "w"); + output = utils.open_file("%s/%s_%s_binary-%s.list" % (Cnf["Dir::Lists"], suite, component, architecture), "w"); generate_bin_list(suite, component, architecture, output, "deb", dislocated_files); output.close(); - if component == "main" and (suite == "unstable" or suite == "testing"): # FIXME: must be a cleaner way to say debian-installer is main only? + if component == "main" and (suite == "unstable" or suite == "testing") and Cnf.has_key("Section::debian-installer"): # FIXME: must be a cleaner way to say debian-installer is main only? Logger.log(["Processing dists/%s/%s/debian-installer/binary-%s..." % (suite,component, architecture)]); - output = utils.open_file("%s/%s_%s_debian-installer_binary-%s.list" % (Cnf["Dir::ListsDir"], suite, component, architecture), "w"); + output = utils.open_file("%s/%s_%s_debian-installer_binary-%s.list" % (Cnf["Dir::Lists"], suite, component, architecture), "w"); generate_bin_list(suite, component, architecture, output, "udeb", dislocated_files); output.close(); Logger.close();