Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emerge: allow --onlydeps merge if root package(s) masked by license #1087

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 25 additions & 5 deletions lib/_emerge/depgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -5492,7 +5492,13 @@ def _resolve(self, myfavorites):
# set below is reserved for cases where there are *zero* other
# problems. For reference, see backtrack_depgraph, where it skips the
# get_best_run() call when success_without_autounmask is True.
if self._have_autounmask_changes():

if onlydeps and self._dynamic_config._needed_license_changes:
# needed license changes should only be fatal for packages that
# would actually be installed
return True, myfavorites
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've ignored non-license autounmask changes here. It would only make sense to return True here if there were no non-license autounmask changes. Ultimately, I think it will be much cleaner to set empty LICENSE metadata for the onlydeps package instance, rather than trigger autoumask for a LICENSE that you intend to ignore anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting license metadata to empty is an excellent suggestion. I'll look into it. Thanks!


elif self._have_autounmask_changes():
# We failed if the user needs to change the configuration
self._dynamic_config._success_without_autounmask = True
if (
Expand Down Expand Up @@ -7242,7 +7248,9 @@ def _select_pkg_highest_available_imp(

return pkg, existing

def _pkg_visibility_check(self, pkg, autounmask_level=None, trust_graph=True):
def _pkg_visibility_check(
self, pkg, autounmask_level=None, trust_graph=True, onlydeps=False
):
if pkg.visible:
return True

Expand Down Expand Up @@ -7281,7 +7289,11 @@ def _pkg_visibility_check(self, pkg, autounmask_level=None, trust_graph=True):
elif hint.key == "p_mask":
masked_by_p_mask = True
elif hint.key == "license":
missing_licenses = hint.value
if not onlydeps:
# onlydeps should only be set to True for top level packages
# don't block an onlydeps merge when the package blocked it
# would not be merged
missing_licenses = hint.value
else:
masked_by_something_else = True

Expand Down Expand Up @@ -7317,7 +7329,11 @@ def _pkg_visibility_check(self, pkg, autounmask_level=None, trust_graph=True):
and not autounmask_level.allow_missing_keywords
)
or (masked_by_p_mask and not autounmask_level.allow_unmasks)
or (missing_licenses and not autounmask_level.allow_license_changes)
or (
missing_licenses
and not autounmask_level.allow_license_changes
and not onlydeps
)
):
# We are not allowed to do the needed changes.
return False
Expand Down Expand Up @@ -7646,7 +7662,11 @@ def _wrapped_select_pkg_highest_available_imp(
# _dep_check_composite_db, in order to prevent
# incorrect choices in || deps like bug #351828.

if not self._pkg_visibility_check(pkg, autounmask_level):
# We pass onlydeps here so that masks on packages
# that would not be installed are not fatal
if not self._pkg_visibility_check(
pkg, autounmask_level, onlydeps=onlydeps
):
continue

# Enable upgrade or downgrade to a version
Expand Down
Loading