Gentoo Archives: gentoo-portage-dev

From: Brian Dolbec <dolsen@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] emaint rewrite
Date: Sun, 15 Jan 2012 19:53:05
In Reply to: [gentoo-portage-dev] emaint rewrite by Brian Dolbec
1 On Sat, 2011-12-10 at 20:20 -0800, Brian Dolbec wrote:
2 > I have just rebased the emaint re-write that I did some time ago. I
3 > have also updated the modules for changes since I originally did the
4 > rewrite into a plug-in modules system.
5 >
6 > The changes have been condensed down into several key commits.
7 >
8 > The emaint branch is available on github:
9 >
10 >
11 >
12 > It is now very easy to add or remove modules, by only adding/removing
13 > the modules directory to/from the emaint/modules directory.
15 > The overall benefit to portage is that emaint should be easier to
16 > maintain, the modules are also now available to portage/emerge or other
17 > tools for internal script use, not just the bin/emaint script. The
18 > plug-in code in is also universal in nature and can easily be
19 > moved elsewhere in portage's namespace. It can be used for any number
20 > of independant plug-in systems. The plug-in modules can also be more
21 > complex in nature as well as export more than one specific functionality
22 > as well as more than just ["check", "fix"] options.
23 >
25 > Please test it out to ensure everything is working 100%.
26 >
28 A big "Thank you" to those of you that tested it, reported some bugs
29 which I have since fixed.
31 I have also now moved the functional code for the 'clean-config' feature
32 from _emerge.main.clean_config() into an emaint plug-in module. I have
33 also added 2 cli options to it's use in emaint. They are:
35 -p, --pretend which removes the '-delete' from the PORT_LOGDIR_CLEAN
36 cmd defined in make.globals. It therefore just lists all
37 the files it would otherwise delete.
39 'find "${PORT_LOGDIR}" -type f ! -name "summary.log*" -mtime +7 -delete'
41 -t, --time NUM which takes the number of days to change the default
42 '+7' to for the run. It also takes 0 (zero) which
43 deletes '-mtime +7' from the command to delete
45 I have also changed all the modules check, fix functions to take
46 **kwargs so that any module can accept (not necessarily use) more input
47 parameters that are required to function. Doing this allowed the
48 CleanLogs module to get all the cli options, settings passed into it.
49 In this case:
51 # emaint -Cpt 4 logs
53 With that working I also changed the _emerge.main.clean_logs() to run
54 the emaint module's CleanLogs.clean(). This also shows some of the
55 flexibility of the new plugin system. The emaint module code is
56 available to emerge or any other app for embedding.
58 Some other notes to remember for designing new modules are:
60 # emaint -t 4 logs
61 # emaint -p logs
63 Also work, even though they have "store" actions configured rather than
64 the "callback" default, so do not directly initiate running the module.
65 But, the emaint main() code will automatically add the -c, --check
66 option to run the module's check(). In this case check() simply
67 adds/sets the pretend option to true and calls the clean().
69 # emaint -c logs
71 Of course also works the same as "emaint -Cp logs"
73 Also since CleanLogs does not have a fix() it will not be included and
74 run if a user does:
76 # emaint -f all
78 Which would be desired since it does not actually "fix" anything.
82 > I have some other dummy example modules I had prepared and will add them
83 > to the branch in an example-modules directory.
85 Done. There is an example module which changes the class the plug-in
86 system passes back to the caller according to an environment variable's
87 setting.
90 Please test everything again and let me know of any bugs, improvements I
91 should fix/do. I believe Zac is planning to merge the changes soon.
93 Thank you
94 --
95 Brian Dolbec <dolsen@g.o>


File name MIME type
signature.asc application/pgp-signature


Subject Author
Re: [gentoo-portage-dev] emaint rewrite Brian Dolbec <dolsen@g.o>
Re: [gentoo-portage-dev] emaint rewrite Brian Dolbec <dolsen@g.o>