X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=fernanda;h=466f6197c349bfd7271539154fe3aec0b7407e4c;hb=240185ce8d1003ad7a1a15817d1e0c2ee55675f3;hp=6f1a71fbbc0b3f4e9a5accbb0bd7838fcc6735b5;hpb=15e88015bcce67148a75c87db823c57c12bd73d5;p=dak.git diff --git a/fernanda b/fernanda index 6f1a71fb..466f6197 100755 --- a/fernanda +++ b/fernanda @@ -2,7 +2,7 @@ # Script to automate some parts of checking NEW packages # Copyright (C) 2000, 2001 James Troup -# $Id: fernanda,v 1.1 2001-06-15 01:18:25 troup Exp $ +# $Id: fernanda,v 1.5 2001-11-18 19:57:58 rmurray 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 @@ -47,6 +47,18 @@ re_doc_directory = re.compile(r".*/doc/([^/]*).*"); ################################################################################ +def usage (exit_code=0): + print """Usage: fernanda [PACKAGE]... +Check NEW package(s). + + -h, --help show this help and exit + +PACKAGE can be a .changes, .dsc, .deb or .udeb filename.""" + + sys.exit(exit_code) + +################################################################################ + def do_command (command, filename): o = os.popen("%s %s" % (command, filename)); print o.read(); @@ -73,7 +85,7 @@ def check_dsc (dsc_filename): files = utils.build_file_list(dsc, 1); print "---- .dsc file for %s ----" % (dsc_filename); - dsc_file = utils.open_file(dsc_filename, 'r'); + dsc_file = utils.open_file(dsc_filename); for line in dsc_file.readlines(): print line[:-1]; print; @@ -88,7 +100,7 @@ def check_deb (deb_filename): print "---- control file for %s ----" % (filename); do_command ("dpkg -I", deb_filename); - + if is_a_udeb: print "---- skipping lintian check for µdeb ----"; print ; @@ -110,16 +122,16 @@ def check_deb (deb_filename): def check_changes (changes_filename): changes = utils.parse_changes (changes_filename, 0); - + print "---- .changes file for %s ----" % (changes_filename); - file = utils.open_file (changes_filename, 'r'); + file = utils.open_file (changes_filename); for line in file.readlines(): print line[:-1] print ; file.close(); - + files = utils.build_file_list(changes, ""); - + for file in files.keys(): if file[-4:] == ".deb" or file[-5:] == ".udeb": check_deb(file); @@ -130,18 +142,21 @@ def check_changes (changes_filename): def main (): global Cnf, projectB, db_files, waste, excluded; - apt_pkg.init(); - - Cnf = apt_pkg.newConfiguration(); - apt_pkg.ReadConfigFileISC(Cnf,utils.which_conf_file()); + Cnf = utils.get_conf() - Arguments = [('D',"debug","Jennifer::Options::Debug", "IntVal"), - ('h',"help","Jennifer::Options::Help"), - ('v',"version","Jennifer::Options::Version")]; + Arguments = [('h',"help","Fernanda::Options::Help")]; + for i in [ "help" ]: + if not Cnf.has_key("Frenanda::Options::%s" % (i)): + Cnf["Fernanda::Options::%s" % (i)] = ""; args = apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv); + Options = Cnf.SubTree("Fernanda::Options") + + if Options["Help"]: + usage(); + stdout_fd = sys.stdout; - + for file in args: try: # Pipe output for each argument through less @@ -163,12 +178,12 @@ def main (): sys.stdout = stdout_fd; except IOError, e: if errno.errorcode[e.errno] == 'EPIPE': - utils.warn("[fernanda] Caught EPIPE; skipping.\n"); + utils.warn("[fernanda] Caught EPIPE; skipping."); pass; else: raise; except KeyboardInterrupt: - utils.warn("[fernanda] Caught C-c; skipping.\n"); + utils.warn("[fernanda] Caught C-c; skipping."); pass; #######################################################################################