From 6672c96db326c0736234fe0b505dcb0fb4b77d2a Mon Sep 17 00:00:00 2001 From: "Adam D. Barratt" Date: Fri, 11 Nov 2011 13:28:04 +0000 Subject: [PATCH] MigrationItem: support "$pkg/$ver/$arch" syntax This relies on the caller supplying a list of valid architectures, and assumes that none of the list entries are also valid version strings. Signed-off-by: Adam D. Barratt --- migrationitem.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/migrationitem.py b/migrationitem.py index de4d46b..6b68cd7 100644 --- a/migrationitem.py +++ b/migrationitem.py @@ -13,6 +13,16 @@ # GNU General Public License for more details. class MigrationItem: + _architectures = [] + + @classmethod + def set_architectures(cls, architectures = None): + cls._architectures = architectures or [] + + @classmethod + def get_architectures(cls): + return cls._architectures + def __init__(self, name = None, versionned = False): self._name = None self._uvname = None @@ -71,6 +81,10 @@ class MigrationItem: else: self._architecture = 'source' + if self._version in self.__class__.get_architectures(): + (self._architecture, self._version) = \ + (self._version, self._architecture) + if '_' in self._architecture: self._architecture, self._suite = \ self._architecture.split('_', 2)