conan icon indicating copy to clipboard operation
conan copied to clipboard

[feature] Store more metadata in cache folders

Open jasal82 opened this issue 7 months ago • 2 comments

What is your suggestion?

For example, as far as I know there is no way to determine the reference that a folder in the cache belongs to. This is information that is known to Conan when the folder is created, so why is it not stored there? It is possible to navigate from ref to path using conan cache path but not the other way around. This could be helpful to determine the full reference for broken packages when dealing with compiler errors. So I would suggest serializing such information into a machine readable format and put it into the cache folders.

Have you read the CONTRIBUTING guide?

  • [x] I've read the CONTRIBUTING guide

jasal82 avatar Jun 17 '25 08:06 jasal82

Hi @jasal82

Thanks for the feedback. We need to check where to put that info, because it is not possible to put those files inside many folders, as that would affect the package contents. It might also have some maintenance challenges, like needing to remove it in some situations? We need to check that.

It was already discussed that at least the conan cache ref <path> (it returns the ref based on the path) would be useful, and I think at least that can be added, so I am marking this as a feature.

memsharded avatar Jun 17 '25 08:06 memsharded

@memsharded Thanks, I guess a conan cache ref <path> command would definitely make sense and solve some problems. However, I would still pursue the solution of making the cache navigable in both directions purely at file system level, so that you don't have to rely on a tool to retrieve information. This could also speed up Conan commands because it would serve as a cache (data structure) that you can read back.

jasal82 avatar Jun 17 '25 08:06 jasal82

https://github.com/conan-io/conan/pull/18518 PR is proposing a new conan cache ref <path> command that can return an artifact reference based on a specific folder.

We have discussed in the team, and there is unanimous opinion to not add any extra files in the Conan cache with that information, as that would add some maintenance burden of this metadata (it is already stored in the DB). Every Conan command has full output of the export folder, the source folder, the build folder, the package folder being used in the command, so navigating to those folders after a command is the recommended way, rather than navigating the raw cache filesystem

memsharded avatar Jun 24 '25 12:06 memsharded

Closed by https://github.com/conan-io/conan/pull/18518 for next Conan 2.18

memsharded avatar Jun 26 '25 09:06 memsharded