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

Detect System package name by recipe settings (#5026) #5215

Merged
merged 8 commits into from Jul 1, 2019

Conversation

uilianries
Copy link
Member

@uilianries uilianries commented May 24, 2019

Changelog: Feature: SystemPackageTool platform detection (#5026)
Docs: conan-io/docs#1291

closes #5026

  • 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.

Note: By default this PR will skip the slower tests and will use a limited set of python versions. Check here how to increase the testing level by writing some tags in the current PR body text.

- Each package manages has a specific prefix/suffix to deal with
  architectures.
- Some package managers (e.g brew) do not provide multi-arch
  support, only an universal option.

Signed-off-by: Uilian Ries <uilianries@gmail.com>
- Validate yum and apt when installing x86

Signed-off-by: Uilian Ries <uilianries@gmail.com>
Copy link
Member

@danimtb danimtb left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution!
Although I have to say that this is the typical thing that never hammers all the nails at once 🔨 🔨

@SSE4
Copy link
Contributor

SSE4 commented May 27, 2019

hi @uilianries
do I right understand that it will always transform package name? e.g. wayland-protocols becomes wayland-protocols:i386 or whatever? in that case, it would be breaking for some packages, as wayland-protocols for instance have no arch packages, and it has only wayland-protocols:all. https://packages.debian.org/sid/wayland-protocols

@lasote lasote added this to the 1.16 milestone May 27, 2019
@lasote
Copy link
Contributor

lasote commented May 27, 2019

Probably we need an opt-out at install to escape the magic

@uilianries
Copy link
Member Author

do I right understand that it will always transform package name? e.g. wayland-protocols becomes wayland-protocols:i386 or whatever? in that case, it would be breaking for some packages, as wayland-protocols for instance have no arch packages, and it has only wayland-protocols:all.

Yes, you are right. I totally forget the exotic repositories.

Probably we need an opt-out at install to escape the magic

The initial idea was including an option called plataforms, just like AutoToolsBuildEnvironment. When passing the platform dictionary we can replace our customization:

platforms = {"x86_64": "all", "x86": "all"}
installer = SystemPackageTool(tool=AptTool(), settings=self.settings, platforms=platforms)
installer.install("foobar")

OUTPUT: apt-get install -y --no-install-recommends foobar:all

WDYT?

conans/client/tools/system_pm.py Outdated Show resolved Hide resolved
@@ -114,6 +116,17 @@ def install(self, packages, update=True, force=False):
self.update()
self._install_any(packages)

def _parse_packages_arch(self, packages):
if self._settings and cross_building(self._settings):
_, _, _, host_arch = get_cross_building_settings(self._settings)
Copy link
Member

Choose a reason for hiding this comment

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

I do not fully understand that packages will be installed for the host_arch always, as by definition, the apt-get will be running in the build-machine, not the host. Will this break everything for users with build_requires packages that use SystemPackageTool?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thinking again, you are right. I thought in the case where someone wants to cross-building some package and need a library from system. But sometimes users need a tool rather a library, which means the arch build.

We could detect if arch is not declared and use build_arch instead. WDYT?

- User is able to specify prefix/suffix according the arch

Signed-off-by: Uilian Ries <uilianries@gmail.com>
@lasote lasote assigned memsharded and unassigned uilianries May 28, 2019
Copy link
Contributor

@lasote lasote left a comment

Choose a reason for hiding this comment

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

It is more confusing that it should, because the idea is very simple. I suggested some changes.

conans/client/tools/system_pm.py Outdated Show resolved Hide resolved
conans/client/tools/system_pm.py Outdated Show resolved Hide resolved
conans/client/tools/system_pm.py Outdated Show resolved Hide resolved
conans/client/tools/system_pm.py Outdated Show resolved Hide resolved
conans/client/tools/system_pm.py Outdated Show resolved Hide resolved
conans/client/tools/system_pm.py Show resolved Hide resolved
@lasote lasote modified the milestones: 1.16, 1.17 May 30, 2019
Signed-off-by: Uilian Ries <uilianries@gmail.com>
Signed-off-by: Uilian Ries <uilianries@gmail.com>
Copy link
Contributor

@jgsogo jgsogo left a comment

Choose a reason for hiding this comment

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

Just change settings to conanfile in the constructor (and docs), probably it is a better pattern for every tool. It is a problem we already have in the MSBuild class.

@lasote
Copy link
Contributor

lasote commented Jun 28, 2019

Good catch @jgsogo . I agree. Please, @uilianries change it so we can merge this.

@uilianries
Copy link
Member Author

@jgsogo yeah, it sounds better, we are using such approach for CMake helper.

Signed-off-by: Uilian Ries <uilianries@gmail.com>
@uilianries
Copy link
Member Author

@lasote @jgsogo Done, both code and docs are updated with conanfile.

Copy link
Contributor

@jgsogo jgsogo left a comment

Choose a reason for hiding this comment

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

I promise to you this is the last change I request 🤞

conans/client/tools/system_pm.py Outdated Show resolved Hide resolved
uilianries and others added 2 commits June 28, 2019 10:40
Co-Authored-By: Javier G. Sogo <jgsogo@gmail.com>
Signed-off-by: Uilian Ries <uilianries@gmail.com>
@lasote lasote merged commit b75300b into conan-io:develop Jul 1, 2019
@lasote
Copy link
Contributor

lasote commented Jul 1, 2019

🎉

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

Successfully merging this pull request may close these issues.

[feature request] SystemPackageTool platform support
6 participants