[question] Avoid duplication conan packages.
What is your question?
Hello,
Is there a way to avoid duplication of conan packages? I have conan package with name, version, user, channel uploaded on the remote. If I upload conan package for the second time in the remote without any change in the files, it will add it as revision in the same package ID. But I don't want to be done this if there is no change in files.
When I have a change in the files and I upload conan package with the same name, version, user, channel, it is created a new package ID for it. But that it is because I decided.
But I want to know if there is a way to avoid duplication for unchanged files from packages.
Thanks in advance!
Have you read the CONTRIBUTING guide?
- [ ] I've read the CONTRIBUTING guide
Hi @Vasile-Creuco
Thanks for your question.
If I upload conan package for the second time in the remote without any change in the files, it will add it as revision in the same package ID. But I don't want to be done this if there is no change in files.
If you mean that you are doing a new build of an existing package, with exactly the same sources, so you have exactly the same recipe-revision, the main problem is that C++ build are often not deterministic, see https://blog.conan.io/2019/09/02/Deterministic-builds-with-C-C++.html, so doing a new build will result in a new package-revision (note that this is different from a recipe-revision), and then Conan will treat it as such.
Multiple package-revisions are not desired, they typically show some problem or flaw in the process, that is re-building from source things that shouldn't have been built in the first place, because there were already existing.
The recommended way to avoid this is to use the --build=missing or --build=missing:pkgpattern policies, even for the conan create command. This way, new package-revisions will not be created at all in the first place.
Hi @Vasile-Creuco
Any further question or comment from the above? Did you try the --build=missing policy for your conan create commands?
Thanks for your feedback.
Sorry for slight hijacking of the question but as it is the same topic: I want to use --build=missing for my package only. Is it allowed to use --build=missing:& here, or do I need to retype the package name despite Conan already knowing it?
It seems to work, the documentation however only talks of & when discussing the profile patterns and this is neither configuration nor an option or a setting.
Thanks
or do I need to retype the package name despite Conan already knowing it?
No, the syntax you're using is a supported use-case. We'll make sure to improve the docs to give an example of --build=missing:&