summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'pym/_emerge/depgraph.py')
-rw-r--r--pym/_emerge/depgraph.py79
1 files changed, 33 insertions, 46 deletions
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index dc7b7da87..966e27be4 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -49,7 +49,6 @@ from _emerge.search import search
from _emerge.SetArg import SetArg
from _emerge.show_invalid_depstring_notice import show_invalid_depstring_notice
from _emerge.UnmergeDepPriority import UnmergeDepPriority
-from _emerge.visible import visible
if sys.hexversion >= 0x3000000:
basestring = str
@@ -74,6 +73,7 @@ class _frozen_depgraph_config(object):
self.roots = {}
# All Package instances
self._pkg_cache = {}
+ self._highest_license_masked = {}
for myroot in trees:
self.trees[myroot] = {}
# Create a RootConfig instance that references
@@ -989,6 +989,7 @@ class depgraph(object):
self._dynamic_config._slot_pkg_map[pkg.root][pkg.slot_atom] = pkg
self._dynamic_config.mydbapi[pkg.root].cpv_inject(pkg)
self._dynamic_config._filtered_trees[pkg.root]["porttree"].dbapi._clear_cache()
+ self._check_masks(pkg)
if not pkg.installed:
# Allow this package to satisfy old-style virtuals in case it
@@ -1047,6 +1048,17 @@ class depgraph(object):
dep_stack.append(pkg)
return 1
+ def _check_masks(self, pkg):
+
+ slot_key = (pkg.root, pkg.slot_atom)
+
+ # Check for upgrades in the same slot that are
+ # masked due to a LICENSE change in a newer
+ # version that is not masked for any other reason.
+ other_pkg = self._frozen_config._highest_license_masked.get(slot_key)
+ if other_pkg is not None and pkg < other_pkg:
+ self._dynamic_config._masked_license_updates.add(other_pkg)
+
def _add_parent_atom(self, pkg, parent_atom):
parent_atoms = self._dynamic_config._parent_atoms.get(pkg)
if parent_atoms is None:
@@ -2350,7 +2362,7 @@ class depgraph(object):
pkg, existing = ret
if pkg is not None:
settings = pkg.root_config.settings
- if visible(settings, pkg) and not (pkg.installed and \
+ if pkg.visible and not (pkg.installed and \
settings._getMissingKeywords(pkg.cpv, pkg.metadata)):
self._dynamic_config._visible_pkgs[pkg.root].cpv_inject(pkg)
return ret
@@ -2425,12 +2437,9 @@ class depgraph(object):
# here, packages that have been masked since they
# were installed can be automatically downgraded
# to an unmasked version.
- try:
- if not visible(pkgsettings, pkg):
- continue
- except portage.exception.InvalidDependString:
- if not installed:
- continue
+
+ if not pkg.visible:
+ continue
# Enable upgrade or downgrade to a version
# with visible KEYWORDS when the installed
@@ -2463,7 +2472,7 @@ class depgraph(object):
except portage.exception.PackageNotFound:
continue
else:
- if not visible(pkgsettings, pkg_eb):
+ if not pkg_eb.visible:
continue
# Calculation of USE for unbuilt ebuilds is relatively
@@ -2762,6 +2771,14 @@ class depgraph(object):
installed=installed, metadata=metadata, onlydeps=onlydeps,
root_config=root_config, type_name=type_name)
self._frozen_config._pkg_cache[pkg] = pkg
+
+ if not pkg.visible and \
+ 'LICENSE' in pkg.masks and len(pkg.masks) == 1:
+ slot_key = (pkg.root, pkg.slot_atom)
+ other_pkg = self._frozen_config._highest_license_masked.get(slot_key)
+ if other_pkg is None or pkg > other_pkg:
+ self._frozen_config._highest_license_masked[slot_key] = pkg
+
return pkg
def _validate_blockers(self):
@@ -2806,35 +2823,11 @@ class depgraph(object):
# packages masked by license, since the user likely wants
# to adjust ACCEPT_LICENSE.
if pkg in final_db:
- if pkg_in_graph and not visible(pkgsettings, pkg):
- self._dynamic_config._masked_installed.add(pkg)
- elif pkgsettings._getMissingLicenses(pkg.cpv, pkg.metadata):
+ if not pkg.visible and \
+ (pkg_in_graph or 'LICENSE' in pkg.masks):
self._dynamic_config._masked_installed.add(pkg)
- elif pkg_in_graph or complete or deep:
- # Check for upgrades in the same slot that are
- # masked due to a LICENSE change in a newer
- # version that is not masked for any other reason.
- # Only do this for packages that are already in
- # the graph, or complete or deep graphs, since
- # otherwise it is likely a waste of time.
- got_mask = False
- for db, pkg_type, built, installed, db_keys in dbs:
- if installed:
- continue
- if got_mask:
- break
- for upgrade_pkg in self._iter_match_pkgs(
- root_config, pkg_type, pkg.slot_atom):
- if upgrade_pkg <= pkg:
- break
- if not visible(pkgsettings,
- upgrade_pkg, ignore=('LICENSE',)):
- continue
- if pkgsettings._getMissingLicenses(
- upgrade_pkg.cpv, upgrade_pkg.metadata):
- self._dynamic_config._masked_license_updates.add(upgrade_pkg)
- got_mask = True
- break
+ else:
+ self._check_masks(pkg)
blocker_atoms = None
blockers = None
@@ -4992,8 +4985,7 @@ class depgraph(object):
continue
raise
- if "merge" == pkg.operation and \
- not visible(root_config.settings, pkg):
+ if "merge" == pkg.operation and not pkg.visible:
if skip_masked:
masked_tasks.append(Dependency(root=pkg.root, parent=pkg))
else:
@@ -5265,13 +5257,8 @@ class _dep_check_composite_db(portage.dbapi):
arg = None
if arg:
return False
- if pkg.installed:
- try:
- if not visible(
- self._depgraph._frozen_config.pkgsettings[pkg.root], pkg):
- return False
- except portage.exception.InvalidDependString:
- pass
+ if pkg.installed and not pkg.visible:
+ return False
in_graph = self._depgraph._dynamic_config._slot_pkg_map[
self._root].get(pkg.slot_atom)
if in_graph is None: