-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Preserve multiarch apt package names in pkg.installed #68933
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: 3006.x
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 |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Fixed pkg.installed(update_holds=True) for APT multiarch packages by preserving arch-qualified package names through install target parsing and verification. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -583,7 +583,9 @@ def _find_install_targets( | |
| if any((pkgs, sources)): | ||
| if pkgs: | ||
| # pylint: disable=not-callable | ||
| desired = _repack_pkgs(pkgs, normalize=normalize) | ||
| desired = _repack_pkgs( | ||
| pkgs, normalize=normalize and kwargs.get("split_arch", True) | ||
| ) | ||
| # pylint: enable=not-callable | ||
| elif sources: | ||
| desired = __salt__["pkg_resource.pack_sources"]( | ||
|
|
@@ -904,12 +906,15 @@ def _verify_install(desired, new_pkgs, ignore_epoch=None, new_caps=None): | |
| cver = new_pkgs.get(pkgname, new_pkgs.get(pkgname.split("/")[-1])) | ||
| elif __grains__["os"] == "OpenBSD": | ||
| cver = new_pkgs.get(pkgname.split("%")[0]) | ||
| elif __grains__["os_family"] == "Debian": | ||
| cver = new_pkgs.get(pkgname.split("=")[0]) | ||
| else: | ||
| cver = new_pkgs.get(pkgname) | ||
|
Comment on lines
-907
to
-910
Contributor
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. Why were these 2 conditions combined?
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 combined them because both branches were doing the same installed-package lookup pattern, and the new normalization fallback needed to apply to both. I kept the Debian-specific split("=")[0] behavior via the lookup_name variable, but merged the rest to avoid duplicating the fallback logic. So only the initial lookup key differs. Is this the prefered solution? :)
Contributor
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. Another option would be: else
if __grains__["os_family"] == "Debian":
lookup_name = pkgname.split("=")[0]
else:
lookup_name = pkgname
cver = new_pkgs.get(lookup_name)
if not cver and "pkg.normalize_name" in __salt__:
normalized_name = __salt__["pkg.normalize_name"](lookup_name)
if normalized_name != lookup_name:
cver = new_pkgs.get(normalized_name)
if not cver and pkgname in new_caps:
cver = new_pkgs.get(new_caps.get(pkgname)[0])but I think it is fine to always split on the equal sign for both like your code is already doing since I don't think yum/dnf supports multi architecture packages though, so it isn't clear from the issue/PR description why yum package logic is changing. Maybe you can update the descriptions to elaborate.
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. YUM/DNF already supports explicit RPM arch-qualified package names such as Should I add this to the description of the PR?
Contributor
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 think that would be a good idea. I am just a user though and not a maintainer/approver.
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. Alright, do you know when to expect a review? Am I missing something in this PR? :) And thank you for your review comments :)
Contributor
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. The reviews tend to come in large batches when they have time. This PR appears to have all the necessary items. |
||
| if not cver and pkgname in new_caps: | ||
| cver = new_pkgs.get(new_caps.get(pkgname)[0]) | ||
| lookup_name = pkgname.split("=")[0] | ||
| cver = new_pkgs.get(lookup_name) | ||
| if not cver and "pkg.normalize_name" in __salt__: | ||
| normalized_name = __salt__["pkg.normalize_name"](lookup_name) | ||
| if normalized_name != lookup_name: | ||
| cver = new_pkgs.get(normalized_name) | ||
| if not cver and lookup_name in new_caps: | ||
| cver = new_pkgs.get(new_caps.get(lookup_name)[0]) | ||
|
|
||
| if not cver: | ||
| failed.append(pkgname) | ||
|
|
@@ -1481,6 +1486,10 @@ def installed( | |
| package, the held package(s) will be skipped and the state will fail. | ||
| By default, this parameter is set to ``False``. | ||
|
|
||
| Package naming rules for held packages may vary by package manager. | ||
| See the documentation for your platform's ``pkg`` module for any | ||
| provider-specific requirements. | ||
|
|
||
| Supported on YUM/DNF & APT based systems. | ||
|
|
||
| .. versionadded:: 2016.11.0 | ||
|
|
@@ -1712,6 +1721,7 @@ def installed( | |
| ignore_epoch=ignore_epoch, | ||
| reinstall=reinstall, | ||
| refresh=refresh, | ||
| split_arch=False, | ||
| **kwargs, | ||
| ) | ||
|
|
||
|
|
@@ -3876,6 +3886,10 @@ def unheld(name, version=None, pkgs=None, all=False, **kwargs): | |
| For ``unheld`` there is no need to specify the exact version | ||
| to be unheld. | ||
|
|
||
| Package naming rules for held packages may vary by package manager. | ||
| See the documentation for your platform's ``pkg`` module for any | ||
| provider-specific requirements. | ||
|
|
||
| :param bool all: | ||
| Force removing of all existings locks. | ||
| By default, this parameter is set to ``False``. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.