Gentoo Archives: gentoo-portage-dev

From: Mike Frysinger <vapier@g.o>
To: gentoo-portage-dev@l.g.o
Subject: [gentoo-portage-dev] [PATCH] make PORTAGE_BIN_PATH settings relocatable
Date: Mon, 01 Jun 2015 06:35:00
Message-Id: 1433140493-3288-1-git-send-email-vapier@gentoo.org
1 Rather than hardcode /usr/lib/portage/bin everywhere, use the currently
2 active script name to locate the right path.
3
4 This helps out the Prefix project as they currently rewrite these on the
5 fly, but even the latest portage no longer installs into that path.
6 ---
7 bin/ebuild-helpers/die | 5 ++++-
8 bin/ebuild-helpers/dobin | 5 ++++-
9 bin/ebuild-helpers/doconfd | 6 +++++-
10 bin/ebuild-helpers/dodir | 5 ++++-
11 bin/ebuild-helpers/dodoc | 5 ++++-
12 bin/ebuild-helpers/doenvd | 6 +++++-
13 bin/ebuild-helpers/doexe | 5 ++++-
14 bin/ebuild-helpers/dohard | 5 ++++-
15 bin/ebuild-helpers/doheader | 5 ++++-
16 bin/ebuild-helpers/dohtml | 6 ++++--
17 bin/ebuild-helpers/doinfo | 5 ++++-
18 bin/ebuild-helpers/doinitd | 6 +++++-
19 bin/ebuild-helpers/doins | 5 ++++-
20 bin/ebuild-helpers/dolib | 5 ++++-
21 bin/ebuild-helpers/doman | 5 ++++-
22 bin/ebuild-helpers/domo | 5 ++++-
23 bin/ebuild-helpers/dosbin | 5 ++++-
24 bin/ebuild-helpers/dosed | 5 ++++-
25 bin/ebuild-helpers/dosym | 5 ++++-
26 bin/ebuild-helpers/ecompress | 5 ++++-
27 bin/ebuild-helpers/ecompressdir | 5 ++++-
28 bin/ebuild-helpers/elog | 5 ++++-
29 bin/ebuild-helpers/emake | 5 ++++-
30 bin/ebuild-helpers/fowners | 5 ++++-
31 bin/ebuild-helpers/fperms | 5 ++++-
32 bin/ebuild-helpers/keepdir | 5 ++++-
33 bin/ebuild-helpers/newins | 5 ++++-
34 bin/ebuild-helpers/portageq | 5 ++++-
35 bin/ebuild-helpers/prepall | 5 ++++-
36 bin/ebuild-helpers/prepalldocs | 5 ++++-
37 bin/ebuild-helpers/prepallinfo | 5 ++++-
38 bin/ebuild-helpers/prepallman | 5 ++++-
39 bin/ebuild-helpers/prepallstrip | 5 ++++-
40 bin/ebuild-helpers/prepinfo | 5 ++++-
41 bin/ebuild-helpers/prepman | 5 ++++-
42 bin/ebuild-helpers/prepstrip | 6 +++++-
43 bin/ebuild-helpers/unprivileged/chown | 7 +++++--
44 bin/ebuild-helpers/xattr/install | 5 ++++-
45 bin/ebuild-ipc | 4 +++-
46 bin/ebuild.sh | 4 +++-
47 bin/helper-functions.sh | 5 ++++-
48 bin/isolated-functions.sh | 5 ++++-
49 bin/misc-functions.sh | 5 ++++-
50 43 files changed, 175 insertions(+), 45 deletions(-)
51
52 diff --git a/bin/ebuild-helpers/die b/bin/ebuild-helpers/die
53 index 9869141..09d1c74 100755
54 --- a/bin/ebuild-helpers/die
55 +++ b/bin/ebuild-helpers/die
56 @@ -2,6 +2,9 @@
57 # Copyright 2010 Gentoo Foundation
58 # Distributed under the terms of the GNU General Public License v2
59
60 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
61 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
62 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")")
63 +fi
64 +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh
65 die "$@"
66 exit 1
67 diff --git a/bin/ebuild-helpers/dobin b/bin/ebuild-helpers/dobin
68 index 0ba1eb0..cf5a9bc 100755
69 --- a/bin/ebuild-helpers/dobin
70 +++ b/bin/ebuild-helpers/dobin
71 @@ -2,7 +2,10 @@
72 # Copyright 1999-2012 Gentoo Foundation
73 # Distributed under the terms of the GNU General Public License v2
74
75 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
76 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
77 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")")
78 +fi
79 +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh
80
81 if [[ $# -lt 1 ]] ; then
82 __helpers_die "${0##*/}: at least one argument needed"
83 diff --git a/bin/ebuild-helpers/doconfd b/bin/ebuild-helpers/doconfd
84 index 1baa3ed..3d5a0f6 100755
85 --- a/bin/ebuild-helpers/doconfd
86 +++ b/bin/ebuild-helpers/doconfd
87 @@ -2,8 +2,12 @@
88 # Copyright 1999-2010 Gentoo Foundation
89 # Distributed under the terms of the GNU General Public License v2
90
91 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
92 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")")
93 +fi
94 +
95 if [[ $# -lt 1 ]] ; then
96 - source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
97 + source "${PORTAGE_BIN_PATH}"/isolated-functions.sh
98 __helpers_die "${0##*/}: at least one argument needed"
99 exit 1
100 fi
101 diff --git a/bin/ebuild-helpers/dodir b/bin/ebuild-helpers/dodir
102 index e03ba9a..34ba300 100755
103 --- a/bin/ebuild-helpers/dodir
104 +++ b/bin/ebuild-helpers/dodir
105 @@ -2,7 +2,10 @@
106 # Copyright 1999-2012 Gentoo Foundation
107 # Distributed under the terms of the GNU General Public License v2
108
109 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
110 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
111 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")")
112 +fi
113 +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh
114
115 if ! ___eapi_has_prefix_variables; then
116 ED=${D}
117 diff --git a/bin/ebuild-helpers/dodoc b/bin/ebuild-helpers/dodoc
118 index 6ccf0a4..2d18e26 100755
119 --- a/bin/ebuild-helpers/dodoc
120 +++ b/bin/ebuild-helpers/dodoc
121 @@ -2,7 +2,10 @@
122 # Copyright 1999-2012 Gentoo Foundation
123 # Distributed under the terms of the GNU General Public License v2
124
125 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
126 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
127 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")")
128 +fi
129 +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh
130
131 if ___eapi_dodoc_supports_-r; then
132 __PORTAGE_HELPER='dodoc' exec doins "$@"
133 diff --git a/bin/ebuild-helpers/doenvd b/bin/ebuild-helpers/doenvd
134 index 67bb934..77e926f 100755
135 --- a/bin/ebuild-helpers/doenvd
136 +++ b/bin/ebuild-helpers/doenvd
137 @@ -2,8 +2,12 @@
138 # Copyright 1999-2010 Gentoo Foundation
139 # Distributed under the terms of the GNU General Public License v2
140
141 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
142 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")")
143 +fi
144 +
145 if [[ $# -lt 1 ]] ; then
146 - source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
147 + source "${PORTAGE_BIN_PATH}"/isolated-functions.sh
148 __helpers_die "${0##*/}: at least one argument needed"
149 exit 1
150 fi
151 diff --git a/bin/ebuild-helpers/doexe b/bin/ebuild-helpers/doexe
152 index c34fcae..4c00c2a 100755
153 --- a/bin/ebuild-helpers/doexe
154 +++ b/bin/ebuild-helpers/doexe
155 @@ -2,7 +2,10 @@
156 # Copyright 1999-2012 Gentoo Foundation
157 # Distributed under the terms of the GNU General Public License v2
158
159 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
160 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
161 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")")
162 +fi
163 +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh
164
165 if [[ $# -lt 1 ]] ; then
166 __helpers_die "${0##*/}: at least one argument needed"
167 diff --git a/bin/ebuild-helpers/dohard b/bin/ebuild-helpers/dohard
168 index e0a44fa..669afd8 100755
169 --- a/bin/ebuild-helpers/dohard
170 +++ b/bin/ebuild-helpers/dohard
171 @@ -2,7 +2,10 @@
172 # Copyright 1999-2012 Gentoo Foundation
173 # Distributed under the terms of the GNU General Public License v2
174
175 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
176 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
177 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")")
178 +fi
179 +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh
180
181 if ! ___eapi_has_dohard; then
182 die "'${0##*/}' has been banned for EAPI '$EAPI'"
183 diff --git a/bin/ebuild-helpers/doheader b/bin/ebuild-helpers/doheader
184 index e4cae6a..3d093f2 100755
185 --- a/bin/ebuild-helpers/doheader
186 +++ b/bin/ebuild-helpers/doheader
187 @@ -2,7 +2,10 @@
188 # Copyright 1999-2012 Gentoo Foundation
189 # Distributed under the terms of the GNU General Public License v2
190
191 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
192 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
193 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")")
194 +fi
195 +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh
196
197 if ! ___eapi_has_doheader; then
198 die "${0##*/} is not supported in EAPI ${EAPI}"
199 diff --git a/bin/ebuild-helpers/dohtml b/bin/ebuild-helpers/dohtml
200 index 0478e49..9c08b11 100755
201 --- a/bin/ebuild-helpers/dohtml
202 +++ b/bin/ebuild-helpers/dohtml
203 @@ -2,13 +2,15 @@
204 # Copyright 2009-2013 Gentoo Foundation
205 # Distributed under the terms of the GNU General Public License v2
206
207 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
208 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
209 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")")
210 +fi
211 +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh
212
213 if ___eapi_has_dohtml_deprecated; then
214 eqawarn "'${0##*/}' is deprecated in EAPI '$EAPI'"
215 fi
216
217 -PORTAGE_BIN_PATH=${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}
218 PORTAGE_PYM_PATH=${PORTAGE_PYM_PATH:-/usr/lib/portage/pym}
219 # Use safe cwd, avoiding unsafe import for bug #469338.
220 export __PORTAGE_HELPER_CWD=${PWD}
221 diff --git a/bin/ebuild-helpers/doinfo b/bin/ebuild-helpers/doinfo
222 index 2edbdc5..f8a9b6e 100755
223 --- a/bin/ebuild-helpers/doinfo
224 +++ b/bin/ebuild-helpers/doinfo
225 @@ -2,7 +2,10 @@
226 # Copyright 1999-2012 Gentoo Foundation
227 # Distributed under the terms of the GNU General Public License v2
228
229 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
230 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
231 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")")
232 +fi
233 +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh
234
235 if [[ -z $1 ]] ; then
236 __helpers_die "${0##*/}: at least one argument needed"
237 diff --git a/bin/ebuild-helpers/doinitd b/bin/ebuild-helpers/doinitd
238 index aa7b66c..5887652 100755
239 --- a/bin/ebuild-helpers/doinitd
240 +++ b/bin/ebuild-helpers/doinitd
241 @@ -2,8 +2,12 @@
242 # Copyright 1999-2010 Gentoo Foundation
243 # Distributed under the terms of the GNU General Public License v2
244
245 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
246 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")")
247 +fi
248 +
249 if [[ $# -lt 1 ]] ; then
250 - source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
251 + source "${PORTAGE_BIN_PATH}"/isolated-functions.sh
252 __helpers_die "${0##*/}: at least one argument needed"
253 exit 1
254 fi
255 diff --git a/bin/ebuild-helpers/doins b/bin/ebuild-helpers/doins
256 index c60e057..ba1f7c7 100755
257 --- a/bin/ebuild-helpers/doins
258 +++ b/bin/ebuild-helpers/doins
259 @@ -2,7 +2,10 @@
260 # Copyright 1999-2012 Gentoo Foundation
261 # Distributed under the terms of the GNU General Public License v2
262
263 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
264 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
265 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")")
266 +fi
267 +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh
268
269 helper=${__PORTAGE_HELPER:-${0##*/}}
270
271 diff --git a/bin/ebuild-helpers/dolib b/bin/ebuild-helpers/dolib
272 index fd92d7f..2d08c6f 100755
273 --- a/bin/ebuild-helpers/dolib
274 +++ b/bin/ebuild-helpers/dolib
275 @@ -2,7 +2,10 @@
276 # Copyright 1999-2012 Gentoo Foundation
277 # Distributed under the terms of the GNU General Public License v2
278
279 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
280 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
281 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")")
282 +fi
283 +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh
284
285 if ! ___eapi_has_prefix_variables; then
286 ED=${D}
287 diff --git a/bin/ebuild-helpers/doman b/bin/ebuild-helpers/doman
288 index d680859..6c78a31 100755
289 --- a/bin/ebuild-helpers/doman
290 +++ b/bin/ebuild-helpers/doman
291 @@ -2,7 +2,10 @@
292 # Copyright 1999-2012 Gentoo Foundation
293 # Distributed under the terms of the GNU General Public License v2
294
295 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
296 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
297 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")")
298 +fi
299 +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh
300
301 if [[ $# -lt 1 ]] ; then
302 __helpers_die "${0##*/}: at least one argument needed"
303 diff --git a/bin/ebuild-helpers/domo b/bin/ebuild-helpers/domo
304 index 9a8dda3..7709da3 100755
305 --- a/bin/ebuild-helpers/domo
306 +++ b/bin/ebuild-helpers/domo
307 @@ -2,7 +2,10 @@
308 # Copyright 1999-2012 Gentoo Foundation
309 # Distributed under the terms of the GNU General Public License v2
310
311 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
312 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
313 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")")
314 +fi
315 +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh
316
317 mynum=${#}
318 if [ ${mynum} -lt 1 ] ; then
319 diff --git a/bin/ebuild-helpers/dosbin b/bin/ebuild-helpers/dosbin
320 index 361ca83..4b4b589 100755
321 --- a/bin/ebuild-helpers/dosbin
322 +++ b/bin/ebuild-helpers/dosbin
323 @@ -2,7 +2,10 @@
324 # Copyright 1999-2012 Gentoo Foundation
325 # Distributed under the terms of the GNU General Public License v2
326
327 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
328 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
329 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")")
330 +fi
331 +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh
332
333 if [[ $# -lt 1 ]] ; then
334 __helpers_die "${0##*/}: at least one argument needed"
335 diff --git a/bin/ebuild-helpers/dosed b/bin/ebuild-helpers/dosed
336 index 7db0629..1793a26 100755
337 --- a/bin/ebuild-helpers/dosed
338 +++ b/bin/ebuild-helpers/dosed
339 @@ -2,7 +2,10 @@
340 # Copyright 1999-2012 Gentoo Foundation
341 # Distributed under the terms of the GNU General Public License v2
342
343 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
344 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
345 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")")
346 +fi
347 +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh
348
349 if ! ___eapi_has_dosed; then
350 die "'${0##*/}' has been banned for EAPI '$EAPI'"
351 diff --git a/bin/ebuild-helpers/dosym b/bin/ebuild-helpers/dosym
352 index 649b100..967e158 100755
353 --- a/bin/ebuild-helpers/dosym
354 +++ b/bin/ebuild-helpers/dosym
355 @@ -2,7 +2,10 @@
356 # Copyright 1999-2012 Gentoo Foundation
357 # Distributed under the terms of the GNU General Public License v2
358
359 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
360 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
361 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")")
362 +fi
363 +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh
364
365 if [[ $# -ne 2 ]] ; then
366 __helpers_die "${0##*/}: two arguments needed"
367 diff --git a/bin/ebuild-helpers/ecompress b/bin/ebuild-helpers/ecompress
368 index 71287b4..57e2ead 100755
369 --- a/bin/ebuild-helpers/ecompress
370 +++ b/bin/ebuild-helpers/ecompress
371 @@ -2,7 +2,10 @@
372 # Copyright 1999-2010 Gentoo Foundation
373 # Distributed under the terms of the GNU General Public License v2
374
375 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
376 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
377 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")")
378 +fi
379 +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh
380
381 if [[ -z $1 ]] ; then
382 __helpers_die "${0##*/}: at least one argument needed"
383 diff --git a/bin/ebuild-helpers/ecompressdir b/bin/ebuild-helpers/ecompressdir
384 index eca5888..f9ae9c3 100755
385 --- a/bin/ebuild-helpers/ecompressdir
386 +++ b/bin/ebuild-helpers/ecompressdir
387 @@ -2,7 +2,10 @@
388 # Copyright 1999-2013 Gentoo Foundation
389 # Distributed under the terms of the GNU General Public License v2
390
391 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/helper-functions.sh
392 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
393 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")")
394 +fi
395 +source "${PORTAGE_BIN_PATH}"/helper-functions.sh
396
397 if [[ -z $1 ]] ; then
398 __helpers_die "${0##*/}: at least one argument needed"
399 diff --git a/bin/ebuild-helpers/elog b/bin/ebuild-helpers/elog
400 index a2303af..2ffd3a9 100755
401 --- a/bin/ebuild-helpers/elog
402 +++ b/bin/ebuild-helpers/elog
403 @@ -2,6 +2,9 @@
404 # Copyright 1999-2009 Gentoo Foundation
405 # Distributed under the terms of the GNU General Public License v2
406
407 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
408 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
409 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")")
410 +fi
411 +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh
412
413 ${0##*/} "$@"
414 diff --git a/bin/ebuild-helpers/emake b/bin/ebuild-helpers/emake
415 index 2a3c2f0..5748312 100755
416 --- a/bin/ebuild-helpers/emake
417 +++ b/bin/ebuild-helpers/emake
418 @@ -9,7 +9,10 @@
419 #
420 # With newer EAPIs, we also automatically fail the build if make itself fails.
421
422 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
423 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
424 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")")
425 +fi
426 +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh
427
428 cmd=(
429 ${MAKE:-make} ${MAKEOPTS} "$@" ${EXTRA_EMAKE}
430 diff --git a/bin/ebuild-helpers/fowners b/bin/ebuild-helpers/fowners
431 index cee4108..28ee049 100755
432 --- a/bin/ebuild-helpers/fowners
433 +++ b/bin/ebuild-helpers/fowners
434 @@ -2,7 +2,10 @@
435 # Copyright 1999-2012 Gentoo Foundation
436 # Distributed under the terms of the GNU General Public License v2
437
438 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
439 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
440 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")")
441 +fi
442 +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh
443
444 if ! ___eapi_has_prefix_variables; then
445 EPREFIX= ED=${D}
446 diff --git a/bin/ebuild-helpers/fperms b/bin/ebuild-helpers/fperms
447 index d854ebb..644a811 100755
448 --- a/bin/ebuild-helpers/fperms
449 +++ b/bin/ebuild-helpers/fperms
450 @@ -2,7 +2,10 @@
451 # Copyright 1999-2012 Gentoo Foundation
452 # Distributed under the terms of the GNU General Public License v2
453
454 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
455 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
456 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")")
457 +fi
458 +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh
459
460 if ! ___eapi_has_prefix_variables; then
461 ED=${D}
462 diff --git a/bin/ebuild-helpers/keepdir b/bin/ebuild-helpers/keepdir
463 index bec2feb..b6af2e9 100755
464 --- a/bin/ebuild-helpers/keepdir
465 +++ b/bin/ebuild-helpers/keepdir
466 @@ -2,7 +2,10 @@
467 # Copyright 1999-2013 Gentoo Foundation
468 # Distributed under the terms of the GNU General Public License v2
469
470 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
471 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
472 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")")
473 +fi
474 +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh
475
476 if ! ___eapi_has_prefix_variables; then
477 ED=${D}
478 diff --git a/bin/ebuild-helpers/newins b/bin/ebuild-helpers/newins
479 index 0335985..062a40f 100755
480 --- a/bin/ebuild-helpers/newins
481 +++ b/bin/ebuild-helpers/newins
482 @@ -2,7 +2,10 @@
483 # Copyright 1999-2012 Gentoo Foundation
484 # Distributed under the terms of the GNU General Public License v2
485
486 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
487 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
488 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")")
489 +fi
490 +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh
491
492 helper=${0##*/}
493
494 diff --git a/bin/ebuild-helpers/portageq b/bin/ebuild-helpers/portageq
495 index ba889eb..a824df6 100755
496 --- a/bin/ebuild-helpers/portageq
497 +++ b/bin/ebuild-helpers/portageq
498 @@ -5,7 +5,10 @@
499 scriptpath=${BASH_SOURCE[0]}
500 scriptname=${scriptpath##*/}
501
502 -PORTAGE_BIN_PATH=${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}
503 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
504 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")")
505 +fi
506 +
507 PORTAGE_PYM_PATH=${PORTAGE_PYM_PATH:-/usr/lib/portage/pym}
508 # Use safe cwd, avoiding unsafe import for bug #469338.
509 cd "${PORTAGE_PYM_PATH}"
510 diff --git a/bin/ebuild-helpers/prepall b/bin/ebuild-helpers/prepall
511 index fb5c2db..99ec50a 100755
512 --- a/bin/ebuild-helpers/prepall
513 +++ b/bin/ebuild-helpers/prepall
514 @@ -2,7 +2,10 @@
515 # Copyright 1999-2012 Gentoo Foundation
516 # Distributed under the terms of the GNU General Public License v2
517
518 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
519 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
520 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")")
521 +fi
522 +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh
523
524 if ! ___eapi_has_prefix_variables; then
525 ED=${D}
526 diff --git a/bin/ebuild-helpers/prepalldocs b/bin/ebuild-helpers/prepalldocs
527 index 3094661..ed09c6e 100755
528 --- a/bin/ebuild-helpers/prepalldocs
529 +++ b/bin/ebuild-helpers/prepalldocs
530 @@ -2,7 +2,10 @@
531 # Copyright 1999-2012 Gentoo Foundation
532 # Distributed under the terms of the GNU General Public License v2
533
534 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
535 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
536 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")")
537 +fi
538 +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh
539
540 if ___eapi_has_docompress; then
541 die "'${0##*/}' has been banned for EAPI '$EAPI'"
542 diff --git a/bin/ebuild-helpers/prepallinfo b/bin/ebuild-helpers/prepallinfo
543 index 1a20275..7ce9ce5 100755
544 --- a/bin/ebuild-helpers/prepallinfo
545 +++ b/bin/ebuild-helpers/prepallinfo
546 @@ -2,7 +2,10 @@
547 # Copyright 1999-2012 Gentoo Foundation
548 # Distributed under the terms of the GNU General Public License v2
549
550 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
551 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
552 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")")
553 +fi
554 +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh
555
556 if ! ___eapi_has_prefix_variables; then
557 ED=${D}
558 diff --git a/bin/ebuild-helpers/prepallman b/bin/ebuild-helpers/prepallman
559 index 5331eaf..5547115 100755
560 --- a/bin/ebuild-helpers/prepallman
561 +++ b/bin/ebuild-helpers/prepallman
562 @@ -2,7 +2,10 @@
563 # Copyright 1999-2012 Gentoo Foundation
564 # Distributed under the terms of the GNU General Public License v2
565
566 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
567 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
568 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")")
569 +fi
570 +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh
571
572 # replaced by controllable compression in EAPI 4
573 ___eapi_has_docompress && exit 0
574 diff --git a/bin/ebuild-helpers/prepallstrip b/bin/ebuild-helpers/prepallstrip
575 index 1aa6686..34e6174 100755
576 --- a/bin/ebuild-helpers/prepallstrip
577 +++ b/bin/ebuild-helpers/prepallstrip
578 @@ -2,7 +2,10 @@
579 # Copyright 1999-2012 Gentoo Foundation
580 # Distributed under the terms of the GNU General Public License v2
581
582 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
583 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
584 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")")
585 +fi
586 +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh
587
588 if ! ___eapi_has_prefix_variables; then
589 ED=${D}
590 diff --git a/bin/ebuild-helpers/prepinfo b/bin/ebuild-helpers/prepinfo
591 index 5afc18a..9312f64 100755
592 --- a/bin/ebuild-helpers/prepinfo
593 +++ b/bin/ebuild-helpers/prepinfo
594 @@ -2,7 +2,10 @@
595 # Copyright 1999-2012 Gentoo Foundation
596 # Distributed under the terms of the GNU General Public License v2
597
598 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
599 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
600 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")")
601 +fi
602 +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh
603
604 if ! ___eapi_has_prefix_variables; then
605 ED=${D}
606 diff --git a/bin/ebuild-helpers/prepman b/bin/ebuild-helpers/prepman
607 index fb5dcb4..95d7d25 100755
608 --- a/bin/ebuild-helpers/prepman
609 +++ b/bin/ebuild-helpers/prepman
610 @@ -5,7 +5,10 @@
611 # Do not compress man pages which are smaller than this (in bytes). #169260
612 SIZE_LIMIT='128'
613
614 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
615 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
616 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")")
617 +fi
618 +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh
619
620 if ! ___eapi_has_prefix_variables; then
621 ED=${D}
622 diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip
623 index 2ef8a1a..f80838b 100755
624 --- a/bin/ebuild-helpers/prepstrip
625 +++ b/bin/ebuild-helpers/prepstrip
626 @@ -2,8 +2,12 @@
627 # Copyright 1999-2014 Gentoo Foundation
628 # Distributed under the terms of the GNU General Public License v2
629
630 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
631 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(readlink -f "$0")")")
632 +fi
633 +
634 PORTAGE_PYM_PATH=${PORTAGE_PYM_PATH:-/usr/lib/portage/pym}
635 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/helper-functions.sh
636 +source "${PORTAGE_BIN_PATH}"/helper-functions.sh
637
638 # avoid multiple calls to `has`. this creates things like:
639 # FEATURES_foo=false
640 diff --git a/bin/ebuild-helpers/unprivileged/chown b/bin/ebuild-helpers/unprivileged/chown
641 index 2f1f161..dde0d78 100755
642 --- a/bin/ebuild-helpers/unprivileged/chown
643 +++ b/bin/ebuild-helpers/unprivileged/chown
644 @@ -2,6 +2,11 @@
645 # Copyright 2012-2015 Gentoo Foundation
646 # Distributed under the terms of the GNU General Public License v2
647
648 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
649 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(dirname "$(readlink -f "$0")")")")
650 +fi
651 +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh
652 +
653 scriptpath=${BASH_SOURCE[0]}
654 scriptname=${scriptpath##*/}
655
656 @@ -23,8 +28,6 @@ for path in ${PATH}; do
657 output="${output}\n ... (further messages truncated)"
658 fi
659
660 - source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
661 -
662 if ! ___eapi_has_prefix_variables; then
663 EPREFIX=
664 fi
665 diff --git a/bin/ebuild-helpers/xattr/install b/bin/ebuild-helpers/xattr/install
666 index 2d2a693..c48f7c5 100755
667 --- a/bin/ebuild-helpers/xattr/install
668 +++ b/bin/ebuild-helpers/xattr/install
669 @@ -2,7 +2,10 @@
670 # Copyright 2013-2015 Gentoo Foundation
671 # Distributed under the terms of the GNU General Public License v2
672
673 -PORTAGE_BIN_PATH=${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}
674 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
675 + PORTAGE_BIN_PATH=$(dirname "$(dirname "$(dirname "$(readlink -f "$0")")")")
676 +fi
677 +
678 PORTAGE_PYM_PATH=${PORTAGE_PYM_PATH:-/usr/lib/portage/pym}
679 INSTALL_XATTR=${EPREFIX}/usr/bin/install-xattr
680 # Use safe cwd, avoiding unsafe import for bug #469338.
681 diff --git a/bin/ebuild-ipc b/bin/ebuild-ipc
682 index 820005f..7d12e05 100755
683 --- a/bin/ebuild-ipc
684 +++ b/bin/ebuild-ipc
685 @@ -2,7 +2,9 @@
686 # Copyright 2010-2013 Gentoo Foundation
687 # Distributed under the terms of the GNU General Public License v2
688
689 -PORTAGE_BIN_PATH=${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}
690 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
691 + PORTAGE_BIN_PATH=$(dirname "$(readlink -f "$0")")
692 +fi
693 PORTAGE_PYM_PATH=${PORTAGE_PYM_PATH:-/usr/lib/portage/pym}
694 # Use safe cwd, avoiding unsafe import for bug #469338.
695 cd "${PORTAGE_PYM_PATH}"
696 diff --git a/bin/ebuild.sh b/bin/ebuild.sh
697 index 4e26f87..4b0f0f9 100755
698 --- a/bin/ebuild.sh
699 +++ b/bin/ebuild.sh
700 @@ -2,7 +2,9 @@
701 # Copyright 1999-2015 Gentoo Foundation
702 # Distributed under the terms of the GNU General Public License v2
703
704 -PORTAGE_BIN_PATH="${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"
705 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
706 + PORTAGE_BIN_PATH=$(dirname "$(readlink -f "$0")")
707 +fi
708 PORTAGE_PYM_PATH="${PORTAGE_PYM_PATH:-/usr/lib/portage/pym}"
709
710 # Prevent aliases from causing portage to act inappropriately.
711 diff --git a/bin/helper-functions.sh b/bin/helper-functions.sh
712 index b9bc74a..5cd8de1 100644
713 --- a/bin/helper-functions.sh
714 +++ b/bin/helper-functions.sh
715 @@ -5,7 +5,10 @@
716 # For routines we want to use in ebuild-helpers/ but don't want to
717 # expose to the general ebuild environment.
718
719 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
720 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
721 + PORTAGE_BIN_PATH=$(dirname "$(readlink -f "$0")")
722 +fi
723 +source "${PORTAGE_BIN_PATH}"/isolated-functions.sh
724
725 #
726 # API functions for doing parallel processing
727 diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
728 index 8e789ec..5fe2e3d 100644
729 --- a/bin/isolated-functions.sh
730 +++ b/bin/isolated-functions.sh
731 @@ -2,7 +2,10 @@
732 # Copyright 1999-2014 Gentoo Foundation
733 # Distributed under the terms of the GNU General Public License v2
734
735 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}/eapi.sh"
736 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
737 + PORTAGE_BIN_PATH=$(dirname "$(readlink -f "$0")")
738 +fi
739 +source "${PORTAGE_BIN_PATH}/eapi.sh"
740
741 # We need this next line for "die" and "assert". It expands
742 # It _must_ preceed all the calls to die and assert.
743 diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
744 index 24941af..8013d7d 100755
745 --- a/bin/misc-functions.sh
746 +++ b/bin/misc-functions.sh
747 @@ -14,7 +14,10 @@
748 MISC_FUNCTIONS_ARGS="$@"
749 shift $#
750
751 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}/ebuild.sh"
752 +if [[ -z ${PORTAGE_BIN_PATH} ]] ; then
753 + PORTAGE_BIN_PATH=$(dirname "$(readlink -f "$0")")
754 +fi
755 +source "${PORTAGE_BIN_PATH}/ebuild.sh"
756
757 install_symlink_html_docs() {
758 if ! ___eapi_has_prefix_variables; then
759 --
760 2.4.1

Replies