Gentoo Archives: gentoo-portage-dev

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