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

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 some commits May 24, 2019

#5026 Detect package prefix name by settings
- 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>
#5026 Validate SystemPackageTool with settings
- Validate yum and apt when installing x86

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

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

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor

commented May 27, 2019

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

@uilianries

This comment has been minimized.

Copy link
Member Author

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?

@@ -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)

This comment has been minimized.

Copy link
@memsharded

memsharded May 27, 2019

Contributor

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?

This comment has been minimized.

Copy link
@uilianries

uilianries May 27, 2019

Author Member

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?

#5026 Support custom platform
- 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

@lasote
Copy link
Contributor

left a comment

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

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 Outdated
Show resolved Hide resolved conans/client/tools/system_pm.py

@lasote lasote modified the milestones: 1.16, 1.17 May 30, 2019

uilianries added some commits May 31, 2019

#5026 Remove useless code
Signed-off-by: Uilian Ries <uilianries@gmail.com>
#5026 Rename methods for package name
Signed-off-by: Uilian Ries <uilianries@gmail.com>
@lasote

lasote approved these changes Jun 28, 2019

@jgsogo
Copy link
Member

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

This comment has been minimized.

Copy link
Contributor

commented Jun 28, 2019

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

@uilianries

This comment has been minimized.

Copy link
Member Author

commented Jun 28, 2019

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

#5026 Use conanfile for SystemPackageTool
Signed-off-by: Uilian Ries <uilianries@gmail.com>
@uilianries

This comment has been minimized.

Copy link
Member Author

commented Jun 28, 2019

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

@jgsogo
Copy link
Member

left a comment

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

Show resolved Hide resolved conans/client/tools/system_pm.py Outdated

uilianries and others added some commits Jun 28, 2019

#5026 Validate output instance
Co-Authored-By: Javier G. Sogo <jgsogo@gmail.com>
#5026 Fix bad indented block
Signed-off-by: Uilian Ries <uilianries@gmail.com>

@lasote lasote merged commit b75300b into conan-io:develop Jul 1, 2019

2 checks passed

continuous-integration/jenkins/pr-head This commit looks good
Details
license/cla Contributor License Agreement is signed.
Details
@lasote

This comment has been minimized.

Copy link
Contributor

commented Jul 1, 2019

🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.