X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fcruft_report.py;h=f7650f986267f2b70ac40b8b7ef5590addfb7f52;hb=86121fc4c31594dc1c184ee2ab7979dd11cd5aa3;hp=aac0d454b5af68cbf1c717eab68c2fc905bbd08e;hpb=12aa4c9ae0c805b3c07eee1d7873e1d513010e98;p=dak.git diff --git a/dak/cruft_report.py b/dak/cruft_report.py index aac0d454..f7650f98 100755 --- a/dak/cruft_report.py +++ b/dak/cruft_report.py @@ -35,16 +35,6 @@ Check for obsolete binary packages ################################################################################ -import warnings -warnings.filterwarnings('ignore', \ - "apt_pkg\.ParseTagFile\(\) is deprecated\. Please see apt_pkg\.TagFile\(\) for the replacement\.", \ - DeprecationWarning) -warnings.filterwarnings('ignore', \ - "Attribute '.*' of the 'apt_pkg\.TagFile' object is deprecated, use '.*' instead\.", \ - DeprecationWarning) - -################################################################################ - import commands, os, sys, re import apt_pkg @@ -68,7 +58,7 @@ def usage(exit_code=0): Check for obsolete or duplicated packages. -h, --help show this help and exit. - -m, --mode=MODE chose the MODE to run in (full or daily). + -m, --mode=MODE chose the MODE to run in (full, daily, bdo). -s, --suite=SUITE check suite SUITE. -w, --wanna-build-dump where to find the copies of http://buildd.debian.org/stats/*.txt""" sys.exit(exit_code) @@ -528,7 +518,8 @@ def main (): for i in [ "help" ]: if not cnf.has_key("Cruft-Report::Options::%s" % (i)): cnf["Cruft-Report::Options::%s" % (i)] = "" - cnf["Cruft-Report::Options::Suite"] = cnf["Dinstall::DefaultSuite"] + + cnf["Cruft-Report::Options::Suite"] = cnf.get("Dinstall::DefaultSuite", "unstable") if not cnf.has_key("Cruft-Report::Options::Mode"): cnf["Cruft-Report::Options::Mode"] = "daily" @@ -547,8 +538,10 @@ def main (): checks = [ "nbs", "nviu", "nvit", "obsolete source", "nfu" ] elif Options["Mode"] == "full": checks = [ "nbs", "nviu", "nvit", "obsolete source", "nfu", "dubious nbs", "bnb", "bms", "anais" ] + elif Options["Mode"] == "bdo": + checks = [ "nbs", "obsolete source" ] else: - utils.warn("%s is not a recognised mode - only 'full' or 'daily' are understood." % (Options["Mode"])) + utils.warn("%s is not a recognised mode - only 'full', 'daily' or 'bdo' are understood." % (Options["Mode"])) usage(1) session = DBConn().session() @@ -565,6 +558,9 @@ def main (): nfu_packages = {} suite = get_suite(Options["Suite"].lower(), session) + if not suite: + utils.fubar("Cannot find suite %s" % Options["Suite"].lower()) + suite_id = suite.suite_id suite_name = suite.suite_name.lower() @@ -580,7 +576,7 @@ def main (): bins_in_suite = get_suite_binaries(suite, session) # Checks based on the Sources files - components = cnf.ValueList("Suite::%s::Components" % (suite_name)) + components = get_component_names(session) for component in components: filename = "%s/dists/%s/%s/source/Sources.gz" % (cnf["Dir::Root"], suite_name, component) # apt_pkg.ParseTagFile needs a real file handle and can't handle a GzipFile instance...