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 error message when a package isn't available #1024

Merged
merged 1 commit into from
Mar 11, 2024

Conversation

cottsay
Copy link
Member

@cottsay cottsay commented Mar 11, 2024

The original behavior was to raise a KeyError with the missing package name, but this was regressed to an assert with no actionable error message by a previous change.

Fixes #1023

The original behavior was to raise a KeyError with the missing package
name, but this was regressed to an assert with no actionable error
message by a previous change.

Fixes 09a78f4
@cottsay cottsay added the bug label Mar 11, 2024
@cottsay cottsay self-assigned this Mar 11, 2024
@@ -175,6 +175,8 @@ def get_binary_package_versions(apt_cache, debian_pkg_names):
pkg = apt_cache.get(debian_pkg_name)
if not pkg:
prov = apt_cache.get_providing_packages(debian_pkg_name)
if not prov:
raise KeyError("No packages available for '%s'" % (debian_pkg_name,))
assert len(prov) == 1
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we remove the assert? I guess it can still trigger if len(prov) > 1, but that isn't a situation we failed on before.

Copy link
Member Author

Choose a reason for hiding this comment

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

The assert should stay. We have no logic here for how to choose which package to install when there are multiple providers of a virtual package, so the added behavior here is to support only virtual packages for which there is a single provider.

...that isn't a situation we failed on before

Before #1023, there was no difference in behavior between a completely missing package and a virtual package, so we never even got this far before.

@cottsay cottsay merged commit 7c12df5 into master Mar 11, 2024
3 of 44 checks passed
@cottsay cottsay deleted the cottsay/package-unavailable-msg branch March 11, 2024 21:06
nuclearsandwich pushed a commit that referenced this pull request Mar 16, 2024
The original behavior was to raise a KeyError with the missing package
name, but this was regressed to an assert with no actionable error
message by a previous change.

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

Successfully merging this pull request may close these issues.

2 participants