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] Validate includedirs directories - check that they exist #8315

Closed
1 task done
mathbunnyru opened this issue Jan 11, 2021 · 9 comments
Closed
1 task done

Comments

@mathbunnyru
Copy link

It would be great, if after package_info() Conan validated if all the directories set in includedirs do exist.
That would decrease the number of recipes with errors.

For example:
conan-io/conan-center-index#4176

@mathbunnyru
Copy link
Author

I do think, that this is a useful check to have, but I'm not sure where it should be implemented - it might be that the hooks is the best place.

If it's about hooks, please move the issue.

@mathbunnyru
Copy link
Author

And if community agrees, I want to implement this feature myself - I think it's relatively simple, and I will get familiar with conan or conan-hooks development workflow.

@memsharded
Copy link
Member

Hi @mathbunnyru

Thanks for offering to contribute this feature. Could you please clarify? The cpp_info already contains a feature (filter_empty) that will filter out non existing directories. Do you have some idea how you would approach the implementation?

@mathbunnyru
Copy link
Author

mathbunnyru commented Jan 11, 2021

Hi @mathbunnyru

Thanks for offering to contribute this feature. Could you please clarify? The cpp_info already contains a feature (filter_empty) that will filter out non existing directories. Do you have some idea how you would approach the implementation?

I think, if someone adds the path which doesn't exist to the includedirs, the package should output the error or even raise the error. It will tell the user that something is not as the user might expect.

I see 0 filter_empty usages in the CCI repo.

@memsharded
Copy link
Member

I think, if someone adds the path which doesn't exist to the includedirs, the package should output the error or even raise the error. It will tell the user that something is not as the user might expect.

I see. Just beware than in some contexts (like editable packages), the cpp_info might be pointing to a directory that doesn't exist yet (it will be populated later), so you might want to not raise an error in that case. There are also other extreme use cases, like users pointing to absolute paths (system proxy packages), that do not exists yet either, and Conan should not be raising.

I see 0 filter_empty usages in the CCI repo.

Yep, filter_empty is the internal thing in the Conan codebase you can grep for if you want to check what it does regarding non-existing directories.

Maybe this feature could be a hook?

@mathbunnyru
Copy link
Author

Yes, if theoretically it can be implemented as a hook, that would be better I suppose.
The problem is I don't know at all how hooks are implemented 😂

@memsharded
Copy link
Member

Hi @mathbunnyru

I suggest having a look at the hooks repo, where we have some hooks and also the production hooks applied at ConanCenter. This one https://github.com/conan-io/hooks/blob/master/hooks/binary_linter.py is checking the binaries, so getting there and checking the existence of "includedirs" seems relatively easy. The documentation here: https://docs.conan.io/en/latest/reference/hooks.html might also help.

Probably it makes a lot of sense to have it as a ConanCenter hook, so it is applied for contributions to conan-center-index.

@mathbunnyru
Copy link
Author

Thanks for detailed answer @memsharded! I will take a look!

@AbrilRBS
Copy link
Member

https://github.com/conan-io/hooks/blob/master/hooks/conan-center.py#L1332 checks for the existence of the includedirs in every component. Marking this as complated by conan-io/hooks#418 :)

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

No branches or pull requests

3 participants