Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Zac Medico <zmedico@g.o>
Subject: [gentoo-portage-dev] [PATCH] unmerge-backup: check BUILD_TIME of existing binary package (bug 586410)
Date: Sun, 19 Jun 2016 21:34:59
Message-Id: 1466372071-6057-1-git-send-email-zmedico@gentoo.org
1 Fix the dblink._quickpkg_dblink method to search for a binary package
2 having identical BUILD_TIME to the installed instance.
3
4 X-Gentoo-Bug: 586410
5 X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=586410
6 ---
7 pym/portage/dbapi/vartree.py | 15 +++++++++++----
8 1 file changed, 11 insertions(+), 4 deletions(-)
9
10 diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
11 index bfbe356..28ae584 100644
12 --- a/pym/portage/dbapi/vartree.py
13 +++ b/pym/portage/dbapi/vartree.py
14 @@ -5231,12 +5231,19 @@ class dblink(object):
15
16 def _quickpkg_dblink(self, backup_dblink, background, logfile):
17
18 + build_time = backup_dblink.getfile('BUILD_TIME')
19 + try:
20 + build_time = long(build_time.strip())
21 + except ValueError:
22 + build_time = 0
23 +
24 trees = QueryCommand.get_db()[self.settings["EROOT"]]
25 bintree = trees["bintree"]
26 - binpkg_path = bintree.getname(backup_dblink.mycpv)
27 - if os.path.exists(binpkg_path) and \
28 - catsplit(backup_dblink.mycpv)[1] not in bintree.invalids:
29 - return os.EX_OK
30 +
31 + for binpkg in reversed(
32 + bintree.dbapi.match('={}'.format(backup_dblink.mycpv))):
33 + if binpkg.build_time == build_time:
34 + return os.EX_OK
35
36 self.lockdb()
37 try:
38 --
39 2.7.4

Replies