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.

uilianries added 2 commits May 24, 2019
- 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

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 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 lasote commented May 27, 2019

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

@uilianries
Copy link
Member Author

@uilianries uilianries commented May 27, 2019

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

@memsharded memsharded May 27, 2019

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

@uilianries uilianries May 27, 2019

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

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 removed this from the 1.16 milestone May 30, 2019
@lasote lasote added this to the 1.17 milestone May 30, 2019
uilianries added 2 commits May 31, 2019
Signed-off-by: Uilian Ries <uilianries@gmail.com>
Signed-off-by: Uilian Ries <uilianries@gmail.com>
lasote
lasote approved these changes Jun 28, 2019
Copy link
Member

@jgsogo jgsogo left a comment

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 lasote commented Jun 28, 2019

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

@uilianries
Copy link
Member Author

@uilianries uilianries commented Jun 28, 2019

@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

@uilianries uilianries commented Jun 28, 2019

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

Copy link
Member

@jgsogo jgsogo left a comment

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 Jun 28, 2019
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
2 checks passed
@lasote
Copy link
Contributor

@lasote 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
Linked issues

Successfully merging this pull request may close these issues.

6 participants