public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/_emerge/
Date: Mon,  3 Apr 2017 20:03:44 +0000 (UTC)	[thread overview]
Message-ID: <1491249717.f479250c9cb9d82af4d621aa008d4d1e37a28a39.zmedico@gentoo> (raw)

commit:     f479250c9cb9d82af4d621aa008d4d1e37a28a39
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Apr  2 00:16:53 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Apr  3 20:01:57 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=f479250c

emerge: fix --autounmask-continue to work with --getbinpkg (bug 614474)

Fix action_build to populate binarytree instances with remote package
metadata following config reload, using a new getbinpkg_refresh=False
parameter to prevent redundant fetching of remote package metadata.

X-Gentoo-bug: 614474
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=614474
Fixes: e2d88ef3ff59 ("Add emerge --autounmask-continue option (bug 582624)")
Acked-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/_emerge/actions.py       | 15 +++++++++++++++
 pym/portage/dbapi/bintree.py | 19 +++++++++++++++----
 2 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index cc0269d5d..818fab90a 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -347,6 +347,21 @@ def action_build(emerge_config, trees=DeprecationWarning,
 			adjust_configs(emerge_config.opts, emerge_config.trees)
 			settings, trees, mtimedb = emerge_config
 
+			# After config reload, the freshly instantiated binarytree
+			# instances need to load remote metadata if --getbinpkg
+			# is enabled. Use getbinpkg_refresh=False to use cached
+			# metadata, since the cache is already fresh.
+			if "--getbinpkg" in emerge_config.opts:
+				for root_trees in emerge_config.trees.values():
+					try:
+						root_trees["bintree"].populate(
+							getbinpkgs=True,
+							getbinpkg_refresh=False)
+					except ParseError as e:
+						writemsg("\n\n!!!%s.\nSee make.conf(5) for more info.\n"
+								 % e, noiselevel=-1)
+						return 1
+
 		if "--autounmask-only" in myopts:
 			mydepgraph.display_problems()
 			return 0

diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py
index 12c3d3e51..ca90ba8f9 100644
--- a/pym/portage/dbapi/bintree.py
+++ b/pym/portage/dbapi/bintree.py
@@ -510,8 +510,16 @@ class binarytree(object):
 			except PortageException:
 				pass
 
-	def populate(self, getbinpkgs=0):
-		"populates the binarytree"
+	def populate(self, getbinpkgs=False, getbinpkg_refresh=True):
+		"""
+		Populates the binarytree with package metadata.
+
+		@param getbinpkgs: include remote packages
+		@type getbinpkgs: bool
+		@param getbinpkg_refresh: attempt to refresh the cache
+			of remote package metadata if getbinpkgs is also True
+		@type getbinpkg_refresh: bool
+		"""
 
 		if self._populating:
 			return
@@ -522,13 +530,13 @@ class binarytree(object):
 				pkgindex_lock = lockfile(self._pkgindex_file,
 					wantnewlockfile=1)
 			self._populating = True
-			self._populate(getbinpkgs)
+			self._populate(getbinpkgs, getbinpkg_refresh=getbinpkg_refresh)
 		finally:
 			if pkgindex_lock:
 				unlockfile(pkgindex_lock)
 			self._populating = False
 
-	def _populate(self, getbinpkgs=0):
+	def _populate(self, getbinpkgs=False, getbinpkg_refresh=True):
 		if (not os.path.isdir(self.pkgdir) and not getbinpkgs):
 			return 0
 
@@ -832,6 +840,9 @@ class binarytree(object):
 				url = base_url.rstrip("/") + "/Packages"
 				f = None
 
+				if not getbinpkg_refresh and local_timestamp:
+					raise UseCachedCopyOfRemoteIndex()
+
 				try:
 					ttl = float(pkgindex.header.get("TTL", 0))
 				except ValueError:


             reply	other threads:[~2017-04-03 20:03 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-03 20:03 Zac Medico [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-08-30 23:44 [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/_emerge/ Zac Medico
2014-11-20  4:08 Zac Medico
2014-02-24  9:23 Alexander Berntsen
2013-03-13  5:56 Zac Medico
2013-01-23 16:19 Zac Medico
2013-01-05 15:20 Zac Medico
2012-12-23  5:33 Arfrever Frehtes Taifersar Arahesis
2012-11-24 21:57 Zac Medico
2012-04-22 18:57 Zac Medico
2012-04-21  6:51 Zac Medico
2012-02-17 22:19 Zac Medico
2012-02-16  0:33 Zac Medico
2012-02-14 23:40 Zac Medico
2012-02-10  1:28 Zac Medico
2012-02-08  1:16 Zac Medico
2012-02-08  0:36 Zac Medico
2011-10-28  2:34 Zac Medico
2011-10-16 20:26 Zac Medico
2011-10-15  5:10 Zac Medico
2011-06-03 10:16 Zac Medico
2011-05-24  5:31 Zac Medico
2011-05-24  0:33 Zac Medico
2011-05-09  5:16 Zac Medico
2011-03-26  7:39 Zac Medico
2011-03-26  3:24 Zac Medico
2011-03-25  4:34 Zac Medico
2011-03-25  4:34 Zac Medico
2011-03-25  4:34 Zac Medico

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1491249717.f479250c9cb9d82af4d621aa008d4d1e37a28a39.zmedico@gentoo \
    --to=zmedico@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox