/[gentoo]/xml/htdocs/proj/en/glep/glep-0047.html
Gentoo

Diff of /xml/htdocs/proj/en/glep/glep-0047.html

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.2 Revision 1.5
6PEP, see http://www.python.org/peps/pep-0001.html for instructions and links 6PEP, see http://www.python.org/peps/pep-0001.html for instructions and links
7to templates. DO NOT USE THIS HTML FILE AS YOUR TEMPLATE! 7to templates. DO NOT USE THIS HTML FILE AS YOUR TEMPLATE!
8--> 8-->
9<head> 9<head>
10 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 10 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
11 <meta name="generator" content="Docutils 0.3.5: http://docutils.sourceforge.net/" /> 11 <meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" />
12 <title>GLEP 47 -- Creating 'safe' environment variables</title> 12 <title>GLEP 47 -- Creating 'safe' environment variables</title>
13 <link rel="stylesheet" href="tools/glep.css" type="text/css" /> 13 <style type="text/css">
14
15/*
16:Author: David Goodger
17:Contact: goodger@users.sourceforge.net
18:date: $Date: 2006/10/10 20:25:14 $
19:version: $Revision: 1.5 $
20:copyright: This stylesheet has been placed in the public domain.
21
22Default cascading style sheet for the PEP HTML output of Docutils.
23*/
24
25.first {
26 margin-top: 0 }
27
28.last {
29 margin-bottom: 0 }
30
31.navigation {
32 width: 100% ;
33 background: #cc99ff ;
34 margin-top: 0px ;
35 margin-bottom: 0px }
36
37.navigation .navicon {
38 width: 150px ;
39 height: 35px }
40
41.navigation .textlinks {
42 padding-left: 1em ;
43 text-align: left }
44
45.navigation td, .navigation th {
46 padding-left: 0em ;
47 padding-right: 0em ;
48 vertical-align: middle }
49
50.rfc2822 {
51 margin-top: 0.5em ;
52 margin-left: 0.5em ;
53 margin-right: 0.5em ;
54 margin-bottom: 0em }
55
56.rfc2822 td {
57 text-align: left }
58
59.rfc2822 th.field-name {
60 text-align: right ;
61 font-family: sans-serif ;
62 padding-right: 0.5em ;
63 font-weight: bold ;
64 margin-bottom: 0em }
65
66a.toc-backref {
67 text-decoration: none ;
68 color: black }
69
70body {
71 margin: 0px ;
72 margin-bottom: 1em ;
73 padding: 0px }
74
75dd {
76 margin-bottom: 0.5em }
77
78div.section {
79 margin-left: 1em ;
80 margin-right: 1em ;
81 margin-bottom: 1.5em }
82
83div.section div.section {
84 margin-left: 0em ;
85 margin-right: 0em ;
86 margin-top: 1.5em }
87
88div.abstract {
89 margin: 2em 5em }
90
91div.abstract p.topic-title {
92 font-weight: bold ;
93 text-align: center }
94
95div.attention, div.caution, div.danger, div.error, div.hint,
96div.important, div.note, div.tip, div.warning {
97 margin: 2em ;
98 border: medium outset ;
99 padding: 1em }
100
101div.attention p.admonition-title, div.caution p.admonition-title,
102div.danger p.admonition-title, div.error p.admonition-title,
103div.warning p.admonition-title {
104 color: red ;
105 font-weight: bold ;
106 font-family: sans-serif }
107
108div.hint p.admonition-title, div.important p.admonition-title,
109div.note p.admonition-title, div.tip p.admonition-title {
110 font-weight: bold ;
111 font-family: sans-serif }
112
113div.figure {
114 margin-left: 2em }
115
116div.footer, div.header {
117 font-size: smaller }
118
119div.footer {
120 margin-left: 1em ;
121 margin-right: 1em }
122
123div.system-messages {
124 margin: 5em }
125
126div.system-messages h1 {
127 color: red }
128
129div.system-message {
130 border: medium outset ;
131 padding: 1em }
132
133div.system-message p.system-message-title {
134 color: red ;
135 font-weight: bold }
136
137div.topic {
138 margin: 2em }
139
140h1 {
141 font-family: sans-serif ;
142 font-size: large }
143
144h2 {
145 font-family: sans-serif ;
146 font-size: medium }
147
148h3 {
149 font-family: sans-serif ;
150 font-size: small }
151
152h4 {
153 font-family: sans-serif ;
154 font-style: italic ;
155 font-size: small }
156
157h5 {
158 font-family: sans-serif;
159 font-size: x-small }
160
161h6 {
162 font-family: sans-serif;
163 font-style: italic ;
164 font-size: x-small }
165
166.section hr {
167 width: 75% }
168
169ol.simple, ul.simple {
170 margin-bottom: 1em }
171
172ol.arabic {
173 list-style: decimal }
174
175ol.loweralpha {
176 list-style: lower-alpha }
177
178ol.upperalpha {
179 list-style: upper-alpha }
180
181ol.lowerroman {
182 list-style: lower-roman }
183
184ol.upperroman {
185 list-style: upper-roman }
186
187p.caption {
188 font-style: italic }
189
190p.credits {
191 font-style: italic ;
192 font-size: smaller }
193
194p.label {
195 white-space: nowrap }
196
197p.topic-title {
198 font-family: sans-serif ;
199 font-weight: bold }
200
201pre.line-block {
202 font-family: serif ;
203 font-size: 100% }
204
205pre.literal-block, pre.doctest-block {
206 margin-left: 2em ;
207 margin-right: 2em ;
208 background-color: #eeeeee }
209
210span.classifier {
211 font-family: sans-serif ;
212 font-style: oblique }
213
214span.classifier-delimiter {
215 font-family: sans-serif ;
216 font-weight: bold }
217
218span.interpreted {
219 font-family: sans-serif }
220
221span.option-argument {
222 font-style: italic }
223
224span.pre {
225 white-space: pre }
226
227span.problematic {
228 color: red }
229
230table {
231 margin-top: 0.5em ;
232 margin-bottom: 0.5em }
233
234td, th {
235 padding-left: 0.5em ;
236 padding-right: 0.5em ;
237 vertical-align: top }
238
239td.num {
240 text-align: right }
241
242th.field-name {
243 font-weight: bold ;
244 text-align: left ;
245 white-space: nowrap }
246
247h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt {
248 font-size: 100% }
249
250tt {
251 background-color: #eeeeee }
252
253ul.auto-toc {
254 list-style-type: none }
255
256</style>
14</head> 257</head>
15<body bgcolor="white"> 258<body bgcolor="white">
16<table class="navigation" cellpadding="0" cellspacing="0" 259<table class="navigation" cellpadding="0" cellspacing="0"
17 width="100%" border="0"> 260 width="100%" border="0">
18<tr><td class="navicon" width="150" height="35"> 261<tr><td class="navicon" width="150" height="35">
19<a href="http://www.gentoo.org/" title="Gentoo Linux Home Page"> 262<a href="http://www.gentoo.org/" title="Gentoo Linux Home Page">
20<img src="http://www.gentoo.org/images/gentoo-new.gif" alt="[Gentoo]" 263<img src="http://www.gentoo.org/images/gentoo-new.gif" alt="[Gentoo]"
21 border="0" width="150" height="35" /></a></td> 264 border="0" width="150" height="35" /></a></td>
22<td class="textlinks" align="left"> 265<td class="textlinks" align="left">
23[<b><a href="http://www.gentoo.org/">Gentoo Linux Home</a></b>] 266[<b><a href="http://www.gentoo.org/">Gentoo Linux Home</a></b>]
24[<b><a href="http://www.gentoo.org/proj/en/glep">GLEP Index</a></b>] 267[<b><a href="http://www.gentoo.org/peps">GLEP Index</a></b>]
25[<b><a href="./glep-0047.txt">GLEP Source</a></b>] 268[<b><a href="http://www.gentoo.org/proj/en/glep/glep-0047.txt">GLEP Source</a></b>]
26</td></tr></table> 269</td></tr></table>
27<div class="document">
28<table class="rfc2822 field-list" frame="void" rules="none"> 270<table class="rfc2822 docutils field-list" frame="void" rules="none">
29<col class="field-name" /> 271<col class="field-name" />
30<col class="field-body" /> 272<col class="field-body" />
31<tbody valign="top"> 273<tbody valign="top">
32<tr class="field"><th class="field-name">GLEP:</th><td class="field-body">47</td> 274<tr class="field"><th class="field-name">GLEP:</th><td class="field-body">47</td>
33</tr> 275</tr>
34<tr class="field"><th class="field-name">Title:</th><td class="field-body">Creating 'safe' environment variables</td> 276<tr class="field"><th class="field-name">Title:</th><td class="field-body">Creating 'safe' environment variables</td>
35</tr> 277</tr>
36<tr class="field"><th class="field-name">Version:</th><td class="field-body">1.1</td> 278<tr class="field"><th class="field-name">Version:</th><td class="field-body">1.4</td>
37</tr> 279</tr>
38<tr class="field"><th class="field-name">Last-Modified:</th><td class="field-body"><a class="reference" href="http://www.gentoo.org/cgi-bin/viewcvs/xml/htdocs/proj/en/glep/glep-0047.txt?cvsroot=gentoo">2006/02/09 21:42:57</a></td> 280<tr class="field"><th class="field-name">Last-Modified:</th><td class="field-body"><a class="reference" href="http://www.gentoo.org/cgi-bin/viewcvs.cgi/xml/htdocs/proj/en/glep/glep-0047.txt?cvsroot=gentoo">2006/02/13 21:00:50</a></td>
39</tr> 281</tr>
40<tr class="field"><th class="field-name">Author:</th><td class="field-body">Diego Pettenò, Fabian Groffen</td> 282<tr class="field"><th class="field-name">Author:</th><td class="field-body">Diego Pettenò, Fabian Groffen</td>
41</tr> 283</tr>
42<tr class="field"><th class="field-name">Status:</th><td class="field-body">Draft</td> 284<tr class="field"><th class="field-name">Status:</th><td class="field-body">Draft</td>
43</tr> 285</tr>
44<tr class="field"><th class="field-name">Type:</th><td class="field-body">Standards Track</td> 286<tr class="field"><th class="field-name">Type:</th><td class="field-body">Standards Track</td>
45</tr> 287</tr>
46<tr class="field"><th class="field-name">Content-Type:</th><td class="field-body"><a class="reference" href="glep-0012.html">text/x-rst</a></td> 288<tr class="field"><th class="field-name">Content-Type:</th><td class="field-body"><a class="reference" href="glep-0002.html">text/x-rst</a></td>
47</tr> 289</tr>
48<tr class="field"><th class="field-name">Created:</th><td class="field-body">14-Oct-2005</td> 290<tr class="field"><th class="field-name">Created:</th><td class="field-body">14-Oct-2005</td>
49</tr> 291</tr>
50<tr class="field"><th class="field-name">Post-History:</th><td class="field-body">09-Feb-2006</td> 292<tr class="field"><th class="field-name">Post-History:</th><td class="field-body">09-Feb-2006</td>
51</tr> 293</tr>
52</tbody> 294</tbody>
53</table> 295</table>
54<hr /> 296<hr />
55<div class="contents topic" id="contents"> 297<div class="contents topic">
56<p class="topic-title first"><a name="contents">Contents</a></p> 298<p class="topic-title first"><a id="contents" name="contents">Contents</a></p>
57<ul class="simple"> 299<ul class="simple">
58<li><a class="reference" href="#credits" id="id5" name="id5">Credits</a></li> 300<li><a class="reference" href="#credits" id="id5" name="id5">Credits</a></li>
59<li><a class="reference" href="#abstract" id="id6" name="id6">Abstract</a></li> 301<li><a class="reference" href="#abstract" id="id6" name="id6">Abstract</a></li>
60<li><a class="reference" href="#motivation" id="id7" name="id7">Motivation</a></li> 302<li><a class="reference" href="#motivation" id="id7" name="id7">Motivation</a></li>
61<li><a class="reference" href="#rationale" id="id8" name="id8">Rationale</a></li> 303<li><a class="reference" href="#rationale" id="id8" name="id8">Rationale</a></li>
66</li> 308</li>
67<li><a class="reference" href="#references" id="id12" name="id12">References</a></li> 309<li><a class="reference" href="#references" id="id12" name="id12">References</a></li>
68<li><a class="reference" href="#copyright" id="id13" name="id13">Copyright</a></li> 310<li><a class="reference" href="#copyright" id="id13" name="id13">Copyright</a></li>
69</ul> 311</ul>
70</div> 312</div>
71<div class="section" id="credits"> 313<div class="section">
72<h1><a class="toc-backref" href="#id5" name="credits">Credits</a></h1> 314<h1><a class="toc-backref" href="#id5" id="credits" name="credits">Credits</a></h1>
73<p>The text of this GLEP is a result of a discussion and input of the 315<p>The text of this GLEP is a result of a discussion and input of the
74following persons, in no particular order: Mike Frysinger, Diego 316following persons, in no particular order: Mike Frysinger, Diego
75Pettenò, Fabian Groffen and Finn Thain.</p> 317Pettenò, Fabian Groffen and Finn Thain.</p>
76</div> 318</div>
77<div class="section" id="abstract"> 319<div class="section">
78<h1><a class="toc-backref" href="#id6" name="abstract">Abstract</a></h1> 320<h1><a class="toc-backref" href="#id6" id="abstract" name="abstract">Abstract</a></h1>
79<p>In order for ebuilds and eclasses to be able to make host specific 321<p>In order for ebuilds and eclasses to be able to make host specific
80decisions, it is necessary to have a number of environmental variables 322decisions, it is necessary to have a number of environmental variables
81which allow for such decisions. This GLEP introduces some measures that 323which allow for such decisions. This GLEP introduces some measures that
82need to be made to make these decisions 'safe', by making sure the 324need to be made to make these decisions 'safe', by making sure the
83variables the decisions are based on are 'safe'. A small overlap with 325variables the decisions are based on are 'safe'. A small overlap with
84GLEP 22 <a class="footnote-reference" href="#id3" id="id1" name="id1">[1]</a> is being handled in this GLEP where the use of 2-tuple 326GLEP 22 <a class="footnote-reference" href="#id3" id="id1" name="id1">[1]</a> is being handled in this GLEP where the use of 2-tuple
85keywords are being kept instead of 4-tuple keywords. Additionally, the 327keywords are being kept instead of 4-tuple keywords. Additionally, the
86<tt class="literal"><span class="pre">ELIBC</span></tt>, <tt class="literal"><span class="pre">KERNEL</span></tt> and <tt class="literal"><span class="pre">ARCH</span></tt> get auto filled starting from 328<tt class="docutils literal"><span class="pre">ELIBC</span></tt>, <tt class="docutils literal"><span class="pre">KERNEL</span></tt> and <tt class="docutils literal"><span class="pre">ARCH</span></tt> get auto filled starting from
87<tt class="literal"><span class="pre">CHOST</span></tt> and the 2-tuple keyword, instead of solely from they 4-tuple 329<tt class="docutils literal"><span class="pre">CHOST</span></tt> and the 2-tuple keyword, instead of solely from they 4-tuple
88keyword as proposed in GLEP 22.</p> 330keyword as proposed in GLEP 22.</p>
89<p>The destiny of the <tt class="literal"><span class="pre">USERLAND</span></tt> variable is out of the scope of this 331<p>The destiny of the <tt class="docutils literal"><span class="pre">USERLAND</span></tt> variable is out of the scope of this
90GLEP. Depending on its presence in the tree, it may be decided to set 332GLEP. Depending on its presence in the tree, it may be decided to set
91this variable the same way we propose to set <tt class="literal"><span class="pre">ELIBC</span></tt>, <tt class="literal"><span class="pre">KERNEL</span></tt> and 333this variable the same way we propose to set <tt class="docutils literal"><span class="pre">ELIBC</span></tt>, <tt class="docutils literal"><span class="pre">KERNEL</span></tt> and
92<tt class="literal"><span class="pre">ARCH</span></tt>, or alternatively, e.g. via the profiles.</p> 334<tt class="docutils literal"><span class="pre">ARCH</span></tt>, or alternatively, e.g. via the profiles.</p>
93</div> 335</div>
94<div class="section" id="motivation"> 336<div class="section">
95<h1><a class="toc-backref" href="#id7" name="motivation">Motivation</a></h1> 337<h1><a class="toc-backref" href="#id7" id="motivation" name="motivation">Motivation</a></h1>
96<p>The Gentoo/Alt project is in an emerging state to get ready to serve a 338<p>The Gentoo/Alt project is in an emerging state to get ready to serve a
97plethora of 'alternative' configurations such as FreeBSD, NetBSD, 339plethora of 'alternative' configurations such as FreeBSD, NetBSD,
98DragonflyBSD, GNU/kFreeBSD, Mac OS X, (Open)Darwin, (Open)Solaris and so 340DragonflyBSD, GNU/kFreeBSD, Mac OS X, (Open)Darwin, (Open)Solaris and so
99on. As such, the project is in need for a better grip on the actual 341on. As such, the project is in need for a better grip on the actual
100host being built on. This information on the host environment is 342host being built on. This information on the host environment is
101necessary to make proper (automated) decisions on settings that are 343necessary to make proper (automated) decisions on settings that are
102highly dependant on the build environment, such as platform or C-library 344highly dependant on the build environment, such as platform or C-library
103implementation.</p> 345implementation.</p>
104</div> 346</div>
105<div class="section" id="rationale"> 347<div class="section">
106<h1><a class="toc-backref" href="#id8" name="rationale">Rationale</a></h1> 348<h1><a class="toc-backref" href="#id8" id="rationale" name="rationale">Rationale</a></h1>
107<p>Gentoo's unique Portage system allows easy installation of applications 349<p>Gentoo's unique Portage system allows easy installation of applications
108from source packages. Compiling sources is prone to many environmental 350from source packages. Compiling sources is prone to many environmental
109settings and availability of certain tools. Only recently the Gentoo 351settings and availability of certain tools. Only recently the Gentoo
110for FreeBSD project has started, as second Gentoo project that operates 352for FreeBSD project has started, as second Gentoo project that operates
111on a foreign host operating system using foreign (non-GNU) C-libraries 353on a foreign host operating system using foreign (non-GNU) C-libraries
116environmental differences, information regarding it should be supplied. 358environmental differences, information regarding it should be supplied.
117Since decisions based on this information can be vital, it is of high 359Since decisions based on this information can be vital, it is of high
118importance that this information can be trusted and the values can be 360importance that this information can be trusted and the values can be
119considered 'safe' and correct.</p> 361considered 'safe' and correct.</p>
120</div> 362</div>
121<div class="section" id="backwards-compatibility"> 363<div class="section">
122<h1><a class="toc-backref" href="#id9" name="backwards-compatibility">Backwards Compatibility</a></h1> 364<h1><a class="toc-backref" href="#id9" id="backwards-compatibility" name="backwards-compatibility">Backwards Compatibility</a></h1>
123<p>The proposed keywording scheme in this GLEP is fully compatible with the 365<p>The proposed keywording scheme in this GLEP is fully compatible with the
124current situation of the portage tree, this in contrast to GLEP 22. The 366current situation of the portage tree, this in contrast to GLEP 22. The
125variables provided by GLEP 22 can't be extracted from the new keyword, 367variables provided by GLEP 22 can't be extracted from the new keyword,
126but since GLEP 22-style keywords aren't in the tree at the moment, that 368but since GLEP 22-style keywords aren't in the tree at the moment, that
127is not a problem. The same information can be extracted from the CHOST 369is not a problem. The same information can be extracted from the CHOST
128variable, if necessary. No modifications to ebuilds will have to be 370variable, if necessary. No modifications to ebuilds will have to be
129made.</p> 371made.</p>
130</div> 372</div>
131<div class="section" id="specification"> 373<div class="section">
132<h1><a class="toc-backref" href="#id10" name="specification">Specification</a></h1> 374<h1><a class="toc-backref" href="#id10" id="specification" name="specification">Specification</a></h1>
133<p>Unlike GLEP 22 the currently used keyword scheme is not changed. 375<p>Unlike GLEP 22 the currently used keyword scheme is not changed.
134Instead of proposing a 4-tuple <a class="footnote-reference" href="#id4" id="id2" name="id2">[2]</a> keyword, a 2-tuple keyword is chosen 376Instead of proposing a 4-tuple <a class="footnote-reference" href="#id4" id="id2" name="id2">[2]</a> keyword, a 2-tuple keyword is chosen
135for archs that require them. Archs for which a 1-tuple keyword 377for archs that require them. Archs for which a 1-tuple keyword
136suffices, can keep that keyword. Since this doesn't change anything to 378suffices, can keep that keyword. Since this doesn't change anything to
137the current situation in the tree, it is considered to be a big 379the current situation in the tree, it is considered to be a big
138advantage over the 4-tuple keyword from GLEP 22. This GLEP is an 380advantage over the 4-tuple keyword from GLEP 22. This GLEP is an
139official specification of the syntax of the keyword.</p> 381official specification of the syntax of the keyword.</p>
140<p>Keywords will consist out of two parts separated by a hyphen ('-'). The 382<p>Keywords will consist out of two parts separated by a hyphen ('-'). The
141left hand part of the keyword 2-tuple is the architecture, such as 383part up to the first hyphen from the left of the keyword 2-tuple is the
142ppc64, sparc and x86. The right hand part indicates the operating 384architecture, such as ppc64, sparc and x86. Allowed characters for the
385architecture name are in <tt class="docutils literal"><span class="pre">a-z0-9</span></tt>. The remaining part on the right of
386the first hyphen from the left indicates the operating system or
143system or distribution, such as linux, macos, darwin, obsd, etc. If the 387distribution, such as linux, macos, darwin, obsd, et-cetera. If the
144right hand part is omitted, it implies the operating system/distribution 388right hand part is omitted, it implies the operating system/distribution
145type is Gentoo GNU/Linux. In such case the hyphen is also omitted. 389type is Gentoo GNU/Linux. In such case the hyphen is also omitted, and
146Examples of such keywords are ppc-darwin and x86. This is fully 390the keyword consists of solely the architecture. The operating system
147compatible with the current use of keywords in the tree.</p> 391or distribution name can consist out of characters in <tt class="docutils literal"><span class="pre">a-zA-Z0-9_+:-</span></tt>.
392Please note that the hyphen is an allowed character, and therefore the
393separation of the two fields in the keyword is only determinable by
394scanning for the first hyphen character from the start of the keyword
395string. Examples of keywords following this specification are
396ppc-darwin and x86. This is fully compatible with the current use of
397keywords in the tree.</p>
148<p>The variables <tt class="literal"><span class="pre">ELIBC</span></tt>, <tt class="literal"><span class="pre">KERNEL</span></tt> and <tt class="literal"><span class="pre">ARCH</span></tt> are currently set in 398<p>The variables <tt class="docutils literal"><span class="pre">ELIBC</span></tt>, <tt class="docutils literal"><span class="pre">KERNEL</span></tt> and <tt class="docutils literal"><span class="pre">ARCH</span></tt> are currently set in
149the profiles when other than their defaults for a GNU/Linux system. 399the profiles when other than their defaults for a GNU/Linux system.
150They can as such easily be overridden and defined by the user. To 400They can as such easily be overridden and defined by the user. To
151prevent this from happening, the variables should be auto filled by 401prevent this from happening, the variables should be auto filled by
152Portage itself, based on the <tt class="literal"><span class="pre">CHOST</span></tt> variable. While the <tt class="literal"><span class="pre">CHOST</span></tt> 402Portage itself, based on the <tt class="docutils literal"><span class="pre">CHOST</span></tt> variable. While the <tt class="docutils literal"><span class="pre">CHOST</span></tt>
153variable can be as easy as the others set by the user, it still is 403variable can be as easy as the others set by the user, it still is
154assumed to be 'safe'. This assumption is grounded in the fact that the 404assumed to be 'safe'. This assumption is grounded in the fact that the
155variable itself is being used in various other places with the same 405variable itself is being used in various other places with the same
156intention, and that an invalid <tt class="literal"><span class="pre">CHOST</span></tt> will cause major malfunctioning 406intention, and that an invalid <tt class="docutils literal"><span class="pre">CHOST</span></tt> will cause major malfunctioning
157of the system. A user that changes the <tt class="literal"><span class="pre">CHOST</span></tt> into something that is 407of the system. A user that changes the <tt class="docutils literal"><span class="pre">CHOST</span></tt> into something that is
158not valid for the system, is already warned that this might render the 408not valid for the system, is already warned that this might render the
159system unusable. Concluding, the 'safeness' of the <tt class="literal"><span class="pre">CHOST</span></tt> variable 409system unusable. Concluding, the 'safeness' of the <tt class="docutils literal"><span class="pre">CHOST</span></tt> variable
160is based on externally assumed 'safeness', which's discussion falls 410is based on externally assumed 'safeness', which's discussion falls
161outside this GLEP.</p> 411outside this GLEP.</p>
162<p>Current USE-expansion of the variables is being maintained, as this 412<p>Current USE-expansion of the variables is being maintained, as this
163results in full backward compatibility. Since the variables themself 413results in full backward compatibility. Since the variables themself
164don't change in what they represent, but only how they are being 414don't change in what they represent, but only how they are being
173 ... 423 ...
174 use elibc_FreeBSD &amp;&amp; myconf=&quot;${myconf} -Dlibc=/usr/lib/libc.a&quot; 424 use elibc_FreeBSD &amp;&amp; myconf=&quot;${myconf} -Dlibc=/usr/lib/libc.a&quot;
175 ... 425 ...
176} 426}
177</pre> 427</pre>
178<p>Alternatively, the variables <tt class="literal"><span class="pre">ELIBC</span></tt>, <tt class="literal"><span class="pre">KERNEL</span></tt> and <tt class="literal"><span class="pre">ARCH</span></tt> 428<p>Alternatively, the variables <tt class="docutils literal"><span class="pre">ELIBC</span></tt>, <tt class="docutils literal"><span class="pre">KERNEL</span></tt> and <tt class="docutils literal"><span class="pre">ARCH</span></tt>
179are available in the ebuild evironment and they can be used instead of 429are available in the ebuild evironment and they can be used instead of
180invoking <tt class="literal"><span class="pre">xxx_Xxxx</span></tt> or in switch statements where they are actually 430invoking <tt class="docutils literal"><span class="pre">xxx_Xxxx</span></tt> or in switch statements where they are actually
181necessary.</p> 431necessary.</p>
182<p>A map file can be used to have the various <tt class="literal"><span class="pre">CHOST</span></tt> values being 432<p>A map file can be used to have the various <tt class="docutils literal"><span class="pre">CHOST</span></tt> values being
183translated to the correct values for the four variables. This change is 433translated to the correct values for the four variables. This change is
184invisible for ebuilds and eclasses, but allows to rely on these 434invisible for ebuilds and eclasses, but allows to rely on these
185variables as they are based on a 'safe' value -- the <tt class="literal"><span class="pre">CHOST</span></tt> variable. 435variables as they are based on a 'safe' value -- the <tt class="docutils literal"><span class="pre">CHOST</span></tt> variable.
186Ebuilds should not be sensitive to the keyword value, but use the 436Ebuilds should not be sensitive to the keyword value, but use the
187aforementioned four variables instead. They allow specific tests for 437aforementioned four variables instead. They allow specific tests for
188properties. If this is undesirable, the full <tt class="literal"><span class="pre">CHOST</span></tt> variable can be 438properties. If this is undesirable, the full <tt class="docutils literal"><span class="pre">CHOST</span></tt> variable can be
189used to match a complete operating system.</p> 439used to match a complete operating system.</p>
190<div class="section" id="variable-assignment"> 440<div class="section">
191<h2><a class="toc-backref" href="#id11" name="variable-assignment">Variable Assignment</a></h2> 441<h2><a class="toc-backref" href="#id11" id="variable-assignment" name="variable-assignment">Variable Assignment</a></h2>
192<p>The <tt class="literal"><span class="pre">ELIBC</span></tt>, <tt class="literal"><span class="pre">KERNEL</span></tt>, <tt class="literal"><span class="pre">ARCH</span></tt> variables are filled from a profile 442<p>The <tt class="docutils literal"><span class="pre">ELIBC</span></tt>, <tt class="docutils literal"><span class="pre">KERNEL</span></tt>, <tt class="docutils literal"><span class="pre">ARCH</span></tt> variables are filled from a profile
193file. The file can be overlaid, such that the following entries in the 443file. The file can be overlaid, such that the following entries in the
194map file (on the left of the arrow) will result in the assigned 444map file (on the left of the arrow) will result in the assigned
195variables on the right hand side of the arrow:</p> 445variables on the right hand side of the arrow:</p>
196<pre class="literal-block"> 446<pre class="literal-block">
197*-*-linux-* -&gt; KERNEL=&quot;linux&quot; 447*-*-linux-* -&gt; KERNEL=&quot;linux&quot;
198*-*-*-gnu -&gt; ELIBC=&quot;glibc&quot; 448*-*-*-gnu -&gt; ELIBC=&quot;glibc&quot;
199*-*-kfreebsd-gnu -&gt; KERNEL=&quot;FreeBSD&quot; ELIBC=&quot;glibc&quot; 449*-*-kfreebsd-gnu -&gt; KERNEL=&quot;FreeBSD&quot; ELIBC=&quot;glibc&quot;
200*-*-freebsd* -&gt; KERNEL=&quot;FreeBSD&quot; ELIBC=&quot;FreeBSD&quot; 450*-*-freebsd* -&gt; KERNEL=&quot;FreeBSD&quot; ELIBC=&quot;FreeBSD&quot;
201*-*-darwin* -&gt; KERNEL=&quot;Darwin&quot; ELIBC=&quot;Darwin&quot; 451*-*-darwin* -&gt; KERNEL=&quot;Darwin&quot; ELIBC=&quot;Darwin&quot;
202*-*-netbsd* -&gt; KERNEL=&quot;NetBSD&quot; ELIBC=&quot;NetBSD&quot; 452*-*-netbsd* -&gt; KERNEL=&quot;NetBSD&quot; ELIBC=&quot;NetBSD&quot;
203*-*-solaris* -&gt; KERNEL=&quot;Solaris&quot; ELIBC=&quot;Solaris&quot; 453*-*-solaris* -&gt; KERNEL=&quot;Solaris&quot; ELIBC=&quot;Solaris&quot;
204</pre> 454</pre>
205<p>A way to achieve this is proposed by Mike Frysinger, which 455<p>A way to achieve this is proposed by Mike Frysinger, which
206suggests to have a env-map file, for instance filled with:</p> 456suggests to have an env-map file, for instance filled with:</p>
207<pre class="literal-block"> 457<pre class="literal-block">
208% cat env-map 458% cat env-map
209*-linux-* KERNEL=linux 459*-linux-* KERNEL=linux
210*-gnu ELIBC=glibc 460*-gnu ELIBC=glibc
211x86_64-* ARCH=amd64 461x86_64-* ARCH=amd64
212</pre> 462</pre>
213<p>then the following bash script can be used to set the four variables to 463<p>then the following bash script can be used to set the four variables to
214their correct values:</p> 464their correct values:</p>
215<pre class="literal-block"> 465<pre class="literal-block">
216% cat readmap 466% cat readmap
217#!/bin/bash 467#!/bin/bash
218 468
219CBUILD=${CBUILD:-${CHOST=${CHOST:-$1}}} 469CBUILD=${CBUILD:-${CHOST=${CHOST:-$1}}}
220[[ -z ${CHOST} ]] &amp;&amp; echo need chost 470[[ -z ${CHOST} ]] &amp;&amp; echo need chost
221 471
222unset KERNEL ELIBC ARCH 472unset KERNEL ELIBC ARCH
223 473
224while read LINE ; do 474while read LINE ; do
225 set -- ${LINE} 475 set -- ${LINE}
226 targ=$1 476 targ=$1
227 shift 477 shift
228 [[ ${CBUILD} == ${targ} ]] &amp;&amp; eval $&#64; 478 [[ ${CBUILD} == ${targ} ]] &amp;&amp; eval $&#64;
229done &lt; env-map 479done &lt; env-map
230 480
231echo ARCH=${ARCH} KERNEL=${KERNEL} ELIBC=${ELIBC} 481echo ARCH=${ARCH} KERNEL=${KERNEL} ELIBC=${ELIBC}
232</pre> 482</pre>
233<p>Given the example env-map file, this script would result in:</p> 483<p>Given the example env-map file, this script would result in:</p>
234<pre class="literal-block"> 484<pre class="literal-block">
235% ./readmap x86_64-pc-linux-gnu 485% ./readmap x86_64-pc-linux-gnu
236ARCH=amd64 KERNEL=linux ELIBC=glibc 486ARCH=amd64 KERNEL=linux ELIBC=glibc
237</pre> 487</pre>
238<p>The entries in the <tt class="literal"><span class="pre">env-map</span></tt> file will be evaluated in a forward 488<p>The entries in the <tt class="docutils literal"><span class="pre">env-map</span></tt> file will be evaluated in a forward
239linear full scan. A side-effect of this exhaustive search is that the 489linear full scan. A side-effect of this exhaustive search is that the
240variables can be re-assigned if multiple entries match the given 490variables can be re-assigned if multiple entries match the given
241<tt class="literal"><span class="pre">CHOST</span></tt>. Because of this, the order of the entries does matter. 491<tt class="docutils literal"><span class="pre">CHOST</span></tt>. Because of this, the order of the entries does matter.
242Because the <tt class="literal"><span class="pre">env-map</span></tt> file size is assumed not to exceed the block 492Because the <tt class="docutils literal"><span class="pre">env-map</span></tt> file size is assumed not to exceed the block
243size of the file system, the performance penalty of a full scan versus 493size of the file system, the performance penalty of a full scan versus
244'first-hit-stop technique' is assumed to be minimal.</p> 494'first-hit-stop technique' is assumed to be minimal.</p>
245<p>It should be noted, however, that the above bash script is a proof of 495<p>It should be noted, however, that the above bash script is a proof of
246concept implementation. Since Portage is largerly written in Python, it 496concept implementation. Since Portage is largerly written in Python, it
247will be more efficient to write an equivalent of this code in Python 497will be more efficient to write an equivalent of this code in Python
248also. Coding wise, this is considered to be a non-issue, but the format 498also. Coding wise, this is considered to be a non-issue, but the format
249of the <tt class="literal"><span class="pre">env-map</span></tt> file, and especially its wildcard characters, might 499of the <tt class="docutils literal"><span class="pre">env-map</span></tt> file, and especially its wildcard characters, might
250not be the best match with Python. For this purpose, the format 500not be the best match with Python. For this purpose, the format
251specification of the <tt class="literal"><span class="pre">env-map</span></tt> file is deferred to the Python 501specification of the <tt class="docutils literal"><span class="pre">env-map</span></tt> file is deferred to the Python
252implementation, and only the requirements are given here.</p> 502implementation, and only the requirements are given here.</p>
253<p>The <tt class="literal"><span class="pre">env-map</span></tt> file should be capable of encoding a <tt class="literal"><span class="pre">key</span></tt>, <tt class="literal"><span class="pre">value</span></tt> 503<p>The <tt class="docutils literal"><span class="pre">env-map</span></tt> file should be capable of encoding a <tt class="docutils literal"><span class="pre">key</span></tt>, <tt class="docutils literal"><span class="pre">value</span></tt>
254pair, where <tt class="literal"><span class="pre">key</span></tt> is a (regular) expression that matches a 504pair, where <tt class="docutils literal"><span class="pre">key</span></tt> is a (regular) expression that matches a
255chost-string, and <tt class="literal"><span class="pre">value</span></tt> contains at least one, distinct variable 505chost-string, and <tt class="docutils literal"><span class="pre">value</span></tt> contains at least one, distinct variable
256assignment for the variables <tt class="literal"><span class="pre">ARCH</span></tt>, <tt class="literal"><span class="pre">KERNEL</span></tt> and <tt class="literal"><span class="pre">ELIBC</span></tt>. The 506assignment for the variables <tt class="docutils literal"><span class="pre">ARCH</span></tt>, <tt class="docutils literal"><span class="pre">KERNEL</span></tt> and <tt class="docutils literal"><span class="pre">ELIBC</span></tt>. The
257interpreter of the <tt class="literal"><span class="pre">env-map</span></tt> file must scan the file linearly and 507interpreter of the <tt class="docutils literal"><span class="pre">env-map</span></tt> file must scan the file linearly and
258continue trying to match the <tt class="literal"><span class="pre">key</span></tt>s and assign variables if 508continue trying to match the <tt class="docutils literal"><span class="pre">key</span></tt>s and assign variables if
259appropriate until the end of file.</p> 509appropriate until the end of file.</p>
260<p>Since Portage will use the <tt class="literal"><span class="pre">env-map</span></tt> file, the location of the file is 510<p>Since Portage will use the <tt class="docutils literal"><span class="pre">env-map</span></tt> file, the location of the file is
261beyond the scope of this GLEP and up to the Portage implementors.</p> 511beyond the scope of this GLEP and up to the Portage implementors.</p>
262</div> 512</div>
263</div> 513</div>
264<div class="section" id="references"> 514<div class="section">
265<h1><a class="toc-backref" href="#id12" name="references">References</a></h1> 515<h1><a class="toc-backref" href="#id12" id="references" name="references">References</a></h1>
266<table class="footnote" frame="void" id="id3" rules="none"> 516<table class="docutils footnote" frame="void" id="id3" rules="none">
267<colgroup><col class="label" /><col /></colgroup> 517<colgroup><col class="label" /><col /></colgroup>
268<tbody valign="top"> 518<tbody valign="top">
269<tr><td class="label"><a class="fn-backref" href="#id1" name="id3">[1]</a></td><td>GLEP 22, New &quot;keyword&quot; system to incorporate various 519<tr><td class="label"><a class="fn-backref" href="#id1" name="id3">[1]</a></td><td>GLEP 22, New &quot;keyword&quot; system to incorporate various
270userlands/kernels/archs, Goodyear, 520userlands/kernels/archs, Goodyear,
271(<a class="reference" href="http://glep.gentoo.org/glep-0022.html">http://glep.gentoo.org/glep-0022.html</a>)</td></tr> 521(<a class="reference" href="http://glep.gentoo.org/glep-0022.html">http://glep.gentoo.org/glep-0022.html</a>)</td></tr>
272</tbody> 522</tbody>
273</table> 523</table>
274<table class="footnote" frame="void" id="id4" rules="none"> 524<table class="docutils footnote" frame="void" id="id4" rules="none">
275<colgroup><col class="label" /><col /></colgroup> 525<colgroup><col class="label" /><col /></colgroup>
276<tbody valign="top"> 526<tbody valign="top">
277<tr><td class="label"><a class="fn-backref" href="#id2" name="id4">[2]</a></td><td>For the purpose of readability, we will refer to 1, 2 and 527<tr><td class="label"><a class="fn-backref" href="#id2" name="id4">[2]</a></td><td>For the purpose of readability, we will refer to 1, 2 and
2784-tuples, even though tuple in itself suggest a field consisting of 5284-tuples, even though tuple in itself suggest a field consisting of
279two values. For clarity: a 1-tuple describes a single value field, 529two values. For clarity: a 1-tuple describes a single value field,
280while a 4-tuple describes a field consisting out of four values.</td></tr> 530while a 4-tuple describes a field consisting out of four values.</td></tr>
281</tbody> 531</tbody>
282</table> 532</table>
283</div> 533</div>
284<div class="section" id="copyright"> 534<div class="section">
285<h1><a class="toc-backref" href="#id13" name="copyright">Copyright</a></h1> 535<h1><a class="toc-backref" href="#id13" id="copyright" name="copyright">Copyright</a></h1>
286<p>This document has been placed in the public domain.</p> 536<p>This document has been placed in the public domain.</p>
287</div> 537</div>
288</div>
289 538
539</div>
540<div class="footer">
290<hr class="footer" /> 541<hr class="footer" />
291<div class="footer">
292<a class="reference" href="glep-0047.txt">View document source</a>. 542<a class="reference" href="glep-0047.txt">View document source</a>.
293Generated on: 2006-02-11 21:38 UTC. 543Generated on: 2006-10-10 20:23 UTC.
294Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source. 544Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
545
295</div> 546</div>
296</body> 547</body>
297</html> 548</html>
298 549

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.20