[game-data-packager] 01/01: add support for (multipart) ARJ archives

Alexandre Detiste detiste-guest at moszumanska.debian.org
Mon Mar 30 13:31:21 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 26e1f2ef03efc4ac57a7e2cbf2b023caae2a5176
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date:   Mon Mar 30 15:30:50 2015 +0200

    add support for (multipart) ARJ archives
---
 data/descent1.yaml             | 39 ++++++++++++++++++++-------------------
 debian/control                 |  2 ++
 game_data_packager/__init__.py | 27 +++++++++++++++++++++++++--
 3 files changed, 47 insertions(+), 21 deletions(-)

diff --git a/data/descent1.yaml b/data/descent1.yaml
index d2d7bd6..c48ec63 100644
--- a/data/descent1.yaml
+++ b/data/descent1.yaml
@@ -68,25 +68,26 @@ files:
   descent.pig_full:
     install_as: descent.pig
 
-  #desc14sw.exe:
-  #  provides:
-  #  - descent1.sow
-  #  - descent2.sow
-  #  format: zip
-  #descent1.sow:
-  #  prodives:
-  #  - descent.hog
-  #  - readme.txt
-  #  - refcard.txt
-  #  - descent.pig_part1
-  #  format: arj
-  #descent2.sow:
-  #  # needs to be unpacked after descent1.sow in the same working folder
-  #  # in order to add data to existing descent.pig
-  #  # without that, we get a descent.pig with 1416672 NULL at the start
-  #  prodives:
-  #  - descent.pig_part2
-  #  format: arj
+  desc14sw.exe:
+    provides:
+    - descent1.sow
+    - descent2.sow
+    unpack:
+      format: zip
+  descent1.sow:
+    provides:
+    - descent.hog
+    - descent.pig
+    - readme.txt
+    - refcard.txt
+    unpack:
+      format: arj
+      other_parts: [descent2.sow]
+      unpack:
+      - DESCENT.HOG
+      - DESCENT.PIG
+      - README.TXT
+      - REFCARD.TXT
 
   descent.faq:
     install_to: $docdir
diff --git a/debian/control b/debian/control
index 19eea13..3fac8c4 100644
--- a/debian/control
+++ b/debian/control
@@ -43,6 +43,8 @@ Suggests:
 	p7zip-full,
 # for Jedi Academy (demo)
 	unshield,
+# for Descent 1
+        arj,
 Architecture: all
 Multi-Arch: foreign
 Description: Installer for game data files
diff --git a/game_data_packager/__init__.py b/game_data_packager/__init__.py
index 39b4c1d..dc46216 100644
--- a/game_data_packager/__init__.py
+++ b/game_data_packager/__init__.py
@@ -1501,7 +1501,6 @@ class GameData(object):
                         self.consider_file(os.path.join(tmpdir, f.lstrip('/')), True)
                 elif fmt == 'unshield':
                     other_parts = provider.unpack['other_parts']
-                    print(other_parts)
                     for p in other_parts:
                         self.fill_gap(package, self.files[p], download=False, log=True)
                         if p not in self.found:
@@ -1523,7 +1522,31 @@ class GameData(object):
                             tmp = os.path.join(tmpdir, f)
                             os.utime(tmp, (orig_time, orig_time))
                             self.consider_file(tmp, True)
-
+                elif fmt == 'arj':
+                    other_parts = set(provider.unpack.get('other_parts'))
+                    other_parts.discard(None)
+                    for p in other_parts:
+                        self.fill_gap(package, self.files[p], download=False, log=True)
+                        if p not in self.found:
+                            # can't concatenate: one of the bits is missing
+                            break
+                    else:
+                        to_unpack = provider.unpack.get('unpack', provider.provides)
+                        logger.debug('Extracting %r from %s',
+                                to_unpack, found_name)
+                        tmpdir = os.path.join(self.get_workdir(), 'tmp',
+                                provider_name + '.d')
+                        mkdir_p(tmpdir)
+                        subprocess.check_call(['arj', 'e',
+                                  os.path.abspath(found_name)] +
+                                  list(to_unpack), cwd=tmpdir)
+                        for p in other_parts:
+                            subprocess.check_call(['arj', 'e', '-jya',
+                                  os.path.join(os.path.dirname(found_name),p)] +
+                                  list(to_unpack), cwd=tmpdir)
+                        for f in to_unpack:
+                            tmp = os.path.join(tmpdir, f)
+                            self.consider_file(tmp, True)
                 elif fmt == 'cat':
                     self.cat_files(package, provider, wanted)
 

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