-
Notifications
You must be signed in to change notification settings - Fork 989
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
Feature/metadata2 #14152
Feature/metadata2 #14152
Conversation
conan/api/subapi/download.py
Outdated
@@ -62,5 +62,5 @@ def package(self, pref: PkgReference, remote: Remote, metadata=None): | |||
conan_file_path = layout.conanfile() | |||
conanfile = app.loader.load_basic(conan_file_path, display=pref.ref) | |||
output.info(f"Downloading package '{pref.repr_notime()}'") | |||
app.remote_manager.get_package(conanfile, pref, remote) | |||
app.remote_manager.get_package(conanfile, pref, remote, metadata) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was a bug, forgetting to pass the argument resulted in metadata not downloaded.
@@ -39,7 +39,9 @@ def cmd_export(app, conanfile_path, name, version, user, channel, graph_lock=Non | |||
# TODO: cache2.0 move this creation to other place | |||
mkdir(export_folder) | |||
mkdir(export_src_folder) | |||
conanfile.folders.set_base_recipe_metadata(recipe_layout.metadata()) | |||
recipe_metadata = recipe_layout.metadata() | |||
mkdir(recipe_metadata) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Automatic creation of the folder, so conan cache path --folder=metadata
has an existing folder to copy things to.
def download(self, url, file_path, auth, verify_ssl, retry, retry_wait): | ||
if not self._download_cache: | ||
def download(self, url, file_path, auth, verify_ssl, retry, retry_wait, metadata=False): | ||
if not self._download_cache or metadata: # Metadata not cached and can be overwritten |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The metadata cannot be cached, as it is not immutable, and not controlled by checksum
assert os.path.isdir(pkg_folder), "Pkg '%s' folder must exist: %s" % (str(pref), pkg_folder) | ||
for n in package.nodes: | ||
n.prev = pref.revision # Make sure the prev is assigned | ||
conanfile = n.conanfile | ||
# Call the info method | ||
conanfile.folders.set_base_package(pkg_folder) | ||
conanfile.folders.set_base_pkg_metadata(pkg_metadata) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This allows deployers to access dep.package_metadata_folder
to collect and deploy metadata.
urls = {fn: self.router.recipe_file(ref, fn) for fn in files} | ||
self._download_and_save_files(urls, dest_folder, files, parallel=True) | ||
result.update({fn: os.path.join(dest_folder, fn) for fn in files}) | ||
if metadata: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to separate the download to define metadata=True
that allows 1) not caching and 2) allows overwriting existing files
@@ -278,8 +278,8 @@ def recipe_metadata_folder(self): | |||
return self.folders.recipe_metadata_folder | |||
|
|||
@property | |||
def pkg_metadata_folder(self): | |||
return self.folders.pkg_metadata_folder | |||
def package_metadata_folder(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a rename, to not use the pkg
short version, everything else UI in Conan is package
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noting down the recipe metadata todos to have them for next release, but this looks good, thanks a lot for the explanation comments, made reviewing much easier :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
Changelog: Feature: Metadata improvements.
Docs: Omit
download_cache
(as it is not checksum, nor revision controlled, and it is mutable)pkg_metadata_folder
=>package_metadata_folder
ConanFileInterface
for deployers accessClose #4689
Close #4564