conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
8.17k stars 974 forks source link

[bug] EndeavourOS not among list of distros listed for pacman support #11970

Closed cchulo closed 2 years ago

cchulo commented 2 years ago

Environment Details (include every applicable attribute)

Steps to reproduce (Include if Applicable)

In a python interpreter

>>> from conans import tools
>>> tools.os_info.with_pacman
False
>>>tools.os_info.is_linux
True
>>> tools.os_info.linux_distro
'endeavouros'

We need to add endeavouros to this line

Logs (Executed commands with output) (Include/Attach if Applicable)

As a result of the above, OpenGL recipe doesn't know how to install itself, xorg/system also fails to install some dependencies as well

opengl/system: Package installed 5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9
opengl/system: Downloaded package revision 0
xorg/system: Retrieving package 5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 from remote 'conancenter' 
Downloading conanmanifest.txt completed [0.06k]                                          
Downloading conaninfo.txt completed [0.16k]                                              
Downloading conan_package.tgz completed [0.06k]                                          
Decompressing conan_package.tgz completed [0.00k]                                        
xorg/system: Package installed 5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9
xorg/system: Downloaded package revision 0
opengl/system: WARN: Don't know how to install OpenGL for your distro.
ERROR: xorg/system: Error in package_info() method, line 79
        pkg_config.fill_cpp_info(
        ConanException: pkg-config command ['pkg-config', '--print-provides', 'xvmc', '--print-errors'] failed with error: Command 'pkg-config --print-provides xvmc --print-errors' returned non-zero exit status 1.
Package xvmc was not found in the pkg-config search path.
Perhaps you should add the directory containing `xvmc.pc'
to the PKG_CONFIG_PATH environment variable
Package 'xvmc', required by 'virtual:world', not found
cchulo commented 2 years ago

imo, it feels a bit cumbersome to have to list out distros, couldn't it use shutil instead?

The check could be something like:

import shutil

# ...

@property
    def with_pacman(self):
        if self.is_linux:
            return shutil.which('pacman') != None
        # ...

This will then take care of any flavor of Arch in the future, only requirement is shutil is only available in python 3.3+, if there is a need for compatibility with all of python3, you could add a custom which command as found here

memsharded commented 2 years ago

Hi @cchulo

There is a difference in a tool being installed in the system, and users really wanting to run that tool. It is not impossible to have a pacman executable in your Linux system that is the pacman videogame (for other distros), for example.

Also Conan will try in general not having to guess. So what it has is defined a common default mapping of OS-system package managers. If you want to add EndeavourOS to that list, pull requests are welcome! Note that we are talking about the new tooling in https://docs.conan.io/en/latest/reference/conanfile/tools/system/package_manager.html, not the legacy ones you are referring above, that will not be changed now that we are already in 2.0-beta.

Also in the meantime, it is simple to define that you want to run pacman, if you check that doc, you can see that the conf tools.system.package_manager:tool allows you to define pacman, and everything should work.

cchulo commented 2 years ago

@memsharded ah that is a good point, I had not considered that

Your proposed solution should work, I will try it. I will create a pull request anyway to include this string addition.

memsharded commented 2 years ago

@memsharded ah that is a good point, I had not considered that

Yeah, we have learned from experience, some distros containing more than one system package manager, and then everything was a mess, distros with matching applications that were no system package managers... the only way was to allow users to explicitly define the tool they want (besides a hardcoded default for most common distros)

cchulo commented 2 years ago

@memsharded thank you very much for the guidance, running my installation script worked with these additional options:

tools.system.package_manager:tool=pacman
tools.system.package_manager:mode=install
tools.system.package_manager:sudo=True
memsharded commented 2 years ago

Closed by https://github.com/conan-io/conan/pull/11971, will be in 1.53. Thanks very much for the fix!