From debd6a7229647e433451b4a03fba3067415455bb Mon Sep 17 00:00:00 2001 From: "Adam D. Barratt" Date: Wed, 9 Nov 2011 23:24:42 +0000 Subject: [PATCH] MigrationItem: canonicalise item names on output Although multiple formats of item name are accepted (e.g. $pkg_$suite/$arch and $pkg/$arch_$suite), for compatibility and ease of parsing by clients the output format is standardised. Signed-off-by: Adam D. Barratt --- migrationitem.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/migrationitem.py b/migrationitem.py index 3bb1189..502fe0f 100644 --- a/migrationitem.py +++ b/migrationitem.py @@ -78,14 +78,17 @@ class MigrationItem: if self.is_removal: self._suite = 'testing' + parts = self._name.split('/', 3) + if len(parts) == 1 or self._architecture == 'source': + self._uvname = self._package + else: + self._uvname = "%s/%s" % (self._package, self._architecture) + if self._suite not in ('testing', 'unstable'): + self._uvname = '%s_%s' % (self._uvname, self._suite) 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]) + self._name = '%s/%s' % (self._uvname, self._version) else: - self._uvname = self._name + self._name = self._uvname name = property(_get_name, _set_name)