[dak/security] Split a little function of of main()
---
ChangeLog | 4 ++++
dak/cruft_report.py | 23 +++++++++++++++--------
2 files changed, 19 insertions(+), 8 deletions(-)
mode change 100755 => 100644 dak/process_unchecked.py
diff --git a/ChangeLog b/ChangeLog
index eead3da..e7e5ea8 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 238cdd4..cc5aa4b 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
--
1.5.6.5
Reply to: