From 7eb341282884985f3d5fd8889b316dbdae4f7ec9 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Thu, 24 Jul 2014 15:28:12 +0100 Subject: [PATCH] Add a --distribution option --- britney.py | 6 ++++++ britney2/excuse.py | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/britney.py b/britney.py index 23bf463..0971f23 100755 --- a/britney.py +++ b/britney.py @@ -415,6 +415,8 @@ class Britney(object): help="just print a summary of uninstallable packages") parser.add_option("", "--components", action="store", dest="components", help="Sources/Packages are laid out by components listed (, sep)") + parser.add_option("", "--distribution", action="store", dest="distribution", default="ubuntu", + help="set distribution name") parser.add_option("", "--series", action="store", dest="series", default=None, help="set distribution series name") (self.options, self.args) = parser.parse_args() @@ -1142,6 +1144,7 @@ class Britney(object): # otherwise, add a new excuse for its removal src = self.sources['testing'][pkg] excuse = Excuse("-" + pkg) + excuse.set_distribution(self.options.distribution) excuse.addhtml("Package not in unstable, will try to remove") excuse.set_vers(src.version, None) src.maintainer and excuse.set_maint(src.maintainer) @@ -1184,6 +1187,7 @@ class Britney(object): excuse.set_vers(source_t.version, source_t.version) source_u.maintainer and excuse.set_maint(source_u.maintainer) source_u.section and excuse.set_section(source_u.section) + excuse.set_distribution(self.options.distribution) # if there is a `remove' hint and the requested version is the same as the # version in testing, then stop here and return False @@ -1353,6 +1357,7 @@ class Britney(object): excuse.set_vers(source_t and source_t.version or None, source_u.version) source_u.maintainer and excuse.set_maint(source_u.maintainer) source_u.section and excuse.set_section(source_u.section) + excuse.set_distribution(self.options.distribution) # if the version in unstable is older, then stop here with a warning in the excuse and return False if source_t and apt_pkg.version_compare(source_u.version, source_t.version) < 0: @@ -1655,6 +1660,7 @@ class Britney(object): # add the removal of the package to upgrade_me and build a new excuse upgrade_me_append("-%s" % (src)) excuse = Excuse("-%s" % (src)) + excuse.set_distribution(self.options.distribution) excuse.set_vers(tsrcv, None) excuse.addhtml("Removal request by %s" % (hint.user)) excuse.addhtml("Package is broken, will try to remove") diff --git a/britney2/excuse.py b/britney2/excuse.py index d7afd18..5211973 100644 --- a/britney2/excuse.py +++ b/britney2/excuse.py @@ -52,6 +52,7 @@ class Excuse(object): self.needs_approval = False self.hints = [] self.forced = False + self.distribution = "ubuntu" self.invalid_deps = [] self.deps = {} @@ -101,6 +102,10 @@ class Excuse(object): """Set the section of the package""" self.section = section + def set_distribution(self, distribution): + """Set the distribution name""" + self.distribution = distribution + def add_dep(self, name, arch): """Add a dependency""" if name not in self.deps: self.deps[name]=[]