[game-data-packager] 01/01: Move Lintian overrides into PackagingSystem

Simon McVittie smcv at debian.org
Tue Jan 5 10:12:38 UTC 2016


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

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

commit 883470ab27c73f78a715fb25910b04ffc45a0775
Author: Simon McVittie <smcv at debian.org>
Date:   Tue Jan 5 10:11:37 2016 +0000

    Move Lintian overrides into PackagingSystem
---
 game_data_packager/build.py                   |  6 ++--
 game_data_packager/games/doom_common.py       |  7 +++--
 game_data_packager/games/ecwolf_common.py     |  6 ++--
 game_data_packager/games/residualvm_common.py |  6 ++--
 game_data_packager/games/scummvm_common.py    |  4 ++-
 game_data_packager/packaging/__init__.py      |  3 ++
 game_data_packager/packaging/deb.py           |  9 +++++-
 game_data_packager/util.py                    | 19 -------------
 game_data_packager/util_deb.py                | 41 ---------------------------
 9 files changed, 31 insertions(+), 70 deletions(-)

diff --git a/game_data_packager/build.py b/game_data_packager/build.py
index e8ea2b4..4489245 100644
--- a/game_data_packager/build.py
+++ b/game_data_packager/build.py
@@ -51,7 +51,6 @@ from .util import (AGENT,
         copy_with_substitutions,
         human_size,
         lang_score,
-        lintian_license,
         mkdir_p,
         rm_rf,
         recursive_utime,
@@ -1336,7 +1335,10 @@ class PackagingTask(object):
                  licenses.add("/%s/%s/%s" % (self.packaging.LICENSEDIR,
                      package.name, license_file))
                  if os.path.splitext(license_file)[0].lower() == 'license':
-                     lintian_license(destdir, package.name, license_file)
+                     self.packaging.override_lintian(destdir, package.name,
+                             'extra-license-file',
+                             'usr/share/doc/%s/%s' % (package.name,
+                                 license_file))
 
             if package.component == 'local':
                 o.write('It contains proprietary game data '
diff --git a/game_data_packager/games/doom_common.py b/game_data_packager/games/doom_common.py
index 2b33d84..34652e2 100644
--- a/game_data_packager/games/doom_common.py
+++ b/game_data_packager/games/doom_common.py
@@ -24,7 +24,7 @@ import subprocess
 from .. import GameData
 from ..build import (PackagingTask)
 from ..paths import DATADIR
-from ..util import (copy_with_substitutions, mkdir_p, lintian_desktop)
+from ..util import (copy_with_substitutions, mkdir_p)
 from ..version import (FORMAT)
 
 logger = logging.getLogger('game-data-packager.games.doom-common')
@@ -171,7 +171,10 @@ class DoomTask(PackagingTask):
                       'w', encoding='utf-8') as output:
                  desktop.write(output, space_around_delimiters=False)
 
-            lintian_desktop(destdir, package.name, package.program)
+            self.packaging.override_lintian(destdir, package.name,
+                    'desktop-command-not-in-package',
+                    '%s/%s.desktop %s' % (appdir,
+                        desktop_file, package.program))
 
             if FORMAT == 'deb':
                 debdir = os.path.join(destdir, 'DEBIAN')
diff --git a/game_data_packager/games/ecwolf_common.py b/game_data_packager/games/ecwolf_common.py
index d9bc702..5f4ed57 100644
--- a/game_data_packager/games/ecwolf_common.py
+++ b/game_data_packager/games/ecwolf_common.py
@@ -23,7 +23,7 @@ import subprocess
 from .. import GameData
 from ..build import (PackagingTask)
 from ..paths import DATADIR
-from ..util import (mkdir_p, lintian_desktop)
+from ..util import (mkdir_p)
 
 logger = logging.getLogger('game-data-packager.games.ecwolf-common')
 
@@ -100,6 +100,8 @@ class EcwolfTask(PackagingTask):
                   'w', encoding='utf-8') as output:
              desktop.write(output, space_around_delimiters=False)
 
-        lintian_desktop(destdir, package.name, 'ecwolf')
+        self.packaging.override_lintian(destdir, package.name,
+                'desktop-command-not-in-package',
+                '%s/%s.desktop %s' % (appdir, package.name, 'ecwolf'))
 
 GAME_DATA_SUBCLASS = EcwolfGameData
diff --git a/game_data_packager/games/residualvm_common.py b/game_data_packager/games/residualvm_common.py
index 120abc8..8822e42 100644
--- a/game_data_packager/games/residualvm_common.py
+++ b/game_data_packager/games/residualvm_common.py
@@ -24,7 +24,7 @@ import subprocess
 from .. import GameData
 from ..build import (PackagingTask)
 from ..paths import DATADIR
-from ..util import (mkdir_p, lintian_desktop)
+from ..util import (mkdir_p)
 
 logger = logging.getLogger('game-data-packager.games.residualvm-common')
 
@@ -114,6 +114,8 @@ class ResidualvmTask(PackagingTask):
                   'w', encoding='utf-8') as output:
              desktop.write(output, space_around_delimiters=False)
 
-        lintian_desktop(destdir, package.name, 'residualvm')
+        self.packaging.override_lintian(destdir, package.name,
+                'desktop-command-not-in-package',
+                '%s/%s.desktop %s' % (appdir, package.name, 'residualvm'))
 
 GAME_DATA_SUBCLASS = ResidualvmGameData
