diff options
| -rw-r--r-- | debian/control | 2 | ||||
| -rwxr-xr-x | mini-dinstall | 21 |
2 files changed, 22 insertions, 1 deletions
diff --git a/debian/control b/debian/control index 9643c4c..f124876 100644 --- a/debian/control +++ b/debian/control @@ -10,7 +10,7 @@ XS-Vcs-Browser: http://git.debian.org/?p=mini-dinstall/mini-dinstall.git Package: mini-dinstall Architecture: all -Depends: ${python:Depends}, python-apt, apt-utils +Depends: ${python:Depends}, python-apt, apt-utils, python-crypto Suggests: debian-keyring Description: daemon for updating Debian packages in a repository This program implements a miniature version of the "dinstall" program diff --git a/mini-dinstall b/mini-dinstall index f576c51..92f3831 100755 --- a/mini-dinstall +++ b/mini-dinstall @@ -1171,6 +1171,15 @@ class ArchiveDirIndexer(threading.Thread): shasum.update(buf) buf = f.read(8192) return shasum.hexdigest() + elif type == 'sha256': + import Crypto.Hash.SHA256 + f = open(filename) + buf = f.read(8192) + shasum256 = SHA256.new(buf) + while buf != '': + shasum256.hash_update(buf) + buf = f.read(8192) + return shasum256.hash_digest() else: raise DinstallException('cannot compute hash of type %s; no builtin method or /usr/bin/%ssum', type, type) @@ -1375,6 +1384,12 @@ class SimpleSubdirArchiveDirIndexer(ArchiveDirIndexer): shasum = self._get_file_sum('sha1', absfile) size = os.stat(absfile)[stat.ST_SIZE] f.write(' %s% 16d %s\n' % (shasum, size, os.path.basename(absfile))) + f.write('SHA256:\n') + for file in indexfiles: + absfile = self._abspath(file) + shasum256 = self._get_file_sum('sha256', absfile) + size = os.stat(absfile)[stat.ST_SIZE] + f.write(' %s% 16d %s\n' % (shasum256, size, os.path.basename(absfile))) f.close() if self._sign_releasefile(os.path.basename(tmpname), self._abspath(arch)): os.rename(tmpname, targetname) @@ -1473,6 +1488,12 @@ class FlatArchiveDirIndexer(ArchiveDirIndexer): shasum = self._get_file_sum('sha1', absfile) size = os.stat(absfile)[stat.ST_SIZE] f.write(' %s% 16d %s\n' % (shasum, size, file)) + f.write('SHA256:\n') + for file in indexfiles: + absfile = self._abspath(file) + shasum256 = self._get_file_sum('sha256', absfile) + size = os.stat(absfile)[stat.ST_SIZE] + f.write(' %s% 16d %s\n' % (shasum256, size, file)) f.close() if self._sign_releasefile(tmpname, self._abspath()): os.rename(tmpname, targetname) |
