I'm using a ncurses conan package for some projects. In configuration of ncurses the path to terminfo is set. This path depends on the linux distribution. On ubuntu it is /lib and on centos it is /usr/share. Therefor I use OSInfo to determine the distro:
def build(self):
env_build = AutoToolsBuildEnvironment(self)
args = ["--without-debug"]
if self.options.shared:
args += ["--with-shared", "--without-normal"]
info = OSInfo()
if info.is_linux and info.linux_distro in ("debian", "ubuntu"):
args += ["--datadir=/lib"]
env_build.configure(configure_dir="src", args=args, build=False, host=False, target=False)
env_build.make()
The settings tuple contains:
"os", "compiler", "build_type", "arch"
As far as I understand following can happen.
I build this package on ubuntu and upload the package.
I use a centos with same compiler, arch and build_type.
Conan genrates the same hash on centos and ubuntu and downloads the ubuntu package on centos with wrong datadir.
How can I avoid this problem? I'd like to add something like os.distro into the settings tuple.
Yes, the best solution would be to augment the settings.yml with something like:
os:
...
WindowsStore:
version: ["8.1", "10.0"]
Linux:
distro: ["Ubuntu", "RHEL6", ...]
As it is a subsetting of os for Linux, it will generate different packages in the different distros.
You probably want to add distro=Ubuntu, etc., in your profiles and default profiles
Please remember that both the settings.yml and the profiles can be shared automatically with conan config install command.
As this a common question, I have opened an issue in the docs to add it to the FAQ: conan-io/docs#1137
I think the solution is pretty clear so I am considering this question as solved, but please feel free to comment any other idea.
Thanks!
Most helpful comment
Yes, the best solution would be to augment the
settings.ymlwith something like:As it is a subsetting of
osfor Linux, it will generate different packages in the different distros.You probably want to add
distro=Ubuntu, etc., in your profiles and default profilesPlease remember that both the settings.yml and the profiles can be shared automatically with
conan config installcommand.