Gentoo Archives: gentoo-dev

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

Attachments

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