diff options
author | 2017-04-01 17:16:53 -0700 | |
---|---|---|
committer | 2017-04-03 13:01:57 -0700 | |
commit | f479250c9cb9d82af4d621aa008d4d1e37a28a39 (patch) | |
tree | e30008a7bcfdb05abaab5e775fd320733f4035c4 | |
parent | depgraph: trigger slot operator rebuilds via _complete_graph (bug 614390) (diff) | |
download | portage-f479250c9cb9d82af4d621aa008d4d1e37a28a39.tar.gz portage-f479250c9cb9d82af4d621aa008d4d1e37a28a39.tar.bz2 portage-f479250c9cb9d82af4d621aa008d4d1e37a28a39.zip |
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@gentoo.org>
-rw-r--r-- | pym/_emerge/actions.py | 15 | ||||
-rw-r--r-- | 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: |