-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[Proposal] Add info.shared_library_package_id()
in package_id()
of recipes with shared option and requirements
#8987
Comments
Ok so I've tested, I was not sure looking at the documentation: https://docs.conan.io/en/latest/reference/conanfile/methods.html#self-info-shared-library-package-id In terms of internal build in CCI, I think it's fine. For consumers it means that if they just change shared to True in one recipe A, and any option in another static/header only dependency B of this recipe (even an option which doesn't contribute to package id of B I think), it would not match package id of pre build shared package of recipe A in conan-center. But I guess it's also what we would like, isn't it? But let's say a recipe A depends on boost header-only. |
It would be an improvement for sure. I have one concern: does it imply that in a situation when a shared lib requires a static lib, it is impossible to override the version of the static requirement without rebuilding the shared lib? It would make 100% sense, but basically banish version overriding from CCI. |
Good point. But I don't think it's incompatible with CCI. It would mean that we wouldn't add |
there are several things I personally dislike with
given the above reasons, I am also not sure about its future, e.g. will this helper stay in 2.0, or will it get a proper fix for package ID calculation (conan-io/conan#9712). nevertheless, we're going to discuss this internally and let you know about the overall strategy going forward. |
So I recently tried to roll out the Anyway, it would be nice if when using |
@fanselm , it looks like it could be useful feedback to Conan client. If you feel like there is a bug of something that can be improved, please do, if it is not possible for Conan v1.x at least that feedback will be considered for the Conan v2 version which is right now under development. Regarding the topic of this issue. We asked and we've been said that Conan v2 won't have this problem, the dependency graph is improved and this situation is managed properly. So probably some of the tools or helpers won't be available (the best situation would be that they exist but are noop during the transition, but better if we don't need them at all in v2 codebase). Also, we have been working under this situation since the very beginning. Also, as it has been said, def shared_library_package_id(self):
if "shared" in self.full_options and self.full_options.shared:
for dep_name in self.requires.pkg_names:
dep_options = self.full_options[dep_name]
if "shared" not in dep_options or not dep_options.shared:
self.requires[dep_name].package_revision_mode() and We can document this behavior, I'm fine to start a section in the documentation of CCI about known issues where we can describe the problem and the possible workaround (better if we promote the one that doesn't require modifying recipes). Thinking about the future we can talk about using |
for the record, shared_library_package_id internally uses pakcage_revision_mode under the hood. |
I would like to add
self.info.shared_library_package_id()
topackage_id()
of all recipes which have both:shared
optioninfo.shared_library_package_id()
experimentationsInputs
coin-osi/0.108.6
depends oncoin-utils/2.11.4
coin-utils/2.11.4
depends onbzip2/1.0.8
andzlib/1.2.11
bzip2/1.0.8
andzlib/1.2.11
have no dependencyall these 4 recipes have a
shared
optionself.info.shared_library_package_id()
added topackage_id()
ofcoin-utils
andcoin-osi
recipessemver_direct_mode
1 profile:
Results
Additional informations and analysis:
the package id of a package if static is the same whether
self.info.shared_library_package_id()
is in the recipe or not => no breaking change to package id of static binaries in CCI.Basically it means that these 2 sentences are identical, and it's fine:
the package id of a package if shared and all dependencies static is different depending on whether
self.info.shared_library_package_id()
is in the recipe or not. It makes sense, shared options of its dependencies (direct & transitive) now contribute to its package id, and it's fine. Moreover there is likely no side effect for CCI, almost all shared packages in CCI are built against static dependencies.if shared and
self.info.shared_library_package_id()
in the recipe, all combinations of shared values in dependencies (direct and transitive) will lead to a different package id.When
coin-osi
andcoin-utils
are shared (the 4 last lines in the 2nd table), binaries ofcoin-osi
are the same regardless ofbzip2:shared
andzlib:shared
values, but package id are different. It comes from the fact that conan treats all dependencies of a recipe as public dependencies, so it can't know thatbzip2
&zlib
are private dependencies ofcoin-utils
. Otherwise conan would have known that a private dependency of a shared library (ie a dependency which doesn't leak in public headers of this library) can't leak into the binaries of downstreams of this shared library.I've not tested how it behaves when another option than
shared
is changed in a dependency (since I've used).semver_direct_mode
I would not expect a rebuild of the downstream shared packagessee also these discussions:
[question] Usage of shared_library_package_id #1609
[bug] impossible to consume all shared conan#9712
Feature: update conan new to latest guidelines conan#8106 (comment)
https://cpplang.slack.com/archives/C41CWV9HA/p1642585377350200
Currently, 486 recipes in CCI have dependencies (but I don't know how many of them are not header only libs or pure tools). By the way, regarding pure tools, they should also have a different package id depending on shared options of their dependencies, but it's out of scope of this proposal.
WDYT? Can we safely add this feature in CCI recipes?
/cc @madebr @SSE4 @uilianries @memsharded @lasote @jgsogo
The text was updated successfully, but these errors were encountered: