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:
