ui: update_report: fix source/binary confusion (LP: #2102147)#464
Open
schopin-pro wants to merge 2 commits intocanonical:mainfrom
Open
ui: update_report: fix source/binary confusion (LP: #2102147)#464schopin-pro wants to merge 2 commits intocanonical:mainfrom
schopin-pro wants to merge 2 commits intocanonical:mainfrom
Conversation
Will be useful to fix apport-collect
Rather than relying on binary packages being named the same as their source package, we actually split the two of them. There's an underlying assumption that we're reporting to a backend that cares about source packages, so that's what we're basing it all on, by adding a field to list the binary packages actually installed from that source package. It might not work perfectly (the Package field will be marked with "not installed" for glibc, for instance), but it's still much better than the current state. Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/apport/+bug/2102147
Contributor
Author
|
Ugh, apparently the tests assume that -p is for the source package. This entire thing is just sooooo confusing. |
bdrung
reviewed
Mar 12, 2025
| return { | ||
| pkg.name | ||
| for pkg in self._cache() | ||
| if pkg.installed and (source_package == pkg.installed.source_name) |
Member
There was a problem hiding this comment.
Suggested change
| if pkg.installed and (source_package == pkg.installed.source_name) | |
| if pkg.installed and source_package == pkg.installed.source_name |
| self.cur_package = src | ||
| self.report["SourcePackage"] = src | ||
| self.report["Package"] = src # Slight abuse of the field but it's mandatory | ||
| self.report["InstalledBinaries"] = " ".join(sorted(binaries)) |
Member
There was a problem hiding this comment.
We probably also want to collect the version of those packages (similar to what Dependencies does).
Contributor
Author
There was a problem hiding this comment.
I was going to answer that we don't need it since it's already known, but actually that's a really good point, that would show mixed-version weirdness.
| # hook available to collect sensible information | ||
| try: | ||
| packaging.get_version(p) | ||
| packaging.get_version(next(iter(binaries))) |
Member
There was a problem hiding this comment.
That will only return one of the binary packages and is not stable.
| try: | ||
| packaging.get_version(p) | ||
| packaging.get_version(next(iter(binaries))) | ||
| except ValueError: |
Member
There was a problem hiding this comment.
question: Can we still reach that exception?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rather than relying on binary packages being named the same as their
source package, we actually split the two of them. There's an underlying
assumption that we're reporting to a backend that cares about source
packages, so that's what we're basing it all on, by adding a field to
list the binary packages actually installed from that source package.
It might not work perfectly (the Package field will be marked with "not
installed" for glibc, for instance), but it's still much better than the
current state.
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/apport/+bug/2102147