[game-data-packager] 10/11: Add support for Heretic shareware
Simon McVittie
smcv at debian.org
Mon Jan 12 23:37:04 UTC 2015
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 ba21036c98329f892d1074adb154432a792c7e7d
Author: Simon McVittie <smcv at debian.org>
Date: Mon Jan 12 23:21:02 2015 +0000
Add support for Heretic shareware
- in the process, add support for concatenating files,
needed for Quake 1
---
data/heretic.yaml | 80 +++++++++++++++++++++++++-------------
debian/changelog | 3 ++
lib/game_data_packager/__init__.py | 72 ++++++++++++++++++++++++----------
3 files changed, 109 insertions(+), 46 deletions(-)
diff --git a/data/heretic.yaml b/data/heretic.yaml
index b69919d..393608f 100644
--- a/data/heretic.yaml
+++ b/data/heretic.yaml
@@ -10,12 +10,14 @@ plugin: doom_common
doom_engine: heretic
help_text: |
- Please provide HERETIC.WAD from Heretic 1.3.
+ Please provide HERETIC.WAD from Heretic v1.3, and/or HERETIC1.WAD
+ from Heretic (shareware) v1.2.
- The shareware version is not yet supported.
+ HERETIC1.WAD will be downloaded if necessary.
- Patching older versions is not currently supported. If you have
- an older version, it might be possible to patch it manually using dosbox.
+ Patching older versions of HERETIC.WAD is not currently supported. If
+ you have an older version, it might be possible to patch it manually
+ using dosbox.
packages:
heretic-wad:
@@ -24,35 +26,46 @@ packages:
install:
- heretic.wad
- # Not supported yet
- #heretic-shareware-wad:
- # install_to: usr/share/games/doom
- # type: demo
+ heretic-shareware-data:
+ longname: "Heretic (shareware)"
+ install_to: usr/share/games/doom
+ type: demo
+ install:
+ - heretic1.wad
files:
- # FIXME: this needs the 'cat' unpack format
- #htic_v12.zip:
- # download:
- # idstuff-mirrors:
- # path: heretic/htic_v12.zip
- # provides: [htic_v12.1, htic_v12.2]
- # unpack:
- # format: zip
- #
- #htic_v12.1:
- # provides: [htic_v12.1, htic_v12.2]
- # unpack:
- # format: zip
- #
- #htic_v12_1_2.zip:
- # provides: [heretic1.wad_1.2]
- # unpack:
- # format: zip
+ htic_v12.zip:
+ download:
+ idstuff-mirrors:
+ path: heretic
+ provides: [HTIC_V12.1, HTIC_V12.2]
+ unpack:
+ format: zip
+
+ HTIC_V12.1:
+ size: 1439232
+ provides: [htic_v12.exe]
+ unpack:
+ format: cat
+ other_parts: [HTIC_V12.2]
+
+ HTIC_V12.2:
+ size: 1442874
+
+ htic_v12.exe:
+ size: 2882106
+ provides: [heretic1.wad_1.2]
+ unpack:
+ format: zip
heretic.wad:
alternatives:
- heretic.wad_1.3
+ heretic1.wad:
+ alternatives:
+ - heretic1.wad_1.2
+
heretic.wad_1.3:
size: 14189976
look_for: [heretic.wad]
@@ -83,12 +96,27 @@ md5sums: |
66d686b1ed6d35ff103f15dbd30e0341 heretic.wad_1.3
ae779722390ec32fa37b0d361f7d82f8 heretic1.wad_1.2
023b52175d2f260c3bdc5528df5d0a8c heretic1.wad_1.0
+ 211253fb961aa944385db1927d3c43c5 HTIC_V12.1
+ f9d17f6f4f7d26efc1015dfd90c0f721 HTIC_V12.2
+ e51a426ff89094599263f1484ed98967 htic_v12.exe
+
sha1sums: |
+ dcb0c3be73fff3affd58ead2f85c1cb22872513f htic_v12.zip
b5a6cc79cde48d97905b44282e82c4c966a23a87 heretic.wad_1.0
a54c5d30629976a649119c5ce8babae2ddfb1a60 heretic.wad_1.2
f489d479371df32f6d280a0cb23b59a35ba2b833 heretic.wad_1.3
b4c50ca9bea07f7c35250a1a11906091971c05ae heretic1.wad_1.2
+ 15e536e2af20fb6e3cf21e35eb40d17df2276ee6 HTIC_V12.1
+ ba5e52bffc34a9e16f1c20d3ce3465cc58fc9968 HTIC_V12.2
+ 4643f3bfcc5c2d0bdf304025f618e5cd1e32e2e0 htic_v12.exe
+
+sha256sums: |
+ 5ffbb47e4a5750fef144c312973ee5782266b4a63474b77478103b6c1aaed39d htic_v12.zip
+ 3ab2f21828877e49e5eb3220785aaf8798050b7c4132003b5db7b8f3678bede4 heretic1.wad_1.2
+ 5ae52ee961636418e10f5fd71e4c44d56b4adf8116a299350ab3cae15a4a10a8 HTIC_V12.1
+ 62c9c88adc3e97dc301f155ab1651083c2e6a9b0dde44e817b2d4e39fbbc0176 HTIC_V12.2
+ 34c44e1153a636278daadcaa5904c9a02ab14cee58518f59bb88af6f481a2d5d htic_v12.exe
...
# vim:set sw=2 sts=2 et:
diff --git a/debian/changelog b/debian/changelog
index d6ddf5c..1215fe7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -40,6 +40,9 @@ game-data-packager (39) UNRELEASED; urgency=medium
* Add support for flagging files in YAML as known-but-unsuitable,
and use it for older versions of various .wad files
* Install Heretic and Hexen to /usr/share/games/doom again
+ * Add support for Heretic shareware
+ - in the process, add support for concatenating files,
+ needed for Quake 1
-- Simon McVittie <smcv at debian.org> Mon, 05 Jan 2015 19:38:04 +0000
diff --git a/lib/game_data_packager/__init__.py b/lib/game_data_packager/__init__.py
index 03d57d5..dc4cc71 100644
--- a/lib/game_data_packager/__init__.py
+++ b/lib/game_data_packager/__init__.py
@@ -70,6 +70,11 @@ class HashedFile(object):
@classmethod
def from_file(cls, name, f, write_to=None, size=None, progress=False):
+ return cls.from_concatenated_files(name, [f], write_to, size, progress)
+
+ @classmethod
+ def from_concatenated_files(cls, name, fs, write_to=None, size=None,
+ progress=False):
md5 = hashlib.new('md5')
sha1 = hashlib.new('sha1')
sha256 = hashlib.new('sha256')
@@ -84,27 +89,28 @@ class HashedFile(object):
else:
update_progress = lambda s: None
- while True:
- if size is None:
- update_progress(human_size(done))
- else:
- update_progress('%.0f%% %s/%s' % (
- 100 * done / size,
- human_size(done),
- human_size(size)))
-
- blob = f.read(io.DEFAULT_BUFFER_SIZE)
- if not blob:
- update_progress('')
- break
+ for f in fs:
+ while True:
+ if size is None:
+ update_progress(human_size(done))
+ else:
+ update_progress('%.0f%% %s/%s' % (
+ 100 * done / size,
+ human_size(done),
+ human_size(size)))
+
+ blob = f.read(io.DEFAULT_BUFFER_SIZE)
+ if not blob:
+ update_progress('')
+ break
- done += len(blob)
+ done += len(blob)
- md5.update(blob)
- sha1.update(blob)
- sha256.update(blob)
- if write_to is not None:
- write_to.write(blob)
+ md5.update(blob)
+ sha1.update(blob)
+ sha256.update(blob)
+ if write_to is not None:
+ write_to.write(blob)
self = cls(name)
self.md5 = md5.hexdigest()
@@ -452,6 +458,10 @@ class GameData(object):
for filename, wanted in self.files.items():
if wanted.unpack:
assert 'format' in wanted.unpack, filename
+ if wanted.unpack['format'] == 'cat':
+ assert len(wanted.provides) == 1, filename
+ assert isinstance(wanted.unpack['other_parts'],
+ list), filename
if wanted.alternatives:
for alt in wanted.alternatives:
@@ -935,6 +945,27 @@ class GameData(object):
random.shuffle(mirrors)
return mirrors
+ def cat_files(self, provider, wanted):
+ other_parts = provider.unpack['other_parts']
+ for p in other_parts:
+ self.fill_gap(self.files[p], download=False, log=True)
+ if p not in self.found:
+ # can't concatenate: one of the bits is missing
+ break
+ else:
+ # we didn't break, so we have all the bits
+ path = os.path.join(self.get_workdir(), 'tmp',
+ wanted.name)
+ with open(path, 'wb') as writer:
+ def open_files():
+ yield open(self.found[provider.name], 'rb')
+ for p in other_parts:
+ yield open(self.found[p], 'rb')
+ hasher = HashedFile.from_concatenated_files(wanted.name,
+ open_files(), writer, size=wanted.size,
+ progress=(wanted.size > QUITE_LARGE))
+ self.use_file(wanted, path, hasher)
+
def fill_gap(self, wanted, download=False, log=True):
"""Try to unpack, download or otherwise obtain wanted.
@@ -1088,7 +1119,8 @@ class GameData(object):
cwd=tmpdir)
for f in to_unpack:
self.consider_file(os.path.join(tmpdir, f), True)
-
+ elif fmt == 'cat':
+ self.cat_files(provider, wanted)
elif providable:
# we don't have it, but we can get it
--
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