public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] [PATCH] unmerge-backup: check BUILD_TIME of existing binary package (bug 586410)
@ 2016-06-19 21:34 Zac Medico
  2016-06-19 22:00 ` Brian Dolbec
  0 siblings, 1 reply; 2+ messages in thread
From: Zac Medico @ 2016-06-19 21:34 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Zac Medico

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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [gentoo-portage-dev] [PATCH] unmerge-backup: check BUILD_TIME of existing binary package (bug 586410)
  2016-06-19 21:34 [gentoo-portage-dev] [PATCH] unmerge-backup: check BUILD_TIME of existing binary package (bug 586410) Zac Medico
@ 2016-06-19 22:00 ` Brian Dolbec
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Dolbec @ 2016-06-19 22:00 UTC (permalink / raw
  To: gentoo-portage-dev

On Sun, 19 Jun 2016 14:34:31 -0700
Zac Medico <zmedico@gentoo.org> wrote:

> 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:

looks fine to me, I trust it'll do the job :)

-- 
Brian Dolbec <dolsen>



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-19 22:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-19 21:34 [gentoo-portage-dev] [PATCH] unmerge-backup: check BUILD_TIME of existing binary package (bug 586410) Zac Medico
2016-06-19 22:00 ` Brian Dolbec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox