Skip to content

Add export-pkg support for art:build-info create command#201

Merged
czoido merged 13 commits into
mainfrom
danimtb/bi_export-pkg
Aug 4, 2025
Merged

Add export-pkg support for art:build-info create command#201
czoido merged 13 commits into
mainfrom
danimtb/bi_export-pkg

Conversation

@danimtb

@danimtb danimtb commented Jul 29, 2025

Copy link
Copy Markdown
Member

closes #199

Comment on lines +131 to +136
def get_artifacts_folder(self, node, artifact_type):
if artifact_type == "package":
return node.get("package_folder")
else:
reference = RecipeReference.loads(node.get("ref"))
return self._conan_api.cache.export_path(reference)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the package folder is ok in both conan create/install and export-pkg graphs, however for the re recipe_folder, in the export-pkg graph the path points to the user local folder, so here I resorted to query the conan cache to get the recipe path in the cache

@danimtb

danimtb commented Jul 29, 2025

Copy link
Copy Markdown
Member Author

For clarification:

There was already a test for export-pkg at

def test_build_info_export_pkg():

The test was not failing because it it using the artifactory server to search for the "missing" files (conan_sources.tgz). However, the conan_sources.tgz are already in the conan cache, but the recipe_folder was pointing to the user's local folder instead of the conan cache (the fix in this PR), and it was not finding them.


PD: Another question arises at this point. If the recipe used for export-pkg, does not have source()/export/export_sources, does it make sense to look for the conan_sources.tgz?

@memsharded

Copy link
Copy Markdown
Member

PD: Another question arises at this point. If the recipe used for export-pkg, does not have source()/export/export_sources, does it make sense to look for the conan_sources.tgz?

A recipe that is created with export-pkg can have exports exported files, like conandata.yml and other auxiliary files to the recipe that are used by the recipe, not necessarily as sources.

Comment thread tests/test_build_info.py Outdated
Comment thread extensions/commands/art/cmd_build_info.py
@danimtb danimtb marked this pull request as ready for review July 30, 2025 10:38
Comment thread tests/test_build_info.py Outdated
run("conan new cmake_lib -d name=lib2 -d version=1.0 -d requires=lib1/1.0 --force")
run("conan build .")
run("conan export-pkg . --test-folder= -f json > export_pkg.json")
run("conan upload lib* -c -r conancenter --dry-run") # To generate the .tgz files in conan local cache

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More a question for the client: Isn't it possible to pass an empty remote or not add the argument for a dry-run? (I guess it's not but maybe it should be possible?) passing conancenter there feels a bit odd

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not possible, the --dry-run still checks in the remote what needs to be uploaded and what not, so it checks the server too.

@danimtb danimtb mentioned this pull request Jul 31, 2025
@czoido czoido merged commit 75899df into main Aug 4, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

commands/art: build_info: _get_local_artifacts() assumes that recipe_folder is in conan's cache

3 participants