X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fcheck_overrides.py;h=7ed38147787a0efc2216df5dfa53715224444aa6;hb=3f4d9093048af1545f78aef3b5236a1e8094fa89;hp=0915b8d40aec6271be6134a99022fc28cb5cbd88;hpb=06ce98c8111a8b09e5603dbbd34324a216412d69;p=dak.git diff --git a/dak/check_overrides.py b/dak/check_overrides.py index 0915b8d4..7ed38147 100755 --- a/dak/check_overrides.py +++ b/dak/check_overrides.py @@ -49,8 +49,10 @@ ################################################################################ import pg, sys, os -import dak.lib.utils, dak.lib.database, dak.lib.logging import apt_pkg +import daklib.database +import daklib.logging +import daklib.utils ################################################################################ @@ -82,26 +84,26 @@ def gen_blacklist(dir): def process(osuite, affected_suites, originosuite, component, type): global Logger, Options, projectB, sections, priorities - osuite_id = dak.lib.database.get_suite_id(osuite) + osuite_id = daklib.database.get_suite_id(osuite) if osuite_id == -1: - dak.lib.utils.fubar("Suite '%s' not recognised." % (osuite)) + daklib.utils.fubar("Suite '%s' not recognised." % (osuite)) originosuite_id = None if originosuite: - originosuite_id = dak.lib.database.get_suite_id(originosuite) + originosuite_id = daklib.database.get_suite_id(originosuite) if originosuite_id == -1: - dak.lib.utils.fubar("Suite '%s' not recognised." % (originosuite)) + daklib.utils.fubar("Suite '%s' not recognised." % (originosuite)) - component_id = dak.lib.database.get_component_id(component) + component_id = daklib.database.get_component_id(component) if component_id == -1: - dak.lib.utils.fubar("Component '%s' not recognised." % (component)) + daklib.utils.fubar("Component '%s' not recognised." % (component)) - type_id = dak.lib.database.get_override_type_id(type) + type_id = daklib.database.get_override_type_id(type) if type_id == -1: - dak.lib.utils.fubar("Type '%s' not recognised. (Valid types are deb, udeb and dsc)" % (type)) - dsc_type_id = dak.lib.database.get_override_type_id("dsc") - deb_type_id = dak.lib.database.get_override_type_id("deb") + daklib.utils.fubar("Type '%s' not recognised. (Valid types are deb, udeb and dsc)" % (type)) + dsc_type_id = daklib.database.get_override_type_id("dsc") + deb_type_id = daklib.database.get_override_type_id("deb") - source_priority_id = dak.lib.database.get_priority_id("source") + source_priority_id = daklib.database.get_priority_id("source") if type == "deb" or type == "udeb": packages = {} @@ -110,7 +112,7 @@ SELECT b.package FROM binaries b, bin_associations ba, files f, location l, component c WHERE b.type = '%s' AND b.id = ba.bin AND f.id = b.file AND l.id = f.location AND c.id = l.component AND ba.suite IN (%s) AND c.id = %s -""" % (type, ",".join(map(str,affected_suites)), component_id)) +""" % (type, ",".join([ str(i) for i in affected_suites ]), component_id)) for i in q.getresult(): packages[i[0]] = 0 @@ -120,7 +122,7 @@ SELECT s.source FROM source s, src_associations sa, files f, location l, component c WHERE s.id = sa.source AND f.id = s.file AND l.id = f.location AND c.id = l.component AND sa.suite IN (%s) AND c.id = %s -""" % (",".join(map(str,affected_suites)), component_id)) +""" % (",".join([ str(i) for i in affected_suites]), component_id)) for i in q.getresult(): src_packages[i[0]] = 0 @@ -136,7 +138,7 @@ SELECT s.source FROM source s, src_associations sa, files f, location l, src_packages[package] = 1 else: if blacklist.has_key(package): - dak.lib.utils.warn("%s in incoming, not touching" % package) + daklib.utils.warn("%s in incoming, not touching" % package) continue Logger.log(["removing unused override", osuite, component, type, package, priorities[i[1]], sections[i[2]], i[3]]) @@ -200,7 +202,7 @@ SELECT s.source FROM source s, src_associations sa, files f, location l, for package, hasoverride in src_packages.items(): if not hasoverride: - dak.lib.utils.warn("%s has no override!" % package) + daklib.utils.warn("%s has no override!" % package) else: # binary override for i in q.getresult(): @@ -209,7 +211,7 @@ SELECT s.source FROM source s, src_associations sa, files f, location l, packages[package] = 1 else: if blacklist.has_key(package): - dak.lib.utils.warn("%s in incoming, not touching" % package) + daklib.utils.warn("%s in incoming, not touching" % package) continue Logger.log(["removing unused override", osuite, component, type, package, priorities[i[1]], sections[i[2]], i[3]]) @@ -254,7 +256,7 @@ SELECT s.source FROM source s, src_associations sa, files f, location l, for package, hasoverride in packages.items(): if not hasoverride: - dak.lib.utils.warn("%s has no override!" % package) + daklib.utils.warn("%s has no override!" % package) projectB.query("COMMIT WORK") sys.stdout.flush() @@ -265,7 +267,7 @@ SELECT s.source FROM source s, src_associations sa, files f, location l, def main (): global Logger, Options, projectB, sections, priorities - Cnf = dak.lib.utils.get_conf() + Cnf = daklib.utils.get_conf() Arguments = [('h',"help","Check-Overrides::Options::Help"), ('n',"no-action", "Check-Overrides::Options::No-Action")] @@ -279,7 +281,7 @@ def main (): usage() projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"])) - dak.lib.database.init(Cnf, projectB) + daklib.database.init(Cnf, projectB) # init sections, priorities: q = projectB.query("SELECT id, section FROM section") @@ -290,9 +292,9 @@ def main (): priorities[i[0]] = i[1] if not Options["No-Action"]: - Logger = dak.lib.logging.Logger(Cnf, "check-overrides") + Logger = daklib.logging.Logger(Cnf, "check-overrides") else: - Logger = dak.lib.logging.Logger(Cnf, "check-overrides", 1) + Logger = daklib.logging.Logger(Cnf, "check-overrides", 1) gen_blacklist(Cnf["Dir::Queue::Accepted"]) @@ -320,14 +322,14 @@ def main (): suites.append(suite) q = projectB.query("SELECT id FROM suite WHERE suite_name in (%s)" \ - % ", ".join(map(repr, suites)).lower()) + % ", ".join([ repr(i) for i in suites ]).lower()) suiteids = [] for i in q.getresult(): suiteids.append(i[0]) if len(suiteids) != len(suites) or len(suiteids) < 1: - dak.lib.utils.fubar("Couldn't find id's of all suites: %s" % suites) + daklib.utils.fubar("Couldn't find id's of all suites: %s" % suites) for component in Cnf.SubTree("Component").List(): if component == "mixed":