X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=dak%2Fcruft_report.py;h=c8183aaeb810182105c9d23bde527d159b08c516;hb=d729de9019b62e26eae3d24111af464e9bf30c64;hp=91b3844a1596d6dd8cf65911b4de91a32b7d9583;hpb=7aaaad3135c9164390af5897925660842368660b;p=dak.git diff --git a/dak/cruft_report.py b/dak/cruft_report.py index 91b3844a..c8183aae 100755 --- a/dak/cruft_report.py +++ b/dak/cruft_report.py @@ -29,8 +29,8 @@ import commands, pg, os, string, sys, time import apt_pkg -import dak.lib.database as database -import dak.lib.utils as utils +import daklib.database +import daklib.utils ################################################################################ @@ -116,7 +116,7 @@ def do_anais(architecture, binaries_list, source): ################################################################################ def do_nviu(): - experimental_id = database.get_suite_id("experimental") + experimental_id = daklib.database.get_suite_id("experimental") if experimental_id == -1: return # Check for packages in experimental obsoleted by versions in unstable @@ -126,7 +126,7 @@ SELECT s.source, s.version AS experimental, s2.version AS unstable WHERE sa.suite = %s 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""" % (experimental_id, - database.get_suite_id("unstable"))) + daklib.database.get_suite_id("unstable"))) ql = q.getresult() if ql: nviu_to_remove = [] @@ -247,7 +247,7 @@ def do_obsolete_source(duplicate_bins, bin2source): def main (): global Cnf, projectB, suite_id, source_binaries, source_versions - Cnf = utils.get_conf() + Cnf = daklib.utils.get_conf() Arguments = [('h',"help","Cruft-Report::Options::Help"), ('m',"mode","Cruft-Report::Options::Mode", "HasArg"), @@ -272,11 +272,11 @@ def main (): elif Options["Mode"] == "full": checks = [ "nbs", "nviu", "obsolete source", "dubious nbs", "bnb", "bms", "anais" ] else: - utils.warn("%s is not a recognised mode - only 'full' or 'daily' are understood." % (Options["Mode"])) + daklib.utils.warn("%s is not a recognised mode - only 'full' or 'daily' are understood." % (Options["Mode"])) usage(1) projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"])) - database.init(Cnf, projectB) + daklib.database.init(Cnf, projectB) bin_pkgs = {} src_pkgs = {} @@ -289,7 +289,7 @@ def main (): duplicate_bins = {} suite = Options["Suite"] - suite_id = database.get_suite_id(suite) + suite_id = daklib.database.get_suite_id(suite) bin_not_built = {} @@ -308,12 +308,12 @@ def main (): for component in components: filename = "%s/dists/%s/%s/source/Sources.gz" % (Cnf["Dir::Root"], suite, component) # apt_pkg.ParseTagFile needs a real file handle and can't handle a GzipFile instance... - temp_filename = utils.temp_filename() + temp_filename = daklib.utils.temp_filename() (result, output) = commands.getstatusoutput("gunzip -c %s > %s" % (filename, temp_filename)) if (result != 0): sys.stderr.write("Gunzip invocation failed!\n%s\n" % (output)) sys.exit(result) - sources = utils.open_file(temp_filename) + sources = daklib.utils.open_file(temp_filename) Sources = apt_pkg.ParseTagFile(sources) while Sources.Step(): source = Sources.Section.Find('Package') @@ -353,16 +353,16 @@ def main (): # Checks based on the Packages files for component in components + ['main/debian-installer']: - architectures = filter(utils.real_arch, Cnf.ValueList("Suite::%s::Architectures" % (suite))) + architectures = filter(daklib.utils.real_arch, Cnf.ValueList("Suite::%s::Architectures" % (suite))) for architecture in architectures: filename = "%s/dists/%s/%s/binary-%s/Packages.gz" % (Cnf["Dir::Root"], suite, component, architecture) # apt_pkg.ParseTagFile needs a real file handle - temp_filename = utils.temp_filename() + temp_filename = daklib.utils.temp_filename() (result, output) = commands.getstatusoutput("gunzip -c %s > %s" % (filename, temp_filename)) if (result != 0): sys.stderr.write("Gunzip invocation failed!\n%s\n" % (output)) sys.exit(result) - packages = utils.open_file(temp_filename) + packages = daklib.utils.open_file(temp_filename) Packages = apt_pkg.ParseTagFile(packages) while Packages.Step(): package = Packages.Section.Find('Package') @@ -379,7 +379,7 @@ def main (): bin2source[package]["version"] = version bin2source[package]["source"] = source if source.find("(") != -1: - m = utils.re_extract_src_version.match(source) + m = daklib.utils.re_extract_src_version.match(source) source = m.group(1) version = m.group(2) if not bin_pkgs.has_key(package):