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

Fix virtual package resolution #146

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dillon-giacoppo
Copy link
Contributor

@dillon-giacoppo dillon-giacoppo commented Dec 22, 2024

Currently, a simple install of bash produces the following error:

WARNING: Following dependencies could not be resolved for bash: awk

In identifying the root cause of this issue, found a few behaviors for the Provides key are not correct (as described by the spec here).

Fixed the following in Provides:

  • Handle multiple packages, i.e. Provides: bar, baz.
  • Handle unversioned packages, i.e. Provides: bar and Provides: bar (= 1.0) are both valid.
  • Ensure alternatives (referred in code as dependency groups) are evaluated left-to-right and added to unmet_deps if none resolve.
  • Handle multiple candidates for virtual packages if can fallback to a single Priority: required package.
  • Resolve multiple virtual package candidates from the same package to the highest available version.

The usage of Priority: required is necessary to account for Distroless base images not containing the "true" minimal package set as described here: https://wiki.debian.org/Proposals/EssentialOnDiet. This creates a problem for package dependencies like awk which expect to find mawk by default. A potential future improvement could resolve ambiguous virtual packages by picking an explicit package in the manifest.

Fixes to the Provides handling leads to significantly more virtual packages being identified and resolved correctly.

], resolved_name = "bar-plus")

# Un-versioned match, multiple provides
check_resolves([
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is awesome, can we drop some links here from the upstream debian documentation/tests for future references?

# If multiple versions of a package expose the same virtual package,
# we should only keep a single reference for the one with greater
# version.
for (i, (provider, provided_version)) in enumerate(providers):
Copy link
Collaborator

Choose a reason for hiding this comment

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

There seems to be lots of improvements here. It might take me couple days to understand this.

@thesayyn
Copy link
Collaborator

There are some buildifier issues, can you look at them?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants