Conan: [question] Recipe exported to local cache downloads package from remote

Created on 10 Jan 2020  路  7Comments  路  Source: conan-io/conan

I am having an issue with a behaviour that bit me recently and I would like to know whether it is the intended behaviour of Conan.

I am developing a library and a few small projects using it - for context I should be using the project in editable mode but I didn't manage to make it work, this issue is not about this - let's call the library my-lib and a small project my-project. I develop my-project locally on my computer and occasionally push new versions to the company's conan_server accessible via the remote company-remote; since we are still in early development stage the library appears under the name my-lib/0.1.0@company/stable and the version number doesn't change between releases yet. The remote contains precompiled packages for common configurations of my-lib.

I recently removed my-lib entirely via conan remove my-lib, changed a few .cpp files and reexported the recipe and sources to the local cache via conan export . company/stable. So far so good.

I then tried to use the new modifications in my-project, so I went to the project's directory and ran conan install conanfile.txt, expecting it to recompile my-lib with the recipe and sources that I just exported to the local cache according to the configuration in the conanfile.txt. Instead it downloaded a pre-compiled package of my-lib from company-remote with the corresponding configuration. I didn't expect the conan install to download the package from company-remote since there was already a recipe in the local and it wasn't explicitly linked to any remote (conan remote list_ref doesn't show anything and the metadata.json for the-lib indeed contains "remote": "null").

Is it the expected behaviour that in such a case Conan downloads the pre-compiled package from the remote despite the recipe being present in the local cache and not explicitly linked to said remote?


question

All 7 comments

Hi @Morwenn,
I think that maybe this could happen in the case that you don't have revisions enabled and you don't update the recipe version when making changes. Could this be the case?
Then, without using revisions, Conan does not know that the package is not generated with the new recipe version and downloads the one from the server thinking that matches the recipe. If that is the case I would suggest changing versions (or changing the user or channel for your local development) in recipes or using revisions.
Hope this helps. Please, tell me if the problem persists.

It's indeed the case that I'm not using revisions, however the recipe didn't change either: the main difference between the remote version and the local version are the exported .cpp sources. The recipe uses exports_sources = "*" so changing the source files doesn't change the recipe itself, which means that even revisions are probably not enough to solve my problem.

I think that changing the version will be the simplest thing to explain to other devs, so I will probably settle on that. Thanks!

Hi @Morwenn, sorry, I put the example for the modified recipe but it would be the same if you modify the cpp files. The new sources will affect the revision as well as the changes in the recipe code because the recipe revision is calculated hashing the recipe manifest that includes the exported sources. Just in case you want to give a try to revisions.

Oh, good catch, I thought it was really about the recipes themselves, thanks for the clarification.

I guess that I will discuss the issue with the other developers and feel the mood about what seems the easier to teach and the least likely to cause issues.

I'm closing this issue, it looks like clear enough. Feel free to open it again if you need to add anything.

Thanks!

I don't think I will need to reopen it. I'll just had a bit more feedback:

  1. I told the other devs to export my-lib/0.1.0@company/dev and consume it from projects trying the new feature as long as they were still in developing. It was easy to tech, and apparently doesn't cause new problems, which is good: the stable/dev change easier than having development versions.
  2. conan-io/docs#1298 could surely have helped me.

Got it, I've added https://github.com/conan-io/docs/issues/1298 to the backlog, improving the docs is always good

Was this page helpful?
0 / 5 - 0 ratings