Friday, February 19, 2010

New gentoolkit utility --- analyse

Well, I've gone and done it again, I haven't finished the eclean re-write and I've found something else to work on. It all started from a forum post. He wanted to fix his mistakes and it looked like the only way was the hard way.

Having been doing more gentoolkit coding I put together a quick and dirty python script to output some USE flag info about his installed pkgs. With that and me saying I could add some more code to spit out a package.use file populated with what is installed/what flags enabled/disabled. I have now been coding it up and have it now working for USE flag analysis and rebuild. I plan on adding more so it can analyse and repair keywords and mask files too.

I also would like to code up yet another /etc/portage/package.* cleaning tool. Since It'll have nearly/all the functions needed for gathering the info, may as well do that too. All the main functionality will also be importable for other apps to use as library functions/methods.

analyse rebuild -pv use

analyse analyse -uv use

left: showing the output of the report. Enabled USE flags are marked with a leading + and colored blue. Disabled USE flags are marked - and colored red. Unset USE flags are plain text.

It also indicates if the flag is a system default, the number of packages that have it enabled/disabled/unset and using the --verbose option lists the packages.

right: Part way down the report. notice that mplayer has faac faad flags enabled but ffmpeg does not. Something that I didn't notice before. Now I know to set them for ffmpeg too.

This last one shows the totals at the end of the analyse report.

Also if you can think of a good "e" name for it to go along with the other gentoolkit apps like eclean & equery. Post a comment.

some of the names so far:
  • erepair
  • esylana (analyse spelled backward)

Sunday, February 7, 2010

more ecleaning

I'ts been awhile since my last post. I've made good progress on the eclean modular re-write. The cleaning modules have been completed, but not tested yet. I have gotten about halfway coding the testing modules for it. I swear there is going to be 3 times more lines of code to test those functions that there are lines of code in the functions. This is due mostly to having to create a small fake distfiles and packages directories and a small fake portage dbapi to return the pre-programmed data back to the function/module being unit tested.

The output module should be complete aside from minor changes.

The search module has mostly been re-worked and the distfiles search function has now been turned into a class and split up into 13 smaller functions/methods. Along the way I discovered that there were several bugs in the code logic that could potentially clean installed sources that it should not have. I have that mostly fixed now, but intend to extend some of the options a little where I can. Along the way I have been optimizing the code to increase speed for the slow non-destructive distfiles search. I have managed to reduce the time taken by approximately 10-12% while at the same time doing a more thorough search.

I have also added a -v, --verbose option which will give more info about it's actions and findings. useful for debugging and knowledge about your system. It will also inform you of installed package versions that are no longer in any installed trees/overlays, while protecting them from deletion.

That's all for now, gotta go on some errands...