summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Brown <ben.brown@codethink.co.uk>2017-04-10 14:00:04 +0100
committerBen Brown <ben.brown@codethink.co.uk>2017-04-10 14:53:15 +0100
commit81804c2dd3e53c62539439468b1c80a6645c4fae (patch)
tree07d202cc5d79084efcf3dcdd5a4d656f50b24226
parentb721a4e2b94728986c21f1820ee87971c6b5c8e6 (diff)
downloadybd-benbrown/binary-inputs.tar.gz
Don't perform checksum operations before checking fieldsbenbrown/binary-inputs
-rw-r--r--ybd/repos.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/ybd/repos.py b/ybd/repos.py
index 1ea1781..f6f3a7b 100644
--- a/ybd/repos.py
+++ b/ybd/repos.py
@@ -347,14 +347,16 @@ def get_binary(dn):
app.log(dn, 'Downloaded', os.path.join(os.getcwd(), filename))
exit = (app.config.get('check-definitions') == 'exit')
- checksum = utils.sha256(filename)
- if dn.get('sha256') and checksum != dn['sha256']:
- app.log(dn, 'sha256 mismatch: %s |' % dn['sha256'], checksum,
- exit=exit)
- checksum = utils.md5(filename)
- if dn.get('md5') and checksum != dn['md5']:
- app.log(dn, 'md5 mismatch: %s |' % dn['md5'], checksum,
- exit=exit)
+ if dn.get('sha256'):
+ checksum = utils.sha256(filename)
+ if checksum != dn['sha256']:
+ app.log(dn, 'sha256 mismatch: %s |' % dn['sha256'], checksum,
+ exit=exit)
+ if dn.get('md5'):
+ checksum = utils.md5(filename)
+ if checksum != dn['md5']:
+ app.log(dn, 'md5 mismatch: %s |' % dn['md5'], checksum,
+ exit=exit)
app.log(dn, 'Downloaded binary input', filename)