From 60c4a4cf20a71578e8ad0b8875fd3f26bca0c26e 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 | 2 ++ britney2/excuse.py | 4 ++++ britney2/excusefinder.py | 3 +++ 3 files changed, 9 insertions(+) diff --git a/britney.py b/britney.py index 7013522..a71bb6b 100755 --- a/britney.py +++ b/britney.py @@ -417,6 +417,8 @@ class Britney(object): help="Do not compute which packages can migrate.") parser.add_option("", "--series", action="store", dest="series", default='', help="set distribution series name") + parser.add_option("", "--distribution", action="store", dest="distribution", default="Debian", + help="set distribution name") (self.options, self.args) = parser.parse_args() if self.options.verbose: diff --git a/britney2/excuse.py b/britney2/excuse.py index 7c15895..b6e0026 100644 --- a/britney2/excuse.py +++ b/britney2/excuse.py @@ -236,6 +236,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_dependency(self, dep, spec): """Add a dependency of type deptype diff --git a/britney2/excusefinder.py b/britney2/excusefinder.py index 3675c6b..31ccdf4 100644 --- a/britney2/excusefinder.py +++ b/britney2/excusefinder.py @@ -49,6 +49,7 @@ class ExcuseFinder(object): # otherwise, add a new excuse for its removal src = item.suite.sources[pkg] excuse = Excuse(item) + excuse.set_distribution(self.options.distribution) excuse.addinfo("Package not in %s, will try to remove" % source_suite.name) excuse.set_vers(src.version, None) src.maintainer and excuse.set_maint(src.maintainer) @@ -93,6 +94,7 @@ class ExcuseFinder(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 @@ -294,6 +296,7 @@ class ExcuseFinder(object): source_u.maintainer and excuse.set_maint(source_u.maintainer) source_u.section and excuse.set_section(source_u.section) excuse.add_package(PackageId(src, source_u.version, "source")) + 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: