Bug #303211 - Discard invalid SIZE metadata when using the old binhost
authorZac Medico <zmedico@gentoo.org>
Tue, 2 Mar 2010 20:11:56 +0000 (20:11 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 2 Mar 2010 20:11:56 +0000 (20:11 -0000)
protocol. (trunk r15333)

svn path=/main/branches/2.1.7/; revision=15564

pym/portage/dbapi/bintree.py

index e817e3d035b6cbf3b2a96297e3079b30470ea107..e07f58a47bb21dd399bacc784ad24e822f817709 100644 (file)
@@ -838,6 +838,17 @@ class binarytree(object):
                                        remote_metadata = self.remotepkgs[mypkg]
                                        for k, v in remote_metadata.items():
                                                remote_metadata[k] = v.strip()
+
+                                       # Eliminate metadata values with names that digestCheck
+                                       # uses, since they are not valid when using the old
+                                       # protocol. Typically this is needed for SIZE metadata
+                                       # which corresponds to the size of the unpacked files
+                                       # rather than the binpkg file size, triggering digest
+                                       # verification failures as reported in bug #303211.
+                                       remote_metadata.pop('SIZE', None)
+                                       for k in portage.checksum.hashfunc_map:
+                                               remote_metadata.pop(k, None)
+
                                        self._remotepkgs[fullpkg] = remote_metadata
                                        #print "  -- Injected"
                                except SystemExit as e: