[game-data-packager] 03/17: Add support for French-language version of Return to Castle Wolfenstein
Simon McVittie
smcv at debian.org
Fri Jan 2 21:11:55 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 89132932e6c0903e1e4178e2cad2d49de0424fca
Author: Simon McVittie <smcv at debian.org>
Date: Fri Jan 2 17:47:23 2015 +0000
Add support for French-language version of Return to Castle Wolfenstein
Thanks to Alexandre Detiste for providing details of the French
version of sp_pak1.pk3.
---
data/rtcw-data.yaml | 30 +++++--
debian/changelog | 5 +-
lib/game_data_packager/__init__.py | 155 ++++++++++++++++++++++++++++++-------
3 files changed, 153 insertions(+), 37 deletions(-)
diff --git a/data/rtcw-data.yaml b/data/rtcw-data.yaml
index a79f9c9..b2c5d3b 100644
--- a/data/rtcw-data.yaml
+++ b/data/rtcw-data.yaml
@@ -25,7 +25,6 @@ install_files_from_cksums: |
26592339 20024689 main/mp_pakmaps5.pk3
3620415895 10080181 main/mp_pakmaps6.pk3
3545821488 315823656 main/pak0.pk3
- 2543414594 293887431 main/sp_pak1.pk3
136047737 11026123 main/sp_pak2.pk3
868477447 152544 main/sp_pak3.pk3
3497089350 15532040 main/sp_pak4.pk3
@@ -62,7 +61,7 @@ sources:
- main/mp_pak1.pk3
- main/mp_pak2.pk3
- main/pak0.pk3
- - main/sp_pak1.pk3
+ - "FIXME: main/sp_pak1.pk3_en or main/sp_pak1.pk3_fr"
- main/sp_pak2.pk3
help: |
Install Return to Castle Wolfenstein from CD-ROM using Windows or Wine,
@@ -73,6 +72,24 @@ sources:
C:/Program Files/Steam/steamapps/common/Return to Castle Wolfenstein
files:
+ main/sp_pak1.pk3:
+ install: true
+ alternatives:
+ - main/sp_pak1.pk3_en
+ - main/sp_pak1.pk3_fr
+
+ main/sp_pak1.pk3_en:
+ distinctive_name: false
+ look_for:
+ - main/sp_pak1.pk3
+ size: 293887431
+
+ main/sp_pak1.pk3_fr:
+ distinctive_name: false
+ look_for:
+ - main/sp_pak1.pk3
+ size: 256811934
+
iortcw-1.42b-linux-x86.zip:
download: https://docs.google.com/uc?export=download&id=0ByCRmO4G6HOoRWNjaS04VTlMbWc
size: 21860031
@@ -162,7 +179,8 @@ md5sums: |
bb24fb011b0f4b84335c66a869d1ab1c main/mp_pakmaps5.pk3
397e0b48673a1a8e0ec25eb0f3ccae9d main/mp_pakmaps6.pk3
ce92b11df889cb0a045762bb5fd7cde5 main/pak0.pk3
- a0d3fe956f85f40c8efd6babe0d09832 main/sp_pak1.pk3
+ a0d3fe956f85f40c8efd6babe0d09832 main/sp_pak1.pk3_en
+ f19c389fe6310c24e664bc0fc84fdd95 main/sp_pak1.pk3_fr
330b272d5261fe19fcf3c3fbc943c7f3 main/sp_pak2.pk3
cf25d6731ed29c80303febbb177aa585 main/sp_pak3.pk3
4223cc6588594ec0ceee186f0e73a6e9 main/sp_pak4.pk3
@@ -191,7 +209,8 @@ sha1sums: |
c118c02922f8fd7d281f3fcfd94778317839fed1 main/mp_pakmaps5.pk3
abf1ff047a1cc6f92c9d24164991e5a49c98d0f8 main/mp_pakmaps6.pk3
917685b93cd3430ec9aa41dcbabb7063c6b2a785 main/pak0.pk3
- 4fe77f53b7effd54a1576212983b9bb9b36e50ed main/sp_pak1.pk3
+ 4fe77f53b7effd54a1576212983b9bb9b36e50ed main/sp_pak1.pk3_en
+ 0867395305426cc9374aa1d6e49b091f9b281cce main/sp_pak1.pk3_fr
feee8ecadb551a769dfb1ee97eff4c7ed7f93495 main/sp_pak2.pk3
94539eded69eb99a86d752808c5e029d5915fde7 main/sp_pak3.pk3
76b1074a350616bd8942005c4eabda06199e81f2 main/sp_pak4.pk3
@@ -220,7 +239,8 @@ sha256sums: |
85cc0e8358a26601211625a9600ca47c126e4a38cca0bac60d7465ffb5ccadfe main/mp_pakmaps5.pk3
fcdb3754ca4e9f60b3086c8461b26160dd8de7f5e94c04100a2eb6f9519abca2 main/mp_pakmaps6.pk3
1dfcfc3187ba09fe32cd8a7921a09cd15dd789816186c89b11e5e0d954c55e6c main/pak0.pk3
- 66785d612f88a19c3bb5fd24f84d89b240375a28550a79039dfb6afae865ec9a main/sp_pak1.pk3
+ 66785d612f88a19c3bb5fd24f84d89b240375a28550a79039dfb6afae865ec9a main/sp_pak1.pk3_en
+ d8825aa5b7fb0b03f6956da4e6bf822db5dd50153a8e2f87dfedefb434b78e54 main/sp_pak1.pk3_fr
eca64ea0fda6edd653865e2eb768f152d38abc8b89941aa954ed74fa36928796 main/sp_pak2.pk3
936437413956f88b9e5d548ccab9b51b8c8b9754f8f8e13ee7b910813a24d0f9 main/sp_pak3.pk3
5532801005eaf2d74fe9098dc638abdb8284225c293cee3573ffa9b6c2edd8fc main/sp_pak4.pk3
diff --git a/debian/changelog b/debian/changelog
index 70996a0..faa682a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -21,8 +21,9 @@ game-data-packager (38) UNRELEASED-experimental; urgency=low
Windows or Wine is required: we do not know how to extract files
from the patches.
* Add support for gathering PK3 and related files from Return to
- Castle Wolfenstein. An installation using Windows or Wine is required,
- but it does not have to be fully patched.
+ Castle Wolfenstein (English or French language). An installation
+ using Windows or Wine is required, but it does not have to be fully
+ patched.
* Standards-Version: 3.9.6
* Bump debhelper compat to 9 for better Python 3 handling
diff --git a/lib/game_data_packager/__init__.py b/lib/game_data_packager/__init__.py
index 3033e77..5ad5d34 100644
--- a/lib/game_data_packager/__init__.py
+++ b/lib/game_data_packager/__init__.py
@@ -144,10 +144,10 @@ class HashedFile(object):
class WantedFile(HashedFile):
def __init__(self, name):
super(WantedFile, self).__init__(name)
+ self.alternatives = []
self.distinctive_name = True
self.distinctive_size = False
self.download = None
- self.install = False
self._install_as = None
self._look_for = []
self.optional = False
@@ -157,6 +157,8 @@ class WantedFile(HashedFile):
@property
def look_for(self):
+ if self.alternatives:
+ return set([])
if not self._look_for:
self._look_for = set([self.name.lower()])
return self._look_for
@@ -165,13 +167,21 @@ class WantedFile(HashedFile):
self._look_for = set(x.lower() for x in value)
@property
+ def install(self):
+ return (self._install_as is not None)
+ @install.setter
+ def install(self, value):
+ if value:
+ if self._install_as is None:
+ self._install_as = self.name
+ else:
+ self._install_as = None
+
+ @property
def install_as(self):
- if self._install_as is None:
- return self.name
return self._install_as
@install_as.setter
def install_as(self, value):
- self.install = (value is not None)
self._install_as = value
@property
@@ -190,6 +200,7 @@ class WantedFile(HashedFile):
def to_yaml(self):
return {
+ 'alternatives': self.alternatives,
'distinctive_name': self.distinctive_name,
'distinctive_size': self.distinctive_size,
'download': self.download,
@@ -296,6 +307,20 @@ class GameDataPackage(object):
logger.debug('loaded package description:\n%s',
yaml.safe_dump(self.to_yaml()))
+ # consistency check
+ for filename, wanted in self.files.items():
+ if wanted.alternatives:
+ for alt in wanted.alternatives:
+ assert alt in self.files, alt
+
+ # if this is a placeholder for a bunch of alternatives, then
+ # it doesn't make sense for it to have a defined checksum
+ # or size
+ assert wanted.md5 is None
+ assert wanted.sha1 is None
+ assert wanted.sha256 is None
+ assert wanted.size is None
+
def __enter__(self):
return self
@@ -342,6 +367,7 @@ class GameDataPackage(object):
setattr(f, k, kwargs[k])
for k in (
+ 'alternatives',
'distinctive_name',
'distinctive_size',
'download',
@@ -426,6 +452,9 @@ class GameDataPackage(object):
hashes = None
for wanted in self.files.values():
+ if wanted.alternatives:
+ continue
+
for lf in wanted.look_for:
if match_path.endswith('/' + lf):
self.use_file(wanted, path, hashes)
@@ -434,10 +463,12 @@ class GameDataPackage(object):
if wanted.distinctive_size:
if wanted.size == size:
+ logger.debug('... matched by distinctive size %d', size)
self.use_file(wanted, path, hashes)
if hashes is not None:
if hashes.matches(wanted):
+ logger.debug('... matched hashes of %s', wanted.name)
self.use_file(wanted, path, hashes)
return
else:
@@ -461,7 +492,27 @@ class GameDataPackage(object):
for (filename, wanted) in self.files.items():
if wanted.install and filename not in self.found:
- if not self.fill_gap(wanted, download=download):
+ for alt in wanted.alternatives:
+ if alt in self.found:
+ break
+ else:
+ logger.debug('gap needs to be filled: %s', filename)
+
+ for (filename, wanted) in self.files.items():
+ if wanted.install and filename not in self.found:
+ alt_possible = False
+
+ for alt in wanted.alternatives:
+ logger.debug('trying alternative: %s', alt)
+ if alt in self.found:
+ alt_possible = True
+ break
+ elif self.fill_gap(self.files[alt], download=download):
+ alt_possible = True
+
+ if alt_possible:
+ pass
+ elif not self.fill_gap(wanted, download=download):
possible = False
return possible
@@ -479,6 +530,9 @@ class GameDataPackage(object):
if wanted is None:
continue
+ if wanted.alternatives:
+ continue
+
if wanted.size is not None and wanted.size != entry.file_size:
continue
@@ -530,6 +584,9 @@ class GameDataPackage(object):
if wanted is None:
continue
+ if wanted.alternatives:
+ continue
+
if wanted.size is not None and wanted.size != entry.size:
continue
@@ -680,17 +737,40 @@ class GameDataPackage(object):
if not possible:
if log:
- logger.error('could not find %s:\n' +
- ' expected:\n' +
- ' size: %d bytes\n' +
- ' md5: %s\n' +
- ' sha1: %s\n' +
- ' sha256: %s',
- wanted.name,
- wanted.size,
- wanted.md5,
- wanted.sha1,
- wanted.sha256)
+ if wanted.alternatives:
+ logger.error('could not find any version of %s:',
+ wanted.name)
+
+ for alt in wanted.alternatives:
+ alt = self.files[alt]
+ logger.error('%s:\n' +
+ ' expected:\n' +
+ ' size: ' + (
+ '%s' if alt.size is None else '%d bytes') +
+ '\n' +
+ ' md5: %s\n' +
+ ' sha1: %s\n' +
+ ' sha256: %s',
+ alt.name,
+ alt.size,
+ alt.md5,
+ alt.sha1,
+ alt.sha256)
+ else:
+ logger.error('could not find %s:\n' +
+ ' expected:\n' +
+ ' size: ' + (
+ '%s' if wanted.size is None else '%d bytes') +
+ '\n' +
+ ' md5: %s\n' +
+ ' sha1: %s\n' +
+ ' sha256: %s',
+ wanted.name,
+ wanted.size,
+ wanted.md5,
+ wanted.sha1,
+ wanted.sha256)
+
return False
return True
@@ -705,19 +785,25 @@ class GameDataPackage(object):
if filename in self.found:
continue
- complete = False
- if log:
- logger.error('could not find %s:\n' +
- ' expected:\n' +
- ' size: %d bytes\n' +
- ' md5: %s\n' +
- ' sha1: %s\n' +
- ' sha256: %s',
- wanted.name,
- wanted.size,
- wanted.md5,
- wanted.sha1,
- wanted.sha256)
+ for alt in wanted.alternatives:
+ if alt in self.found:
+ break
+ else:
+ complete = False
+ if log:
+ logger.error('could not find %s:\n' +
+ ' expected:\n' +
+ ' size: ' + (
+ '%s' if wanted.size is None else '%d bytes') +
+ '\n' +
+ ' md5: %s\n' +
+ ' sha1: %s\n' +
+ ' sha256: %s',
+ wanted.name,
+ wanted.size,
+ wanted.md5,
+ wanted.sha1,
+ wanted.sha256)
return complete
@@ -745,7 +831,16 @@ class GameDataPackage(object):
if not wanted.install:
continue
- copy_from = self.found[filename]
+ if filename in self.found:
+ copy_from = self.found[filename]
+ else:
+ for alt in wanted.alternatives:
+ if alt in self.found:
+ copy_from = self.found[alt]
+ break
+ else:
+ raise AssertionError('we already checked that %s exists' %
+ (filename))
# cp it into place
with TemporaryUmask(0o22):
--
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