migrationitem: allow for the specification of version information.

The new convenience HintItem class automatically sets the "this item contains
version information" flag when creating a new item.

Signed-off-by: Adam D. Barratt <adam@adam-barratt.org.uk>
bzr-import-20160707
Adam D. Barratt 14 years ago
parent 9c7fcbc42c
commit 59f789a300

@ -13,11 +13,12 @@
# GNU General Public License for more details. # GNU General Public License for more details.
class MigrationItem: class MigrationItem:
def __init__(self, name = None): def __init__(self, name = None, versionned = False):
self._name = None self._name = None
self._version = None self._version = None
self._architecture = None self._architecture = None
self._suite = None self._suite = None
self._versionned = versionned
if name: if name:
self._set_name(name) self._set_name(name)
@ -36,6 +37,13 @@ class MigrationItem:
self._package, self._suite = package.split('_', 2) self._package, self._suite = package.split('_', 2)
else: else:
self._package, self._suite = (package, 'unstable') self._package, self._suite = (package, 'unstable')
if self._versionned:
self._version = parts[1]
if len(parts) == 3:
self._architecture = parts[2]
else:
self._architecture = 'source'
else:
if len(parts) == 2: if len(parts) == 2:
self._architecture = parts[1] self._architecture = parts[1]
else: else:
@ -69,3 +77,7 @@ class MigrationItem:
@property @property
def version(self): def version(self):
return self._version return self._version
class HintItem(MigrationItem):
def __init__(self, name = None):
MigrationItem.__init__(self, name = name, versionned = True)

Loading…
Cancel
Save