Package: mini-dinstall
Version: 0.6.22
Severity: minor
Tags: patch

Hi Christoph, Guido,

Since apt 0.7.7 in sid SHA256 hashes are used for signing repository release 
files.
Now I am unsure if this is required or not, however support for SHA256 seems 
like a
useful addition to mini-dinstall.

Included is a small patch that adds SHA256 hashes to the release file. The only
issue is that python 2.4 doesn't yet have python's hashlib, so I've used
python-crypt instead.

cheers,

Alex de Landgraaf

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.22.5-morphix (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages mini-dinstall depends on:
ii  apt-utils                     0.7.9      APT utility programs
ii  python                        2.4.4-6    An interactive high-level object-o
ii  python-apt                    0.7.3.1+b1 Python interface to libapt-pkg
ii  python-support                0.7.4      automated rebuilding support for p

mini-dinstall recommends no packages.

-- no debconf information
diff -Naur mini-dinstall-0.6.22/debian/control mini-dinstall-0.6.22-new/debian/control
--- mini-dinstall-0.6.22/debian/control	2007-10-06 13:27:39.000000000 +0200
+++ mini-dinstall-0.6.22-new/debian/control	2007-11-26 21:44:35.000000000 +0100
@@ -10,7 +10,7 @@
 
 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 -Naur mini-dinstall-0.6.22/mini-dinstall mini-dinstall-0.6.22-new/mini-dinstall
--- mini-dinstall-0.6.22/mini-dinstall	2007-10-06 13:27:39.000000000 +0200
+++ mini-dinstall-0.6.22-new/mini-dinstall	2007-11-26 21:41:30.000000000 +0100
@@ -1154,6 +1154,15 @@
                 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)
 
@@ -1358,6 +1367,12 @@
                 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' % (sha256sum, size, os.path.basename(absfile)))
             f.close()
             if self._sign_releasefile(os.path.basename(tmpname), self._abspath(arch)):
                 os.rename(tmpname, targetname)
@@ -1456,6 +1471,12 @@
             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)

Reply via email to