[game-data-packager] 01/01: unshield: narrow down expanded files to 'groups'

Alexandre Detiste detiste-guest at moszumanska.debian.org
Mon Apr 27 11:32:54 UTC 2015


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 afe6726abcc5483099f0b16332c71907abf4e556
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date:   Mon Apr 27 13:29:59 2015 +0200

    unshield: narrow down expanded files to 'groups'
---
 data/arx.yaml                  | 11 +----------
 data/ja.yaml                   |  4 +---
 game_data_packager/__init__.py | 24 +++++++++++++++++-------
 3 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/data/arx.yaml b/data/arx.yaml
index ef3ff89..0f628e8 100644
--- a/data/arx.yaml
+++ b/data/arx.yaml
@@ -406,16 +406,7 @@ files:
     unpack:
       format: unshield
       other_parts: [data1.hdr, data2.cab]
-      unpack:
-      - misc/arx.ttf
-      - misc/Logo.bmp
-      - PAK/data.pak
-      - PAK/data2.pak
-      - PAK/LOC.pak
-      - PAK/SFX.pak
-      - PAK/SPEECH.pak
-      - txt/EULA_JPN.txt
-      - txt/readme_japanese_demo.txt
+      groups: ['PAK', 'misc']
     provides:
     - arx.ttf_ja
     - data.pak_demo_ja
diff --git a/data/ja.yaml b/data/ja.yaml
index 5b9df99..73b89f8 100644
--- a/data/ja.yaml
+++ b/data/ja.yaml
@@ -134,9 +134,7 @@ files:
       #open("Disk1/data1.cab", O_RDONLY)       = 4
       #open("Disk1/data1.hdr", O_RDONLY)       = 4
       #open("Disk1/data2.cab", O_RDONLY)       = 4
-      unpack:
-      - Game_Files/assets0.pk3
-      - English_Files/license.txt
+      groups: ['Game Files', 'English Files']
     provides:
     - assets0.pk3_demo
     - license.txt
diff --git a/game_data_packager/__init__.py b/game_data_packager/__init__.py
index f92ab4a..ff43356 100644
--- a/game_data_packager/__init__.py
+++ b/game_data_packager/__init__.py
@@ -1595,16 +1595,26 @@ class GameData(object):
                         tmpdir = os.path.join(self.get_workdir(), 'tmp',
                                 provider_name + '.d')
                         mkdir_p(tmpdir)
-                        subprocess.check_call(['unshield', '-j', 'x',
-                                    os.path.abspath(found_name)], cwd=tmpdir)
+                        # we can't specify individual files to extract
+                        # but we can narrow down to 'groups'
+                        groups = provider.unpack.get('groups')
+                        if groups:
+                            # unshield only take last '-g' into account
+                            for group in groups:
+                                subprocess.check_call(['unshield', '-g', group,
+                                   'x', os.path.abspath(found_name)], cwd=tmpdir)
+                        else:
+                            subprocess.check_call(['unshield', 'x',
+                                     os.path.abspath(found_name)], cwd=tmpdir)
+
                         # this format doesn't store a timestamp, so the extracted
                         # files will instead inherit the archive's timestamp
                         orig_time = os.stat(found_name).st_mtime
-                        for f in to_unpack:
-                            logger.debug('Setting timestamp on %s', f)
-                            tmp = os.path.join(tmpdir, f)
-                            os.utime(tmp, (orig_time, orig_time))
-                            self.consider_file(tmp, True)
+                        for dirpath, dirnames, filenames in os.walk(tmpdir):
+                            for fn in filenames:
+                                full = os.path.join(dirpath, fn)
+                                os.utime(full, (orig_time, orig_time))
+                        self.consider_file_or_dir(tmpdir)
                 elif fmt == 'arj':
                     other_parts = set(provider.unpack.get('other_parts'))
                     other_parts.discard(None)

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