conan icon indicating copy to clipboard operation
conan copied to clipboard

[question] Compatible packages for options of dependencies

Open Nekto89 opened this issue 3 years ago • 3 comments

I'm currently trying to use full_package_mode. Is it possible to somehow state that I don't care about some options of consumed library? For example, my library depends on Boost, but it doesn't use Boost::python at all. So values of "without_python", "python_executable", "python_version", "python_buildid" shouldn't affect binary compatibility.

I've tried using "del" in package_id but it doesn't work because RequirementInfo already contains just hash. Is there a way to achieve this properly? "del self.info.requires["boost"].options.without_python del self.info.requires["boost"].options.python_version"

Nekto89 avatar Sep 12 '22 12:09 Nekto89

Hi @Nekto89

Have you tried operating directly on the options, something like:

def package_id(self):
     del self.info.options["boost"].without_python
     self.info.requires["boost"].package_id = None

(not sure if del works on that, if not you can always force the definition to an empty string value or something like that.)

Note that you need to remove the option, and also do not depend on the package_id of the dependency.

In Conan 2.0 we have already changed that, by default a package_id doesn't depend on the options of the dependencies, only indirectly via the package_id, and that also changes depending on the package linkage, you can see a talk about it here: https://www.youtube.com/watch?v=kKGglzm5ous

memsharded avatar Sep 13 '22 04:09 memsharded

Note that you need to remove the option, and also do not depend on the package_id of the dependency.

Does it transform "full_package_mode" into "full_recipe_mode"? Or "None" causes recalculation without deleted options? I can fully ignore values of some options for calculating final package_id, but not all of them.

Nekto89 avatar Sep 13 '22 05:09 Nekto89

Yes, it would be equivalent, but if you don't want options to affect, you need to drop it, because otherwise it is going to affect your package_id, even if you remove the self.info.options from your consumer package_id, the package_id of boost will still change, and become part of yours. The only possibility would be to fork the boost recipe and drop those options.

memsharded avatar Sep 13 '22 12:09 memsharded