Fix the dblink._quickpkg_dblink method to search for a binary package
having identical BUILD_TIME to the installed instance.

X-Gentoo-Bug: 586410
X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=586410
---
 pym/portage/dbapi/vartree.py | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index bfbe356..28ae584 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -5231,12 +5231,19 @@ class dblink(object):
 
        def _quickpkg_dblink(self, backup_dblink, background, logfile):
 
+               build_time = backup_dblink.getfile('BUILD_TIME')
+               try:
+                       build_time = long(build_time.strip())
+               except ValueError:
+                       build_time = 0
+
                trees = QueryCommand.get_db()[self.settings["EROOT"]]
                bintree = trees["bintree"]
-               binpkg_path = bintree.getname(backup_dblink.mycpv)
-               if os.path.exists(binpkg_path) and \
-                       catsplit(backup_dblink.mycpv)[1] not in 
bintree.invalids:
-                       return os.EX_OK
+
+               for binpkg in reversed(
+                       bintree.dbapi.match('={}'.format(backup_dblink.mycpv))):
+                       if binpkg.build_time == build_time:
+                               return os.EX_OK
 
                self.lockdb()
                try:
-- 
2.7.4


Reply via email to