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 <adam@adam-barratt.org.uk>
bzr-import-20160707
Adam D. Barratt 12 years ago
parent 89bc7c8d61
commit e75c4a4815

@ -209,7 +209,7 @@ if __name__ == '__main__':
sys.path.insert(0, idir) sys.path.insert(0, idir)
from excuse import Excuse from excuse import Excuse
from migrationitem import MigrationItem, HintItem from migrationitem import MigrationItem
from hints import HintCollection from hints import HintCollection
from britney import buildSystem from britney import buildSystem
from britney_util import (old_libraries_format, same_source, undo_changes, from britney_util import (old_libraries_format, same_source, undo_changes,
@ -2267,7 +2267,7 @@ class Britney(object):
for arch in binaries for arch in binaries
for binary in binaries[arch][0] 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 for source in sources if source not in used
] ]
if len(removals) > 0: if len(removals) > 0:
@ -2377,7 +2377,7 @@ class Britney(object):
""" """
if isinstance(pkgvers[0], tuple) or isinstance(pkgvers[0], list): 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: else:
_pkgvers = pkgvers _pkgvers = pkgvers
@ -2530,7 +2530,7 @@ class Britney(object):
to_skip.append(i) to_skip.append(i)
for i in range(len(l)): for i in range(len(l)):
if i not in to_skip: 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): def old_libraries(self, same_source=same_source):
"""Detect old libraries left in testing for smooth transitions """Detect old libraries left in testing for smooth transitions
@ -2551,7 +2551,7 @@ class Britney(object):
pkg = testing[arch][0][pkg_name] pkg = testing[arch][0][pkg_name]
if pkg_name not in unstable[arch][0] and \ if pkg_name not in unstable[arch][0] and \
not same_source(sources[pkg[SOURCE]][VERSION], pkg[SOURCEVER]): 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 return removals
def nuninst_arch_report(self, nuninst, arch): def nuninst_arch_report(self, nuninst, arch):

@ -362,11 +362,11 @@ def write_heidi(filename, sources_t, packages_t,
f.write('%s %s source %s\n' % (src_name, srcv, srcsec)) f.write('%s %s source %s\n' % (src_name, srcv, srcsec))
def make_hintitem(package, sources, VERSION=VERSION): 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 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) item = UnversionnedMigrationItem(package)
return HintItem("%s/%s" % (item.uvname, sources[item.suite][item.package][VERSION])) return MigrationItem("%s/%s" % (item.uvname, sources[item.suite][item.package][VERSION]))

@ -23,7 +23,7 @@ class MigrationItem(object):
def get_architectures(cls): def get_architectures(cls):
return cls._architectures return cls._architectures
def __init__(self, name = None, versionned = False): def __init__(self, name = None, versionned = True):
self._name = None self._name = None
self._uvname = None self._uvname = None
self._package = None self._package = None
@ -141,6 +141,6 @@ class MigrationItem(object):
def uvname(self): def uvname(self):
return self._uvname return self._uvname
class HintItem(MigrationItem): class UnversionnedMigrationItem(MigrationItem):
def __init__(self, name = None): def __init__(self, name = None):
MigrationItem.__init__(self, name = name, versionned = True) MigrationItem.__init__(self, name = name, versionned = False)

Loading…
Cancel
Save