From: Joerg Jaspert Date: Sun, 4 May 2008 21:54:54 +0000 (+0200) Subject: Split a little function of of main() X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2488db57e22feb39b77169c8bd5982932270d27a;p=dak Split a little function of of main() --- diff --git a/ChangeLog b/ChangeLog index eead3da3..e7e5ea82 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,10 @@ * dak/clean_suites.py: likewise * dak/compare_suites.py: likewise * dak/cruft_report.py: likewise + (get_suite_binaries): Seperated in own function, out of main. More + of main should be splitted. (Or well, cruft_report redesigned a + little, so its easier to run on multiple suites with differing tests) + * dak/examine_package.py: likewise * dak/find_null_maintainers.py: likewise * dak/generate_index_diffs.py: likewise diff --git a/dak/cruft_report.py b/dak/cruft_report.py index 238cdd49..cc5aa4b8 100755 --- a/dak/cruft_report.py +++ b/dak/cruft_report.py @@ -242,6 +242,20 @@ def do_obsolete_source(duplicate_bins, bin2source): print " dak rm -S -p -m \"[auto-cruft] obsolete source package\" %s" % (" ".join(to_remove)) print +def get_suite_binaries(): + # Initalize a large hash table of all binary packages + binaries = {} + before = time.time() + + sys.stderr.write("[Getting a list of binary packages in %s..." % (suite)) + q = projectB.query("SELECT distinct b.package FROM binaries b, bin_associations ba WHERE ba.suite = %s AND ba.bin = b.id" % (suite_id)) + ql = q.getresult() + sys.stderr.write("done. (%d seconds)]\n" % (int(time.time()-before))) + for i in ql: + binaries[i[0]] = "" + + return binaries + ################################################################################ def main (): @@ -294,14 +308,7 @@ def main (): bin_not_built = {} if "bnb" in checks: - # Initalize a large hash table of all binary packages - before = time.time() - sys.stderr.write("[Getting a list of binary packages in %s..." % (suite)) - q = projectB.query("SELECT distinct b.package FROM binaries b, bin_associations ba WHERE ba.suite = %s AND ba.bin = b.id" % (suite_id)) - ql = q.getresult() - sys.stderr.write("done. (%d seconds)]\n" % (int(time.time()-before))) - for i in ql: - bins_in_suite[i[0]] = "" + bins_in_suite = get_suite_binaries() # Checks based on the Sources files components = Cnf.ValueList("Suite::%s::Components" % (suite)) diff --git a/dak/process_unchecked.py b/dak/process_unchecked.py old mode 100755 new mode 100644