Hello, So a long time ago solar wrote a bashrc for portage, and posted it on this mailing list for everyone to see. I took it, and started extending it with various things of my own design, and some contributions from others. I've since updated it with the things solar's been adding to his bashrc, plus adding the functionality from ChrisWhites bashrc. Well, adding all of that stuff made the bashrc quite large. In addition I was using CVS for a while, and wrote a lot of hooks to work with CVS, when I went back to 2.0.51, I didnt want to lose all of those, so I backported in a way the hooks from CVS (I mean in a way because the post hooks arent really post hooks, they just run before the pre hook of the next phase), but that meant the bashrc was huge.
So, sometime last night or this morning I set out to create a modular portage bashrc [1], and I have done so. I'll admit, the code is ugly, and it probably could've been done better. But it does lay a good framework for future extensions. The bashrc file is just a skeleton that loads the modules, and handles the pseudo-hook implementation. The real magic happens in the bashrc-modules subdirectory. core-functions.bmod contains the basic functions and handles loading other modules. hooks.bmod defines the hooks used and defines functions used to add new function calls to the hooks. The other bmod files define some sort of library for other modules (like an eclass) or functions that get loaded into the hooks. I don't have any documentation written up for that, so read through the source and you should get an idea of how it all works. The BASHRC_DYN_MODULES variable can be defined in make.conf to limit the modules that are loaded by the bashrc. This is useful if you only want to use a subset of the functionality available in the modules, and dont want to load them all. The default behavior is to load all of the modules under ${ROOT}/etc/portage/bashrc-modules/. To extend the bashrc, for example, to add another feature, you simply create a new bmod following the examples given, then either let it load automatically or add it to BASHRC_DYN_MODULES. I've done some thorough testing and beu did some testing as well, so there shouldnt be any major bugs, but if you find some, please e-mail me with them. I'm especially interested in command not found errors. This is some really ugly bash code, so if you run into obscure errors, dont freak out, theyre a result of how I deal with the infrastructure. Overall though, it appears to be stable, and I'm currently using it on my system. Finally, I'd like to thank the people who directly or indirectly helped with this bashrc and the bashrc system: solar, ChrisWhite, beu, bluefoxicy, and anyone else who I forgot to name. Enjoy everyone! Mike Tindal PS: Heed the warning given in the setup phase, you *cannot* modify variables that affect depends because the environment the bashrc modifies isnt picked up by depends. Be very careful with what you do with category.use, since that can very easily break builds. [1] http://dev.gentoo.org/~urilith/portage-tools/bashrc-2.0.51-modular-20050612.tar.bz2 I've got some sample files in that dir for the random files the bashrc supports.
signature.asc
Description: OpenPGP digital signature