diff --git a/game_data_packager/games/scummvm_common.py b/game_data_packager/games/scummvm_common.py
index e90d192..b64af13 100644
--- a/game_data_packager/games/scummvm_common.py
+++ b/game_data_packager/games/scummvm_common.py
@@ -130,7 +130,9 @@ class ScummvmTask(PackagingTask):
         gameid = package.gameid or self.game.gameid
         if len(package.langs) == 1:
             entry['Exec'] = 'scummvm -p /%s %s' % (package.install_to, gameid)
-            lintian_desktop(destdir, package.name, 'scummvm')
+            self.packaging.override_lintian(destdir, package.name,
+                    'desktop-command-not-in-package',
+                    '%s/%s.desktop %s' % (appdir, package.name, 'scummvm'))
         else:
             pgm = package.name[0:len(package.name)-len('-data')]
             entry['Exec'] = pgm
diff --git a/game_data_packager/packaging/__init__.py b/game_data_packager/packaging/__init__.py
index 23faa11..18def33 100644
--- a/game_data_packager/packaging/__init__.py
+++ b/game_data_packager/packaging/__init__.py
@@ -70,6 +70,9 @@ class PackagingSystem(metaclass=ABCMeta):
                 pkglicensedir=self.LICENSEDIR + '/' + package,
                 )
 
+    def override_lintian(self, destdir, package, tag, args):
+        pass
+
 def get_native_packaging_system():
     # lazy import when actually needed
     from ..version import (FORMAT)
diff --git a/game_data_packager/packaging/deb.py b/game_data_packager/packaging/deb.py
index 5d9c2f9..56d37f8 100644
--- a/game_data_packager/packaging/deb.py
+++ b/game_data_packager/packaging/deb.py
@@ -23,7 +23,7 @@ import subprocess
 from debian.debian_support import Version
 
 from . import (PackagingSystem)
-from ..util import (check_output, run_as_root)
+from ..util import (check_output, mkdir_p, run_as_root)
 
 logger = logging.getLogger(__name__)
 
@@ -122,5 +122,12 @@ class DebPackaging(PackagingSystem):
             # gdebi-gtk etc.
             subprocess.call([method] + list(debs))
 
+    def override_lintian(self, destdir, package, tag, args):
+        assert type(package) is str
+        lintiandir = os.path.join(destdir, 'usr/share/lintian/overrides')
+        mkdir_p(lintiandir)
+        with open(os.path.join(lintian, package), 'a', encoding='utf-8') as l:
+            l.write('%s: %s %s\n' % (package, tag, args))
+
 def get_distro_packaging():
     return DebPackaging()
diff --git a/game_data_packager/util.py b/game_data_packager/util.py
index 84edbb0..6b040e2 100644
--- a/game_data_packager/util.py
+++ b/game_data_packager/util.py
@@ -212,22 +212,3 @@ def recursive_utime(directory, orig_time):
         for fn in filenames:
             full = os.path.join(dirpath, fn)
             os.utime(full, orig_time)
-
-# https://wiki.archlinux.org/index.php/Pacman/Rosetta
-
-# loaded at the end to avoid failed cyclic loads
-if FORMAT == 'deb':
-    from .util_deb import (lintian_license, lintian_desktop)
-elif FORMAT == 'arch':
-    lintian_license = lambda a,b,c: None
-    lintian_desktop = lambda a,b,c: None
-elif DISTRO == 'fedora':
-    lintian_license = lambda a,b,c: None
-    lintian_desktop = lambda a,b,c: None
-elif DISTRO == 'suse':
-    lintian_license = lambda a,b,c: None
-    lintian_desktop = lambda a,b,c: None
-
-# pyflakes
-lintian_license
-lintian_desktop
diff --git a/game_data_packager/util_deb.py b/game_data_packager/util_deb.py
deleted file mode 100644
index e502b9a..0000000
--- a/game_data_packager/util_deb.py
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/python3
-# encoding=utf-8
-#
-# Copyright © 2014-2015 Simon McVittie <smcv at debian.org>
-#           © 2015 Alexandre Detiste <alexandre at detiste.be>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-#
-# You can find the GPL license text on a Debian system under
-# /usr/share/common-licenses/GPL-2.
-
-import logging
-import os
-
-from .util import (mkdir_p)
-
-logger = logging.getLogger('game-data-packager.util_deb')
-
-def lintian_license(destdir, package, file):
-    assert type(package) is str
-    lintiandir = os.path.join(destdir, 'usr/share/lintian/overrides')
-    mkdir_p(lintiandir)
-    with open(os.path.join(lintiandir, package), 'a', encoding='utf-8') as l:
-        l.write('%s: extra-license-file usr/share/doc/%s/%s\n'
-                % (package, package, file))
-
-def lintian_desktop(destdir, package, program):
-    assert type(package) is str
-    lintiandir = os.path.join(destdir, 'usr/share/lintian/overrides')
-    mkdir_p(lintiandir)
-    with open(os.path.join(lintiandir, package), 'a', encoding='utf-8') as l:
-        l.write('%s: desktop-command-not-in-package '
-                'usr/share/applications/%s.desktop %s\n'
-                 % (package, package, program))

-- 
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