Remove direct dependency on zlib?
garethsb opened this issue · 0 comments
d5a45b0 added a direct dependency on zlib in order to avoid version conflict between indirect dependencies on zlib via cpprestsdk and boost.
Now that we are using Conan 2, we have more facilities to avoid that sort of breakage.
For starters, the recipes for Boost and cpprestsdk now specify a version range:
https://github.com/conan-io/conan-center-index/blob/66ef25739f25d2a23c131bc4eb0fd0dfab8450b5/recipes/boost/all/conanfile.py#L650
https://github.com/conan-io/conan-center-index/blob/66ef25739f25d2a23c131bc4eb0fd0dfab8450b5/recipes/cpprestsdk/all/conanfile.py#L63
Secondly, Conan now provides a way of clearly specifying an override for dependencies which still isn't a direct dependency:
https://docs.conan.io/2/tutorial/versioning/conflicts.html
However, as far as I know, that feature is not available as a conan install
command line argument, nor available within a conanfile.txt. I don't think lockfiles are the answer, because this conflict can happen while computing the dependency graph the first time.
So I think the correct solution is to use a conanfile.py with an override=True
requirement, instead of a conanfile.txt.
Note that in the CCI recipe, I am actually removing the zlib dependency completely, because the best practice is that override=True
is specified by the ultimate consumer recipe:
conan-io/conan-center-index#23411
If we keep the conanfile.txt, we should still remove the [imports]
section, since this is ignored in Conan 2, you need to use generators:
https://docs.conan.io/1/migrating_to_2.0/recipes.html#removed-imports-method
The CCI recipe already has a fully-fledged generate
method:
https://github.com/conan-io/conan-center-index/blob/66ef25739f25d2a23c131bc4eb0fd0dfab8450b5/recipes/nmos-cpp/all/conanfile.py#L90