-
Notifications
You must be signed in to change notification settings - Fork 990
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[question] Metadata feature with conan build -of #15091
Comments
Hi @maitrey Thanks for your question
This is expected. At The only metadata that can be saved at Please let me know if this clarifies the issue. |
Thanks for getting back to me. I understand then I could copy to the recipe folder in CMakeLists or the build method and then use it in export method. |
No, that is not possible.
There shouldn't be any issues for running with Python 3.12, but let us know if otherwise. Still always recommended to move to the latest patch for any minor version, the current patch is 2.0.13, please try to update when possible. |
I think I did not understand then the package metadata feature properly.
And the export method looks like this:
If I donot use it in the export method then I do not see the needed metadata in the conan cache. |
The $ conan cache path compmgr/1.0.0@autosar/release:<package_id> --folder=metadata As it seems you are putting there tests results, it doesnt have sense to put that as "recipe metadata", because the tests are build and executed after the recipe is exported/created, the tests only exists after build, so the tests results can only be package metadata, not recipe metadata. |
Thanks james.And do I use the build and export method correctly? |
When I run this example with conan build . -of testing
It does create the metadata folder in testing but when i use conan export-pkg . -of testing, it doesnot copy it to the cache. |
So as per the documentation conan build + conan export-pkg does not do it automatically. I need to run this command and add some copy commands after the package creation has finished: |
Package id could have multiple package revisions. How to get the accurate package id so that I upload the metadata to the write package id? |
Yes, at the moment for
If you did a Note in any case, and this is very important, that in Conan 2.0, having more than 1 package revision for the same package_id is considered a failure in the process. Packages shouldn't have more than 1 package revision. If there is more than one, it means that something went wrong in the process or CI, and something that didn't have to be re-built was unnecessarily rebuilt. If anything changes in the source, the "recipe-revision" will be unique. If anything changes in the configuration, compiler, setup, etc, the |
Because conan create does not offer -of which is needed for our developers. They need depedencies in the same location as the sources. |
This would be a separate discussion. Why do they need the dependencies located with the sources? In the vast majority of cases this wouldn't be necessary, and using from the Conan cache is the recommended practice. Also, the flows for development are typically different than the ones for package creation. Users can use
You can do:
No prob with that. The code in the docs is showing the default of using the latest revisions. |
We use the same interface locally(conan build -of + conan export-pkg) as well as in CI/CD. Developers are not allowed to upload packages to the remote conan repo , that is done only by CI. |
Ok, sounds good that developers are not uploading. I think it might also be doable to implement the copy of the metadata in the |
Could you please give me an example what I should include in the export() and package() method to attach the meta data? |
This? This is needed just to emulate the generation of logs. It is not needed, in theory the logs will come from the build system. The process for exporting the metadata could be like (not tested): def export(self):
# logs that might be generated in the recipe folder at "export" time.
# these would be associated with the recipe repo and original source of the recipe repo
copy(self, "*.log", src=os.path.join(self.recipe_folder, "metadata"),
dst=os.path.join(self.recipe_metadata_folder, "logs"))
def package(self):
# logs originated at build() step, the most common ones
copy(self, "*.logs", src=os.path.join(self.build_folder, "metadata"),
dst=os.path.join(self.package_metadata_folder, "logs")) |
self.package_metadata_folder points to the output folder in the package method. And not to the package folder in the conan cache. Also all the test reports are located in the build folder and in the export method I donot know any variable that can access the self.build_folder. |
I have been double checking this. It seems that |
Submitted #15126, that should fix, and would allow copying the package metadata in the |
What is your question?
Dear Conan Folks,
I am using the following command for building packages:
And I export the contents of the package afterwards.
When I use the metadata feature : https://docs.conan.io/2/devops/metadata.html
I donot use hooks but mainly using the copy calls in build and export method.
In the export method , I donot have access to self.build_folder or self.package_metadata_folder.
Is there any variable that can directly link to self.package_metadata_folder in the export method?
I have some test reports that I like to export as a metadata to the package.
Thanks a lot for your help!
Have you read the CONTRIBUTING guide?
The text was updated successfully, but these errors were encountered: