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

[feature request] SystemPackageTool platform support #5026

Closed
3 tasks done
uilianries opened this issue Apr 24, 2019 · 4 comments · Fixed by #5215
Closed
3 tasks done

[feature request] SystemPackageTool platform support #5026

uilianries opened this issue Apr 24, 2019 · 4 comments · Fixed by #5215

Comments

@uilianries
Copy link
Member

uilianries commented Apr 24, 2019

To help us debug your issue please explain:

As supported by MSBuild, I would like to add the same platforms parameter for SystemPackageTool, where it will solve the package platform to be installed.

def system_requirements(self):
        if tools.os_info.with_apt:
            packages = [
                "libgtk-3-dev",
                "libatk1.0-dev",
                "libglib2.0-dev",
                "libpango1.0-dev",
                "libgdk-pixbuf2.0-dev",
                "libcairo2-dev",
                "libpango1.0-dev",
                "libcairo2-dev"
            ]
            if tools.cross_building(self.settings):
                target_arch = {"x86": "i386", "armv7": "arm", "armv7hf": "armhf"}
                conan_arch = str(self.settings.arch)
                packages = ["%s:%s" % (package, target_arch[conan_arch]) for package in packages]
            installer = SystemPackageTool()
            installer.install(" ".join(packages))

As you can see, I need to append the package name to solve the target platform. I think it could be solve automatically:

def system_requirements(self):
        if tools.os_info.with_apt:
            packages = [
                "libgtk-3-dev",
                "libatk1.0-dev",
                "libglib2.0-dev",
                "libpango1.0-dev",
                "libgdk-pixbuf2.0-dev",
                "libcairo2-dev",
                "libpango1.0-dev",
                "libcairo2-dev"
            ]
            distro_archs = None
            if tools.cross_building(self.settings):
                distro_archs = {"x86": "i386", "armv7": "arm", "armv7hf": "armhf"}
            installer = SystemPackageTool()
            installer.install(" ".join(packages), platforms=distro_archs)

Regards!

  • I've read the CONTRIBUTING guide.
  • I've specified the Conan version, operating system version and any tool that can be relevant.
  • I've explained the steps to reproduce the error or the motivation/use case of the question/suggestion.
@jgsogo
Copy link
Contributor

jgsogo commented Apr 25, 2019

You would need to pass to the installer.install:

  • the target platform, or
  • the distro_archs dictionary and the arch, right?

Or, does it make sense to have the distro_archs inside the SystemPackageTool and pass only the arch? Of course, that distro_archs should be an optional argument to override it.

Does it work for all the system packager tools (appending the arch to the package name like package:arch)? Does it work for all the versions?

...you know that system packages are something we don't feel comfortable with, that's the only reason for so many questions 😸

@jgsogo jgsogo self-assigned this Apr 25, 2019
@uilianries
Copy link
Member Author

I know, SystemPackageTools is evil, but is what we have for now ...

does it make sense to have the distro_archs inside the SystemPackageTool and pass only the arch?

I think yes, since is the same pattern for all packages that we have used with SystemPackageTools.

Of course, that distro_archs should be an optional argument to override it.

Right! If not specified, the behavior should be the same as now.

Does it work for all the system packager tools (appending the arch to the package name like package:arch)?

No ... APT uses the suffix :, YUM uses ., pacman uses the prefix lib-. No idea about Chocolatey

Does it work for all the versions?

Yes, they are compatible.

I think your question Does it work for all the system packager tools make me think again.

We can implement this feature, but we will need to check which package manager we are using. This is not different from what we have done for our packages, most of the time we just copy that pattern from one recipe to another.

@jgsogo
Copy link
Contributor

jgsogo commented Apr 25, 2019

So the SystemPackageTool wrapper should select the arch and then delegate on each one (apt, yum, pacman,...) the composition of the full name for the package (suffix with :, ., prefix lib-,...). Given this neccessity, it makes sense to build the name inside, as we cannot know from the outside which one will be the package manager we are using (ok, we have the OSInfo.with/is_XXX functions but it is an implementation detail).

Probably the cleanest implementation would be to pass the settings object to the SystemPackageTools and implement all the behavior inside (even the cross compiling detection), from outside we should be able to provide the dictionary arch->platform for those cases where the hardcoded one is not valid.

@uilianries
Copy link
Member Author

Probably the cleanest implementation would be to pass the settings object to the SystemPackageTools and implement all the behavior inside

Yes, it sounds better, since we can detect cross-building situation.

from outside we should be able to provide the dictionary arch->platform for those cases where the hardcoded one is not valid.

Right, as we have done for MSBuild helper.

Do you think this feature makes sense?

@jgsogo jgsogo removed their assignment Apr 25, 2019
uilianries added a commit to uilianries/conan that referenced this issue 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>
uilianries added a commit to uilianries/conan that referenced this issue May 24, 2019
- Validate yum and apt when installing x86

Signed-off-by: Uilian Ries <uilianries@gmail.com>
uilianries added a commit to uilianries/conan-docs that referenced this issue May 24, 2019
- Add new section explaning about setting parameter

Signed-off-by: Uilian Ries <uilianries@gmail.com>
@lasote lasote added this to the 1.16 milestone May 27, 2019
uilianries added a commit to uilianries/conan that referenced this issue May 27, 2019
- User is able to specify prefix/suffix according the arch

