Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 593086 - sys-apps/portage: UseManager should warn about USE-deps in package.use, and discard them
Summary: sys-apps/portage: UseManager should warn about USE-deps in package.use, and d...
Status: CONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Configuration (show other bugs)
Hardware: All All
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2016-09-07 23:11 UTC by Zac Medico
Modified: 2023-02-09 21:59 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zac Medico gentoo-dev 2016-09-07 23:11:36 UTC
USE-deps in package.use cause setcpv recursion, as show with this patch:

diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
index 45b7d08..aa7f20b 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
@@ -1372,6 +1372,21 @@ class config(object):

                        return value

+       def _setcpv_recursion_gate(f):
+               """
+               Raise AssertionError for recursive setcpv calls.
+               """
+               def wrapper(self, *args, **kwargs):
+                       if hasattr(self, '_setcpv_active'):
+                               raise AssertionError('setcpv recursion detected')
+                       self._setcpv_active = True
+                       try:
+                               return f(self, *args, **kwargs)
+                       finally:
+                               del self._setcpv_active
+               return wrapper
+
+       @_setcpv_recursion_gate
        def setcpv(self, mycpv, use_cache=None, mydb=None):
                """
                Load a particular CPV into the config, this lets us see the

Traceback (most recent call last):
  File "./bin/emerge", line 50, in <module>
    retval = emerge_main()
  File "pym/_emerge/main.py", line 1224, in emerge_main
    return run_action(emerge_config)
  File "pym/_emerge/actions.py", line 3261, in run_action
    retval = action_build(emerge_config, spinner=spinner)
  File "pym/_emerge/actions.py", line 338, in action_build
    settings, trees, myopts, myparams, myaction, myfiles, spinner)
  File "pym/_emerge/depgraph.py", line 9247, in backtrack_depgraph
    myaction, myfiles, spinner)
  File "pym/_emerge/depgraph.py", line 9284, in _backtrack_depgraph
    success, favorites = mydepgraph.select_files(myfiles)
  File "pym/_emerge/depgraph.py", line 3606, in select_files
    return self._select_files(args)
  File "pym/_emerge/depgraph.py", line 3949, in _select_files
    return self._resolve(myfavorites)
  File "pym/_emerge/depgraph.py", line 4013, in _resolve
    myroot, atom, onlydeps=onlydeps)
  File "pym/_emerge/depgraph.py", line 5364, in _select_pkg_highest_available
    ret = self._select_pkg_highest_available_imp(root, atom, onlydeps=onlydeps, parent=parent)
  File "pym/_emerge/depgraph.py", line 5576, in _select_pkg_highest_available_imp
    root, atom, onlydeps=onlydeps, parent=parent)
  File "pym/_emerge/depgraph.py", line 5872, in _wrapped_select_pkg_highest_available_imp
    onlydeps=onlydeps):
  File "pym/_emerge/depgraph.py", line 5282, in _iter_match_pkgs_atom
    installed=installed, onlydeps=onlydeps, myrepo=repo)
  File "pym/_emerge/depgraph.py", line 6580, in _pkg
    if not self._pkg_visibility_check(pkg) and \
  File "pym/_emerge/depgraph.py", line 5620, in _pkg_visibility_check
    if pkg.visible:
  File "pym/_emerge/Package.py", line 177, in visible
    self._visible = self._eval_visiblity(self.masks)
  File "pym/_emerge/Package.py", line 171, in masks
    self._masks = self._eval_masks()
  File "pym/_emerge/Package.py", line 403, in _eval_masks
    self.cpv, self._metadata)
  File "pym/portage/package/ebuild/config.py", line 2047, in _getMissingLicenses
    cpv, metadata["USE"], metadata["LICENSE"], metadata["SLOT"], metadata.get('repository'))
  File "pym/_emerge/Package.py", line 872, in __getitem__
    v = self._pkg._init_use()
  File "pym/_emerge/Package.py", line 664, in _init_use
    use_str = self._get_pkgsettings()["PORTAGE_USE"]
  File "pym/_emerge/Package.py", line 639, in _get_pkgsettings
    pkgsettings.setcpv(self)
  File "pym/portage/package/ebuild/config.py", line 1384, in wrapper
    return f(self, *args, **kwargs)
  File "pym/portage/package/ebuild/config.py", line 1562, in setcpv
    self.puse = self._use_manager.getPUSE(cpv_slot)
  File "pym/portage/package/ebuild/_config/UseManager.py", line 555, in getPUSE
    puse_matches = ordered_by_atom_specificity(cpdict, pkg)
  File "pym/portage/package/ebuild/_config/helper.py", line 34, in ordered_by_atom_specificity
    bestmatch = best_match_to_list(pkg, keys)
  File "pym/portage/dep/__init__.py", line 2058, in best_match_to_list
    for x in match_to_list(mypkg, mylist):
  File "pym/portage/dep/__init__.py", line 2026, in match_to_list
    if x not in matches and match_from_list(x, pkgs):
  File "pym/portage/dep/__init__.py", line 2341, in match_from_list
    use = getattr(x, "use", None)
  File "pym/_emerge/Package.py", line 633, in use
    self._init_use()
  File "pym/_emerge/Package.py", line 664, in _init_use
    use_str = self._get_pkgsettings()["PORTAGE_USE"]
  File "pym/_emerge/Package.py", line 639, in _get_pkgsettings
    pkgsettings.setcpv(self)
  File "pym/portage/package/ebuild/config.py", line 1381, in wrapper
    raise AssertionError('setcpv recursion detected')
AssertionError: setcpv recursion detected
Comment 1 Brian Dolbec (RETIRED) gentoo-dev 2016-09-08 01:58:20 UTC
What if we do simple substitution for occurrences of ["[", "]"] with a space, along with the error message.

If not that, then just puke out the error and exit rather than ignore the entry. That will force it to be fixed.

In my case I accidentally forgot to edit them out when copy/pasting the entry from an emerge complaint about needing that to satisfy some other pkg.  If it was ignored, I would be incensed wondering why it keeps giving me the same use complaint after I already added it (although incorrectly) to package.use.