1 |
Author: grobian |
2 |
Date: 2011-03-31 17:24:48 +0000 (Thu, 31 Mar 2011) |
3 |
New Revision: 1695 |
4 |
|
5 |
Added: |
6 |
trunk/baselayout-prefix/baselayout-1.12.5-prefix-chaining.patch |
7 |
Log: |
8 |
add aggregated (patchqueue) prefix-chaining patch |
9 |
|
10 |
Added: trunk/baselayout-prefix/baselayout-1.12.5-prefix-chaining.patch |
11 |
=================================================================== |
12 |
--- trunk/baselayout-prefix/baselayout-1.12.5-prefix-chaining.patch (rev 0) |
13 |
+++ trunk/baselayout-prefix/baselayout-1.12.5-prefix-chaining.patch 2011-03-31 17:24:48 UTC (rev 1695) |
14 |
@@ -0,0 +1,190 @@ |
15 |
+# HG changeset patch |
16 |
+# User Markus Duft <mduft@g.o> |
17 |
+# Date 1301591825 -7200 |
18 |
+# Node ID 95bbe3bfa150477a4b13894b675d836b20f9cde8 |
19 |
+# Parent 1df7e0823f1283d1fc9a71e10a89ff2757092dbc |
20 |
+imported patch baselayout-1.12.5-prefix-chaining.patch |
21 |
+ |
22 |
+diff -r 1df7e0823f12 -r 95bbe3bfa150 baselayout-prefix/etc/profile |
23 |
+--- a/baselayout-prefix/etc/profile Thu Mar 31 16:49:00 2011 +0000 |
24 |
++++ b/baselayout-prefix/etc/profile Thu Mar 31 19:17:05 2011 +0200 |
25 |
+@@ -4,6 +4,62 @@ |
26 |
+ # environment for login shells. |
27 |
+ # |
28 |
+ |
29 |
++# |
30 |
++# for prefix-chaining, the very first thing to do is to load |
31 |
++# the profiles for all chained instances above. |
32 |
++# |
33 |
++# TODO: is it safe in any case to shell source make.conf? |
34 |
++# don't do any recursive expansion here. if the parent can |
35 |
++# use READONLY_EPREFIX's, it has to have the same profile as |
36 |
++# we have here, and thus it will source parents before |
37 |
++# evaluating anything from itself. |
38 |
++# |
39 |
++_ro_root=$(. "@GENTOO_PORTAGE_EPREFIX@"/etc/make.conf && echo $READONLY_EPREFIX) |
40 |
++_ro_deps=${_ro_root#*:} |
41 |
++_ro_root=${_ro_root%:*} |
42 |
++ |
43 |
++# |
44 |
++# prevent dooming of _ro_* variables by recursing down the |
45 |
++# profile chain, by backing the up, tagged by resursion depth. |
46 |
++# |
47 |
++ |
48 |
++[[ -z "${_ro_recursion_level}" ]] && _ro_recursion_level=0 |
49 |
++((++_ro_recursion_level)) |
50 |
++ |
51 |
++for _ro_backup_var in _ro_root _ro_deps; do |
52 |
++ eval "_ro_b${_ro_recursion_level}_${_ro_backup_var}=\${${_ro_backup_var}}" |
53 |
++done |
54 |
++ |
55 |
++if [ -n "${_ro_root}" -a -f "${_ro_root}"/etc/profile ]; then |
56 |
++ . "${_ro_root}"/etc/profile |
57 |
++fi |
58 |
++ |
59 |
++for _ro_backup_var in _ro_root _ro_deps; do |
60 |
++ eval "${_ro_backup_var}=\${_ro_b${_ro_recursion_level}_${_ro_backup_var}}" |
61 |
++done |
62 |
++ |
63 |
++((--_ro_recursion_level)) |
64 |
++ |
65 |
++# |
66 |
++# With prefix-chaining we want another set of variables that |
67 |
++# should be retained for all prefixes. for example it is ok |
68 |
++# to retain PKG_CONFIG_PATH if the parent of the chain can |
69 |
++# be used to resolve RDEPEND... |
70 |
++# |
71 |
++if [[ -n "${_ro_root}" ]]; then |
72 |
++ _ro_chained_path_vars="PATH MANPATH" |
73 |
++ |
74 |
++ if [[ ${_ro_deps} == *RDEPEND* ]]; then |
75 |
++ _ro_chained_path_vars="${_ro_chained_path_vars} PKG_CONFIG_PATH" |
76 |
++ else |
77 |
++ unset PKG_CONFIG_PATH |
78 |
++ fi |
79 |
++ |
80 |
++ for var in ${_ro_chained_path_vars}; do |
81 |
++ eval "_ro_backupenv_paths_${var}=\${${var}}" |
82 |
++ done |
83 |
++fi |
84 |
++ |
85 |
+ # Load environment settings from profile.env, which is created by |
86 |
+ # env-update from the files in /etc/env.d |
87 |
+ if [ -e "@GENTOO_PORTAGE_EPREFIX@"/etc/profile.env ] ; then |
88 |
+@@ -21,10 +77,17 @@ |
89 |
+ # It is intentional in the following line to use || instead of -o. |
90 |
+ # This way the evaluation can be short-circuited and calling whoami is |
91 |
+ # avoided. |
92 |
++# |
93 |
++# system directories are only appended if this prefix is the last |
94 |
++# one in a chain of prefixes (or the only prefix in the chain), so |
95 |
++# that they don't end up in the middle of multiple different prefix |
96 |
++# paths (profile is recursive now, see above!) |
97 |
+ if [ "$EUID" = "0" ] || [ "$USER" = "root" ] ; then |
98 |
+- PATH="@GENTOO_PORTAGE_EPREFIX@/usr/sbin:@GENTOO_PORTAGE_EPREFIX@/usr/bin:@GENTOO_PORTAGE_EPREFIX@/sbin:@GENTOO_PORTAGE_EPREFIX@/bin:${ROOTPATH}:/usr/sbin:/usr/bin:/sbin:/bin" |
99 |
++ PATH="@GENTOO_PORTAGE_EPREFIX@/usr/sbin:@GENTOO_PORTAGE_EPREFIX@/usr/bin:@GENTOO_PORTAGE_EPREFIX@/sbin:@GENTOO_PORTAGE_EPREFIX@/bin:${ROOTPATH}" |
100 |
++ [[ -z "${_ro_root}" ]] && PATH="$PATH:/usr/sbin:/usr/bin:/sbin:/bin" |
101 |
+ else |
102 |
+- PATH="@GENTOO_PORTAGE_EPREFIX@/usr/bin:@GENTOO_PORTAGE_EPREFIX@/bin:${PATH}:/usr/bin:/bin" |
103 |
++ PATH="@GENTOO_PORTAGE_EPREFIX@/usr/bin:@GENTOO_PORTAGE_EPREFIX@/bin:${PATH}" |
104 |
++ [[ -z "${_ro_root}" ]] && PATH="$PATH:/usr/bin:/bin" |
105 |
+ fi |
106 |
+ export PATH |
107 |
+ unset ROOTPATH |
108 |
+@@ -47,9 +110,34 @@ |
109 |
+ # it in the user's dot-files), but it shouldn't make any |
110 |
+ # difference. |
111 |
+ . "@GENTOO_PORTAGE_EPREFIX@"/etc/bash/bashrc |
112 |
++ elif [ -n "${_ro_root}" ]; then |
113 |
++ # We're in a prefix chain, but have no local bash. we rely on bash |
114 |
++ # beeing there _somewhere_ in the chain, so we do not need to set |
115 |
++ # PS1 explicitly. |
116 |
++ if [ -z "${PS1}" ]; then |
117 |
++ # try harder to find something in the parent prefix of the chain. |
118 |
++ # dont bother to search multiple chain members up to the top. |
119 |
++ if [ -f "${_ro_root}/etc/bash/bashrc" ]; then |
120 |
++ . "${_ro_root}/etc/bash/bashrc" |
121 |
++ fi |
122 |
++ fi |
123 |
+ else |
124 |
+ PS1='\u@\h \w \$ ' |
125 |
+ fi |
126 |
++ |
127 |
++ # Set the last dirpart of the current prefix somewhere |
128 |
++ # in the prompt, so one immediately knows where he/she is. |
129 |
++ if [ ${_ro_recursion_level} == 0 ]; then |
130 |
++ # we're in the last prefix of the chain here. |
131 |
++ _ro_name="@GENTOO_PORTAGE_EPREFIX@" |
132 |
++ _ro_name="${_ro_name##*/}" |
133 |
++ |
134 |
++ # use color only if the prompt already contains color escapes |
135 |
++ case "${PS1}" in |
136 |
++ *'\[\033['*'m\]'*) PS1="\[\033[01;36m\][${_ro_name}]\[\033[00m\] ${PS1}" ;; |
137 |
++ *) PS1="[${_ro_name}] ${PS1}" ;; |
138 |
++ esac |
139 |
++ fi |
140 |
+ else |
141 |
+ # Setup a bland default prompt. Since this prompt should be useable |
142 |
+ # on color and non-color terminals, as well as shells that don't |
143 |
+@@ -57,9 +145,43 @@ |
144 |
+ PS1="`whoami`@`uname -n | cut -f1 -d.` \$ " |
145 |
+ fi |
146 |
+ |
147 |
++# when chaining prefixes, we want the prompt to be passed to the child too, |
148 |
++# so we need to export it. |
149 |
++export PS1 |
150 |
++ |
151 |
+ for sh in "@GENTOO_PORTAGE_EPREFIX@"/etc/profile.d/*.sh ; do |
152 |
+ if [ -r "$sh" ] ; then |
153 |
+ . "$sh" |
154 |
+ fi |
155 |
+ done |
156 |
+ unset sh |
157 |
++ |
158 |
++# |
159 |
++# finally chain the save variables for previous prefixes in the chain. |
160 |
++# |
161 |
++if [[ -n "${_ro_chained_path_vars}" ]]; then |
162 |
++ for var in ${_ro_chained_path_vars}; do |
163 |
++ eval "export ${var}=\${${var}}:\${_ro_backupenv_paths_${var}}" |
164 |
++ eval "unset _ro_backupenv_paths_${var}" |
165 |
++ done |
166 |
++fi |
167 |
++ |
168 |
++# |
169 |
++# final finally set EPREFIX to our prefix if we don't have a local portage. this |
170 |
++# was previously done by the startprefix script, but we want to be able to start |
171 |
++# this environment by simply sourcing etc/profile with the correct shell. |
172 |
++# |
173 |
++if [[ -z "${EPREFIX}" ]]; then |
174 |
++ if [[ ! -x "@GENTOO_PORTAGE_EPREFIX@"/usr/bin/emerge ]]; then |
175 |
++ export EPREFIX="@GENTOO_PORTAGE_EPREFIX@" |
176 |
++ fi |
177 |
++elif [[ "${EPREFIX}" != "@GENTOO_PORTAGE_EPREFIX@" && ${_ro_recursion_level} == 0 ]]; then |
178 |
++ echo "WARNING: EPREFIX is set from environment to \"${EPREFIX}\"." |
179 |
++ echo " You are entering the prefix \"@GENTOO_PORTAGE_EPREFIX@\"." |
180 |
++ echo " Having EPREFIX set this way will probably render this environment unusable." |
181 |
++fi |
182 |
++ |
183 |
++unset _ro_root |
184 |
++unset _ro_deps |
185 |
++unset _ro_chained_path_vars |
186 |
++ |
187 |
+diff -r 1df7e0823f12 -r 95bbe3bfa150 baselayout-prefix/sbin/env-update.sh |
188 |
+--- a/baselayout-prefix/sbin/env-update.sh Thu Mar 31 16:49:00 2011 +0000 |
189 |
++++ b/baselayout-prefix/sbin/env-update.sh Thu Mar 31 19:17:05 2011 +0200 |
190 |
+@@ -1,4 +1,4 @@ |
191 |
+-#!@GENTOO_PORTAGE_EPREFIX@/bin/bash |
192 |
++#! /usr/bin/env bash |
193 |
+ # Copyright 1999-2004 Gentoo Foundation |
194 |
+ # Distributed under the terms of the GNU General Public License v2 |
195 |
+ |
196 |
+diff -r 1df7e0823f12 -r 95bbe3bfa150 baselayout-prefix/sbin/runscript.sh |
197 |
+--- a/baselayout-prefix/sbin/runscript.sh Thu Mar 31 16:49:00 2011 +0000 |
198 |
++++ b/baselayout-prefix/sbin/runscript.sh Thu Mar 31 19:17:05 2011 +0200 |
199 |
+@@ -1,4 +1,4 @@ |
200 |
+-#!@GENTOO_PORTAGE_EPREFIX@/bin/bash |
201 |
++#! /usr/bin/env bash |
202 |
+ # Copyright 1999-2006 Gentoo Foundation |
203 |
+ # Distributed under the terms of the GNU General Public License v2 |
204 |
+ |