From 6ada259d555e36a1546789c280edc3f944b7de7f Mon Sep 17 00:00:00 2001 From: James Troup Date: Fri, 22 Jun 2001 22:53:14 +0000 Subject: [PATCH] make use of utils.{warn,fubar}. clean up extraneous \n's in fernanda and natalie. remove old override code from rhona. --- TODO | 5 +++-- catherine | 25 +++++++++---------------- cindy | 14 ++++++-------- denise | 17 +++++++---------- fernanda | 6 +++--- heidi | 28 ++++++++++++---------------- jenna | 6 +++--- katie | 22 +++++++++------------- melanie | 6 ++---- natalie.py | 4 ++-- neve | 11 ++++------- rhona | 15 ++++----------- tea | 14 +++++++------- 13 files changed, 71 insertions(+), 102 deletions(-) diff --git a/TODO b/TODO index 0a051353..5523fffa 100644 --- a/TODO +++ b/TODO @@ -47,12 +47,13 @@ Less Urgent o Don't do override checks for stable only uploads o cron.daily* should change umask (aj sucks) o Rene doesn't look at debian-installer but should. + o Rene needs to check for binary-less source packages. - * Bizzare: + * Bizzare/uncertain: - o Fix rhona to unconditionally read override file on startup (huh? no override reading at all!) o validate source consistency, i.e. .dsc and .tar.gz as minimum (??) o Rene also doesn't seem to warn about missing binary packages (??) + o jenna should not delete things because they don't exist (?) * Cleanups & misc: diff --git a/catherine b/catherine index b65d1505..ce4b3dff 100755 --- a/catherine +++ b/catherine @@ -2,7 +2,7 @@ # Poolify (move packages from "legacy" type locations to pool locations) # Copyright (C) 2000, 2001 James Troup -# $Id: catherine,v 1.9 2001-06-05 22:30:43 troup Exp $ +# $Id: catherine,v 1.10 2001-06-22 22:53:14 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 @@ -53,7 +53,7 @@ def poolize (q, limit, verbose, no_action): legacy_filename = qid["path"]+qid["filename"]; size = os.stat(legacy_filename)[stat.ST_SIZE]; if (poolized_size + size) > limit and limit >= 0: - sys.stderr.write("Hit %s limit.\n" % (utils.size_type(limit))); + utils.warn("Hit %s limit." % (utils.size_type(limit))); break; poolized_size = poolized_size + size; poolized_count = poolized_count + 1; @@ -71,8 +71,7 @@ def poolize (q, limit, verbose, no_action): version = control.Find("Version", ""); architecture = control.Find("Architecture", ""); if package == "" or version == "" or architecture == "": - sys.stderr.write("%s: couldn't determine required information to rename .deb file.\n" % (legacy_filename)); - sys.exit(1); + utils.fubar("%s: couldn't determine required information to rename .deb file." % (legacy_filename)); version = utils.re_no_epoch.sub('', version); destination_filename = "%s_%s_%s.deb" % (package, version, architecture); else: @@ -80,34 +79,29 @@ def poolize (q, limit, verbose, no_action): if m != None: source = m.group(1); else: - sys.stderr.write("%s: say what?\n" % (legacy_filename)); - sys.exit(1); + utils.fubar("expandsion of source filename '%s' failed." % (legacy_filename)); # Work out the component name component = qid["component"]; if component == "": q = projectB.query("SELECT DISTINCT(c.name) FROM override o, component c WHERE o.package = '%s' AND o.component = c.id;" % (source)); ql = q.getresult(); if ql == []: - sys.stderr.write("%s: No override match so I can't work out the component.\n" % (source)); - sys.exit(1); + utils.fubar("No override match for '%s' so I can't work out the component." % (source)); if len(ql) > 1: - sys.stderr.write("%s: multiple override matches for %s so I can't work out the component.\n" % (source)); - sys.exit(1); + utils.fubar("Multiple override matches for '%s' so I can't work out the component." % (source)); component = ql[0][0]; # Work out the new location q = projectB.query("SELECT l.id FROM location l, component c WHERE c.name = '%s' AND c.id = l.component AND l.type = 'pool';" % (component)); ql = q.getresult(); if len(ql) != 1: - sys.stderr.write("%s: couldn't determine location ID, query returned %d matches and not 1 as expected.\n" % (source, len(ql))); - sys.exit(1); + utils.fubar("couldn't determine location ID for '%s'. [query returned %d matches, not 1 as expected]" % (source, len(ql))); location_id = ql[0][0]; # First move the files to the new location pool_location = utils.poolify (source, component); pool_filename = pool_location + destination_filename; destination = Cnf["Dir::PoolDir"] + pool_location + destination_filename; if os.path.exists(destination): - sys.stderr.write("%s: already exists in the pool; serious FUBARity.\n" % (legacy_filename)); - sys.exit(1); + utils.fubar("'%s' already exists in the pool; serious FUBARity." % (legacy_filename)); if verbose: print "Moving: %s -> %s" % (legacy_filename, destination); if not no_action: @@ -154,8 +148,7 @@ def main (): # Sanity check the limit argument if limit > 0 and limit < 1024: - sys.stderr.write("-l/--limit takes an argument with a value in kilobytes.\n"); - sys.exit(1); + utils.fubar("-l/--limit takes an argument with a value in kilobytes."); # Grab a list of all files not already in the pool q = projectB.query(""" diff --git a/cindy b/cindy index a963ea4c..367e1e57 100755 --- a/cindy +++ b/cindy @@ -2,7 +2,7 @@ # Output override files for apt-ftparchive and indices/ # Copyright (C) 2000, 2001 James Troup -# $Id: cindy,v 1.3 2001-03-20 00:28:11 troup Exp $ +# $Id: cindy,v 1.4 2001-06-22 22:53:14 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,6 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +################################################################################ # X-Listening-To: Sanitarium / Master of the Puppets - Metallica @@ -40,18 +41,15 @@ def process(suite, component, type): suite_id = db_access.get_suite_id(suite); if suite_id == -1: - sys.stderr.write("Suite '%s' not recognised.\n" % (suite)); - sys.exit(2); + utils.fubar("Suite '%s' not recognised." % (suite)); component_id = db_access.get_component_id(component); if component_id == -1: - sys.stderr.write("Component '%s' not recognised.\n" % (component)); - sys.exit(2); + utils.fubar("Component '%s' not recognised." % (component)); type_id = db_access.get_override_type_id(type); if type_id == -1: - sys.stderr.write("Type '%s' not recognised. (Valid types are deb, udeb and dsc.)\n" % (type)); - sys.exit(2); + utils.fubar("Type '%s' not recognised. (Valid types are deb, udeb and dsc)" % (type)); dsc_type_id = db_access.get_override_type_id("dsc"); if type == "deb" or type == "udeb": @@ -110,7 +108,7 @@ def main (): db_access.init(Cnf, projectB); for suite in [ "stable", "unstable" ]: - sys.stderr.write("Processing %s...\n" % (suite)); + print "Processing %s..." % (suite); for component in Cnf.SubTree("Component").List(): if component == "mixed": continue; # Ick diff --git a/denise b/denise index 2660e8bb..2e2c16e4 100755 --- a/denise +++ b/denise @@ -2,7 +2,7 @@ # Output override files for apt-ftparchive and indices/ # Copyright (C) 2000, 2001 James Troup -# $Id: denise,v 1.4 2001-03-20 00:28:11 troup Exp $ +# $Id: denise,v 1.5 2001-06-22 22:53:14 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 @@ -41,18 +41,15 @@ def list(suite, component, type): suite_id = db_access.get_suite_id(suite); if suite_id == -1: - sys.stderr.write("Suite '%s' not recognised.\n" % (suite)); - sys.exit(2); + utils.fubar("Suite '%s' not recognised." % (suite)); component_id = db_access.get_component_id(component); if component_id == -1: - sys.stderr.write("Component '%s' not recognised.\n" % (component)); - sys.exit(2); + utils.fubar("Component '%s' not recognised." % (component)); type_id = db_access.get_override_type_id(type); if type_id == -1: - sys.stderr.write("Type '%s' not recognised. (Valid types are deb, udeb and dsc.)\n" % (type)); - sys.exit(2); + utils.fubar("Type '%s' not recognised. (Valid types are deb, udeb and dsc)" % (type)); if not override.has_key(suite): override[suite] = {}; @@ -93,7 +90,7 @@ def main (): natalie.init(); for suite in [ "stable", "unstable" ]: - sys.stderr.write("Processing %s...\n" % (suite)); + print "Processing %s..." % (suite); override_suite = Cnf["Suite::%s::OverrideCodeName" % (suite)]; for component in Cnf.SubTree("Component").List(): if component == "mixed": @@ -116,7 +113,7 @@ def main (): # Munge the override file for testing by using unstable's where # possible and falling back on stable's where it's not. - sys.stderr.write("Processing testing...\n"); + print "Processing testing..."; suite = "testing"; suite_id = db_access.get_suite_id(suite); override_suite = Cnf["Suite::%s::OverrideCodeName" % (suite)]; @@ -145,7 +142,7 @@ def main (): else: if type == "dsc" and (override["unstable"][component]["deb"].has_key(package) or override["stable"][component]["deb"].has_key(package)): continue; # source falls back on binary; so accept silently - sys.stderr.write("W: Can't find override entry for testing package '%s' (component %s, type %s).\n" % (package, component, type)); + utils.warn("Can't find override entry for testing package '%s' (component %s, type %s)." % (package, component, type)); sys.stdout.close(); diff --git a/fernanda b/fernanda index 6f1a71fb..d945f752 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.2 2001-06-22 22:53:14 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 @@ -163,12 +163,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; ####################################################################################### diff --git a/heidi b/heidi index 95906103..9dff0244 100755 --- a/heidi +++ b/heidi @@ -2,7 +2,7 @@ # Manipulate suite tags # Copyright (C) 2000, 2001 James Troup -# $Id: heidi,v 1.6 2001-06-20 18:47:37 troup Exp $ +# $Id: heidi,v 1.7 2001-06-22 22:53:14 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 @@ -67,7 +67,7 @@ def process_file (file, suite_id, action): for line in lines: split_line = string.split(string.strip(line[:-1])); if len(split_line) != 3: - sys.stderr.write("W: '%s' does not break into 'package version architecture'.\n" % (line[:-1])); + utils.warn("'%s' does not break into 'package version architecture'." % (line[:-1])); continue; (package, version, architecture) = split_line; @@ -79,10 +79,10 @@ def process_file (file, suite_id, action): ql = q.getresult(); if ql == []: - sys.stderr.write("W: Couldn't find '%s~%s~%s'.\n" % (package, version, architecture)); + utils.warn("Couldn't find '%s~%s~%s'." % (package, version, architecture)); continue; if len(ql) > 1: - sys.stderr.write("E: Found more than one match for '%s~%s~%s'.\n" % (package, version, architecture)); + utils.warn("Found more than one match for '%s~%s~%s'." % (package, version, architecture)); continue; id = ql[0][0]; @@ -97,13 +97,13 @@ def process_file (file, suite_id, action): # Take action if action == "add": if assoication_id != None: - sys.stderr.write("W: '%s~%s~%s' already exists in suite %s.\n" % (package, version, architecture, suite_id)); + utils.warn("'%s~%s~%s' already exists in suite %s." % (package, version, architecture, suite_id)); continue; else: q = projectB.query("INSERT INTO src_associations (suite, source) VALUES (%s, %s)" % (suite_id, id)); elif action == "remove": if assoication_id == None: - sys.stderr.write("W: '%s~%s~%s' doesn't exist in suite %s.\n" % (package, version, architecture, suite_id)); + utils.warn("'%s~%s~%s' doesn't exist in suite %s." % (package, version, architecture, suite_id)); continue; else: q = projectB.query("DELETE FROM src_associations WHERE id = %s" % (assoication_id)); @@ -118,13 +118,13 @@ def process_file (file, suite_id, action): # Take action if action == "add": if assoication_id != None: - sys.stderr.write("W: '%s~%s~%s' already exists in suite %s.\n" % (package, version, architecture, suite_id)); + utils.warn("'%s~%s~%s' already exists in suite %s." % (package, version, architecture, suite_id)); continue; else: q = projectB.query("INSERT INTO bin_associations (suite, bin) VALUES (%s, %s)" % (suite_id, id)); elif action == "remove": if assoication_id == None: - sys.stderr.write("W: '%s~%s~%s' doesn't exist in suite %s.\n" % (package, version, architecture, suite_id)); + utils.warn("'%s~%s~%s' doesn't exist in suite %s." % (package, version, architecture, suite_id)); continue; else: q = projectB.query("DELETE FROM bin_associations WHERE id = %s" % (assoication_id)); @@ -176,24 +176,20 @@ def main (): suite = Cnf["Heidi::Options::%s" % (i)]; if suite !="": if not Cnf.has_key("Suite::%s" % (suite)): - sys.stderr.write("Unknown suite %s.\n" %(suite)); - sys.exit(2); + utils.fubar("Unknown suite '%s'." %(suite)); else: suite_id = db_access.get_suite_id(suite); if action != None: - sys.stderr.write("Can only do one action at a time.\n"); - sys.exit(2); + utils.fubar("Can only perform one action at a time."); action = i; # Need an action... if action == None: - sys.stderr.write("No action specified.\n"); - sys.exit(2); + utils.fubar("No action specified."); # Safety/Sanity check if action == "set" and suite != "testing": - sys.stderr.write("Will not reset a suite other than testing...\n"); - sys.exit(2); + utils.fubar("Will not reset a suite other than testing."); if action == "list": get_list(suite_id); diff --git a/jenna b/jenna index cb0ca8d3..0f635cb4 100755 --- a/jenna +++ b/jenna @@ -2,7 +2,7 @@ # 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.11 2001-05-03 06:52:03 ajt Exp $ +# $Id: jenna,v 1.12 2001-06-22 22:53:14 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 @@ -52,7 +52,7 @@ def generate_src_list(suite, component, output, dislocated_files): else: filename = path + filename; if sources.has_key(source): - sys.stderr.write("E: %s in %s / %s / source is duplicated. Gravity wins!\n" % (source, suite, component)); + utils.warn("%s in %s / %s / source is duplicated." % (source, suite, component)); else: sources[source] = filename; @@ -81,7 +81,7 @@ def generate_bin_list(suite, component, architecture, output, type, dislocated_f else: filename = path + filename; if packages.has_key(package): - sys.stderr.write("E: %s in %s / %s / %s / %s is duplicated. Gravity wins!" % (package, suite, component, architecture, type)); + utils.warn("%s in %s / %s / %s / %s is duplicated." % (package, suite, component, architecture, type)); else: packages[package] = filename; diff --git a/katie b/katie index 64963222..700791ca 100755 --- a/katie +++ b/katie @@ -2,7 +2,7 @@ # Installs Debian packaes # Copyright (C) 2000, 2001 James Troup -# $Id: katie,v 1.46 2001-06-21 18:19:09 troup Exp $ +# $Id: katie,v 1.47 2001-06-22 22:53:14 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 @@ -947,7 +947,7 @@ def install (changes_filename, summary, short_summary): try: utils.move (changes_filename, Cnf["Dir::IncomingDir"] + 'DONE/' + os.path.basename(changes_filename)) except: - sys.stderr.write("W: couldn't move changes file '%s' to DONE directory [Got %s].\n" % (os.path.basename(changes_filename), sys.exc_type)); + utils.warn("couldn't move changes file '%s' to DONE directory. [Got %s]" % (os.path.basename(changes_filename), sys.exc_type)); install_count = install_count + 1; @@ -979,8 +979,7 @@ def stable_install (changes_filename, summary, short_summary): q = projectB.query("SELECT id FROM source WHERE source = '%s' AND version = '%s'" % (package, version)) ql = q.getresult() if ql == []: - sys.stderr.write("INTERNAL ERROR: couldn't find '%s' (%s) in source table.\n" % (package, version)); - sys.exit(1); + utils.fubar("[INTERNAL ERROR] couldn't find '%s' (%s) in source table." % (package, version)); source_id = ql[0][0]; suite_id = db_access.get_suite_id('proposed-updates'); projectB.query("DELETE FROM src_associations WHERE suite = '%s' AND source = '%s'" % (suite_id, source_id)); @@ -996,8 +995,7 @@ def stable_install (changes_filename, summary, short_summary): q = projectB.query("SELECT b.id FROM binaries b, architecture a WHERE b.package = '%s' AND b.version = '%s' AND (a.arch_string = '%s' OR a.arch_string = 'all') AND b.architecture = a.id" % (package, version, architecture)) ql = q.getresult() if ql == []: - sys.stderr.write("INTERNAL ERROR: couldn't find '%s' (%s for %s architecture) in binaries table.\n" % (package, version, architecture)); - sys.exit(1); + utils.fubar("[INTERNAL ERROR] couldn't find '%s' (%s for %s architecture) in binaries table." % (package, version, architecture)); binary_id = ql[0][0]; suite_id = db_access.get_suite_id('proposed-updates'); projectB.query("DELETE FROM bin_associations WHERE suite = '%s' AND bin = '%s'" % (suite_id, binary_id)); @@ -1058,14 +1056,14 @@ def reject (changes_filename, manual_reject_mail_filename): try: utils.move (changes_filename, "%s/REJECT/%s" % (Cnf["Dir::IncomingDir"], base_changes_filename)); except: - sys.stderr.write("W: couldn't reject changes file '%s' [Got %s].\n" % (base_changes_filename, sys.exc_type)); + utils.warn("couldn't reject changes file '%s'. [Got %s]" % (base_changes_filename, sys.exc_type)); pass; for file in files.keys(): if os.path.exists(file): try: utils.move (file, "%s/REJECT/%s" % (Cnf["Dir::IncomingDir"], file)); except: - sys.stderr.write("W: couldn't reject file '%s' [Got %s].\n" % (file, sys.exc_type)); + utils.warn("couldn't reject file '%s'. [Got %s]" % (file, sys.exc_type)); pass; # If this is not a manual rejection generate the .reason file and rejection mail message @@ -1111,8 +1109,7 @@ def manual_reject (changes_filename): if manual_reject_message == "": result = os.system("vi +6 %s" % (reject_filename)) if result != 0: - sys.stderr.write ("vi invocation failed for `%s'!\n" % (reject_filename)) - sys.exit(result) + utils.fubar("vi invocation failed for `%s'!" % (reject_filename), result); # Then process it as if it were an automatic rejection reject (changes_filename, reject_filename) @@ -1291,8 +1288,7 @@ def main(): # Check that we aren't going to clash with the daily cron job if os.path.exists("%s/Archive_Maintenance_In_Progress" % (Cnf["Dir::RootDir"])) and not Cnf["Dinstall::Options::No-Lock"]: - sys.stderr.write("Archive maintenance in progress. Try again later.\n"); - sys.exit(2); + utils.fubar("Archive maintenance in progress. Try again later."); # Obtain lock if not in no-action mode @@ -1311,7 +1307,7 @@ def main(): Subst = {} Subst["__ADMIN_ADDRESS__"] = Cnf["Dinstall::MyAdminAddress"]; Subst["__BUG_SERVER__"] = Cnf["Dinstall::BugServer"]; - bcc = "X-Katie: $Revision: 1.46 $" + bcc = "X-Katie: $Revision: 1.47 $" if Cnf.has_key("Dinstall::Bcc"): Subst["__BCC__"] = bcc + "\nBcc: %s" % (Cnf["Dinstall::Bcc"]); else: diff --git a/melanie b/melanie index 9546c35d..91288a82 100755 --- a/melanie +++ b/melanie @@ -2,7 +2,7 @@ # General purpose archive tool for ftpmaster # Copyright (C) 2000, 2001 James Troup -# $Id: melanie,v 1.13 2001-04-13 20:13:30 troup Exp $ +# $Id: melanie,v 1.14 2001-06-22 22:53:14 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 @@ -232,8 +232,6 @@ def main (): source = re_strip_source_version.sub('', source); if source_packages.has_key(source): to_remove.append(i[2:]); - #else: - #sys.stderr.write("W: skipping '%s' as it's source ('%s') isn't one of the source packages.\n" % (filename, source)); print "done." # If we don't have a reason; spawn an editor so the user can add one @@ -359,7 +357,7 @@ def main (): else: bcc = "Bcc: " + bcc; Subst["__BCC__"] = bcc[:-2]; - Subst["__CC__"] = "X-Melanie: $Revision: 1.13 $\n" + carbon_copy[:-1]; + Subst["__CC__"] = "X-Melanie: $Revision: 1.14 $\n" + carbon_copy[:-1]; Subst["__SUITE_LIST__"] = suites_list; Subst["__SUMMARY__"] = summary; Subst["__ADMIN_ADDRESS__"] = Cnf["Dinstall::MyAdminAddress"]; diff --git a/natalie.py b/natalie.py index 64bd7063..760a574f 100755 --- a/natalie.py +++ b/natalie.py @@ -2,7 +2,7 @@ # Manipulate override files # Copyright (C) 2000, 2001 James Troup -# $Id: natalie.py,v 1.5 2001-04-13 20:13:36 troup Exp $ +# $Id: natalie.py,v 1.6 2001-06-22 22:53:14 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 @@ -177,7 +177,7 @@ def list(suite, component, type): type_id = db_access.get_override_type_id(type); if type_id == -1: - utils.fubar("Type '%s' not recognised. (Valid types are deb, udeb and dsc.)\n" % (type)); + utils.fubar("Type '%s' not recognised. (Valid types are deb, udeb and dsc)" % (type)); if type == "dsc": q = projectB.query("SELECT o.package, s.section, o.maintainer FROM override o, section s WHERE o.suite = %s AND o.component = %s AND o.type = %s AND o.section = s.id ORDER BY s.section, o.package" % (suite_id, component_id, type_id)); diff --git a/neve b/neve index 7412fc37..a5ca0d17 100755 --- a/neve +++ b/neve @@ -2,7 +2,7 @@ # Populate the DB # Copyright (C) 2000, 2001 James Troup -# $Id: neve,v 1.3 2001-03-20 00:28:11 troup Exp $ +# $Id: neve,v 1.4 2001-06-22 22:53:14 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 @@ -295,8 +295,7 @@ def do_sources(location, prefix, suite, component, server): sources = location + prefix + 'Sources.gz'; (result, output) = commands.getstatusoutput("gunzip -c %s > %s" % (sources, temp_filename)); if (result != 0): - sys.stderr.write("Gunzip invocation failed!\n%s\n" % (output)); - sys.exit(result); + utils.fubar("Gunzip invocation failed!\n%s" % (output), result); print 'Processing '+sources+'...'; process_sources (location, temp_filename, suite, component, server); os.unlink(temp_filename); @@ -358,8 +357,7 @@ def main (): # prefix = component + '/' # do_sources(location, prefix); else: - sys.stderr.write("Unknown location type ('%s').\n" % (type)); - sys.exit(2); + utils.fubar("Unknown location type ('%s')." % (type)); # Process Packages files to populate `binaries' and friends @@ -412,8 +410,7 @@ def main (): (result, output) = commands.getstatusoutput("psql projectb < add_constraints.sql"); print output if (result != 0): - sys.stderr.write("psql invocation failed!\n"); - sys.exit(result); + utils.fubar("psql invocation failed!\n%s" % (output), result); return; diff --git a/rhona b/rhona index e3f5c022..c05db312 100755 --- a/rhona +++ b/rhona @@ -2,7 +2,7 @@ # rhona, cleans up unassociated binary and source packages # Copyright (C) 2000, 2001 James Troup -# $Id: rhona,v 1.14 2001-05-31 02:19:30 troup Exp $ +# $Id: rhona,v 1.15 2001-06-22 22:53:14 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 @@ -39,7 +39,6 @@ projectB = None Cnf = None now_date = None; # mark newly "deleted" things as deleted "now" delete_date = None; # delete things marked "deleted" earler than this -overrides = {}; tried_too_hard_exc = "Tried too hard to find a free filename for %s; something's gone Pete Tong"; @@ -106,8 +105,7 @@ def check_sources(): print "Checking for orphaned source packages..." - # Get the list of source packages not in a suite and not linked to - # by any binary packages. + # Get the list of source packages not in a suite. q = projectB.query(""" SELECT s.id, s.file FROM source s @@ -219,7 +217,7 @@ def clean(): for i in q.getresult(): filename = i[0] + i[1]; if not os.path.exists(filename): - sys.stderr.write("E: can not find %s.\n" % (filename)); + utils.warn("can not find '%s'." % (filename)); continue; if os.path.isfile(filename): if os.path.islink(filename): @@ -242,8 +240,7 @@ def clean(): else: utils.move(filename, dest_filename); else: - sys.stderr.write("%s is neither symlink nor file?!\n" % (filename)); - sys.exit(1); + utils.fubar("%s is neither symlink nor file?!" % (filename)); # Delete from the 'files' table if not Cnf["Rhona::Options::No-Action"]: @@ -300,10 +297,6 @@ def main(): print "rhona version 0.0000000000"; usage(0); - override_filename = Cnf["Dir::OverrideDir"] + Cnf["Rhona::OverrideFilename"]; - if not os.access(override_filename, os.R_OK): - sys.stderr.write("W: Could not find source-only override file '%s'.\n" % (override_filename)); - now_date = time.strftime("%Y-%m-%d %H:%M", time.localtime(time.time())); delete_date = time.strftime("%Y-%m-%d %H:%M", time.localtime(time.time()-int(Cnf["Rhona::StayOfExecution"]))); diff --git a/tea b/tea index 20632426..209e63a5 100755 --- a/tea +++ b/tea @@ -2,7 +2,7 @@ # Sanity check the database # Copyright (C) 2000, 2001 James Troup -# $Id: tea,v 1.10 2001-03-24 03:30:35 troup Exp $ +# $Id: tea,v 1.11 2001-06-22 22:53:14 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 @@ -66,7 +66,7 @@ def check_files(): filename = os.path.abspath(i[0] + i[1]); db_files[filename] = ""; if os.access(filename, os.R_OK) == 0: - sys.stderr.write("W: '%s' doesn't exist.\n" % (filename)); + utils.warn("'%s' doesn't exist." % (filename)); file = utils.open_file(Cnf["Dir::OverrideDir"]+'override.unreferenced','r'); for filename in file.readlines(): @@ -96,11 +96,11 @@ def check_dscs(): try: utils.parse_changes(file, 1); except utils.invalid_dsc_format_exc, line: - sys.stderr.write("E: syntax error in .dsc file '%s', line %s.\n" % (file, line)); + utils.warn("syntax error in .dsc file '%s', line %s." % (file, line)); count = count + 1; if count: - sys.stderr.write("Found %s invalid .dsc files.\n" % (count)); + utils.warn("Found %s invalid .dsc files." % (count)); ################################################################################ @@ -170,14 +170,14 @@ def check_md5sums(): try: file = utils.open_file(filename, 'r'); except: - sys.stderr.write("E: can't open '%s'.\n" % (filename)); + utils.warn("can't open '%s'." % (filename)); continue; md5sum = apt_pkg.md5sum(file); size = os.stat(filename)[stat.ST_SIZE]; if md5sum != db_md5sum: - sys.stderr.write("E: **WARNING** md5sum mismatch for '%s' ('%s' [current] vs. '%s' [db]).\n" % (filename, md5sum, db_md5sum)); + utils.warn("**WARNING** md5sum mismatch for '%s' ('%s' [current] vs. '%s' [db])." % (filename, md5sum, db_md5sum)); if size != db_size: - sys.stderr.write("E: **WARNING** size mismatch for '%s' ('%s' [current] vs. '%s' [db]).\n" % (filename, size, db_size)); + utils.warn("**WARNING** size mismatch for '%s' ('%s' [current] vs. '%s' [db])." % (filename, size, db_size)); print "Done." -- 2.39.2