Skip to content
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

Merged
merged 7 commits into from
Jul 12, 2023
Merged

Feature/metadata2 #14152

merged 7 commits into from
Jul 12, 2023

Conversation

memsharded
Copy link
Member

@memsharded memsharded commented Jun 22, 2023

Changelog: Feature: Metadata improvements.
Docs: Omit

  • Creating metadata folders automatically, so easier for users
  • Fixed bug in downloading for the first time with metadata
  • Allowed re-downloading without "file already exists" error (required manual removal, very inconvenient)
  • Make sure metadata is not cached in the download_cache (as it is not checksum, nor revision controlled, and it is mutable)
  • Renamed interface pkg_metadata_folder => package_metadata_folder
  • Made available the metadata folders in ConanFileInterface for deployers access
  • Initial POC of deployers access to metadata (missing recipe metadata)

Close #4689
Close #4564

@memsharded memsharded added this to the 2.0.8 milestone Jun 22, 2023
@@ -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)
Copy link
Member Author

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)
Copy link
Member Author

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
Copy link
Member Author

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)
Copy link
Member Author

@memsharded memsharded Jun 23, 2023

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:
Copy link
Member Author

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):
Copy link
Member Author

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.

@memsharded memsharded marked this pull request as ready for review July 8, 2023 20:22
@memsharded memsharded requested review from AbrilRBS and franramirez688 and removed request for AbrilRBS July 8, 2023 20:23
Copy link
Member

@AbrilRBS AbrilRBS left a 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 :)

Copy link
Contributor

@franramirez688 franramirez688 left a comment

Choose a reason for hiding this comment

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

👏

@czoido czoido merged commit edf6c49 into conan-io:release/2.0 Jul 12, 2023
@memsharded memsharded deleted the feature/metadata2 branch July 12, 2023 20:59
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.

Capture build log in package [question] How to annotate packages with visible free-form meta data
4 participants