]> git.decadent.org.uk Git - dak.git/commitdiff
Add option to not check arch:all rdeps
authorAnsgar Burchardt <ansgar@debian.org>
Sun, 20 Dec 2015 13:06:28 +0000 (14:06 +0100)
committerAnsgar Burchardt <ansgar@debian.org>
Sun, 20 Dec 2015 13:06:28 +0000 (14:06 +0100)
This is useful when removing packages on some architectures that have
many arch:all rdeps.  We know these will break, but listing them
obscures which arch-dep packages will be broken.

Of course we will still break the possibly arch-dep packages of the
arch:all packages that will no longer be installable...

dak/rm.py
daklib/utils.py

index 15f65727090f3cfdb2bc212e347a82d5f236d4ca..7c192a544caa6300be75e1929b1d9ca6bb51522d 100755 (executable)
--- a/dak/rm.py
+++ b/dak/rm.py
@@ -65,6 +65,8 @@ def usage (exit_code=0):
     print """Usage: dak rm [OPTIONS] PACKAGE[...]
 Remove PACKAGE(s) from suite(s).
 
+  -A, --no-arch-all-rdeps    Do not report breaking arch:all packages
+                             or Build-Depends-Indep
   -a, --architecture=ARCH    only act on this architecture
   -b, --binary               PACKAGE are binary packages to remove
   -B, --binary-only          remove binaries only
@@ -100,9 +102,9 @@ def game_over():
 
 ################################################################################
 
-def reverse_depends_check(removals, suite, arches=None, session=None):
+def reverse_depends_check(removals, suite, arches=None, session=None, include_arch_all=True):
     print "Checking reverse dependencies..."
-    if utils.check_reverse_depends(removals, suite, arches, session):
+    if utils.check_reverse_depends(removals, suite, arches, session, include_arch_all=include_arch_all):
         print "Dependency problem found."
         if not Options["No-Action"]:
             game_over()
@@ -118,6 +120,7 @@ def main ():
     cnf = Config()
 
     Arguments = [('h',"help","Rm::Options::Help"),
+                 ('A','no-arch-all-rdeps','Rm::Options::NoArchAllRdeps'),
                  ('a',"architecture","Rm::Options::Architecture", "HasArg"),
                  ('b',"binary", "Rm::Options::Binary"),
                  ('B',"binary-only", "Rm::Options::Binary-Only"),
@@ -133,7 +136,8 @@ def main ():
                  ('S',"source-only", "Rm::Options::Source-Only"),
                  ]
 
-    for i in [ "architecture", "binary", "binary-only", "carbon-copy", "component",
+    for i in [ 'NoArchAllRdeps',
+               "architecture", "binary", "binary-only", "carbon-copy", "component",
                "done", "help", "no-action", "partial", "rdep-check", "reason",
                "source-only", "Do-Close" ]:
         if not cnf.has_key("Rm::Options::%s" % (i)):
@@ -337,7 +341,8 @@ def main ():
 
     if Options["Rdep-Check"]:
         arches = utils.split_args(Options["Architecture"])
-        reverse_depends_check(removals, suites[0], arches, session)
+        include_arch_all = Options['NoArchAllRdeps'] == ''
+        reverse_depends_check(removals, suites[0], arches, session, include_arch_all=include_arch_all)
 
     # If -n/--no-action, drop out here
     if Options["No-Action"]:
index 00699ec410f6963360166f032c3e41a3f4e5d5a3..cdec3a773865c7faee74a41b063b892a59f2dc19 100644 (file)
@@ -1123,7 +1123,7 @@ def call_editor(text="", suffix=".txt"):
 
 ################################################################################
 
-def check_reverse_depends(removals, suite, arches=None, session=None, cruft=False, quiet=False):
+def check_reverse_depends(removals, suite, arches=None, session=None, cruft=False, quiet=False, include_arch_all=True):
     dbsuite = get_suite(suite, session)
     overridesuite = dbsuite
     if dbsuite.overridesuite is not None:
@@ -1144,7 +1144,11 @@ def check_reverse_depends(removals, suite, arches=None, session=None, cruft=Fals
         'metakey_d_id': metakey_d.key_id,
         'metakey_p_id': metakey_p.key_id,
     }
-    for architecture in all_arches | set(['all']):
+    if include_arch_all:
+        rdep_architectures = all_arches | set(['all'])
+    else:
+        rdep_architectures = all_arches
+    for architecture in rdep_architectures:
         deps = {}
         sources = {}
         virtual_packages = {}
@@ -1238,9 +1242,14 @@ def check_reverse_depends(removals, suite, arches=None, session=None, cruft=Fals
     all_broken = defaultdict(set)
     metakey_bd = get_or_set_metadatakey("Build-Depends", session)
     metakey_bdi = get_or_set_metadatakey("Build-Depends-Indep", session)
+    if include_arch_all:
+        metakey_ids = (metakey_bd.key_id, metakey_bdi.key_id)
+    else:
+        metakey_ids = (metakey_bd.key_id,)
+
     params = {
         'suite_id':    dbsuite.suite_id,
-        'metakey_ids': (metakey_bd.key_id, metakey_bdi.key_id),
+        'metakey_ids': metakey_ids,
     }
     statement = '''
         SELECT s.source, string_agg(sm.value, ', ') as build_dep