Check if entries contain the required hashes before writing the Manifest (trunk r5902)
authorZac Medico <zmedico@gentoo.org>
Fri, 22 Jun 2007 01:16:07 +0000 (01:16 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 22 Jun 2007 01:16:07 +0000 (01:16 -0000)
svn path=/main/branches/2.1.2/; revision=6926

pym/portage_manifest.py

index 6645963dda219b58995437f996da3eb557c49926..c0f8bef9d158f6462e40e97dc6cc1a9653841f29 100644 (file)
@@ -344,8 +344,15 @@ class Manifest(object):
                                except FileNotFound:
                                        pass
 
+       def checkIntegrity(self):
+               for t in self.fhashdict:
+                       for f in self.fhashdict[t]:
+                               if portage_const.MANIFEST2_REQUIRED_HASH not in self.fhashdict[t][f]:
+                                       raise MissingParameter("Missing %s checksum: %s %s" % (portage_const.MANIFEST2_REQUIRED_HASH, t, f))
+
        def write(self, sign=False, force=False):
                """ Write Manifest instance to disk, optionally signing it """
+               self.checkIntegrity()
                try:
                        if self.compat:
                                self._writeDigests()