[game-data-packager] 01/01: decode architecure the OO-way, enable easier future SuSE support

Alexandre Detiste detiste-guest at moszumanska.debian.org
Thu Jan 7 14:44:49 UTC 2016


This is an automated email from the git hooks/post-receive script.

detiste-guest pushed a commit to branch master
in repository game-data-packager.

commit a94681c7a11cfe9aca372eac4e5cd978b0544a20
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date:   Thu Jan 7 15:43:22 2016 +0100

    decode architecure the OO-way, enable easier future SuSE support
    
    keep as many possible Distro-specific bits in
    one file per-distro for readability
---
 game_data_packager/build.py              | 12 +-----------
 game_data_packager/packaging/__init__.py |  6 ++++++
 game_data_packager/packaging/arch.py     |  5 +++++
 game_data_packager/packaging/rpm.py      |  5 +++++
 4 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/game_data_packager/build.py b/game_data_packager/build.py
index b403a11..b3c4c74 100644
--- a/game_data_packager/build.py
+++ b/game_data_packager/build.py
@@ -2457,6 +2457,7 @@ class PackagingTask(object):
             arch = package.architecture
             if arch != 'all':
                 arch = self.packaging.get_architecture(arch)
+            arch = self.packaging.ARCH_DECODE.get(arch, arch)
 
             if FORMAT == 'deb':
                 pkg = self.build_deb(package, arch, destination, compress=compress)
@@ -2643,11 +2644,6 @@ class PackagingTask(object):
         if not self.fill_dest_dir(package, destdir):
             return None
 
-        arch = {'all': 'any',
-                'amd64': 'x86_64',
-                'i386': 'i686',
-                }.get(arch, arch)
-
         self.fill_dest_dir_arch(package, destdir, compress, arch)
         self.our_dh_fixperms(destdir)
 
@@ -2681,12 +2677,6 @@ class PackagingTask(object):
         if not self.fill_dest_dir(package, destdir):
             return None
 
-        # translate back from Debian arch name
-        arch = {'all': 'noarch',
-                'amd64': 'x86_64',
-                'i386': 'i686',
-                 }.get(arch, arch)
-
         if arch == 'noarch':
             setarch = []
         else:
diff --git a/game_data_packager/packaging/__init__.py b/game_data_packager/packaging/__init__.py
index a17a3f6..8fd4bfa 100644
--- a/game_data_packager/packaging/__init__.py
+++ b/game_data_packager/packaging/__init__.py
@@ -31,6 +31,12 @@ class PackagingSystem(metaclass=ABCMeta):
     # 'None' means that this pgm is not packaged by $distro
     PACKAGE_MAP = dict()
 
+    # we keep Debian codification as reference, as it
+    # - has the most architectures supported
+    # - differentiates 'any' from 'all'
+    # - is the most tested
+    ARCH_DECODE = dict()
+
     def __init__(self):
         self._architecture = None
         self._foreign_architectures = set()
diff --git a/game_data_packager/packaging/arch.py b/game_data_packager/packaging/arch.py
index 9556f4f..12d30c7 100644
--- a/game_data_packager/packaging/arch.py
+++ b/game_data_packager/packaging/arch.py
@@ -34,6 +34,11 @@ class ArchPackaging(PackagingSystem):
                   '7z': 'p7zip',
                   # XXX
                   }
+    ARCH_DECODE = {
+                  'all': 'any',
+                  'amd64': 'x86_64',
+                  'i386': 'i686',
+                  }
 
     def read_architecture(self):
         super(ArchPackaging, self).read_architecture()
diff --git a/game_data_packager/packaging/rpm.py b/game_data_packager/packaging/rpm.py
index 6365dda..b6de20d 100644
--- a/game_data_packager/packaging/rpm.py
+++ b/game_data_packager/packaging/rpm.py
@@ -28,6 +28,11 @@ logger = logging.getLogger(__name__)
 class RpmPackaging(PackagingSystem):
     CHECK_CMD = 'rpmlint'
     LICENSEDIR = 'usr/share/licenses'
+    ARCH_DECODE = {
+                  'all': 'noarch',
+                  'i386': 'i686',
+                  'amd64': 'x86_64',
+                  }
 
     def is_installed(self, package):
         return 0 == subprocess.call(['rpm', '-q', package],

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/game-data-packager.git



More information about the Pkg-games-commits mailing list