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

Support for shared processors in repos #82

Closed
timsutton opened this issue Apr 3, 2014 · 2 comments
Closed

Support for shared processors in repos #82

timsutton opened this issue Apr 3, 2014 · 2 comments

Comments

@timsutton
Copy link
Member

Some people are writing more general-purpose processors like importers, downloaders, etc. We don't currently have a mechanism to have autopkg install and read these processors from some common area, so that somebody could maintain a processor outside of the AutoPkg core and yet still have it easily usable by others' recipes. Decided to open an issue to try and propose a solution we can test out.

One idea discussed today in IRC: support the placing of custom processors in a special directory like Processors (?) within a recipe repo which can contain these, and they would be loaded as additional Python modules available to AutoPkg. If someone wanted to keep a separate repo for just for one or more custom processors that should also be fine.

Currently the autopkglib and a recipe's folder are searched for processors, and so this would need to extend to searching a certain reserved location within each item in RECIPE_SEARCH_DIRS.

The issue of namespacing came up - there would be a conflict if more than one person writes a processor with the same name and both try to get imported.

Since we now use a Process step's Processor key to take the module name, perhaps we support namespacing within this repo, in a form like: com.github.autopkg.timsutton-recipes:MyGreatProcessor. The actual module to load is prefixed by the dirname of the recipe repo.

I'm not exactly sure how this should work if I were giving the --search-dir options, however. The --search-dir given could be a repo or not, and if it is, we could only possibly infer that it's the same repo by actually and reading the repo config in .git/config, which seems a bit clunky.

We could also still support searching all RECIPE_SEARCH_DIRS if a non-namespaced value is given for Processor, with log feedback about thedir (if any) in which the processor was found, but as most people using third-party shared processors should be namespacing them, it means we need to have a reliable way to determine whether a search path corresponds to this namespace. What I just outlined seems like it could work, but perhaps there are more elegant, cleaner ways.

All of this would also mean we should have some kind of RequiredRepos-like key with which a recipe can specify other repos that it requires in order to run - but that is an issue that can be addressed in parallel.

@jessepeterson
Copy link
Member

Also note #38 for some (short) historical thoughts on this.

@timsutton
Copy link
Member Author

Implemented for 0.4.0.

Relevant discussion here:

https://groups.google.com/d/msg/autopkg-discuss/Wi867GXaOl8/l7mrnt51yRQJ

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