From f284e76cc4938b7ca27ad65297161e9aad5ead80 Mon Sep 17 00:00:00 2001 From: "Adam D. Barratt" Date: Sat, 7 Sep 2013 17:01:58 +0000 Subject: [PATCH] Make MigrationItems versionned by default As HintItem is now redundant, also replace it with a new class - UnversionnedMigrationItem - and migrate users of the classes to use the new versions. Signed-off-by: Adam D. Barratt --- britney.py | 10 +++++----- britney_util.py | 8 ++++---- migrationitem.py | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/britney.py b/britney.py index 17f0a5c..53a4fba 100755 --- a/britney.py +++ b/britney.py @@ -209,7 +209,7 @@ if __name__ == '__main__': sys.path.insert(0, idir) from excuse import Excuse -from migrationitem import MigrationItem, HintItem +from migrationitem import MigrationItem from hints import HintCollection from britney import buildSystem from britney_util import (old_libraries_format, same_source, undo_changes, @@ -2267,7 +2267,7 @@ class Britney(object): for arch in binaries for binary in binaries[arch][0] ) - removals = [ HintItem("-%s/%s" % (source, sources[source][VERSION])) + removals = [ MigrationItem("-%s/%s" % (source, sources[source][VERSION])) for source in sources if source not in used ] if len(removals) > 0: @@ -2377,7 +2377,7 @@ class Britney(object): """ if isinstance(pkgvers[0], tuple) or isinstance(pkgvers[0], list): - _pkgvers = [ HintItem('%s/%s' % (p, v)) for (p,v) in pkgvers ] + _pkgvers = [ MigrationItem('%s/%s' % (p, v)) for (p,v) in pkgvers ] else: _pkgvers = pkgvers @@ -2530,7 +2530,7 @@ class Britney(object): to_skip.append(i) for i in range(len(l)): if i not in to_skip: - self.do_hint("easy", "autohinter", [ HintItem("%s/%s" % (x[0], x[1])) for x in l[i] ]) + self.do_hint("easy", "autohinter", [ MigrationItem("%s/%s" % (x[0], x[1])) for x in l[i] ]) def old_libraries(self, same_source=same_source): """Detect old libraries left in testing for smooth transitions @@ -2551,7 +2551,7 @@ class Britney(object): pkg = testing[arch][0][pkg_name] if pkg_name not in unstable[arch][0] and \ not same_source(sources[pkg[SOURCE]][VERSION], pkg[SOURCEVER]): - removals.append(HintItem("-" + pkg_name + "/" + arch + "/" + pkg[SOURCEVER])) + removals.append(MigrationItem("-" + pkg_name + "/" + arch + "/" + pkg[SOURCEVER])) return removals def nuninst_arch_report(self, nuninst, arch): diff --git a/britney_util.py b/britney_util.py index 40b41eb..2552a69 100644 --- a/britney_util.py +++ b/britney_util.py @@ -362,11 +362,11 @@ def write_heidi(filename, sources_t, packages_t, f.write('%s %s source %s\n' % (src_name, srcv, srcsec)) def make_hintitem(package, sources, VERSION=VERSION): - """Convert a textual package specification to a HintItem + """Convert a textual package specification to a MigrationItem sources is a list of source packages in each suite, used to determine - the version which should be used for the HintItem. + the version which should be used for the MigrationItem. """ - item = MigrationItem(package) - return HintItem("%s/%s" % (item.uvname, sources[item.suite][item.package][VERSION])) + item = UnversionnedMigrationItem(package) + return MigrationItem("%s/%s" % (item.uvname, sources[item.suite][item.package][VERSION])) diff --git a/migrationitem.py b/migrationitem.py index 1ab50b4..f5b49b2 100644 --- a/migrationitem.py +++ b/migrationitem.py @@ -23,7 +23,7 @@ class MigrationItem(object): def get_architectures(cls): return cls._architectures - def __init__(self, name = None, versionned = False): + def __init__(self, name = None, versionned = True): self._name = None self._uvname = None self._package = None @@ -141,6 +141,6 @@ class MigrationItem(object): def uvname(self): return self._uvname -class HintItem(MigrationItem): +class UnversionnedMigrationItem(MigrationItem): def __init__(self, name = None): - MigrationItem.__init__(self, name = name, versionned = True) + MigrationItem.__init__(self, name = name, versionned = False)