X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=dak%2Frm.py;h=97af8c2c6779593bc7ff3dc6f3904b71d3a1f50b;hb=47cd096281f1cc36dfe9818ef1fbae8d02f6ada6;hp=10d58ea9ddbb08551ffa6cadda8eeba2946dcc7d;hpb=d611da53692a145b3f974b6731a10920577acc45;p=dak.git diff --git a/dak/rm.py b/dak/rm.py index 10d58ea9..97af8c2c 100755 --- a/dak/rm.py +++ b/dak/rm.py @@ -65,7 +65,8 @@ def usage (exit_code=0): Remove PACKAGE(s) from suite(s). -a, --architecture=ARCH only act on this architecture - -b, --binary remove binaries only + -b, --binary PACKAGE are binary packages to remove + -B, --binary-only remove binaries only -c, --component=COMPONENT act on this component -C, --carbon-copy=EMAIL send a CC of removal message to EMAIL -d, --done=BUG# send removal message as closure to bug# @@ -118,6 +119,7 @@ def main (): Arguments = [('h',"help","Rm::Options::Help"), ('a',"architecture","Rm::Options::Architecture", "HasArg"), ('b',"binary", "Rm::Options::Binary"), + ('B',"binary-only", "Rm::Options::Binary-Only"), ('c',"component", "Rm::Options::Component", "HasArg"), ('C',"carbon-copy", "Rm::Options::Carbon-Copy", "HasArg"), # Bugs to Cc ('d',"done","Rm::Options::Done", "HasArg"), # Bugs fixed @@ -130,7 +132,7 @@ def main (): ('S',"source-only", "Rm::Options::Source-Only"), ] - for i in [ "architecture", "binary", "carbon-copy", "component", + for i in [ "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)): @@ -151,8 +153,10 @@ def main (): utils.fubar("need at least one package name as an argument.") if Options["Architecture"] and Options["Source-Only"]: utils.fubar("can't use -a/--architecture and -S/--source-only options simultaneously.") - if Options["Binary"] and Options["Source-Only"]: - utils.fubar("can't use -b/--binary and -S/--source-only options simultaneously.") + if ((Options["Binary"] and Options["Source-Only"]) + or (Options["Binary"] and Options["Binary-Only"]) + or (Options["Binary-Only"] and Options["Source-Only"])): + utils.fubar("Only one of -b/--binary, -B/--binary-only and -S/--source-only can be used.") if Options.has_key("Carbon-Copy") and not Options.has_key("Done"): utils.fubar("can't use -C/--carbon-copy without also using -d/--done option.") if Options["Architecture"] and not Options["Partial"]: @@ -160,11 +164,8 @@ def main (): Options["Partial"] = "true" if Options["Do-Close"] and not Options["Done"]: utils.fubar("No.") - if Options["Do-Close"] and Options["Binary"]: - utils.fubar("No.") - if Options["Do-Close"] and Options["Source-Only"]: - utils.fubar("No.") - if Options["Do-Close"] and Options["Suite"] != 'unstable': + if (Options["Do-Close"] + and (Options["Binary"] or Options["Binary-Only"] or Options["Source-Only"])): utils.fubar("No.") # Force the admin to tell someone if we're not doing a 'dak @@ -241,12 +242,10 @@ def main (): if Options["Rdep-Check"] and len(suites) > 1: utils.fubar("Reverse dependency check on multiple suites is not implemented.") - print "Working...", - sys.stdout.flush() to_remove = [] maintainers = {} - # We have 3 modes of package selection: binary, source-only, + # We have 3 modes of package selection: binary, source-only, binary-only # and source+binary. # XXX: TODO: This all needs converting to use placeholders or the object @@ -258,8 +257,9 @@ def main (): to_remove.extend(q) else: # Source-only - q = session.execute("SELECT s.source, s.version, 'source', s.id, s.maintainer FROM source s, src_associations sa, suite su, archive, files f, files_archive_map af, component c WHERE sa.source = s.id AND sa.suite = su.id AND archive.id = su.archive_id AND s.file = f.id AND af.file_id = f.id AND af.archive_id = su.archive_id AND af.component_id = c.id %s %s %s" % (con_packages, con_suites, con_components)) - to_remove.extend(q) + if not Options["Binary-Only"]: + q = session.execute("SELECT s.source, s.version, 'source', s.id, s.maintainer FROM source s, src_associations sa, suite su, archive, files f, files_archive_map af, component c WHERE sa.source = s.id AND sa.suite = su.id AND archive.id = su.archive_id AND s.file = f.id AND af.file_id = f.id AND af.archive_id = su.archive_id AND af.component_id = c.id %s %s %s" % (con_packages, con_suites, con_components)) + to_remove.extend(q) if not Options["Source-Only"]: # Source + Binary q = session.execute(""" @@ -275,7 +275,6 @@ def main (): JOIN src_associations sa ON s.id = sa.source AND sa.suite = su.id WHERE TRUE %s %s %s %s""" % (con_packages, con_suites, con_components, con_architectures)) to_remove.extend(q) - print "done." if not to_remove: print "Nothing to do." @@ -464,14 +463,6 @@ def main (): summarymail += "----------------------------------------------\n" Subst_close_rm["__SUMMARY__"] = summarymail - whereami = utils.where_am_i() - Archive = get_archive(whereami, session) - if Archive is None: - utils.warn("Cannot find archive %s. Setting blank values for origin" % whereami) - Subst_close_rm["__PRIMARY_MIRROR__"] = "" - else: - Subst_close_rm["__PRIMARY_MIRROR__"] = Archive.primary_mirror - for bug in utils.split_args(Options["Done"]): Subst_close_rm["__BUG_NUMBER__"] = bug if Options["Do-Close"]: