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] Permit pattern/range matching in local-recipes-index config.yml #17774

Open
1 task done
mrjoel opened this issue Feb 13, 2025 · 1 comment
Open
1 task done
Assignees

Comments

@mrjoel
Copy link
Contributor

mrjoel commented Feb 13, 2025

What is your suggestion?

We're experimenting with using the local-recipes-index. For a meta-package we have, we have historically just had it located in <repo>/recipes/package-foo/conanfile.py. We use the set_version() method to use dynamic git-based versioning of the version. We're wanting to move it into <repo>/recipes/package-foo/all/conanfile.py but configuring it in a static config.yml without pattern matching then becomes problematic.

This may be a chicken and egg request however, since the config.yml seems to serve as an index of available versions?

Is there a way to "properly" index this in the layout, or do we still need to resort to just directly conan exporting the recipe, and have the version obtained in that way? IOW, not usable directly from local-recipes-index.

The problem is that we'd like to ship it alongside other recipes in the repo, even if it needs to be directly exported. However, when trying to do simple things like conan list "*" -r=local-index I get an error of "Corrupted repo, folder package-foo without 'config.yml'. For now I've just put a dummy version of 0.0.0in theconfig.yml`, but it'd be nice to have a better option.

Have you read the CONTRIBUTING guide?

  • I've read the CONTRIBUTING guide
@memsharded memsharded self-assigned this Feb 14, 2025
@memsharded
Copy link
Member

Hi @mrjoel

Thanks for the suggestion.

This is the internal code of local-recipes-index:

        for r in recipes:
            if r.startswith("."):
                # Skip hidden folders, no recipes should start with a dot
                continue
            if not fnmatch(r, name_pattern):
                continue
            folder = self._get_base_folder(r)
            config_yml = self._load_config_yml(folder)
            if config_yml is None:
                raise ConanException(f"Corrupted repo, folder {r} without 'config.yml'")
            versions = config_yml["versions"]
            for v in versions:

So yes, it leverages the config.yml versions to resolve all the versions. It is the only way it is tractable, if every recipe had to be loaded to process the versions, it will be very slow.

For a meta-package we have, we have historically just had it located in /recipes/package-foo/conanfile.py. We use the set_version() method to use dynamic git-based versioning of the version.

I think this is an effect of the suggestions in https://docs.conan.io/2/devops/devops_local_recipes_index.html

It is designed for third-party packages, where recipes in one repository are creating packages with sources located elsewhere. To package your own code, the standard practice of adding conanfile.py recipes along with the source code and using the standard conan create flow is recommended.

Your meta-package is not a third-party, but a first party. Trying to make it fit in the local-recipe-index structure doesn't fit naturally.

So I am afraid that this will not be possible, chicken-and-egg, versions need to be read from the config.yml for this to work. Thanks for the suggestion anyway!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants