Skip to content

package_manager version support added #18517

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

Open
wants to merge 13 commits into
base: develop2
Choose a base branch
from

Conversation

davidsanfal
Copy link
Contributor

@davidsanfal davidsanfal commented Jun 24, 2025

Changelog: Feature: Added support to the system_package tool for defining the system package version to be installed
Docs: conan-io/docs#4170

Close #17744

  • Refer to the issue that supports this Pull Request.
  • If the issue has missing info, explain the purpose/use case/pain/need that covers this Pull Request.
  • I've read the Contributing guide.
  • I've followed the PEP8 style guides for Python code.
  • I've opened another PR in the Conan docs repo to the develop branch, documenting this one.

@davidsanfal davidsanfal requested a review from memsharded June 24, 2025 09:44
Copy link
Member

@memsharded memsharded left a comment

Choose a reason for hiding this comment

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

Looking good

@memsharded memsharded modified the milestone: 2.18.0 Jun 24, 2025
@davidsanfal davidsanfal marked this pull request as ready for review July 16, 2025 11:13
@@ -25,8 +25,6 @@ def system_requirements(self):
print("missing:", not_installed)
""")})
client.run("create . --name=test --version=1.0 -s:b arch=armv8 -s:h arch=x86")
assert "dpkg-query: no packages found matching non-existing1:i386" in client.out
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've removed these lines because dpkg -l doesn't print anything if it doesn't find any package with the search pattern

@davidsanfal davidsanfal requested review from jcar87 and memsharded July 16, 2025 11:23
Copy link
Member

@memsharded memsharded left a comment

Choose a reason for hiding this comment

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

Looks good to me!

install_command = "{sudo}{tool} install -y {recommends}{packages}"
update_command = "{sudo}{tool} update"
check_command = "dpkg-query -W -f='${{Status}}' {package} | grep -q \"ok installed\""
check_command = "dpkg -l | grep -q -E \"^ii\\s+\\b{package}\\s+\\b\""
Copy link
Member

Choose a reason for hiding this comment

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

Does the change to check_command solve issues of the previous one, or is this change more to align it with the check_version_command?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change is necessary to fix a false positive issue we had before. It is also to align with the way of checking the version of a package.

If your package had a default architecture that was implicit and the others were explicit, the old check found the default package substring within an installation for another architecture:

For example: foo and foo:armv8. The old check said that foo was already installed if it found foo:armv8.

@memsharded memsharded added this to the 2.19.0 milestone Jul 16, 2025
arch_name=arch_name,
version="",
version_separator="")
if version and self.check_version_command:
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should we output a warning message when we are specifying versions but the package manager does not support that?

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

Successfully merging this pull request may close these issues.

[feature] Add the possibility to choose exact package version with tools.system.package_manager
3 participants