emaint rewrite
I have just rebased the emaint re-write that I did some time ago. I
have also updated the modules for changes since I originally did the rewrite into a plug-in modules system. The changes have been condensed down into several key commits. The emaint branch is available on github: https://github.com/dol-sen/portage It is now very easy to add or remove modules, by only adding/removing the modules directory to/from the emaint/modules directory. All the help and menu options are picked up and added automatically. The modules.py code also only imports the individual module's __init__.py which contains the module_spec. The target module is only imported when it is requested, keeping speed and overhead to a minimum. The overall benefit to portage is that emaint should be easier to maintain, the modules are also now available to portage/emerge or other tools for internal script use, not just the bin/emaint script. The plug-in code in modules.py is also universal in nature and can easily be moved elsewhere in portage's namespace. It can be used for any number of independant plug-in systems. The plug-in modules can also be more complex in nature as well as export more than one specific functionality as well as more than just ["check", "fix"] options. I have also just created a cleanconfig module inspired from this forum topic: http://forums.gentoo.org/viewtopic-t-905022.html Please test it out to ensure everything is working 100%. To test just how easy it is to add/remove modules, simply move one or more modules in/out of the emaint/modules directory and run emaint --help, etc... I have some other dummy example modules I had prepared and will add them to the branch in an example-modules directory. -- Brian Dolbec <dolsen@gentoo.org> |
emaint rewrite
On Sat, 2011-12-10 at 20:20 -0800, Brian Dolbec wrote:
> I have just rebased the emaint re-write that I did some time ago. I > have also updated the modules for changes since I originally did the > rewrite into a plug-in modules system. > > The changes have been condensed down into several key commits. > > The emaint branch is available on github: > > https://github.com/dol-sen/portage > > It is now very easy to add or remove modules, by only adding/removing > the modules directory to/from the emaint/modules directory. > The overall benefit to portage is that emaint should be easier to > maintain, the modules are also now available to portage/emerge or other > tools for internal script use, not just the bin/emaint script. The > plug-in code in modules.py is also universal in nature and can easily be > moved elsewhere in portage's namespace. It can be used for any number > of independant plug-in systems. The plug-in modules can also be more > complex in nature as well as export more than one specific functionality > as well as more than just ["check", "fix"] options. > > Please test it out to ensure everything is working 100%. > A big "Thank you" to those of you that tested it, reported some bugs which I have since fixed. I have also now moved the functional code for the 'clean-config' feature from _emerge.main.clean_config() into an emaint plug-in module. I have also added 2 cli options to it's use in emaint. They are: -p, --pretend which removes the '-delete' from the PORT_LOGDIR_CLEAN cmd defined in make.globals. It therefore just lists all the files it would otherwise delete. 'find "${PORT_LOGDIR}" -type f ! -name "summary.log*" -mtime +7 -delete' -t, --time NUM which takes the number of days to change the default '+7' to for the run. It also takes 0 (zero) which deletes '-mtime +7' from the command to delete I have also changed all the modules check, fix functions to take **kwargs so that any module can accept (not necessarily use) more input parameters that are required to function. Doing this allowed the CleanLogs module to get all the cli options, settings passed into it. In this case: # emaint -Cpt 4 logs With that working I also changed the _emerge.main.clean_logs() to run the emaint module's CleanLogs.clean(). This also shows some of the flexibility of the new plugin system. The emaint module code is available to emerge or any other app for embedding. Some other notes to remember for designing new modules are: # emaint -t 4 logs # emaint -p logs Also work, even though they have "store" actions configured rather than the "callback" default, so do not directly initiate running the module. But, the emaint main() code will automatically add the -c, --check option to run the module's check(). In this case check() simply adds/sets the pretend option to true and calls the clean(). # emaint -c logs Of course also works the same as "emaint -Cp logs" Also since CleanLogs does not have a fix() it will not be included and run if a user does: # emaint -f all Which would be desired since it does not actually "fix" anything. > I have some other dummy example modules I had prepared and will add them > to the branch in an example-modules directory. Done. There is an example module which changes the class the plug-in system passes back to the caller according to an environment variable's setting. Please test everything again and let me know of any bugs, improvements I should fix/do. I believe Zac is planning to merge the changes soon. Thank you -- Brian Dolbec <dolsen@gentoo.org> |
emaint rewrite
On Sun, 2012-01-15 at 11:52 -0800, Brian Dolbec wrote:
> On Sat, 2011-12-10 at 20:20 -0800, Brian Dolbec wrote: > -t, --time NUM which takes the number of days to change the default > '+7' to for the run. It also takes 0 (zero) which > deletes '-mtime +7' from the command to delete ++ all matching logs > Thank you -- Brian Dolbec <dolsen@gentoo.org> |
emaint rewrite
On Sun, 2012-01-15 at 11:52 -0800, Brian Dolbec wrote:
> On Sat, 2011-12-10 at 20:20 -0800, Brian Dolbec wrote: > I have also now moved the functional code for the 'clean-config' feature Corrections... s/'clean-config'/'clean-logs' ^^ / > from _emerge.main.clean_config() into an emaint plug-in module. I have > also added 2 cli options to it's use in emaint. > Thank you -- Brian Dolbec <dolsen@gentoo.org> |
| All times are GMT. The time now is 09:44 PM. |
VBulletin, Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.