From c1c7681bf43c58dd5cf34d1c1814a75ae594688b Mon Sep 17 00:00:00 2001 From: James Troup Date: Sun, 4 Nov 2001 22:28:44 +0000 Subject: [PATCH] lose second argument to open_file since we use default, change foo == [] to not foo. --- catherine | 6 +++--- christina | 4 ++-- cindy | 4 ++-- contrib/fix.9 | 4 ++-- fernanda | 6 +++--- halle | 4 ++-- jeri | 4 ++-- julia | 4 ++-- natalie.py | 4 ++-- rene | 22 +++++++++++----------- tea | 8 ++++---- 11 files changed, 35 insertions(+), 35 deletions(-) diff --git a/catherine b/catherine index 70996a9f..16b7ad66 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.11 2001-09-27 01:22:51 troup Exp $ +# $Id: catherine,v 1.12 2001-11-04 22:28:44 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 @@ -76,7 +76,7 @@ def poolize (q, limit, verbose, no_action): destination_filename = base_filename; # Work out the source package name if utils.re_isadeb.match(base_filename) != None: - control = apt_pkg.ParseSection(apt_inst.debExtractControl(utils.open_file(legacy_filename,"r"))) + control = apt_pkg.ParseSection(apt_inst.debExtractControl(utils.open_file(legacy_filename))) package = control.Find("Package", ""); source = control.Find("Source", package); if string.find(source, "(") != -1: @@ -100,7 +100,7 @@ def poolize (q, limit, verbose, no_action): 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 == []: + if not ql: utils.fubar("No override match for '%s' so I can't work out the component." % (source)); if len(ql) > 1: utils.fubar("Multiple override matches for '%s' so I can't work out the component." % (source)); diff --git a/christina b/christina index 18b968bc..b6af669b 100644 --- a/christina +++ b/christina @@ -2,7 +2,7 @@ # Compares Packages-Arch-Specific (from Quinn-Diff) against the archive # Copyright (C) 2000, 2001 James Troup -# $Id: christina,v 1.2 2001-07-07 03:15:36 troup Exp $ +# $Id: christina,v 1.3 2001-11-04 22:28:44 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 @@ -118,7 +118,7 @@ def main (): as_source = {}; filename = "/org/buildd.debian.org/web/quinn-diff/Packages-arch-specific"; - file = utils.open_file(filename, 'r'); + file = utils.open_file(filename); line_count = 0; for line in file.readlines(): line = string.strip(utils.re_comments.sub("", line)); diff --git a/cindy b/cindy index 367e1e57..038a4796 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.4 2001-06-22 22:53:14 troup Exp $ +# $Id: cindy,v 1.5 2001-11-04 22:28:44 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 @@ -79,7 +79,7 @@ def process(suite, component, type): #% (package, suite_id, component_id, type_id)); # Then if source doesn't already have a copy, insert it into source q = projectB.query("SELECT package FROM override WHERE package = '%s' AND suite = %s AND component = %s AND type = %s" % (package, suite_id, component_id, dsc_type_id)); - if q.getresult() == []: + if not q.getresult(): #projectB.query("INSERT INTO override (package, suite, component, priority, section, type, maintainer) VALUES ('%s', %s, %s, %s, %s, %s, '%s')" % (package, suite_id, component_id, i[1], i[2], dsc_type_id, i[3])); print "(nop)" else: # dsc diff --git a/contrib/fix.9 b/contrib/fix.9 index 4a655285..3c530a1c 100755 --- a/contrib/fix.9 +++ b/contrib/fix.9 @@ -2,7 +2,7 @@ # Fix for bug in katie where dsc_files was initialized from changes and not dsc # Copyright (C) 2000 James Troup -# $Id: fix.9,v 1.2 2000-12-18 07:11:25 troup Exp $ +# $Id: fix.9,v 1.3 2001-11-04 22:28:44 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 @@ -61,7 +61,7 @@ def main (): dsc_files = utils.build_file_list(dsc, 1); q = projectB.query("SELECT s.id, l.id, l.path FROM source s, location l, files f WHERE s.source = '%s' AND s.version = '%s' AND f.id = s.file AND f.location = l.id" % (dsc["source"], dsc["version"])); ql = q.getresult(); - if ql == [] or len(ql) > 1: + if not ql or len(ql) > 1: print " EEEEEEEEEEEEEEK!!!" print " ",base_dsc_file source_id = ql[0][0]; diff --git a/fernanda b/fernanda index 206633d5..b9d8f500 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.3 2001-09-27 01:22:51 troup Exp $ +# $Id: fernanda,v 1.4 2001-11-04 22:28:44 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 @@ -85,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; @@ -124,7 +124,7 @@ 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 ; diff --git a/halle b/halle index e1705958..06f42a65 100755 --- a/halle +++ b/halle @@ -2,7 +2,7 @@ # Remove obsolete .changes files from proposed-updates # Copyright (C) 2001 James Troup -# $Id: halle,v 1.1 2001-11-04 20:41:50 troup Exp $ +# $Id: halle,v 1.2 2001-11-04 22:28:44 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 @@ -162,7 +162,7 @@ def main (): if Options["Help"]: usage(0); - if arguments == []: + if not arguments: utils.fubar("need at least one package name as an argument."); projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"])); diff --git a/jeri b/jeri index ba7209d6..616c2672 100755 --- a/jeri +++ b/jeri @@ -2,7 +2,7 @@ # Dependency check proposed-updates # Copyright (C) 2001 James Troup -# $Id: jeri,v 1.1 2001-11-04 20:41:50 troup Exp $ +# $Id: jeri,v 1.2 2001-11-04 22:28:44 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 @@ -286,7 +286,7 @@ def main (): if Options["Help"]: usage(0); - if arguments == []: + if not arguments: utils.fubar("need at least one package name as an argument."); projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"])); diff --git a/julia b/julia index 6d5ff374..f3d8ac43 100755 --- a/julia +++ b/julia @@ -2,7 +2,7 @@ # Sync PostgreSQL with (LDAP-generated) passwd file # Copyright (C) 2001 James Troup -# $Id: julia,v 1.2 2001-09-27 01:23:41 troup Exp $ +# $Id: julia,v 1.3 2001-11-04 22:28:44 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 @@ -70,7 +70,7 @@ def main (): if Options["Help"]: usage(); - if arguments == []: + if not arguments: utils.warn("julia needs the name of the passwd file to sync with as an argument."); usage(1); elif len(arguments) > 1: diff --git a/natalie.py b/natalie.py index d5a476d5..8626798e 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.11 2001-09-27 01:23:41 troup Exp $ +# $Id: natalie.py,v 1.12 2001-11-04 22:28:44 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 @@ -245,7 +245,7 @@ def main (): Logger = logging.Logger(Cnf, "natalie"); if file_list != []: for file in file_list: - process_file(utils.open_file(file,'r'), suite, component, type); + process_file(utils.open_file(file), suite, component, type); else: process_file(sys.stdin, suite, component, type); Logger.close(); diff --git a/rene b/rene index 04d89a5c..b7a3eec1 100755 --- a/rene +++ b/rene @@ -2,7 +2,7 @@ # Check for obsolete binary packages # Copyright (C) 2000, 2001 James Troup -# $Id: rene,v 1.7 2001-07-25 15:51:15 troup Exp $ +# $Id: rene,v 1.8 2001-11-04 22:28:44 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,7 @@ def main (): global Cnf, projectB; apt_pkg.init(); - + Cnf = apt_pkg.newConfiguration(); apt_pkg.ReadConfigFileISC(Cnf,utils.which_conf_file()); @@ -73,7 +73,7 @@ def main (): if (result != 0): sys.stderr.write("Gunzip invocation failed!\n%s\n" % (output)); sys.exit(result); - sources = utils.open_file(temp_filename, 'r'); + sources = utils.open_file(temp_filename); Sources = apt_pkg.ParseTagFile(sources); while Sources.Step(): source = Sources.Section.Find('Package'); @@ -89,7 +89,7 @@ def main (): binary = string.strip(binary); q = projectB.query("SELECT a.arch_string, b.version FROM binaries b, bin_associations ba, architecture a WHERE ba.suite = %s AND ba.bin = b.id AND b.architecture = a.id AND b.package = '%s'" % (suite_id, binary)); ql = q.getresult(); - if ql == []: + if not ql: utils.warn("%s lists %s as a binary, but it doesn't seem to exist in %s?" % (source, binary, suite)); # Loop around twice; first to get the latest 'valid' version versions = []; @@ -113,11 +113,11 @@ def main (): print "** mwaap, mwapp! Ignore me **"; continue; if apt_pkg.VersionCompare(latest_version, version) != -1: - print "- out of date.", + print "- out of date.", else: print "- current.", print "[%s vs %s (%s)]" % (latest_version, version, arch); - + # Check for duplicated packages and build indices for checking "no source" later source_index = component + '/' + source; if src_pkgs.has_key(source): @@ -139,7 +139,7 @@ def main (): if [ "source", "all" ].count(architecture) != 0: continue; filename = "%s/dists/%s/%s/binary-%s/Packages" % (Cnf["Dir::RootDir"], suite, component, architecture); - packages = utils.open_file(filename, 'r'); + packages = utils.open_file(filename); Packages = apt_pkg.ParseTagFile(packages); while Packages.Step(): package = Packages.Section.Find('Package'); @@ -161,10 +161,10 @@ def main (): suite_id = db_access.get_suite_id("unstable"); q = projectB.query(""" -SELECT s.source, s.version AS experimental, s2.version AS unstable - FROM src_associations sa, source s, source s2, src_associations sa2 - WHERE sa.suite = 1 AND sa2.suite = %d AND sa.source = s.id - AND sa2.source = s2.id AND s.source = s2.source +SELECT s.source, s.version AS experimental, s2.version AS unstable + FROM src_associations sa, source s, source s2, src_associations sa2 + WHERE sa.suite = 1 AND sa2.suite = %d AND sa.source = s.id + AND sa2.source = s2.id AND s.source = s2.source AND versioncmp(s.version, s2.version) < 0""" % (suite_id)); ql = q.getresult(); if ql != []: diff --git a/tea b/tea index bf163f18..b6ff8c6c 100755 --- a/tea +++ b/tea @@ -2,7 +2,7 @@ # Sanity check the database # Copyright (C) 2000, 2001 James Troup -# $Id: tea,v 1.12 2001-09-27 01:23:41 troup Exp $ +# $Id: tea,v 1.13 2001-11-04 22:28:44 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 @@ -68,7 +68,7 @@ def check_files(): if os.access(filename, os.R_OK) == 0: utils.warn("'%s' doesn't exist." % (filename)); - file = utils.open_file(Cnf["Dir::OverrideDir"]+'override.unreferenced','r'); + file = utils.open_file(Cnf["Dir::OverrideDir"]+'override.unreferenced'); for filename in file.readlines(): filename = filename[:-1]; excluded[filename] = ""; @@ -90,7 +90,7 @@ def check_dscs(): continue; component = string.lower(component); list_filename = '%s%s_%s_source.list' % (Cnf["Dir::ListsDir"], suite, component); - list_file = utils.open_file(list_filename, 'r'); + list_file = utils.open_file(list_filename); for line in list_file.readlines(): file = line[:-1]; try: @@ -168,7 +168,7 @@ def check_md5sums(): db_md5sum = i[2]; db_size = int(i[3]); try: - file = utils.open_file(filename, 'r'); + file = utils.open_file(filename); except: utils.warn("can't open '%s'." % (filename)); continue; -- 2.39.5