aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatarChristoph Goehre <christoph.goehre@gmx.de>2007-12-30 22:08:50 +0100
committerLibravatarChristoph Goehre <christoph.goehre@gmx.de>2007-12-30 22:08:50 +0100
commit607e3c772fd6d39b40e544d815d457a8248333c1 (patch)
treec894b330a4cc067c37223dd4e38738a7652cd1fd
parented83fe28c74522097f9aa2bd885618397bb83fa6 (diff)
add SHA256 hashes in release files
-rw-r--r--debian/control2
-rwxr-xr-xmini-dinstall21
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)