[game-data-packager] 01/02: Add support for optional files
Simon McVittie
smcv at debian.org
Fri Jan 16 00:23:40 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 2d7905976e737fc73f382ab86f082a6698cc6f12
Author: Simon McVittie <smcv at debian.org>
Date: Fri Jan 16 00:21:23 2015 +0000
Add support for optional files
---
data/rtcw.yaml | 14 ++++++++++----
debian/changelog | 2 ++
lib/game_data_packager/__init__.py | 35 +++++++++++++++++++++++++++++------
3 files changed, 41 insertions(+), 10 deletions(-)
diff --git a/data/rtcw.yaml b/data/rtcw.yaml
index 82d8fbe..ea89789 100644
--- a/data/rtcw.yaml
+++ b/data/rtcw.yaml
@@ -54,10 +54,9 @@ packages:
sha1: 7994040e61a234e284c730287ea6d098878cbfea
md5: f7b2003ef7499f2a6e750c2925c870ad
- # optional files aren't supported yet
- #main/rotate.cfg:
- # size: 9559
- # optional: true
+ optional:
+ - main/autoexec.cfg
+ - main/rotate.cfg
help_text: |
Install Return to Castle Wolfenstein from CD-ROM using Windows or Wine,
@@ -73,6 +72,10 @@ files:
- main/sp_pak1.pk3_en
- main/sp_pak1.pk3_fr
+ main/rotate.cfg:
+ size: 9559
+ optional: true
+
main/sp_pak1.pk3_en:
look_for:
- main/sp_pak1.pk3
@@ -172,6 +175,7 @@ md5sums: |
bb24fb011b0f4b84335c66a869d1ab1c main/mp_pakmaps5.pk3
397e0b48673a1a8e0ec25eb0f3ccae9d main/mp_pakmaps6.pk3
ce92b11df889cb0a045762bb5fd7cde5 main/pak0.pk3
+ f97ff15e4248a72567aaddfa15443d1e main/rotate.cfg
a0d3fe956f85f40c8efd6babe0d09832 main/sp_pak1.pk3_en
f19c389fe6310c24e664bc0fc84fdd95 main/sp_pak1.pk3_fr
330b272d5261fe19fcf3c3fbc943c7f3 main/sp_pak2.pk3
@@ -202,6 +206,7 @@ sha1sums: |
c118c02922f8fd7d281f3fcfd94778317839fed1 main/mp_pakmaps5.pk3
abf1ff047a1cc6f92c9d24164991e5a49c98d0f8 main/mp_pakmaps6.pk3
917685b93cd3430ec9aa41dcbabb7063c6b2a785 main/pak0.pk3
+ 6a700396ae789cbf7ba592d0e1ce7de6fe6616a9 main/rotate.cfg
4fe77f53b7effd54a1576212983b9bb9b36e50ed main/sp_pak1.pk3_en
0867395305426cc9374aa1d6e49b091f9b281cce main/sp_pak1.pk3_fr
feee8ecadb551a769dfb1ee97eff4c7ed7f93495 main/sp_pak2.pk3
@@ -232,6 +237,7 @@ sha256sums: |
85cc0e8358a26601211625a9600ca47c126e4a38cca0bac60d7465ffb5ccadfe main/mp_pakmaps5.pk3
fcdb3754ca4e9f60b3086c8461b26160dd8de7f5e94c04100a2eb6f9519abca2 main/mp_pakmaps6.pk3
1dfcfc3187ba09fe32cd8a7921a09cd15dd789816186c89b11e5e0d954c55e6c main/pak0.pk3
+ b0d5fa3f029167d73eddabec562938e6ee8d97b2a7f5215dde66525a574b40d5 main/rotate.cfg
66785d612f88a19c3bb5fd24f84d89b240375a28550a79039dfb6afae865ec9a main/sp_pak1.pk3_en
d8825aa5b7fb0b03f6956da4e6bf822db5dd50153a8e2f87dfedefb434b78e54 main/sp_pak1.pk3_fr
eca64ea0fda6edd653865e2eb768f152d38abc8b89941aa954ed74fa36928796 main/sp_pak2.pk3
diff --git a/debian/changelog b/debian/changelog
index 7947d58..0d64126 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -60,6 +60,8 @@ 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
* Add support for concatenating files, needed for Quake 1
+ * Add support for optional files, used for Wolfenstein 3D, Quake 1
+ and Return to Castle Wolfenstein
-- 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 e6aef76..11f5a87 100644
--- a/lib/game_data_packager/__init__.py
+++ b/lib/game_data_packager/__init__.py
@@ -244,7 +244,6 @@ class WantedFile(HashedFile):
self.install_as = name
self.install_to = None
self._look_for = []
- self.optional = False
self._provides = set()
self._size = None
self.unpack = None
@@ -288,7 +287,6 @@ class WantedFile(HashedFile):
'install_to': self.install_to,
'look_for': list(self.look_for),
'name': self.name,
- 'optional': self.optional,
'provides': list(self.provides),
'size': self.size,
'skip_hash_matching': self.skip_hash_matching,
@@ -325,6 +323,9 @@ class GameDataPackage(object):
# set of names of WantedFile instances to be installed
self._install = set()
+ # set of names of WantedFile instances to be optionally installed
+ self._optional = set()
+
# type of package: full, demo or expansion
# full packages include quake-registered, quake2-full-data, quake3-data
# demo packages include quake-shareware, quake2-demo-data
@@ -352,6 +353,13 @@ class GameDataPackage(object):
self._install_contents_of = set(value)
@property
+ def optional(self):
+ return self._optional
+ @optional.setter
+ def optional(self, value):
+ self._optional = set(value)
+
+ @property
def type(self):
return self._type
@type.setter
@@ -365,6 +373,7 @@ class GameDataPackage(object):
'install_to': self.install_to,
'install_to_docdir': self.install_to_docdir,
'name': self.name,
+ 'optional': sorted(self.optional),
'steam': self.steam,
'symlinks': self.symlinks,
}
@@ -544,6 +553,8 @@ class GameData(object):
assert package.install, package.name
for installable in package.install:
assert installable in self.files, installable
+ for installable in package.optional:
+ assert installable in self.files, installable
for filename, wanted in self.files.items():
if wanted.unpack:
@@ -628,6 +639,12 @@ class GameData(object):
f = self._ensure_file(filename)
package.install.add(filename)
+ if 'optional' in d:
+ assert isinstance(d['optional'], list), package.name
+ for filename in d['optional']:
+ f = self._ensure_file(filename)
+ package.optional.add(filename)
+
if 'install_files_from_cksums' in d:
for line in d['install_files_from_cksums'].splitlines():
stripped = line.strip()
@@ -664,7 +681,6 @@ class GameData(object):
'install_to',
'look_for',
'md5',
- 'optional',
'provides',
'sha1',
'sha256',
@@ -873,7 +889,7 @@ class GameData(object):
result = FillResult.COMPLETE
- for filename in package.install:
+ for filename in (package.install | package.optional):
if filename not in self.found:
wanted = self.files[filename]
@@ -884,7 +900,9 @@ class GameData(object):
# updates file_status as a side-effect
self.fill_gap(package, wanted, download=download, log=log)
- result &= self.file_status[filename]
+ if filename in package.install:
+ # it is mandatory
+ result &= self.file_status[filename]
self.package_status[package.name] = result
return result
@@ -1308,7 +1326,7 @@ class GameData(object):
if os.path.isfile(maintscript):
shutil.copy(maintscript, os.path.join(debdir, ms))
- for filename in package.install:
+ for filename in (package.install | package.optional):
wanted = self.files[filename]
install_as = wanted.install_as
@@ -1322,6 +1340,11 @@ class GameData(object):
install_as = self.files[alt].install_as
break
else:
+ if filename not in package.install:
+ logger.debug('optional file %r is missing, ignoring',
+ filename)
+ continue
+
raise AssertionError('we already checked that %s exists' %
(filename))
--
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