migrationitem: add an "unversioned name" property

This can be used to retrieve the version information from a versionned hint;
for unversionned hints, it is effectively a synonym for "name".

Signed-off-by: Adam D. Barratt <adam@adam-barratt.org.uk>
debian
Adam D. Barratt 13 years ago
parent 0c2c672bb2
commit 02a9aa14ef

@ -56,6 +56,15 @@ class MigrationItem:
if self.is_removal:
self._suite = 'testing'
if self._versionned:
parts = self._name.split('/', 3)
if len(parts) == 1 or self._architecture == 'source':
self._uvname = parts[0]
else:
self._uvname = "%s/%s" % (parts[0], parts[1])
else:
self._uvname = self._name
name = property(_get_name, _set_name)
@property
@ -78,6 +87,10 @@ class MigrationItem:
def version(self):
return self._version
@property
def uvname(self):
return self._uvname
class HintItem(MigrationItem):
def __init__(self, name = None):
MigrationItem.__init__(self, name = name, versionned = True)

Loading…
Cancel
Save