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

extra patches path #17520

Draft
wants to merge 20 commits into
base: develop2
Choose a base branch
from

Conversation

memsharded
Copy link
Member

Changelog: Feature: Allow applying patches on "create" time for conan-center-index like layouts from an external centralized folder.
Docs: https://github.com/conan-io/docs/pull/XXXX

Close #17360

Some constraints:

  • Recipes must have export_conandata_patches() call
  • Recipes must have the conandata.yml with a patches entry (otherwise export_conandata_patches fails anyway)
  • It only works after a trim_conandata(). If not it will most likely crash.

@memsharded memsharded added this to the 2.12.0 milestone Dec 23, 2024
@kambala-decapitator
Copy link
Contributor

just tested this with my patch from conan-io/conan-center-index#26260 - worked great!

at first I tried to pass the new config value on command line, but got

ERROR: [conf] 'core.*' configurations are not allowed in profiles.

is it intended that this feature is global and not per-profile?

And I didn't see the new message Applying extra patches 'core.sources.patch:extra_path', although expected to. The command I used was conan install --require minizip/1.3.1 ...

@memsharded
Copy link
Member Author

Thanks for testing this @kambala-decapitator !

ERROR: [conf] 'core.*' configurations are not allowed in profiles.

Yes, it is not possible. The core config is independent of the profile (applies to both host and build context, but it is mostly something that is kind of more "internal" to Conan than recipe code). It can be defined in:

  • global.conf
  • Command line with the -cc (--core-conf)

Consider for example a conan source execution, that apply patches. But the conan source is "profile-less", it doesn't use any profile at all. So the idea is that the conf for this can't be per-profile, but needs to be global.

Co-authored-by: Andrey Filipenkov <[email protected]>
@kambala-decapitator
Copy link
Contributor

I should've used -cc instead of -c. Thank you for the explanation!

kambala-decapitator and others added 18 commits January 15, 2025 11:26
- was inconsistent before: returned False if the
  pattern was not found (with strict off), otherwise None
* better traces and msgs

* fix tests
* working in workspace_api

* fixed loader + run() error
…io#17507)

* proposing new --format=file.ext feature

* change approach and some simplifications

* remove unused

* minor changes

* minor changes

* simplify a bit

* fix format

* minor changes

* fix

* move colorama deinit/reinit

* add out-file only if formatters

* revert

* wip

* do not deinit/reinit if not tty

* clean import

* minor changes

---------

Co-authored-by: czoido <[email protected]>
* new test for remote_login

* unittest->pytest
* Keep sessions around between each ConanRequester

Avoid creating a new session for each ConanRequester instance, this
helps a lot with performance, as it avoids the overhead duplicate handshakes

* Patch new cached value on ConanRequester tests

* Modify adapter as needed

* Fix tests

* Name

* Update conans/client/rest/conan_requester.py

* Refactor requester tests

* Reinit is not part of this PR

* Refactor request usage out of app

* Make max_retries a local variable
Add rest of posible ConanBasicApp usages
As the API actually accepts the remote to be `None`, this should also be
reflected in the type information in order to support users.
* Updated to use maxsplit=1

* Add tests, unquote paths with spaces

---------

Co-authored-by: Abril Rincón Blanco <[email protected]>
* refactor moving model conans->conan

* fix tests
@@ -69,5 +69,8 @@ def trim_conandata(conanfile, raise_if_missing=True):
if version_data is not None:
result[k] = {version: version_data}

# Update the internal conanfile data too
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 is important @AbrilRBS @jcar87
This was not done before, but it seems it make sense, otherwise self.conan_data in recipes can have outdated/trimmed information. Please check if this could be an issue in any ConanCenter flow.

Copy link
Member

@AbrilRBS AbrilRBS Jan 15, 2025

Choose a reason for hiding this comment

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

It's not an issue in the current CCI CI, as the current flow is to first export each version separatedly, and upload it to a staging repo from which workers can then download it to build them, so the create/install is done on an already trimmed recipe conandata

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 possible issue would be if some custom command or something was reading conanfile.conandata after the export that trimmed it and somehow reading other versions information too. I doubt this happens ,but just in case

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

Successfully merging this pull request may close these issues.

[feature] consider ability to apply/inject arbitrary patches to recipe without forking repository
7 participants