-
Notifications
You must be signed in to change notification settings - Fork 22
ui: update_report: fix source/binary confusion (LP: #2102147) #464
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -777,27 +777,38 @@ def run_update_report(self) -> bool: | |
|
|
||
| # list of affected source packages | ||
| self.report = apport.Report("Bug") | ||
| # FIXME: for now we assume this is a binary package because it's just easier | ||
| # and it didn't work with a source package anyway. | ||
| if self.args.package: | ||
| pkgs = [self.args.package.strip()] | ||
| binary = self.args.package.strip() | ||
| pkgs = {packaging.get_source(binary): set((binary,))} | ||
| else: | ||
| pkgs = self.crashdb.get_affected_packages(self.args.update_report) | ||
| pkgs = { | ||
| src: packaging.get_installed_binaries(src) | ||
| for src in self.crashdb.get_affected_packages(self.args.update_report) | ||
| } | ||
|
|
||
| info_collected = False | ||
| for p in pkgs: | ||
| assert self.report is not None | ||
| for src, binaries in pkgs.items(): | ||
| # print(f"Collecting apport information for source package {p}...") | ||
| self.cur_package = p | ||
| self.report["SourcePackage"] = p | ||
| self.report["Package"] = p # no way to find this out | ||
| assert binaries | ||
| 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We probably also want to collect the version of those packages (similar to what
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. |
||
|
|
||
| # we either must have the package installed or a source package | ||
| # 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That will only return one of the binary packages and is not stable. |
||
| except ValueError: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question: Can we still reach that exception? |
||
| if not os.path.exists( | ||
| os.path.join(apport.report.PACKAGE_HOOK_DIR, f"source_{p}.py") | ||
| os.path.join(apport.report.PACKAGE_HOOK_DIR, f"source_{src}.py") | ||
| ): | ||
| print(f"Package {p} not installed and no hook available, ignoring") | ||
| print( | ||
| f"Package {src} not installed and no hook available, ignoring" | ||
| ) | ||
| continue | ||
| self.collect_info(ignore_uninstalled=True) | ||
| info_collected = True | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.