conan-io / hooks

Official Conan client hooks
MIT License
32 stars 46 forks source link

[conan-center] KB-H055: Wrongly detected on Conan v2 #488

Closed Linux13524 closed 1 year ago

Linux13524 commented 1 year ago

When enabling the conan-center hooks with Conan v2 we get the following error:

[HOOK - hook_conan_center.py] pre_export(): ERROR: [SINGLE REQUIRES (KB-H055)] Both 'requires' attribute and 'requirements()' method should not be declared at same recipe. (https://github.com/conan-io/conan-center-index/blob/master/docs/error_knowledge_base.md#KB-H055)

However we are not setting the method def requirements() and the attribute self.requires at the same time, we only use the method.

Did something change with Conan V2 that could lead to the self.requires attribute being detected by mistake?

uilianries commented 1 year ago

Hello @Linux13524 the conan-center.py hook is not adapted for Conan 2.x and won't be.

Also, the disabled-hook_conan-center-v2.py is not well ported, that's why it's named as disabled.

So, there is no such support for Conan v2 yet.

We need to rethink about hooks, as there are features not used on Conan v2 and also CCI counts with linters.

Linux13524 commented 1 year ago

Ah, I see. I supposed the disabled-hook_conan-center-v2.py is already ready for Conan V2.

Thanks for the clarification!

uilianries commented 1 year ago

@Linux13524 sorry, it's not well documented, but we tried to adapt it for Conan v2 and run over Conan Center Index, but not all cases were covered and started to fail for many recipes. It should be broken now, but actually we need to re-model it as many features changed from Conan 1.x to 2.x. I'll open a PR documenting it, because you are not the first one which tried to use Conan center hook and is surprise by an error.