Gentoo Archives: gentoo-dev

From: Rumen Yotov <rumen_yotov@×××.bg>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Even More Portage Bashrc Fun
Date: Tue, 14 Jun 2005 05:09:31
Message-Id: 42AE669F.8020208@dir.bg
In Reply to: [gentoo-dev] Even More Portage Bashrc Fun by Michael Tindal
1 Michael Tindal wrote:
2
3 >Hello,
4 >
5 >So a long time ago solar wrote a bashrc for portage, and posted it on
6 >this mailing list for everyone to see. I took it, and started extending
7 >it with various things of my own design, and some contributions from
8 >others. I've since updated it with the things solar's been adding to
9 >his bashrc, plus adding the functionality from ChrisWhites bashrc.
10 >Well, adding all of that stuff made the bashrc quite large. In addition
11 >I was using CVS for a while, and wrote a lot of hooks to work with CVS,
12 >when I went back to 2.0.51, I didnt want to lose all of those, so I
13 >backported in a way the hooks from CVS (I mean in a way because the post
14 >hooks arent really post hooks, they just run before the pre hook of the
15 >next phase), but that meant the bashrc was huge.
16 >
17 >So, sometime last night or this morning I set out to create a modular
18 >portage bashrc [1], and I have done so. I'll admit, the code is ugly,
19 >and it probably could've been done better. But it does lay a good
20 >framework for future extensions.
21 >
22 >The bashrc file is just a skeleton that loads the modules, and handles
23 >the pseudo-hook implementation. The real magic happens in the
24 >bashrc-modules subdirectory. core-functions.bmod contains the basic
25 >functions and handles loading other modules. hooks.bmod defines the
26 >hooks used and defines functions used to add new function calls to the
27 >hooks. The other bmod files define some sort of library for other
28 >modules (like an eclass) or functions that get loaded into the hooks. I
29 >don't have any documentation written up for that, so read through the
30 >source and you should get an idea of how it all works.
31 >
32 >The BASHRC_DYN_MODULES variable can be defined in make.conf to limit the
33 >modules that are loaded by the bashrc. This is useful if you only want
34 >to use a subset of the functionality available in the modules, and dont
35 >want to load them all. The default behavior is to load all of the
36 >modules under ${ROOT}/etc/portage/bashrc-modules/. To extend the
37 >bashrc, for example, to add another feature, you simply create a new
38 >bmod following the examples given, then either let it load automatically
39 >or add it to BASHRC_DYN_MODULES.
40 >
41 >I've done some thorough testing and beu did some testing as well, so
42 >there shouldnt be any major bugs, but if you find some, please e-mail me
43 >with them. I'm especially interested in command not found errors. This
44 >is some really ugly bash code, so if you run into obscure errors, dont
45 >freak out, theyre a result of how I deal with the infrastructure.
46 >Overall though, it appears to be stable, and I'm currently using it on
47 >my system.
48 >
49 >Finally, I'd like to thank the people who directly or indirectly helped
50 >with this bashrc and the bashrc system: solar, ChrisWhite, beu,
51 >bluefoxicy, and anyone else who I forgot to name. Enjoy everyone!
52 >
53 >Mike Tindal
54 >
55 >PS: Heed the warning given in the setup phase, you *cannot* modify
56 >variables that affect depends because the environment the bashrc
57 >modifies isnt picked up by depends. Be very careful with what you do
58 >with category.use, since that can very easily break builds.
59 >
60 >[1]
61 >http://dev.gentoo.org/~urilith/portage-tools/bashrc-2.0.51-modular-20050612.tar.bz2
62 >
63 >I've got some sample files in that dir for the random files the bashrc
64 >supports.
65 >
66 >
67 Hi,
68 Till now used the old/org bashrc-script plus package.* files.
69 Now when replaced them with the new one get some errors, seems just
70 syntax ones.
71 Here's the log when using it:
72 ...
73 >>> Loading module hooks.bmod...
74 >>> Loading module string-utils.bmod...
75 >>> Loading module audit.bmod...
76 >>> Loading module autooverlay.bmod...
77 >>> Loading module autopatch.bmod...
78 >>> Loading module conf.bmod...
79 >>> Loading module distdir-clean.bmod...
80 >>> Loading module enotice.bmod...
81 >>> Loading module etc-portage.bmod...
82 //etc/portage/bashrc-modules/core-functions.bmod: eval: line 103:
83 unexpected EOF while looking for matching `''
84 //etc/portage/bashrc-modules/core-functions.bmod: eval: line 104: syntax
85 error: unexpected end of file
86 //etc/portage/bashrc-modules/core-functions.bmod: eval: line 108:
87 unexpected EOF while looking for matching `''
88 //etc/portage/bashrc-modules/core-functions.bmod: eval: line 109: syntax
89 error: unexpected end of file
90 //etc/portage/bashrc-modules/core-functions.bmod: eval: line 103:
91 unexpected EOF while looking for matching `''
92 //etc/portage/bashrc-modules/core-functions.bmod: eval: line 104: syntax
93 error: unexpected end of file
94 //etc/portage/bashrc-modules/core-functions.bmod: eval: line 108:
95 unexpected EOF while looking for matching `''
96 //etc/portage/bashrc-modules/core-functions.bmod: eval: line 109: syntax
97 error: unexpected end of file
98 //etc/portage/bashrc-modules/core-functions.bmod: eval: line 103:
99 unexpected EOF while looking for matching `''
100 //etc/portage/bashrc-modules/core-functions.bmod: eval: line 104: syntax
101 error: unexpected end of file
102 //etc/portage/bashrc-modules/core-functions.bmod: eval: line 108:
103 unexpected EOF while looking for matching `''
104 //etc/portage/bashrc-modules/core-functions.bmod: eval: line 109: syntax
105 error: unexpected end of file
106 >>> Loading module eutils.bmod...
107 >>> Loading module optipng.bmod...
108 >>> Loading module pathchk.bmod...
109 >>> Loading module prelink.bmod...
110 >>> Loading module setup.bmod...
111 >>> Loading module whatis.bmod...
112 >>> root -sandbox(setup) [Enter]
113 !!!!!! !!!!!! Do
114 !!NOT!! use these files to modify variables
115 that would !!!!!! alter the dependencies of the package. If you
116 do, things !!!!!! WILL break. This
117 bashrc has no control before the !!!!!! depend phase, so
118 the files cannot be used to modify
119 !!!!!! dependency-related variables. These files are mostly
120 !!!!!! used to enable features and/or
121 variables on a per-package !!!!!! basis without having to
122 cluttler /etc/make.conf !!!!!! -------- WARNING
123 ON PER-PACKAGE FEATURES IN THIS BASHRC --------
124 !!!//etc/portage/bashrc-modules/core-functions.bmod: eval: line 103:
125 unexpected EOF while looking for matching `''
126 //etc/portage/bashrc-modules/core-functions.bmod: eval: line 104: syntax
127 error: unexpected end of file
128 //etc/portage/bashrc-modules/core-functions.bmod: eval: line 108:
129 unexpected EOF while looking for matching `''
130 //etc/portage/bashrc-modules/core-functions.bmod: eval: line 109: syntax
131 error: unexpected end of file
132 >>> Using package.cflags entry for target sys-devel for sys-devel/gettext
133 >>> root +sandbox(setup) [Leave]
134 >>> root +sandbox(unpack) [Enter]
135 /var/tmp/portage/gettext-0.14.4/temp/environment: eval: line 2942:
136 unexpected EOF while looking for matching `''
137 /var/tmp/portage/gettext-0.14.4/temp/environment: eval: line 2943:
138 syntax error: unexpected end of file
139 /var/tmp/portage/gettext-0.14.4/temp/environment: eval: line 2946:
140 unexpected EOF while looking for matching `''
141 /var/tmp/portage/gettext-0.14.4/temp/environment: eval: line 2947:
142 syntax error: unexpected end of file
143 >>> Using package.cflags entry for target sys-devel for sys-devel/gettext
144 >>> Unpacking source...
145 ...
146 PS: will also look into it but not now, later. Will report anything new.
147 Thanks for your work. Rumen

Attachments

File name MIME type
smime.p7s application/x-pkcs7-signature

Replies

Subject Author
Re: [gentoo-dev] Even More Portage Bashrc Fun Michael Tindal <urilith@g.o>