Gentoo Archives: gentoo-dev

From: "Sérgio Almeida" <mephx.x@×××××.com>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Google SoC @ Gentoo - Universal Select Tool
Date: Sat, 23 May 2009 02:18:26
Message-Id: 1243045100.3909.29.camel@thedude
In Reply to: Re: [gentoo-dev] Google SoC @ Gentoo - Universal Select Tool by Michael Haubenwallner
1 Michael,
2
3 > Eventually, we should pass something like "-Dhostname=superhost" as
4 > cmdline parameter to uselect...
5 >
6
7 Didn't want to get into that detail. Afterall `hostname` will always
8 return the same regarding the host therefore it can be retrieved from
9 uselect's engine.
10
11 > I don't like to have anything interpreted after the usual and well-known
12 > comment-marker, this just feels hackish.
13 >
14
15 Agreed, it was just an "easy to read" example. Will adopt {} for those.
16
17 >
18 > I do have something like this content-syntax in mind for .uselect (or
19 > eventually some .uprofile) file:
20 >
21 > 8<8<8<
22 > version "0.1"
23 >
24 > include "path/to/another/uselect/file"
25 >
26 > profile "generic solaris" {
27 > module A actionAX "valueAX1" "valueAX2"
28 > module B actionBX "valueBX1" "valueBX2
29 > }
30 >
31 > profile "generic host" {
32 > module C actionCX "valueCX1"
33 > }
34 >
35 > profile "superhost" {
36 > inherit profile "generic solaris"
37 > inherit profile "generic host"
38 > module C actionCX "newvalueCX1"
39 > module A actionAX "newvalueAX1" "newvalueAX2"
40 > module D actionDY "valueBY1" "valueBY2"
41 > }
42 >
43 > profile "generic user" {
44 > module E actionEX "valueEX1"
45 > }
46 >
47 > profile "user haubi" {
48 > inherit profile "generic user"
49 > module F actionFX "valueFX1"
50 > }
51 >
52 > profile "any user on superhost" {
53 > module G actionGX "valueGX1"
54 > }
55 >
56 > profile "fallback host" {
57 > inherit profile "generic host"
58 > module A actionAX "valueAX1" "valueAX2"
59 > }
60 >
61 > activation "superhost activation" {
62 > in category "host"
63 > on fallback level 0
64 > when $hostname matches string "superhost"
65 > activate profile "superhost"
66 > }
67 >
68 > activation "haubi on superhost" {
69 > in category "user"
70 > on fallback level 0
71 > when $username matches string "haubi"
72 > when $hostname matches string "superhost"
73 > activate profile "any user on superhost"
74 > activate profile "user haubi"
75 > }
76 >
77 > activation "haubi" {
78 > in category "user"
79 > on fallback level 1
80 > when $username matches string "haubi"
81 > activate profile "user haubi"
82 > }
83 >
84 > activation "gentoo host" {
85 > in category "host"
86 > on fallback level 1
87 > when $hostname matches regex ".*\.gentoo\.org"
88 > activate profile "fallback host"
89 > }
90 > >8>8>8
91 >
92 > I'm not sure to have an ascending "fallback level" or descending
93 > "priority" value, but both should allow for negative integer values.
94 >
95
96 I'm not quite shure if this hierarchy fallback method is the most
97 adequate one. Again, remember that the profiles will be automatically
98 created and manipulation needs to be easy. I guess we can arrange for a
99 better way of managing this.
100
101 > The selection of one or more profiles is controlled by "activation"
102 > entries, independent for each "category". The order and selection of
103 > categories is done via a commandline argument, fex "--categories".
104 >
105
106 We are mixing some more complex concepts that don't need to be managed
107 this way. Let's see.
108
109 Types of Profiles:
110
111 something.uprofile <- local file profile
112 .uprofile <- folder profile
113 /usr/share/uprofiles/*.uprofile <- template profiles
114
115 Adding categories to a folder profile is the same as having several file
116 profiles into that directory and load them on demand. Why specify to
117 uselect --categories=something when you can "uselelect loadprofile
118 something" (loads .uselect folder profile first, and then overrides
119 settings as specified in something.uprofile).
120
121 > Profiles are selected when all of the "when" entries (besides "category"
122 > and "fallback level") in "activation {}" do match.
123 > Selected are *all* of the matching profiles in the *lowest* "fallback
124 > level" *only*, which does have at least one matching profile.
125 >
126 > And I'm thinking of something like this commandline:
127 > $ uselect \
128 > --categories host,user \
129 > --define hostname=`hostname` \
130 > --define username=`whoami`
131 >
132 > >
133 > > Remember that profile creation/storing/managing should be automatic and
134 > > nothing would need to be written by hand.
135 >
136 > Yes, would be fine. When using something like above configuration file
137 > syntax, some GUIding tool would be useful, at least to see which
138 > profiles are selected for specific cmdline args.
139 >
140
141 Mmm... later feature for more complex profiling. Let us stop now and
142 focus on simple profiling with easy managing.
143
144 > > By other words, create a basic
145 > > profile automatically using your currently running settings and then
146 > > alter the profile with the util to add constrains to it.
147 >
148 > Sounds interesting...
149 >
150 > > Remember that
151 > > all the machines that this profile is read would need to have the same
152 > > uselect modules into it's /usr/share/uselect/modules or similar.
153 >
154 > Indeed, yes.
155 >
156 > > > Ha! This kind of inheritance tree could be a solution for my long
157 > > > standing bug here to simplify our way too complex environment script...
158 > > >
159 > >
160 > > This is a basic idea from softenv so it has has it's place into uselect.
161 >
162 > Don't know softenv. Found http://www.teragrid.org/userinfo/softenv/
163 > Do you mean this one?
164 >
165
166 Indeed.
167
168 > > The question now is, bloat it all into uselect or create a uprofile
169 > > util? I like the idea of having to use only uselect for basic profiling
170 > > and using uprofile for further managing.
171 >
172 > That's indeed the question.
173 >
174 > > Mmmm... As you wrote I realized: Complain if module versions are
175 > > different is not a bad idea at all...
176 >
177 > Indeed, not only the configuration needs to be versioned, but the
178 > modules too.
179 >
180
181 On to-do!
182
183 > >
184 > > Why would we need more that one profile file per project/folder anyway?
185 >
186 > Might not be necessary, at least not for non-profiled uselect.
187 >
188 > > > Uh, so many strange ideas!
189 > > > More of them?
190 > >
191 > > Keep 'em coming! Thanks!
192 >
193 > Well, you have asked ;)
194 >
195 > /haubi/
196
197
198 Thanks again.
199
200 Cheers,
201 Sérgio
202 --
203 Sérgio Almeida <mephx.x@×××××.com>
204 mephx @ freenode

Attachments

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