Closed lo1ol closed 6 days ago
Hi @lo1ol
There are 2 different concepts here:
conan config home
<conan_home>/p
(note the p
) folder, which is the one containing the actual package recipes and binaries.The core.cache:storage_path
conf changes the second one, the package storage, but not the Conan home/cache folder.
ok. So what is the proper way for getting package storage path? Something like this?
config = ConfigAPI.load_config(conan_api.home_folder)
cache_folder = config.get("core.cache:storage_path")
if cache_folder is None:
cache_folder = os.path.join(conan_api.home_folder,"p")
The subapis shouldn't be instantiated, you should always use the object from the conan_api
:
conan_api.sub_api.method()
conan_api.config.get(...)
Still your code above is not correct, the cache_folder
will point in the second case (if storage_path is not defined) to the Conan home, while if storage_path
is defined, it will return the "package storage", which is a different folder.
Also, some guidelines about the cache and package storage:
conan cache path
Not sure what you are aiming to do with the "storage_path" folder, but please note that everything there is an internal implementation detail (can change at any time in any future Conan version), and shouldn't be modified externally, that could be undefined behavior and fail in unexpected ways.
Not sure what you are aiming to do with the "storage_path" folder
We have several docker containers that could build project in parallel. All of them started on the same machine. Containers has the cache drive, that mounted to /conan_cache
folder. We want to sync access to it via flock.
So, this flock has to be located in common space too.
I got your idea that this folder is read-only. I think, we will start to keep cache in /conan/cache
folder and will create lock file in /conan
folder
Describe the bug
Hi!
I noticed, that in my custom command
conan_api.cache_folder
returns'/home/user/.conan2'
. But Inglobal.conf
it set to another folder: "core.cache:storage_path=/conan/some_folder".Is it Ok?
How to reproduce it
Add custom command: