[game-data-packager] 01/10: Add support for files with no known hash
Simon McVittie
smcv at debian.org
Sun Jan 4 18:34:48 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 a1fc50d55f64a877bf8acfe74e247df9dc538e46
Author: Simon McVittie <smcv at debian.org>
Date: Sat Jan 3 20:10:32 2015 +0000
Add support for files with no known hash
---
lib/game_data_packager/__init__.py | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/lib/game_data_packager/__init__.py b/lib/game_data_packager/__init__.py
index d49e7a8..7acf835 100644
--- a/lib/game_data_packager/__init__.py
+++ b/lib/game_data_packager/__init__.py
@@ -57,6 +57,7 @@ class HashedFile(object):
self.md5 = None
self.sha1 = None
self.sha256 = None
+ self.skip_hash_matching = False
@classmethod
def from_file(cls, name, f, write_to=None, size=None, progress=False):
@@ -105,6 +106,9 @@ class HashedFile(object):
def matches(self, other):
matched = False
+ if self.skip_hash_matching or other.skip_hash_matching:
+ return False
+
if None not in (self.md5, other.md5):
matched = True
if self.md5 != other.md5:
@@ -194,6 +198,7 @@ class WantedFile(HashedFile):
'optional': self.optional,
'provides': list(self.provides),
'size': self.size,
+ 'skip_hash_matching': self.skip_hash_matching,
'unpack': self.unpack,
}
@@ -464,6 +469,7 @@ class GameData(object):
'sha1',
'sha256',
'size',
+ 'skip_hash_matching',
'unpack',
):
if k in data:
@@ -497,7 +503,7 @@ class GameData(object):
hashes = HashedFile.from_file(path, open(path, 'rb'), size=size,
progress=(size > QUITE_LARGE))
- if not hashes.matches(wanted):
+ if not wanted.skip_hash_matching and not hashes.matches(wanted):
logger.warning('found possible %s\n' +
'but its checksums do not match:\n' +
' file: %s\n' +
@@ -555,7 +561,7 @@ class GameData(object):
self.use_file(wanted, path, hashes)
if hashes is not None:
- if hashes.matches(wanted):
+ if not wanted.skip_hash_matching and hashes.matches(wanted):
logger.debug('... matched hashes of %s', wanted.name)
self.use_file(wanted, path, hashes)
return
--
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