| 1 | GLEP: 47 |
1 | GLEP: 47 |
| 2 | Title: Creating 'safe' environment variables |
2 | Title: Creating 'safe' environment variables |
| 3 | Version: $Revision: 1.2 $ |
3 | Version: $Revision: 1.5 $ |
| 4 | Last-Modified: $Date: 2006/02/11 21:43:14 $ |
4 | Last-Modified: $Date: 2007/04/21 03:13:16 $ |
| 5 | Author: Diego Pettenò, Fabian Groffen |
5 | Author: Diego Pettenò, Fabian Groffen |
| 6 | Status: Draft |
6 | Status: Deferred |
| 7 | Type: Standards Track |
7 | Type: Standards Track |
| 8 | Content-Type: text/x-rst |
8 | Content-Type: text/x-rst |
| 9 | Created: 14-Oct-2005 |
9 | Created: 14-Oct-2005 |
| 10 | Post-History: 09-Feb-2006 |
10 | Post-History: 09-Feb-2006 |
| 11 | |
11 | |
| … | |
… | |
| 91 | the current situation in the tree, it is considered to be a big |
91 | the current situation in the tree, it is considered to be a big |
| 92 | advantage over the 4-tuple keyword from GLEP 22. This GLEP is an |
92 | advantage over the 4-tuple keyword from GLEP 22. This GLEP is an |
| 93 | official specification of the syntax of the keyword. |
93 | official specification of the syntax of the keyword. |
| 94 | |
94 | |
| 95 | Keywords will consist out of two parts separated by a hyphen ('-'). The |
95 | Keywords will consist out of two parts separated by a hyphen ('-'). The |
| 96 | left hand part of the keyword 2-tuple is the architecture, such as |
96 | part up to the first hyphen from the left of the keyword 2-tuple is the |
| 97 | ppc64, sparc and x86. The right hand part indicates the operating |
97 | architecture, such as ppc64, sparc and x86. Allowed characters for the |
|
|
98 | architecture name are in ``a-z0-9``. The remaining part on the right of |
|
|
99 | the first hyphen from the left indicates the operating system or |
| 98 | system or distribution, such as linux, macos, darwin, obsd, etc. If the |
100 | distribution, such as linux, macos, darwin, obsd, et-cetera. If the |
| 99 | right hand part is omitted, it implies the operating system/distribution |
101 | right hand part is omitted, it implies the operating system/distribution |
| 100 | type is Gentoo GNU/Linux. In such case the hyphen is also omitted. |
102 | type is Gentoo GNU/Linux. In such case the hyphen is also omitted, and |
| 101 | Examples of such keywords are ppc-darwin and x86. This is fully |
103 | the keyword consists of solely the architecture. The operating system |
| 102 | compatible with the current use of keywords in the tree. |
104 | or distribution name can consist out of characters in ``a-zA-Z0-9_+:-``. |
|
|
105 | Please note that the hyphen is an allowed character, and therefore the |
|
|
106 | separation of the two fields in the keyword is only determinable by |
|
|
107 | scanning for the first hyphen character from the start of the keyword |
|
|
108 | string. Examples of keywords following this specification are |
|
|
109 | ppc-darwin and x86. This is fully compatible with the current use of |
|
|
110 | keywords in the tree. |
| 103 | |
111 | |
| 104 | The variables ``ELIBC``, ``KERNEL`` and ``ARCH`` are currently set in |
112 | The variables ``ELIBC``, ``KERNEL`` and ``ARCH`` are currently set in |
| 105 | the profiles when other than their defaults for a GNU/Linux system. |
113 | the profiles when other than their defaults for a GNU/Linux system. |
| 106 | They can as such easily be overridden and defined by the user. To |
114 | They can as such easily be overridden and defined by the user. To |
| 107 | prevent this from happening, the variables should be auto filled by |
115 | prevent this from happening, the variables should be auto filled by |
| … | |
… | |
| 162 | *-*-darwin* -> KERNEL="Darwin" ELIBC="Darwin" |
170 | *-*-darwin* -> KERNEL="Darwin" ELIBC="Darwin" |
| 163 | *-*-netbsd* -> KERNEL="NetBSD" ELIBC="NetBSD" |
171 | *-*-netbsd* -> KERNEL="NetBSD" ELIBC="NetBSD" |
| 164 | *-*-solaris* -> KERNEL="Solaris" ELIBC="Solaris" |
172 | *-*-solaris* -> KERNEL="Solaris" ELIBC="Solaris" |
| 165 | |
173 | |
| 166 | A way to achieve this is proposed by Mike Frysinger, which |
174 | A way to achieve this is proposed by Mike Frysinger, which |
| 167 | suggests to have a env-map file, for instance filled with:: |
175 | suggests to have an env-map file, for instance filled with:: |
| 168 | |
176 | |
| 169 | % cat env-map |
177 | % cat env-map |
| 170 | *-linux-* KERNEL=linux |
178 | *-linux-* KERNEL=linux |
| 171 | *-gnu ELIBC=glibc |
179 | *-gnu ELIBC=glibc |
| 172 | x86_64-* ARCH=amd64 |
180 | x86_64-* ARCH=amd64 |