]> err.no Git - dak/commitdiff
cruft_report: Split NBS command by source package
authorFrank Lichtenheld <djpig@debian.org>
Mon, 13 Apr 2009 19:44:13 +0000 (19:44 +0000)
committerFrank Lichtenheld <djpig@debian.org>
Mon, 13 Apr 2009 20:17:29 +0000 (20:17 +0000)
This makes the commands easier to check if there are a lot of
them or if some source packages lost a lot of binary packages-

Signed-off-by: Frank Lichtenheld <djpig@debian.org>
dak/cruft_report.py

index 4c6d323e82c1d380e3e1f8c8c4f537c499491d5d..30650d4139ec7860ea35158329bf87126f06f875 100755 (executable)
@@ -206,7 +206,7 @@ def do_nbs(real_nbs):
     output = "Not Built from Source\n"
     output += "---------------------\n\n"
 
-    nbs_to_remove = []
+    cmd_output = ""
     nbs_keys = real_nbs.keys()
     nbs_keys.sort()
     for source in nbs_keys:
@@ -216,21 +216,22 @@ def do_nbs(real_nbs):
         output += "      but no longer builds:\n"
         versions = real_nbs[source].keys()
         versions.sort(apt_pkg.VersionCompare)
+        all_packages = []
         for version in versions:
             packages = real_nbs[source][version].keys()
             packages.sort()
-            for pkg in packages:
-                nbs_to_remove.append(pkg)
+            all_packages.extend(packages)
             output += "        o %s: %s\n" % (version, ", ".join(packages))
+        if all_packages:
+            all_packages.sort()
+            cmd_output += " dak rm -m \"[auto-cruft] NBS (was built by %s)\" -s %s -b %s\n\n" % (source, suite, " ".join(all_packages))
 
         output += "\n"
 
-    if nbs_to_remove:
+    if len(cmd_output):
         print output
-
-        print "Suggested command:"
-        print " dak rm -m \"[auto-cruft] NBS\" -s %s -b %s" % (suite, " ".join(nbs_to_remove))
-        print
+        print "Suggested commands:\n"
+        print cmd_output
 
 ################################################################################