From 58325c024443af943f5dc933e8af48c030d51d5e Mon Sep 17 00:00:00 2001 From: Ansgar Burchardt Date: Sun, 20 Dec 2015 14:06:28 +0100 Subject: [PATCH] Add option to not check arch:all rdeps 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 | 13 +++++++++---- daklib/utils.py | 15 ++++++++++++--- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/dak/rm.py b/dak/rm.py index 15f65727..7c192a54 100755 --- 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"]: diff --git a/daklib/utils.py b/daklib/utils.py index 00699ec4..cdec3a77 100644 --- a/daklib/utils.py +++ b/daklib/utils.py @@ -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 -- 2.39.5