docs icon indicating copy to clipboard operation
docs copied to clipboard

[question] Avoid duplication conan packages.

Open Vasile-Creuco opened this issue 7 months ago • 4 comments

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

Vasile-Creuco avatar Jul 16 '25 09:07 Vasile-Creuco

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.

memsharded avatar Jul 16 '25 11:07 memsharded

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.

memsharded avatar Jul 23 '25 15:07 memsharded

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

numo68 avatar Sep 18 '25 18:09 numo68

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:&

AbrilRBS avatar Sep 19 '25 07:09 AbrilRBS