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
Merged
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
2 changes: 2 additions & 0 deletions ros_buildfarm/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

pkg = apt_cache[prov[0]]
versions[debian_pkg_name] = max(pkg.versions).version
Expand Down
Loading