In bintree.inject(), ensure that _pkgindex_entry returns local metadata
authorZac Medico <zmedico@gentoo.org>
Tue, 27 Apr 2010 22:49:05 +0000 (15:49 -0700)
committerZac Medico <zmedico@gentoo.org>
Tue, 27 Apr 2010 22:49:05 +0000 (15:49 -0700)
rather than remote metadata. Thanks to Kenneth Waters <kwaters@chromium.org>
for reporting.

pym/portage/dbapi/bintree.py

index caa17699f07994e97622f77d4b864dac8d109570..8a7112fdedeb50306dadd6a29585312599dfb9f7 100644 (file)
@@ -943,6 +943,12 @@ class binarytree(object):
                        if not self._pkgindex_version_supported(pkgindex):
                                pkgindex = self._new_pkgindex()
 
+                       # Discard remote metadata to ensure that _pkgindex_entry
+                       # gets the local metadata. This also updates state for future
+                       # isremote calls.
+                       if self._remotepkgs is not None:
+                               self._remotepkgs.pop(cpv, None)
+
                        try:
                                d = self._pkgindex_entry(cpv)
                        except portage.exception.InvalidDependString:
@@ -981,11 +987,6 @@ class binarytree(object):
                        if pkgindex_lock:
                                unlockfile(pkgindex_lock)
 
-               if self._remotepkgs is not None:
-                       # When a remote package is downloaded and injected,
-                       # update state so self.isremote() returns False.
-                       self._remotepkgs.pop(cpv, None)
-
        def _pkgindex_entry(self, cpv):
                """
                Performs checksums and evaluates USE flag conditionals.