From: Mark Hymers Date: Sun, 15 Nov 2009 17:28:03 +0000 (+0000) Subject: generate shasums if necessary due to old changes format X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=dd2d52d7a0f0a8508c7a96103131af413a32b6c0;p=dak.git generate shasums if necessary due to old changes format Signed-off-by: Mark Hymers --- diff --git a/dak/import_new_files.py b/dak/import_new_files.py index 253e656d..8e1958b5 100755 --- a/dak/import_new_files.py +++ b/dak/import_new_files.py @@ -86,15 +86,27 @@ class ImportNewFiles(object): files=[] for chg_fn in u.pkg.files.keys(): + f = open(chg_fn) cpf = ChangePendingFile() cpf.filename = chg_fn cpf.size = u.pkg.files[chg_fn]['size'] cpf.md5sum = u.pkg.files[chg_fn]['md5sum'] - cpf.sha1sum = u.pkg.files[chg_fn]['sha1sum'] - cpf.sha256sum = u.pkg.files[chg_fn]['sha256sum'] + + if u.pkg.files[chg_fn].has_key('sha1sum'): + cpf.sha1sum = u.pkg.files[chg_fn]['sha1sum'] + else: + log.warning("Having to generate sha1sum for %s" % chg_fn) + cpf.sha1sum = apt_pkg.sha1sum(f) + + if u.pkg.files[chg_fn].has_key('sha256sum'): + cpf.sha256sum = u.pkg.files[chg_fn]['sha256sum'] + else: + log.warning("Having to generate sha256sum for %s" % chg_fn) + cpf.sha256sum = apt_pkg.sha256sum(f) session.add(cpf) files.append(cpf) + f.close() chg.files = files