Signed-off-by: Uilian Ries <uilianries@gmail.com>
@lasote lasote modified the milestones: 1.16, 1.17 May 30, 2019
uilianries added a commit to uilianries/conan that referenced this issue May 31, 2019
Signed-off-by: Uilian Ries <uilianries@gmail.com>
uilianries added a commit to uilianries/conan that referenced this issue May 31, 2019
Signed-off-by: Uilian Ries <uilianries@gmail.com>
uilianries added a commit to uilianries/conan that referenced this issue Jun 28, 2019
Signed-off-by: Uilian Ries <uilianries@gmail.com>
uilianries added a commit to uilianries/conan that referenced this issue Jun 28, 2019
Co-Authored-By: Javier G. Sogo <jgsogo@gmail.com>
uilianries added a commit to uilianries/conan that referenced this issue Jun 28, 2019
Signed-off-by: Uilian Ries <uilianries@gmail.com>
lasote pushed a commit that referenced this issue Jul 1, 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>

* #5026 Support custom platform

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

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

* #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>

* #5026 Use conanfile for SystemPackageTool

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

* #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 pushed a commit to conan-io/docs that referenced this issue Jul 9, 2019
* Update SystemPackageTool conan-io/conan#5026

- Add new section explaning about setting parameter

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

* Use ConanFile when creating SystemPackageTool

Signed-off-by: Uilian Ries <uilianries@gmail.com>
lasote added a commit to conan-io/docs that referenced this issue Jul 9, 2019
* conan new template (#1286)

* conan new template

* added template description

* fix code-block

* Add detected_os description (#1276)

* Add detected_os description

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

* Update reference/tools.rst

Co-Authored-By: Javier G. Sogo <jgsogo@gmail.com>

* workpsace yaml list (#1288)

* Adding docs from host-specific proxies (#1241)

* document QNX Neutrino support (#1290)

* - document QNX Neutrino support

Signed-off-by: SSE4 <tomskside@gmail.com>

* Update integrations/qnx_neutrino.rst

Co-Authored-By: Daniel <danimanzaneque@gmail.com>

* - update settings.yml

Signed-off-by: SSE4 <tomskside@gmail.com>

* change default for CMake build_helper (#1292)

* add docs about pre/post_package_info (#1293)

* Add an example of removing system requirements via a wildcard (#1294)

* Add notes about new config global variables CONAN_RETRY and CONAN_RETRY_WAIT (#1295)

* fixed commands help update (Tried linux)

* updated conan new --file docs

* Deprecated -p in conan upload (#1300)

* Add documentation for tools.to_android_abi (#1102)

* Added missing bits of docs for Android flags (#1301)

* update help messages according to conan/#4896 (#1285)

* cascade policy (#1296)

* Purge 'export-pkg' reference docs (#1232)

* purge 'export-pkg' reference docs

* package folder

* write a couple of examples!

* change workspace by working folder

* typos related to formatting

* minor fix

* Feature/commands help update (#1299)

* Commands help update

* Added editable and workspace

* Update commands

* clarify behavior of package() (#1304)

* conan new jinja template (#1306)

* Add know pip installation issue (#1311)

* Add know pip installation issue

* Rephrase

* Update installation.rst

Co-Authored-By: Javier G. Sogo <jgsogo@gmail.com>

* Integrations refactor (#1308)

* Integrations

* Rename and fixed link

* Fix link

* Update integrations/custom.rst

Co-Authored-By: Daniel <danimanzaneque@gmail.com>

* Update integrations/vcs/git.rst

Co-Authored-By: Javier G. Sogo <jgsogo@gmail.com>

* Update integrations.rst

Co-Authored-By: Javier G. Sogo <jgsogo@gmail.com>

* Update integrations/build_system.rst

Co-Authored-By: Javier G. Sogo <jgsogo@gmail.com>

* Update integrations/cross_platform.rst

Co-Authored-By: Daniel <danimanzaneque@gmail.com>

* Update integrations/vcs/svn.rst

Co-Authored-By: Javier G. Sogo <jgsogo@gmail.com>

* Update integrations/linting/binary.rst

Co-Authored-By: SSE4 <tomskside@gmail.com>

* Msbuild and visual studio, clion update

* Same as clion

* Redirects

* Fixed symlinks

* Rewrite of the SCM optimization tip box (#1307)

* Rewrite of the SCM optimization tip box

* review

* Update creating_packages/package_repo.rst

Co-Authored-By: Javier G. Sogo <jgsogo@gmail.com>

* update docs to reflect conan new --template arg

* update help commands (#1315)

* update help

* update equal sign

* Conan Extension for Visual Studio (#1312)

* lines about VS extension after #1308

* Apply suggestions from code review

Co-Authored-By: Daniel <danimanzaneque@gmail.com>

* Add apple-clang 11 to settings.yml (#1327)

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

* add example with just one reference with further info using tuples (#1332)

* --package argument deprecation (#1317)

* Note about using only forward slashes for PROFILE_DIR variable (#1333)

* note about using only forward slashes

* it is the path to directory, not to the file

* typo

* working

* redirects

* working...

* working on docs

* Wip

* Wip

* Commands reference

* Message

* new package id modes (#1345)

* Update SystemPackageTool to support settings (#1291)

* Update SystemPackageTool conan-io/conan#5026

- Add new section explaning about setting parameter

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

* Use ConanFile when creating SystemPackageTool

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

* 1.17.0

* Changelog

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

Successfully merging a pull request may close this issue.

4 participants