Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: bin/ebuild-helpers/, pym/portage/tests/emerge/, bin/
Date: Wed, 02 Nov 2011 02:17:42
Message-Id: 1af0c40b1300651ca03a7509f49f152c1e595736.zmedico@gentoo
1 commit: 1af0c40b1300651ca03a7509f49f152c1e595736
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Wed Nov 2 02:17:19 2011 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Wed Nov 2 02:17:19 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=1af0c40b
7
8 Add EPREFIX and ED support in all ebuild helpers.
9
10 This allows our prefix tests to use helpers like insinto, doins, and dosym.
11
12 ---
13 bin/dohtml.py | 12 ++-
14 bin/ebuild-helpers/dobin | 8 +-
15 bin/ebuild-helpers/dodir | 6 +-
16 bin/ebuild-helpers/dodoc | 4 +-
17 bin/ebuild-helpers/doexe | 10 ++-
18 bin/ebuild-helpers/dohard | 8 +-
19 bin/ebuild-helpers/doinfo | 10 ++-
20 bin/ebuild-helpers/doins | 16 ++--
21 bin/ebuild-helpers/dolib | 6 +-
22 bin/ebuild-helpers/doman | 8 +-
23 bin/ebuild-helpers/domo | 11 ++-
24 bin/ebuild-helpers/dosbin | 10 ++-
25 bin/ebuild-helpers/dosed | 8 +-
26 bin/ebuild-helpers/dosym | 10 ++-
27 bin/ebuild-helpers/ecompressdir | 26 ++++---
28 bin/ebuild-helpers/fowners | 6 +-
29 bin/ebuild-helpers/fperms | 5 +-
30 bin/ebuild-helpers/prepall | 10 ++-
31 bin/ebuild-helpers/prepalldocs | 7 +-
32 bin/ebuild-helpers/prepallinfo | 6 +-
33 bin/ebuild-helpers/prepallman | 6 +-
34 bin/ebuild-helpers/prepallstrip | 6 +-
35 bin/ebuild-helpers/prepinfo | 8 +-
36 bin/ebuild-helpers/preplib | 8 +-
37 bin/ebuild-helpers/prepman | 10 ++-
38 bin/ebuild-helpers/prepstrip | 26 ++++---
39 bin/ebuild.sh | 8 +-
40 bin/misc-functions.sh | 124 ++++++++++++++++++-------------
41 bin/phase-functions.sh | 9 ++-
42 bin/phase-helpers.sh | 81 ++++++++++++--------
43 pym/portage/tests/emerge/test_simple.py | 24 ++++--
44 31 files changed, 299 insertions(+), 198 deletions(-)
45
46 diff --git a/bin/dohtml.py b/bin/dohtml.py
47 index 00258ec..122daf3 100755
48 --- a/bin/dohtml.py
49 +++ b/bin/dohtml.py
50 @@ -56,9 +56,9 @@ def install(basename, dirname, options, prefix=""):
51 fullpath = dirname + "/" + fullpath
52
53 if options.DOCDESTTREE:
54 - destdir = options.D + "usr/share/doc/" + options.PF + "/" + options.DOCDESTTREE + "/" + options.doc_prefix + "/" + prefix
55 + destdir = options.ED + "usr/share/doc/" + options.PF + "/" + options.DOCDESTTREE + "/" + options.doc_prefix + "/" + prefix
56 else:
57 - destdir = options.D + "usr/share/doc/" + options.PF + "/html/" + options.doc_prefix + "/" + prefix
58 + destdir = options.ED + "usr/share/doc/" + options.PF + "/html/" + options.doc_prefix + "/" + prefix
59
60 if not os.path.exists(fullpath):
61 sys.stderr.write("!!! dohtml: %s does not exist\n" % fullpath)
62 @@ -86,13 +86,15 @@ def install(basename, dirname, options, prefix=""):
63 class OptionsClass:
64 def __init__(self):
65 self.PF = ""
66 - self.D = ""
67 + self.ED = ""
68 self.DOCDESTTREE = ""
69
70 if "PF" in os.environ:
71 self.PF = os.environ["PF"]
72 - if "D" in os.environ:
73 - self.D = os.environ["D"]
74 + if os.environ.get("EAPI", "0") in ("0", "1", "2"):
75 + self.ED = os.environ.get("D", "")
76 + else:
77 + self.ED = os.environ.get("ED", "")
78 if "_E_DOCDESTTREE_" in os.environ:
79 self.DOCDESTTREE = os.environ["_E_DOCDESTTREE_"]
80
81
82 diff --git a/bin/ebuild-helpers/dobin b/bin/ebuild-helpers/dobin
83 index e385455..af3af0d 100755
84 --- a/bin/ebuild-helpers/dobin
85 +++ b/bin/ebuild-helpers/dobin
86 @@ -9,15 +9,17 @@ if [[ $# -lt 1 ]] ; then
87 exit 1
88 fi
89
90 -if [[ ! -d ${D}${DESTTREE}/bin ]] ; then
91 - install -d "${D}${DESTTREE}/bin" || { helpers_die "${0##*/}: failed to install ${D}${DESTTREE}/bin"; exit 2; }
92 +case "$EAPI" in 0|1|2) ED=${D} ;; esac
93 +
94 +if [[ ! -d ${ED}${DESTTREE}/bin ]] ; then
95 + install -d "${ED}${DESTTREE}/bin" || { helpers_die "${0##*/}: failed to install ${ED}${DESTTREE}/bin"; exit 2; }
96 fi
97
98 ret=0
99
100 for x in "$@" ; do
101 if [[ -e ${x} ]] ; then
102 - install -m0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${x}" "${D}${DESTTREE}/bin"
103 + install -m0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${x}" "${ED}${DESTTREE}/bin"
104 else
105 echo "!!! ${0##*/}: $x does not exist" 1>&2
106 false
107
108 diff --git a/bin/ebuild-helpers/dodir b/bin/ebuild-helpers/dodir
109 index f40bee7..7db7caf 100755
110 --- a/bin/ebuild-helpers/dodir
111 +++ b/bin/ebuild-helpers/dodir
112 @@ -1,10 +1,12 @@
113 #!/bin/bash
114 -# Copyright 1999-2010 Gentoo Foundation
115 +# Copyright 1999-2011 Gentoo Foundation
116 # Distributed under the terms of the GNU General Public License v2
117
118 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
119
120 -install -d ${DIROPTIONS} "${@/#/${D}/}"
121 +case "$EAPI" in 0|1|2) ED=${D} ;; esac
122 +
123 +install -d ${DIROPTIONS} "${@/#/${ED}/}"
124 ret=$?
125 [[ $ret -ne 0 ]] && helpers_die "${0##*/} failed"
126 exit $ret
127
128 diff --git a/bin/ebuild-helpers/dodoc b/bin/ebuild-helpers/dodoc
129 index 65713db..37bbc79 100755
130 --- a/bin/ebuild-helpers/dodoc
131 +++ b/bin/ebuild-helpers/dodoc
132 @@ -9,7 +9,9 @@ if [ $# -lt 1 ] ; then
133 exit 1
134 fi
135
136 -dir="${D}usr/share/doc/${PF}/${_E_DOCDESTTREE_}"
137 +case "$EAPI" in 0|1|2) ED=${D} ;; esac
138 +
139 +dir="${ED}usr/share/doc/${PF}/${_E_DOCDESTTREE_}"
140 if [ ! -d "${dir}" ] ; then
141 install -d "${dir}"
142 fi
143
144 diff --git a/bin/ebuild-helpers/doexe b/bin/ebuild-helpers/doexe
145 index 360800e..a5b9af0 100755
146 --- a/bin/ebuild-helpers/doexe
147 +++ b/bin/ebuild-helpers/doexe
148 @@ -1,5 +1,5 @@
149 #!/bin/bash
150 -# Copyright 1999-2010 Gentoo Foundation
151 +# Copyright 1999-2011 Gentoo Foundation
152 # Distributed under the terms of the GNU General Public License v2
153
154 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
155 @@ -9,8 +9,10 @@ if [[ $# -lt 1 ]] ; then
156 exit 1
157 fi
158
159 -if [[ ! -d ${D}${_E_EXEDESTTREE_} ]] ; then
160 - install -d "${D}${_E_EXEDESTTREE_}"
161 +case "$EAPI" in 0|1|2) ED=${D} ;; esac
162 +
163 +if [[ ! -d ${ED}${_E_EXEDESTTREE_} ]] ; then
164 + install -d "${ED}${_E_EXEDESTTREE_}"
165 fi
166
167 TMP=$T/.doexe_tmp
168 @@ -29,7 +31,7 @@ for x in "$@" ; do
169 mysrc="${x}"
170 fi
171 if [ -e "$mysrc" ] ; then
172 - install $EXEOPTIONS "$mysrc" "$D$_E_EXEDESTTREE_"
173 + install $EXEOPTIONS "$mysrc" "$ED$_E_EXEDESTTREE_"
174 else
175 echo "!!! ${0##*/}: $mysrc does not exist" 1>&2
176 false
177
178 diff --git a/bin/ebuild-helpers/dohard b/bin/ebuild-helpers/dohard
179 index 2270487..cf6fb11 100755
180 --- a/bin/ebuild-helpers/dohard
181 +++ b/bin/ebuild-helpers/dohard
182 @@ -1,5 +1,5 @@
183 #!/bin/bash
184 -# Copyright 1999-2007 Gentoo Foundation
185 +# Copyright 1999-2011 Gentoo Foundation
186 # Distributed under the terms of the GNU General Public License v2
187
188 if [[ $# -ne 2 ]] ; then
189 @@ -7,7 +7,9 @@ if [[ $# -ne 2 ]] ; then
190 exit 1
191 fi
192
193 +case "$EAPI" in 0|1|2) ED=${D} ;; esac
194 +
195 destdir=${2%/*}
196 -[[ ! -d ${D}${destdir} ]] && dodir "${destdir}"
197 +[[ ! -d ${ED}${destdir} ]] && dodir "${destdir}"
198
199 -exec ln -f "${D}$1" "${D}$2"
200 +exec ln -f "${ED}$1" "${ED}$2"
201
202 diff --git a/bin/ebuild-helpers/doinfo b/bin/ebuild-helpers/doinfo
203 index 54fb8da..a922ef1 100755
204 --- a/bin/ebuild-helpers/doinfo
205 +++ b/bin/ebuild-helpers/doinfo
206 @@ -1,5 +1,5 @@
207 #!/bin/bash
208 -# Copyright 1999-2010 Gentoo Foundation
209 +# Copyright 1999-2011 Gentoo Foundation
210 # Distributed under the terms of the GNU General Public License v2
211
212 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
213 @@ -9,11 +9,13 @@ if [[ -z $1 ]] ; then
214 exit 1
215 fi
216
217 -if [[ ! -d ${D}usr/share/info ]] ; then
218 - install -d "${D}usr/share/info" || { helpers_die "${0##*/}: failed to install ${D}usr/share/info"; exit 1; }
219 +case "$EAPI" in 0|1|2) ED=${D} ;; esac
220 +
221 +if [[ ! -d ${ED}usr/share/info ]] ; then
222 + install -d "${ED}usr/share/info" || { helpers_die "${0##*/}: failed to install ${ED}usr/share/info"; exit 1; }
223 fi
224
225 -install -m0644 "$@" "${D}usr/share/info"
226 +install -m0644 "$@" "${ED}usr/share/info"
227 rval=$?
228 if [ $rval -ne 0 ] ; then
229 for x in "$@" ; do
230
231 diff --git a/bin/ebuild-helpers/doins b/bin/ebuild-helpers/doins
232 index 7dec146..b9189d5 100755
233 --- a/bin/ebuild-helpers/doins
234 +++ b/bin/ebuild-helpers/doins
235 @@ -27,12 +27,14 @@ else
236 DOINSRECUR=n
237 fi
238
239 -if [[ ${INSDESTTREE#${D}} != "${INSDESTTREE}" ]]; then
240 +case "$EAPI" in 0|1|2) export ED="${D}" ;; esac
241 +
242 +if [[ ${INSDESTTREE#${ED}} != "${INSDESTTREE}" ]]; then
243 vecho "-------------------------------------------------------" 1>&2
244 - vecho "You should not use \${D} with helpers." 1>&2
245 + vecho "You should not use \${D} or \${ED} with helpers." 1>&2
246 vecho " --> ${INSDESTTREE}" 1>&2
247 vecho "-------------------------------------------------------" 1>&2
248 - helpers_die "${0##*/} used with \${D}"
249 + helpers_die "${0##*/} used with \${D} or \${ED}"
250 exit 1
251 fi
252
253 @@ -49,7 +51,7 @@ export TMP=$T/.doins_tmp
254 # Use separate directories to avoid potential name collisions.
255 mkdir -p "$TMP"/{1,2}
256
257 -[[ ! -d ${D}${INSDESTTREE} ]] && dodir "${INSDESTTREE}"
258 +[[ ! -d ${ED}${INSDESTTREE} ]] && dodir "${INSDESTTREE}"
259
260 _doins() {
261 local mysrc="$1" mydir="$2" cleanup="" rval
262 @@ -63,8 +65,8 @@ _doins() {
263 # $PORTAGE_ACTUAL_DISTDIR/.
264 if [ $PRESERVE_SYMLINKS = y ] && \
265 ! [[ $(readlink "$mysrc") == "$PORTAGE_ACTUAL_DISTDIR"/* ]] ; then
266 - rm -rf "$D$INSDESTTREE/$mydir/${mysrc##*/}" || return $?
267 - cp -P "$mysrc" "$D$INSDESTTREE/$mydir/${mysrc##*/}"
268 + rm -rf "${ED}$INSDESTTREE/$mydir/${mysrc##*/}" || return $?
269 + cp -P "$mysrc" "${ED}$INSDESTTREE/$mydir/${mysrc##*/}"
270 return $?
271 else
272 cp "$mysrc" "$TMP/2/${mysrc##*/}" || return $?
273 @@ -73,7 +75,7 @@ _doins() {
274 fi
275 fi
276
277 - install ${INSOPTIONS} "${mysrc}" "${D}${INSDESTTREE}/${mydir}"
278 + install ${INSOPTIONS} "${mysrc}" "${ED}${INSDESTTREE}/${mydir}"
279 rval=$?
280 [[ -n ${cleanup} ]] && rm -f "${cleanup}"
281 [ $rval -ne 0 ] && echo "!!! ${0##*/}: $mysrc does not exist" 1>&2
282
283 diff --git a/bin/ebuild-helpers/dolib b/bin/ebuild-helpers/dolib
284 index 87ade42..9dd11d8 100755
285 --- a/bin/ebuild-helpers/dolib
286 +++ b/bin/ebuild-helpers/dolib
287 @@ -1,9 +1,11 @@
288 #!/bin/bash
289 -# Copyright 1999-2010 Gentoo Foundation
290 +# Copyright 1999-2011 Gentoo Foundation
291 # Distributed under the terms of the GNU General Public License v2
292
293 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
294
295 +case "$EAPI" in 0|1|2) ED=${D} ;; esac
296 +
297 # Setup ABI cruft
298 LIBDIR_VAR="LIBDIR_${ABI}"
299 if [[ -n ${ABI} && -n ${!LIBDIR_VAR} ]] ; then
300 @@ -12,7 +14,7 @@ fi
301 unset LIBDIR_VAR
302 # we need this to default to lib so that things dont break
303 CONF_LIBDIR=${CONF_LIBDIR:-lib}
304 -libdir="${D}${DESTTREE}/${CONF_LIBDIR}"
305 +libdir="${ED}${DESTTREE}/${CONF_LIBDIR}"
306
307
308 if [[ $# -lt 1 ]] ; then
309
310 diff --git a/bin/ebuild-helpers/doman b/bin/ebuild-helpers/doman
311 index 4561bef..27401f3 100755
312 --- a/bin/ebuild-helpers/doman
313 +++ b/bin/ebuild-helpers/doman
314 @@ -9,6 +9,8 @@ if [[ $# -lt 1 ]] ; then
315 exit 1
316 fi
317
318 +case "$EAPI" in 0|1|2) ED=${D} ;; esac
319 +
320 i18n=""
321
322 ret=0
323 @@ -44,11 +46,11 @@ for x in "$@" ; do
324
325 if [[ ${mandir} == *man[0-9n] ]] ; then
326 if [[ -s ${x} ]] ; then
327 - if [[ ! -d ${D}/usr/share/man/${mandir} ]] ; then
328 - install -d "${D}/usr/share/man/${mandir}"
329 + if [[ ! -d ${ED}/usr/share/man/${mandir} ]] ; then
330 + install -d "${ED}/usr/share/man/${mandir}"
331 fi
332
333 - install -m0644 "${x}" "${D}/usr/share/man/${mandir}/${name}"
334 + install -m0644 "${x}" "${ED}/usr/share/man/${mandir}/${name}"
335 ((ret|=$?))
336 elif [[ ! -e ${x} ]] ; then
337 echo "!!! ${0##*/}: $x does not exist" 1>&2
338
339 diff --git a/bin/ebuild-helpers/domo b/bin/ebuild-helpers/domo
340 index 4737f44..0e3656d 100755
341 --- a/bin/ebuild-helpers/domo
342 +++ b/bin/ebuild-helpers/domo
343 @@ -1,5 +1,5 @@
344 #!/bin/bash
345 -# Copyright 1999-2010 Gentoo Foundation
346 +# Copyright 1999-2011 Gentoo Foundation
347 # Distributed under the terms of the GNU General Public License v2
348
349 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
350 @@ -9,8 +9,11 @@ if [ ${mynum} -lt 1 ] ; then
351 helpers_die "${0}: at least one argument needed"
352 exit 1
353 fi
354 -if [ ! -d "${D}${DESTTREE}/share/locale" ] ; then
355 - install -d "${D}${DESTTREE}/share/locale/"
356 +
357 +case "$EAPI" in 0|1|2) ED=${D} ;; esac
358 +
359 +if [ ! -d "${ED}${DESTTREE}/share/locale" ] ; then
360 + install -d "${ED}${DESTTREE}/share/locale/"
361 fi
362
363 ret=0
364 @@ -18,7 +21,7 @@ ret=0
365 for x in "$@" ; do
366 if [ -e "${x}" ] ; then
367 mytiny="${x##*/}"
368 - mydir="${D}${DESTTREE}/share/locale/${mytiny%.*}/LC_MESSAGES"
369 + mydir="${ED}${DESTTREE}/share/locale/${mytiny%.*}/LC_MESSAGES"
370 if [ ! -d "${mydir}" ] ; then
371 install -d "${mydir}"
372 fi
373
374 diff --git a/bin/ebuild-helpers/dosbin b/bin/ebuild-helpers/dosbin
375 index 87a3091..d0783ed 100755
376 --- a/bin/ebuild-helpers/dosbin
377 +++ b/bin/ebuild-helpers/dosbin
378 @@ -1,5 +1,5 @@
379 #!/bin/bash
380 -# Copyright 1999-2010 Gentoo Foundation
381 +# Copyright 1999-2011 Gentoo Foundation
382 # Distributed under the terms of the GNU General Public License v2
383
384 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
385 @@ -9,15 +9,17 @@ if [[ $# -lt 1 ]] ; then
386 exit 1
387 fi
388
389 -if [[ ! -d ${D}${DESTTREE}/sbin ]] ; then
390 - install -d "${D}${DESTTREE}/sbin" || { helpers_die "${0##*/}: failed to install ${D}${DESTTREE}/sbin"; exit 2; }
391 +case "$EAPI" in 0|1|2) ED=${D} ;; esac
392 +
393 +if [[ ! -d ${ED}${DESTTREE}/sbin ]] ; then
394 + install -d "${ED}${DESTTREE}/sbin" || { helpers_die "${0##*/}: failed to install ${ED}${DESTTREE}/sbin"; exit 2; }
395 fi
396
397 ret=0
398
399 for x in "$@" ; do
400 if [[ -e ${x} ]] ; then
401 - install -m0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${x}" "${D}${DESTTREE}/sbin"
402 + install -m0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${x}" "${ED}${DESTTREE}/sbin"
403 else
404 echo "!!! ${0##*/}: ${x} does not exist" 1>&2
405 false
406
407 diff --git a/bin/ebuild-helpers/dosed b/bin/ebuild-helpers/dosed
408 index afc949b..00cf5da 100755
409 --- a/bin/ebuild-helpers/dosed
410 +++ b/bin/ebuild-helpers/dosed
411 @@ -1,5 +1,5 @@
412 #!/bin/bash
413 -# Copyright 1999-2006 Gentoo Foundation
414 +# Copyright 1999-2011 Gentoo Foundation
415 # Distributed under the terms of the GNU General Public License v2
416
417 if [[ $# -lt 1 ]] ; then
418 @@ -7,12 +7,14 @@ if [[ $# -lt 1 ]] ; then
419 exit 1
420 fi
421
422 +case "$EAPI" in 0|1|2) ED=${D} ;; esac
423 +
424 ret=0
425 file_found=0
426 -mysed="s:${D}::g"
427 +mysed="s:${ED}::g"
428
429 for x in "$@" ; do
430 - y=$D${x#/}
431 + y=$ED${x#/}
432 if [ -e "${y}" ] ; then
433 if [ -f "${y}" ] ; then
434 file_found=1
435
436 diff --git a/bin/ebuild-helpers/dosym b/bin/ebuild-helpers/dosym
437 index 7dd4c6d..8b7b304 100755
438 --- a/bin/ebuild-helpers/dosym
439 +++ b/bin/ebuild-helpers/dosym
440 @@ -1,5 +1,5 @@
441 #!/bin/bash
442 -# Copyright 1999-2010 Gentoo Foundation
443 +# Copyright 1999-2011 Gentoo Foundation
444 # Distributed under the terms of the GNU General Public License v2
445
446 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
447 @@ -9,16 +9,18 @@ if [[ $# -ne 2 ]] ; then
448 exit 1
449 fi
450
451 +case "$EAPI" in 0|1|2) ED=${D} ;; esac
452 +
453 if [[ ${2} == */ ]] || \
454 - [[ -d ${D}${2} && ! -L ${D}${2} ]] ; then
455 + [[ -d ${ED}${2} && ! -L ${ED}${2} ]] ; then
456 # implicit basename not allowed by PMS (bug #379899)
457 eqawarn "QA Notice: dosym target omits basename: '${2}'"
458 fi
459
460 destdir=${2%/*}
461 -[[ ! -d ${D}${destdir} ]] && dodir "${destdir}"
462 +[[ ! -d ${ED}${destdir} ]] && dodir "${destdir}"
463
464 -ln -snf "$1" "${D}$2"
465 +ln -snf "$1" "${ED}$2"
466 ret=$?
467 [[ $ret -ne 0 ]] && helpers_die "${0##*/} failed"
468 exit $ret
469
470 diff --git a/bin/ebuild-helpers/ecompressdir b/bin/ebuild-helpers/ecompressdir
471 index 7a95120..76c2718 100755
472 --- a/bin/ebuild-helpers/ecompressdir
473 +++ b/bin/ebuild-helpers/ecompressdir
474 @@ -1,5 +1,5 @@
475 #!/bin/bash
476 -# Copyright 1999-2010 Gentoo Foundation
477 +# Copyright 1999-2011 Gentoo Foundation
478 # Distributed under the terms of the GNU General Public License v2
479
480 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
481 @@ -9,19 +9,21 @@ if [[ -z $1 ]] ; then
482 exit 1
483 fi
484
485 +case "$EAPI" in 0|1|2) ED=${D} ;; esac
486 +
487 case $1 in
488 --ignore)
489 shift
490 for skip in "$@" ; do
491 - [[ -d ${D}${skip} || -f ${D}${skip} ]] \
492 - && >> "${D}${skip}.ecompress.skip"
493 + [[ -d ${ED}${skip} || -f ${ED}${skip} ]] \
494 + && >> "${ED}${skip}.ecompress.skip"
495 done
496 exit 0
497 ;;
498 --queue)
499 shift
500 set -- "${@/%/.ecompress.dir}"
501 - set -- "${@/#/${D}}"
502 + set -- "${@/#/${ED}}"
503 ret=0
504 for x in "$@" ; do
505 >> "$x"
506 @@ -32,10 +34,10 @@ case $1 in
507 ;;
508 --dequeue)
509 [[ -n $2 ]] && vecho "${0##*/}: --dequeue takes no additional arguments" 1>&2
510 - find "${D}" -name '*.ecompress.dir' -print0 \
511 - | sed -e 's:\.ecompress\.dir::g' -e "s:${D}:/:g" \
512 + find "${ED}" -name '*.ecompress.dir' -print0 \
513 + | sed -e 's:\.ecompress\.dir::g' -e "s:${ED}:/:g" \
514 | ${XARGS} -0 ecompressdir
515 - find "${D}" -name '*.ecompress.skip' -print0 | ${XARGS} -0 rm -f
516 + find "${ED}" -name '*.ecompress.skip' -print0 | ${XARGS} -0 rm -f
517 exit 0
518 ;;
519 --*)
520 @@ -95,8 +97,8 @@ _relocate_skip_dirs() {
521 mv "${src}.ecompress.skip" "${dst}.ecompress.skip"
522 done
523 }
524 -hide_skip_dirs() { _relocate_skip_dirs "${D}" "${T}"/ecompress-skip/ ; }
525 -restore_skip_dirs() { _relocate_skip_dirs "${T}"/ecompress-skip/ "${D}" ; }
526 +hide_skip_dirs() { _relocate_skip_dirs "${ED}" "${T}"/ecompress-skip/ ; }
527 +restore_skip_dirs() { _relocate_skip_dirs "${T}"/ecompress-skip/ "${ED}" ; }
528
529 ret=0
530
531 @@ -104,9 +106,9 @@ rm -rf "${T}"/ecompress-skip
532
533 for dir in "$@" ; do
534 dir=${dir#/}
535 - dir="${D}${dir}"
536 + dir="${ED}${dir}"
537 if [[ ! -d ${dir} ]] ; then
538 - vecho "${0##*/}: /${dir#${D}} does not exist!"
539 + vecho "${0##*/}: /${dir#${ED}} does not exist!"
540 continue
541 fi
542 cd "${dir}"
543 @@ -132,7 +134,7 @@ for dir in "$@" ; do
544
545 # now lets do our work
546 [[ -z ${suffix} ]] && continue
547 - vecho "${0##*/}: $(ecompress --bin) /${actual_dir#${D}}"
548 + vecho "${0##*/}: $(ecompress --bin) /${actual_dir#${ED}}"
549 funk_up_dir "compress" "${suffix}" "ecompress"
550
551 # finally, restore the skipped stuff
552
553 diff --git a/bin/ebuild-helpers/fowners b/bin/ebuild-helpers/fowners
554 index 4cc6bfa..3f51b4e 100755
555 --- a/bin/ebuild-helpers/fowners
556 +++ b/bin/ebuild-helpers/fowners
557 @@ -1,13 +1,15 @@
558 #!/bin/bash
559 -# Copyright 1999-2010 Gentoo Foundation
560 +# Copyright 1999-2011 Gentoo Foundation
561 # Distributed under the terms of the GNU General Public License v2
562
563 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
564
565 +case "$EAPI" in 0|1|2) ED=${D} ;; esac
566 +
567 # we can't prefix all arguments because
568 # chown takes random options
569 slash="/"
570 -chown "${@/#${slash}/${D}${slash}}"
571 +chown "${@/#${slash}/${ED}${slash}}"
572 ret=$?
573 [[ $ret -ne 0 ]] && helpers_die "${0##*/} failed"
574 exit $ret
575
576 diff --git a/bin/ebuild-helpers/fperms b/bin/ebuild-helpers/fperms
577 index 0260bdc..9a2971a 100755
578 --- a/bin/ebuild-helpers/fperms
579 +++ b/bin/ebuild-helpers/fperms
580 @@ -1,13 +1,14 @@
581 #!/bin/bash
582 -# Copyright 1999-2010 Gentoo Foundation
583 +# Copyright 1999-2011 Gentoo Foundation
584 # Distributed under the terms of the GNU General Public License v2
585
586 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
587
588 +case "$EAPI" in 0|1|2) ED=${D} ;; esac
589 # we can't prefix all arguments because
590 # chmod takes random options
591 slash="/"
592 -chmod "${@/#${slash}/${D}${slash}}"
593 +chmod "${@/#${slash}/${ED}${slash}}"
594 ret=$?
595 [[ $ret -ne 0 ]] && helpers_die "${0##*/} failed"
596 exit $ret
597
598 diff --git a/bin/ebuild-helpers/prepall b/bin/ebuild-helpers/prepall
599 index 701ecba..611c4ce 100755
600 --- a/bin/ebuild-helpers/prepall
601 +++ b/bin/ebuild-helpers/prepall
602 @@ -4,12 +4,14 @@
603
604 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
605
606 +case "$EAPI" in 0|1|2) ED=${D} ;; esac
607 +
608 if has chflags $FEATURES ; then
609 # Save all the file flags for restoration at the end of prepall.
610 - mtree -c -p "${D}" -k flags > "${T}/bsdflags.mtree"
611 + mtree -c -p "${ED}" -k flags > "${T}/bsdflags.mtree"
612 # Remove all the file flags so that prepall can do anything necessary.
613 - chflags -R noschg,nouchg,nosappnd,nouappnd "${D}"
614 - chflags -R nosunlnk,nouunlnk "${D}" 2>/dev/null
615 + chflags -R noschg,nouchg,nosappnd,nouappnd "${ED}"
616 + chflags -R nosunlnk,nouunlnk "${ED}" 2>/dev/null
617 fi
618
619 prepallman
620 @@ -19,5 +21,5 @@ prepallstrip
621
622 if has chflags $FEATURES ; then
623 # Restore all the file flags that were saved at the beginning of prepall.
624 - mtree -U -e -p "${D}" -k flags < "${T}/bsdflags.mtree" &> /dev/null
625 + mtree -U -e -p "${ED}" -k flags < "${T}/bsdflags.mtree" &> /dev/null
626 fi
627
628 diff --git a/bin/ebuild-helpers/prepalldocs b/bin/ebuild-helpers/prepalldocs
629 index fdc735d..540d025 100755
630 --- a/bin/ebuild-helpers/prepalldocs
631 +++ b/bin/ebuild-helpers/prepalldocs
632 @@ -1,5 +1,5 @@
633 #!/bin/bash
634 -# Copyright 1999-2010 Gentoo Foundation
635 +# Copyright 1999-2011 Gentoo Foundation
636 # Distributed under the terms of the GNU General Public License v2
637
638 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
639 @@ -8,8 +8,9 @@ if [[ -n $1 ]] ; then
640 vecho "${0##*/}: invalid usage; takes no arguments" 1>&2
641 fi
642
643 -cd "${D}"
644 -[[ -d usr/share/doc ]] || exit 0
645 +case "$EAPI" in 0|1|2) ED=${D} ;; esac
646 +
647 +[[ -d ${ED}usr/share/doc ]] || exit 0
648
649 ecompressdir --ignore /usr/share/doc/${PF}/html
650 ecompressdir --queue /usr/share/doc
651
652 diff --git a/bin/ebuild-helpers/prepallinfo b/bin/ebuild-helpers/prepallinfo
653 index 0d97803..e351f87 100755
654 --- a/bin/ebuild-helpers/prepallinfo
655 +++ b/bin/ebuild-helpers/prepallinfo
656 @@ -1,9 +1,11 @@
657 #!/bin/bash
658 -# Copyright 1999-2006 Gentoo Foundation
659 +# Copyright 1999-2011 Gentoo Foundation
660 # Distributed under the terms of the GNU General Public License v2
661
662 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
663
664 -[[ ! -d ${D}usr/share/info ]] && exit 0
665 +case "$EAPI" in 0|1|2) ED=${D} ;; esac
666 +
667 +[[ -d ${ED}usr/share/info ]] || exit 0
668
669 exec prepinfo
670
671 diff --git a/bin/ebuild-helpers/prepallman b/bin/ebuild-helpers/prepallman
672 index e50de6d..be7f194 100755
673 --- a/bin/ebuild-helpers/prepallman
674 +++ b/bin/ebuild-helpers/prepallman
675 @@ -7,11 +7,13 @@ source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
676 # replaced by controllable compression in EAPI 4
677 has "${EAPI}" 0 1 2 3 || exit 0
678
679 +case "$EAPI" in 0|1|2) ED=${D} ;; esac
680 +
681 ret=0
682
683 -find "${D}" -type d -name man > "${T}"/prepallman.filelist
684 +find "${ED}" -type d -name man > "${T}"/prepallman.filelist
685 while read -r mandir ; do
686 - mandir=${mandir#${D}}
687 + mandir=${mandir#${ED}}
688 prepman "${mandir%/man}"
689 ((ret|=$?))
690 done < "${T}"/prepallman.filelist
691
692 diff --git a/bin/ebuild-helpers/prepallstrip b/bin/ebuild-helpers/prepallstrip
693 index ec12ce6..e9f5f8e 100755
694 --- a/bin/ebuild-helpers/prepallstrip
695 +++ b/bin/ebuild-helpers/prepallstrip
696 @@ -1,5 +1,7 @@
697 #!/bin/bash
698 -# Copyright 1999-2006 Gentoo Foundation
699 +# Copyright 1999-2011 Gentoo Foundation
700 # Distributed under the terms of the GNU General Public License v2
701
702 -exec prepstrip "${D}"
703 +case "$EAPI" in 0|1|2) ED=${D} ;; esac
704 +
705 +exec prepstrip "${ED}"
706
707 diff --git a/bin/ebuild-helpers/prepinfo b/bin/ebuild-helpers/prepinfo
708 index 691fd13..afe214c 100755
709 --- a/bin/ebuild-helpers/prepinfo
710 +++ b/bin/ebuild-helpers/prepinfo
711 @@ -4,17 +4,19 @@
712
713 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
714
715 +case "$EAPI" in 0|1|2) ED=${D} ;; esac
716 +
717 if [[ -z $1 ]] ; then
718 infodir="/usr/share/info"
719 else
720 - if [[ -d ${D}$1/share/info ]] ; then
721 + if [[ -d ${ED}$1/share/info ]] ; then
722 infodir="$1/share/info"
723 else
724 infodir="$1/info"
725 fi
726 fi
727
728 -if [[ ! -d ${D}${infodir} ]] ; then
729 +if [[ ! -d ${ED}${infodir} ]] ; then
730 if [[ -n $1 ]] ; then
731 vecho "${0##*/}: '${infodir}' does not exist!"
732 exit 1
733 @@ -23,7 +25,7 @@ if [[ ! -d ${D}${infodir} ]] ; then
734 fi
735 fi
736
737 -find "${D}${infodir}" -type d -print0 | while read -r -d $'\0' x ; do
738 +find "${ED}${infodir}" -type d -print0 | while read -r -d $'\0' x ; do
739 for f in "${x}"/.keepinfodir*; do
740 [[ -e ${f} ]] && continue 2
741 done
742
743 diff --git a/bin/ebuild-helpers/preplib b/bin/ebuild-helpers/preplib
744 index 76aabe6..8c62921 100755
745 --- a/bin/ebuild-helpers/preplib
746 +++ b/bin/ebuild-helpers/preplib
747 @@ -1,11 +1,13 @@
748 #!/bin/bash
749 -# Copyright 1999-2006 Gentoo Foundation
750 +# Copyright 1999-2011 Gentoo Foundation
751 # Distributed under the terms of the GNU General Public License v2
752
753 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
754
755 eqawarn "QA Notice: Deprecated call to 'preplib'"
756
757 +case "$EAPI" in 0|1|2) ED=${D} ;; esac
758 +
759 LIBDIR_VAR="LIBDIR_${ABI}"
760 if [ -n "${ABI}" -a -n "${!LIBDIR_VAR}" ]; then
761 CONF_LIBDIR="${!LIBDIR_VAR}"
762 @@ -18,9 +20,9 @@ if [ -z "${CONF_LIBDIR}" ]; then
763 fi
764
765 if [ -z "$1" ] ; then
766 - z="${D}usr/${CONF_LIBDIR}"
767 + z="${ED}usr/${CONF_LIBDIR}"
768 else
769 - z="${D}$1/${CONF_LIBDIR}"
770 + z="${ED}$1/${CONF_LIBDIR}"
771 fi
772
773 if [ -d "${z}" ] ; then
774
775 diff --git a/bin/ebuild-helpers/prepman b/bin/ebuild-helpers/prepman
776 index c9add8a..8ea7607 100755
777 --- a/bin/ebuild-helpers/prepman
778 +++ b/bin/ebuild-helpers/prepman
779 @@ -4,14 +4,16 @@
780
781 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
782
783 +case "$EAPI" in 0|1|2) ED=${D} ;; esac
784 +
785 if [[ -z $1 ]] ; then
786 - mandir="${D}usr/share/man"
787 + mandir="${ED}usr/share/man"
788 else
789 - mandir="${D}$1/man"
790 + mandir="${ED}$1/man"
791 fi
792
793 if [[ ! -d ${mandir} ]] ; then
794 - eqawarn "QA Notice: prepman called with non-existent dir '${mandir#${D}}'"
795 + eqawarn "QA Notice: prepman called with non-existent dir '${mandir#${ED}}'"
796 exit 0
797 fi
798
799 @@ -27,6 +29,6 @@ for subdir in "${mandir}"/man* "${mandir}"/*/man* ; do
800 [[ -d ${subdir} ]] && really_is_mandir=1 && break
801 done
802
803 -[[ ${really_is_mandir} == 1 ]] && exec ecompressdir --queue "${mandir#${D}}"
804 +[[ ${really_is_mandir} == 1 ]] && exec ecompressdir --queue "${mandir#${ED}}"
805
806 exit 0
807
808 diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip
809 index 8c2ca48..fac20b2 100755
810 --- a/bin/ebuild-helpers/prepstrip
811 +++ b/bin/ebuild-helpers/prepstrip
812 @@ -18,6 +18,8 @@ exp_tf() {
813 exp_tf FEATURES installsources nostrip splitdebug
814 exp_tf RESTRICT binchecks installsources strip
815
816 +case "$EAPI" in 0|1|2) ED=${D} ;; esac
817 +
818 banner=false
819 SKIP_STRIP=false
820 if ${RESTRICT_strip} || ${FEATURES_nostrip} ; then
821 @@ -99,7 +101,7 @@ save_elf_debug() {
822 ${FEATURES_splitdebug} || return 0
823
824 local x=$1
825 - local y="${D}usr/lib/debug/${x:${#D}}.debug"
826 + local y="${ED}usr/lib/debug/${x:${#ED}}.debug"
827
828 # dont save debug info twice
829 [[ ${x} == *".debug" ]] && return 0
830 @@ -108,7 +110,7 @@ save_elf_debug() {
831
832 local inode=$(inode_var_name "$x")
833 if [[ -n ${!inode} ]] ; then
834 - ln "${D}usr/lib/debug/${!inode:${#D}}.debug" "$y"
835 + ln "${ED}usr/lib/debug/${!inode:${#ED}}.debug" "$y"
836 else
837 eval $inode=\$x
838 if [[ -e ${T}/prepstrip.split.debug ]] ; then
839 @@ -129,18 +131,18 @@ save_elf_debug() {
840 | awk '$NF ~ /GNU/ { getline; printf $2$3$4$5; getline; print $2 }')
841 fi
842 if [[ -n ${buildid} ]] ; then
843 - local buildid_dir="${D}usr/lib/debug/.build-id/${buildid:0:2}"
844 + local buildid_dir="${ED}usr/lib/debug/.build-id/${buildid:0:2}"
845 local buildid_file="${buildid_dir}/${buildid:2}"
846 mkdir -p "${buildid_dir}"
847 - ln -s "../../${x:${#D}}.debug" "${buildid_file}.debug"
848 - ln -s "/${x:${#D}}" "${buildid_file}"
849 + ln -s "../../${x:${#ED}}.debug" "${buildid_file}.debug"
850 + ln -s "/${x:${#ED}}" "${buildid_file}"
851 fi
852 }
853
854 process_elf() {
855 local x=$1 strip_flags=${*:2}
856
857 - vecho " ${x:${#D}}"
858 + vecho " ${x:${#ED}}"
859 save_elf_sources "${x}"
860
861 if ${strip_this} ; then
862 @@ -165,7 +167,7 @@ if ! ${RESTRICT_binchecks} && ! ${RESTRICT_strip} ; then
863 log=$T/scanelf-already-stripped.log
864 qa_var="QA_PRESTRIPPED_${ARCH/-/_}"
865 [[ -n ${!qa_var} ]] && QA_PRESTRIPPED="${!qa_var}"
866 - scanelf -yqRBF '#k%F' -k '!.symtab' "$@" | sed -e "s#^$D##" > "$log"
867 + scanelf -yqRBF '#k%F' -k '!.symtab' "$@" | sed -e "s#^${ED}##" > "$log"
868 if [[ -n $QA_PRESTRIPPED && -s $log && \
869 ${QA_STRICT_PRESTRIPPED-unset} = unset ]] ; then
870 shopts=$-
871 @@ -206,7 +208,7 @@ do
872 set -o noglob
873 strip_this=true
874 for m in $(eval echo ${STRIP_MASK}) ; do
875 - [[ /${x#${D}} == ${m} ]] && strip_this=false && break
876 + [[ /${x#${ED}} == ${m} ]] && strip_this=false && break
877 done
878 set +o noglob
879 else
880 @@ -221,7 +223,7 @@ do
881
882 buildid=
883 if [[ ${f} == *"current ar archive"* ]] ; then
884 - vecho " ${x:${#D}}"
885 + vecho " ${x:${#ED}}"
886 if ${strip_this} ; then
887 # hmm, can we split debug/sources for .a ?
888 ${STRIP} -g "${x}"
889 @@ -239,10 +241,10 @@ if [[ -s ${T}/debug.sources ]] && \
890 ${debugedit_found}
891 then
892 vecho "installsources: rsyncing source files"
893 - [[ -d ${D}${prepstrip_sources_dir} ]] || mkdir -p "${D}${prepstrip_sources_dir}"
894 + [[ -d ${ED}${prepstrip_sources_dir} ]] || mkdir -p "${ED}${prepstrip_sources_dir}"
895 grep -zv '/<[^/>]*>$' "${T}"/debug.sources | \
896 (cd "${WORKDIR}"; LANG=C sort -z -u | \
897 - rsync -tL0 --files-from=- "${WORKDIR}/" "${D}${prepstrip_sources_dir}/" )
898 + rsync -tL0 --files-from=- "${WORKDIR}/" "${ED}${prepstrip_sources_dir}/" )
899
900 # Preserve directory structure.
901 # Needed after running save_elf_sources.
902 @@ -250,5 +252,5 @@ then
903 while read -r -d $'\0' emptydir
904 do
905 >> "$emptydir"/.keepdir
906 - done < <(find "${D}${prepstrip_sources_dir}/" -type d -empty -print0)
907 + done < <(find "${ED}${prepstrip_sources_dir}/" -type d -empty -print0)
908 fi
909
910 diff --git a/bin/ebuild.sh b/bin/ebuild.sh
911 index 7b77c10..5648a97 100755
912 --- a/bin/ebuild.sh
913 +++ b/bin/ebuild.sh
914 @@ -597,17 +597,19 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then
915 PATH=$_ebuild_helpers_path:$PREROOTPATH${PREROOTPATH:+:}/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin${ROOTPATH:+:}$ROOTPATH
916 unset _ebuild_helpers_path
917
918 + _eprefix=${EPREFIX}
919 + case "$EAPI" in 0|1|2) _eprefix= ;; esac
920 # Use default ABI libdir in accordance with bug #355283.
921 x=LIBDIR_${DEFAULT_ABI}
922 [[ -n $DEFAULT_ABI && -n ${!x} ]] && x=${!x} || x=lib
923
924 if has distcc $FEATURES ; then
925 - PATH="/usr/$x/distcc/bin:$PATH"
926 + PATH="${_eprefix}/usr/$x/distcc/bin:$PATH"
927 [[ -n $DISTCC_LOG ]] && addwrite "${DISTCC_LOG%/*}"
928 fi
929
930 if has ccache $FEATURES ; then
931 - PATH="/usr/$x/ccache/bin:$PATH"
932 + PATH="${_eprefix}/usr/$x/ccache/bin:$PATH"
933
934 if [[ -n $CCACHE_DIR ]] ; then
935 addread "$CCACHE_DIR"
936 @@ -617,7 +619,7 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then
937 [[ -n $CCACHE_SIZE ]] && ccache -M $CCACHE_SIZE &> /dev/null
938 fi
939
940 - unset x
941 + unset x _eprefix
942
943 if [[ -n $QA_PREBUILT ]] ; then
944
945
946 diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
947 index 80cd0f8..81bae76 100755
948 --- a/bin/misc-functions.sh
949 +++ b/bin/misc-functions.sh
950 @@ -17,7 +17,9 @@ shift $#
951 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}/ebuild.sh"
952
953 install_symlink_html_docs() {
954 - cd "${D}" || die "cd failed"
955 + local ed=${ED}
956 + case "$EAPI" in 0|1|2) ed=${D} ;; esac
957 + cd "${ed}" || die "cd failed"
958 #symlink the html documentation (if DOC_SYMLINKS_DIR is set in make.conf)
959 if [ -n "${DOC_SYMLINKS_DIR}" ] ; then
960 local mydocdir docdir
961 @@ -64,11 +66,13 @@ canonicalize() {
962 prepcompress() {
963 local -a include exclude incl_d incl_f
964 local f g i real_f real_d
965 + local ed=${ED}
966 + case "$EAPI" in 0|1|2) ed=${D} ;; esac
967
968 # Canonicalize path names and check for their existence.
969 - real_d=$(canonicalize "${D}")
970 + real_d=$(canonicalize "${ed}")
971 for (( i = 0; i < ${#PORTAGE_DOCOMPRESS[@]}; i++ )); do
972 - real_f=$(canonicalize "${D}${PORTAGE_DOCOMPRESS[i]}")
973 + real_f=$(canonicalize "${ed}${PORTAGE_DOCOMPRESS[i]}")
974 f=${real_f#"${real_d}"}
975 if [[ ${real_f} != "${f}" ]] && [[ -d ${real_f} || -f ${real_f} ]]
976 then
977 @@ -79,7 +83,7 @@ prepcompress() {
978 fi
979 done
980 for (( i = 0; i < ${#PORTAGE_DOCOMPRESS_SKIP[@]}; i++ )); do
981 - real_f=$(canonicalize "${D}${PORTAGE_DOCOMPRESS_SKIP[i]}")
982 + real_f=$(canonicalize "${ed}${PORTAGE_DOCOMPRESS_SKIP[i]}")
983 f=${real_f#"${real_d}"}
984 if [[ ${real_f} != "${f}" ]] && [[ -d ${real_f} || -f ${real_f} ]]
985 then
986 @@ -128,7 +132,7 @@ prepcompress() {
987
988 # Split the include list into directories and files
989 for f in "${include[@]}"; do
990 - if [[ -d ${D}${f} ]]; then
991 + if [[ -d ${ed}${f} ]]; then
992 incl_d[${#incl_d[@]}]=${f}
993 else
994 incl_f[${#incl_f[@]}]=${f}
995 @@ -138,15 +142,17 @@ prepcompress() {
996 # Queue up for compression.
997 # ecompress{,dir} doesn't like to be called with empty argument lists.
998 [[ ${#incl_d[@]} -gt 0 ]] && ecompressdir --queue "${incl_d[@]}"
999 - [[ ${#incl_f[@]} -gt 0 ]] && ecompress --queue "${incl_f[@]/#/${D}}"
1000 + [[ ${#incl_f[@]} -gt 0 ]] && ecompress --queue "${incl_f[@]/#/${ed}}"
1001 [[ ${#exclude[@]} -gt 0 ]] && ecompressdir --ignore "${exclude[@]}"
1002 return 0
1003 }
1004
1005 install_qa_check() {
1006 local f i x
1007 + local ed=${ED}
1008 + case "$EAPI" in 0|1|2) ed=${D} ;; esac
1009
1010 - cd "${D}" || die "cd failed"
1011 + cd "${ed}" || die "cd failed"
1012
1013 export STRIP_MASK
1014 prepall
1015 @@ -154,15 +160,12 @@ install_qa_check() {
1016 ecompressdir --dequeue
1017 ecompress --dequeue
1018
1019 - local ed=${ED}
1020 - case "$EAPI" in 0|1|2) ed=${D} ;; esac
1021 -
1022 # Prefix specific checks
1023 [[ ${ed} != ${D} ]] && install_qa_check_prefix
1024
1025 f=
1026 for x in etc/app-defaults usr/man usr/info usr/X11R6 usr/doc usr/locale ; do
1027 - [[ -d $D/$x ]] && f+=" $x\n"
1028 + [[ -d $ed/$x ]] && f+=" $x\n"
1029 done
1030
1031 if [[ -n $f ]] ; then
1032 @@ -172,7 +175,7 @@ install_qa_check() {
1033 fi
1034
1035 # Now we look for all world writable files.
1036 - local unsafe_files=$(find "${D}" -type f -perm -2 | sed -e "s:^${D}:- :")
1037 + local unsafe_files=$(find "${ed}" -type f -perm -2 | sed -e "s:^${ed}:- :")
1038 if [[ -n ${unsafe_files} ]] ; then
1039 vecho "QA Security Notice: world writable file(s):"
1040 vecho "${unsafe_files}"
1041 @@ -202,7 +205,7 @@ install_qa_check() {
1042 if [[ -n "${ROOT}" && "${ROOT}" != "/" ]]; then
1043 forbidden_dirs+=" ${ROOT}"
1044 fi
1045 - local dir l rpath_files=$(scanelf -F '%F:%r' -qBR "${D}")
1046 + local dir l rpath_files=$(scanelf -F '%F:%r' -qBR "${ed}")
1047 f=""
1048 for dir in ${forbidden_dirs}; do
1049 for l in $(echo "${rpath_files}" | grep -E ":${dir}|::|: "); do
1050 @@ -216,7 +219,7 @@ install_qa_check() {
1051
1052 # Reject set*id binaries with $ORIGIN in RPATH #260331
1053 x=$(
1054 - find "${D}" -type f \( -perm -u+s -o -perm -g+s \) -print0 | \
1055 + find "${ed}" -type f \( -perm -u+s -o -perm -g+s \) -print0 | \
1056 xargs -0 scanelf -qyRF '%r %p' | grep '$ORIGIN'
1057 )
1058
1059 @@ -242,7 +245,7 @@ install_qa_check() {
1060 [[ -n ${!qa_var} ]] && QA_TEXTRELS=${!qa_var}
1061 [[ -n ${QA_STRICT_TEXTRELS} ]] && QA_TEXTRELS=""
1062 export QA_TEXTRELS="${QA_TEXTRELS} lib*/modules/*.ko"
1063 - f=$(scanelf -qyRF '%t %p' "${D}" | grep -v 'usr/lib/debug/')
1064 + f=$(scanelf -qyRF '%t %p' "${ed}" | grep -v 'usr/lib/debug/')
1065 if [[ -n ${f} ]] ; then
1066 scanelf -qyRAF '%T %p' "${PORTAGE_BUILDDIR}"/ &> "${T}"/scanelf-textrel.log
1067 vecho -ne '\n'
1068 @@ -282,7 +285,7 @@ install_qa_check() {
1069 [[ -n ${QA_STRICT_WX_LOAD} ]] && QA_WX_LOAD=""
1070 export QA_EXECSTACK="${QA_EXECSTACK} lib*/modules/*.ko"
1071 export QA_WX_LOAD="${QA_WX_LOAD} lib*/modules/*.ko"
1072 - f=$(scanelf -qyRAF '%e %p' "${D}" | grep -v 'usr/lib/debug/')
1073 + f=$(scanelf -qyRAF '%e %p' "${ed}" | grep -v 'usr/lib/debug/')
1074 ;;
1075 esac
1076 ;;
1077 @@ -309,7 +312,7 @@ install_qa_check() {
1078 if [[ "${LDFLAGS}" == *,--hash-style=gnu* ]] && [[ "${PN}" != *-bin ]] ; then
1079 qa_var="QA_DT_HASH_${ARCH/-/_}"
1080 eval "[[ -n \${!qa_var} ]] && QA_DT_HASH=(\"\${${qa_var}[@]}\")"
1081 - f=$(scanelf -qyRF '%k %p' -k .hash "${D}" | sed -e "s:\.hash ::")
1082 + f=$(scanelf -qyRF '%k %p' -k .hash "${ed}" | sed -e "s:\.hash ::")
1083 if [[ -n ${f} ]] ; then
1084 echo "${f}" > "${T}"/scanelf-ignored-LDFLAGS.log
1085 if [ "${QA_STRICT_DT_HASH-unset}" == unset ] ; then
1086 @@ -391,7 +394,7 @@ install_qa_check() {
1087 # Check for shared libraries lacking SONAMEs
1088 qa_var="QA_SONAME_${ARCH/-/_}"
1089 eval "[[ -n \${!qa_var} ]] && QA_SONAME=(\"\${${qa_var}[@]}\")"
1090 - f=$(scanelf -ByF '%S %p' "${D}"{,usr/}lib*/lib*.so* | gawk '$2 == "" { print }' | sed -e "s:^[[:space:]]${D}:/:")
1091 + f=$(scanelf -ByF '%S %p' "${ed}"{,usr/}lib*/lib*.so* | gawk '$2 == "" { print }' | sed -e "s:^[[:space:]]${ed}:/:")
1092 if [[ -n ${f} ]] ; then
1093 echo "${f}" > "${T}"/scanelf-missing-SONAME.log
1094 if [[ "${QA_STRICT_SONAME-unset}" == unset ]] ; then
1095 @@ -425,7 +428,7 @@ install_qa_check() {
1096 # Check for shared libraries lacking NEEDED entries
1097 qa_var="QA_DT_NEEDED_${ARCH/-/_}"
1098 eval "[[ -n \${!qa_var} ]] && QA_DT_NEEDED=(\"\${${qa_var}[@]}\")"
1099 - f=$(scanelf -ByF '%n %p' "${D}"{,usr/}lib*/lib*.so* | gawk '$2 == "" { print }' | sed -e "s:^[[:space:]]${D}:/:")
1100 + f=$(scanelf -ByF '%n %p' "${ed}"{,usr/}lib*/lib*.so* | gawk '$2 == "" { print }' | sed -e "s:^[[:space:]]${ed}:/:")
1101 if [[ -n ${f} ]] ; then
1102 echo "${f}" > "${T}"/scanelf-missing-NEEDED.log
1103 if [[ "${QA_STRICT_DT_NEEDED-unset}" == unset ]] ; then
1104 @@ -459,7 +462,7 @@ install_qa_check() {
1105 PORTAGE_QUIET=${tmp_quiet}
1106 fi
1107
1108 - local unsafe_files=$(find "${D}" -type f '(' -perm -2002 -o -perm -4002 ')')
1109 + local unsafe_files=$(find "${ed}" -type f '(' -perm -2002 -o -perm -4002 ')' | sed -e "s:^${ed}:/:")
1110 if [[ -n ${unsafe_files} ]] ; then
1111 eqawarn "QA Notice: Unsafe files detected (set*id and world writable)"
1112 eqawarn "${unsafe_files}"
1113 @@ -479,8 +482,8 @@ install_qa_check() {
1114 # Sanity check syntax errors in init.d scripts
1115 local d
1116 for d in /etc/conf.d /etc/init.d ; do
1117 - [[ -d ${D}/${d} ]] || continue
1118 - for i in "${D}"/${d}/* ; do
1119 + [[ -d ${ed}/${d} ]] || continue
1120 + for i in "${ed}"/${d}/* ; do
1121 [[ -L ${i} ]] && continue
1122 # if empty conf.d/init.d dir exists (baselayout), then i will be "/etc/conf.d/*" and not exist
1123 [[ ! -e ${i} ]] && continue
1124 @@ -491,17 +494,17 @@ install_qa_check() {
1125 # this should help to ensure that all (most?) shared libraries are executable
1126 # and that all libtool scripts / static libraries are not executable
1127 local j
1128 - for i in "${D}"opt/*/lib{,32,64} \
1129 - "${D}"lib{,32,64} \
1130 - "${D}"usr/lib{,32,64} \
1131 - "${D}"usr/X11R6/lib{,32,64} ; do
1132 + for i in "${ed}"opt/*/lib{,32,64} \
1133 + "${ed}"lib{,32,64} \
1134 + "${ed}"usr/lib{,32,64} \
1135 + "${ed}"usr/X11R6/lib{,32,64} ; do
1136 [[ ! -d ${i} ]] && continue
1137
1138 for j in "${i}"/*.so.* "${i}"/*.so ; do
1139 [[ ! -e ${j} ]] && continue
1140 [[ -L ${j} ]] && continue
1141 [[ -x ${j} ]] && continue
1142 - vecho "making executable: ${j#${D}}"
1143 + vecho "making executable: ${j#${ed}}"
1144 chmod +x "${j}"
1145 done
1146
1147 @@ -509,7 +512,7 @@ install_qa_check() {
1148 [[ ! -e ${j} ]] && continue
1149 [[ -L ${j} ]] && continue
1150 [[ ! -x ${j} ]] && continue
1151 - vecho "removing executable bit: ${j#${D}}"
1152 + vecho "removing executable bit: ${j#${ed}}"
1153 chmod -x "${j}"
1154 done
1155
1156 @@ -533,7 +536,7 @@ install_qa_check() {
1157 # http://bugs.gentoo.org/4411
1158 abort="no"
1159 local a s
1160 - for a in "${D}"usr/lib*/*.a ; do
1161 + for a in "${ed}"usr/lib*/*.a ; do
1162 s=${a%.a}.so
1163 if [[ ! -e ${s} ]] ; then
1164 s=${s%usr/*}${s##*/usr/}
1165 @@ -547,7 +550,7 @@ install_qa_check() {
1166 [[ ${abort} == "yes" ]] && die "add those ldscripts"
1167
1168 # Make sure people don't store libtool files or static libs in /lib
1169 - f=$(ls "${D}"lib*/*.{a,la} 2>/dev/null)
1170 + f=$(ls "${ed}"lib*/*.{a,la} 2>/dev/null)
1171 if [[ -n ${f} ]] ; then
1172 vecho -ne '\n'
1173 eqawarn "QA Notice: Excessive files found in the / partition"
1174 @@ -558,9 +561,9 @@ install_qa_check() {
1175
1176 # Verify that the libtool files don't contain bogus $D entries.
1177 local abort=no gentoo_bug=no always_overflow=no
1178 - for a in "${D}"usr/lib*/*.la ; do
1179 + for a in "${ed}"usr/lib*/*.la ; do
1180 s=${a##*/}
1181 - if grep -qs "${D}" "${a}" ; then
1182 + if grep -qs "${ed}" "${a}" ; then
1183 vecho -ne '\n'
1184 eqawarn "QA Notice: ${s} appears to contain PORTAGE_TMPDIR paths"
1185 abort="yes"
1186 @@ -702,7 +705,7 @@ install_qa_check() {
1187 fi
1188
1189 # Portage regenerates this on the installed system.
1190 - rm -f "${D}"/usr/share/info/dir{,.gz,.bz2}
1191 + rm -f "${ed}"/usr/share/info/dir{,.gz,.bz2}
1192
1193 if has multilib-strict ${FEATURES} && \
1194 [[ -x /usr/bin/file && -x /usr/bin/find ]] && \
1195 @@ -711,15 +714,15 @@ install_qa_check() {
1196 local abort=no dir file firstrun=yes
1197 MULTILIB_STRICT_EXEMPT=$(echo ${MULTILIB_STRICT_EXEMPT} | sed -e 's:\([(|)]\):\\\1:g')
1198 for dir in ${MULTILIB_STRICT_DIRS} ; do
1199 - [[ -d ${D}/${dir} ]] || continue
1200 - for file in $(find ${D}/${dir} -type f | grep -v "^${D}/${dir}/${MULTILIB_STRICT_EXEMPT}"); do
1201 + [[ -d ${ed}/${dir} ]] || continue
1202 + for file in $(find ${ed}/${dir} -type f | grep -v "^${ed}/${dir}/${MULTILIB_STRICT_EXEMPT}"); do
1203 if file ${file} | egrep -q "${MULTILIB_STRICT_DENY}" ; then
1204 if [[ ${firstrun} == yes ]] ; then
1205 echo "Files matching a file type that is not allowed:"
1206 firstrun=no
1207 fi
1208 abort=yes
1209 - echo " ${file#${D}//}"
1210 + echo " ${file#${ed}//}"
1211 fi
1212 done
1213 done
1214 @@ -728,7 +731,7 @@ install_qa_check() {
1215
1216 # ensure packages don't install systemd units automagically
1217 if ! has systemd ${INHERITED} && \
1218 - [[ -d "${D}"/lib/systemd/system ]]
1219 + [[ -d "${ed}"/lib/systemd/system ]]
1220 then
1221 eqawarn "QA Notice: package installs systemd unit files (/lib/systemd/system)"
1222 eqawarn " but does not inherit systemd.eclass."
1223 @@ -886,6 +889,9 @@ preinst_mask() {
1224 return 1
1225 fi
1226
1227 + local ed=${ED}
1228 + case "$EAPI" in 0|1|2) ed=${D} ;; esac
1229 +
1230 # Make sure $PWD is not ${D} so that we don't leave gmon.out files
1231 # in there in case any tools were built with -pg in CFLAGS.
1232 cd "${T}"
1233 @@ -898,11 +904,11 @@ preinst_mask() {
1234 fi
1235 done
1236
1237 - install_mask "${D}" "${INSTALL_MASK}"
1238 + install_mask "${ed}" "${INSTALL_MASK}"
1239
1240 # remove share dir if unnessesary
1241 if has nodoc $FEATURES || has noman $FEATURES || has noinfo $FEATURES; then
1242 - rmdir "${D}usr/share" &> /dev/null
1243 + rmdir "${ed}usr/share" &> /dev/null
1244 fi
1245 }
1246
1247 @@ -911,29 +917,33 @@ preinst_sfperms() {
1248 eerror "${FUNCNAME}: D is unset"
1249 return 1
1250 fi
1251 +
1252 + local ed=${ED}
1253 + case "$EAPI" in 0|1|2) ed=${D} ;; esac
1254 +
1255 # Smart FileSystem Permissions
1256 if has sfperms $FEATURES; then
1257 local i
1258 - find "${D}" -type f -perm -4000 -print0 | \
1259 + find "${ed}" -type f -perm -4000 -print0 | \
1260 while read -r -d $'\0' i ; do
1261 if [ -n "$(find "$i" -perm -2000)" ] ; then
1262 - ebegin ">>> SetUID and SetGID: [chmod o-r] /${i#${D}}"
1263 + ebegin ">>> SetUID and SetGID: [chmod o-r] /${i#${ed}}"
1264 chmod o-r "$i"
1265 eend $?
1266 else
1267 - ebegin ">>> SetUID: [chmod go-r] /${i#${D}}"
1268 + ebegin ">>> SetUID: [chmod go-r] /${i#${ed}}"
1269 chmod go-r "$i"
1270 eend $?
1271 fi
1272 done
1273 - find "${D}" -type f -perm -2000 -print0 | \
1274 + find "${ed}" -type f -perm -2000 -print0 | \
1275 while read -r -d $'\0' i ; do
1276 if [ -n "$(find "$i" -perm -4000)" ] ; then
1277 # This case is already handled
1278 # by the SetUID check above.
1279 true
1280 else
1281 - ebegin ">>> SetGID: [chmod o-r] /${i#${D}}"
1282 + ebegin ">>> SetGID: [chmod o-r] /${i#${ed}}"
1283 chmod o-r "$i"
1284 eend $?
1285 fi
1286 @@ -946,6 +956,10 @@ preinst_suid_scan() {
1287 eerror "${FUNCNAME}: D is unset"
1288 return 1
1289 fi
1290 +
1291 + local ed=${ED}
1292 + case "$EAPI" in 0|1|2) ed=${D} ;; esac
1293 +
1294 # total suid control.
1295 if has suidctl $FEATURES; then
1296 local i sfconf x
1297 @@ -954,10 +968,10 @@ preinst_suid_scan() {
1298 # to files outside of the sandbox, but this
1299 # can easly be bypassed using the addwrite() function
1300 addwrite "${sfconf}"
1301 - vecho ">>> Performing suid scan in ${D}"
1302 - for i in $(find "${D}" -type f \( -perm -4000 -o -perm -2000 \) ); do
1303 + vecho ">>> Performing suid scan in ${ed}"
1304 + for i in $(find "${ed}" -type f \( -perm -4000 -o -perm -2000 \) ); do
1305 if [ -s "${sfconf}" ]; then
1306 - install_path=/${i#${D}}
1307 + install_path=/${i#${ed}}
1308 if grep -q "^${install_path}\$" "${sfconf}" ; then
1309 vecho "- ${install_path} is an approved suid file"
1310 else
1311 @@ -967,7 +981,7 @@ preinst_suid_scan() {
1312 chmod ugo-s "${i}"
1313 grep "^#${install_path}$" "${sfconf}" > /dev/null || {
1314 vecho ">>> Appending commented out entry to ${sfconf} for ${PF}"
1315 - echo "## ${ls_ret%${D}*}${install_path}" >> "${sfconf}"
1316 + echo "## ${ls_ret%${ed}*}${install_path}" >> "${sfconf}"
1317 echo "#${install_path}" >> "${sfconf}"
1318 # no delwrite() eh?
1319 # delwrite ${sconf}
1320 @@ -1008,10 +1022,14 @@ preinst_selinux_labels() {
1321 }
1322
1323 dyn_package() {
1324 +
1325 + local ed=${ED}
1326 + case "$EAPI" in 0|1|2) ed=${D} ;; esac
1327 +
1328 # Make sure $PWD is not ${D} so that we don't leave gmon.out files
1329 # in there in case any tools were built with -pg in CFLAGS.
1330 cd "${T}"
1331 - install_mask "${PORTAGE_BUILDDIR}/image" "${PKG_INSTALL_MASK}"
1332 + install_mask "${ed}" "${PKG_INSTALL_MASK}"
1333 local tar_options=""
1334 [[ $PORTAGE_VERBOSE = 1 ]] && tar_options+=" -v"
1335 # Sandbox is disabled in case the user wants to use a symlink
1336 @@ -1085,10 +1103,14 @@ __END1__
1337 }
1338
1339 dyn_rpm() {
1340 +
1341 + local eprefix=${EPREFIX}
1342 + case "$EAPI" in 0|1|2) eprefix= ;; esac
1343 +
1344 cd "${T}" || die "cd failed"
1345 local machine_name=$(uname -m)
1346 - local dest_dir=/usr/src/rpm/RPMS/${machine_name}
1347 - addwrite /usr/src/rpm
1348 + local dest_dir=${eprefix}/usr/src/rpm/RPMS/${machine_name}
1349 + addwrite ${eprefix}/usr/src/rpm
1350 addwrite "${RPMDIR}"
1351 dyn_spec
1352 rpmbuild -bb --clean --rmsource "${PF}.spec" || die "Failed to integrate rpm spec file"
1353
1354 diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
1355 index 164b309..9dcbf76 100644
1356 --- a/bin/phase-functions.sh
1357 +++ b/bin/phase-functions.sh
1358 @@ -498,8 +498,13 @@ dyn_install() {
1359 fi
1360 trap "abort_install" SIGINT SIGQUIT
1361 ebuild_phase pre_src_install
1362 - rm -rf "${PORTAGE_BUILDDIR}/image"
1363 - mkdir "${PORTAGE_BUILDDIR}/image"
1364 +
1365 + _x=${ED}
1366 + case "$EAPI" in 0|1|2) _x=${D} ;; esac
1367 + rm -rf "${D}"
1368 + mkdir -p "${_x}"
1369 + unset _x
1370 +
1371 if [[ -d $S ]] ; then
1372 cd "${S}"
1373 elif has $EAPI 0 1 2 3 3_pre2 ; then
1374
1375 diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
1376 index a033fa8..8a2f381 100644
1377 --- a/bin/phase-helpers.sh
1378 +++ b/bin/phase-helpers.sh
1379 @@ -19,8 +19,10 @@ into() {
1380 export DESTTREE=""
1381 else
1382 export DESTTREE=$1
1383 - if [ ! -d "${D}${DESTTREE}" ]; then
1384 - install -d "${D}${DESTTREE}"
1385 + local ed=${ED}
1386 + case "$EAPI" in 0|1|2) ed=${D} ;; esac
1387 + if [ ! -d "${ed}${DESTTREE}" ]; then
1388 + install -d "${ed}${DESTTREE}"
1389 local ret=$?
1390 if [[ $ret -ne 0 ]] ; then
1391 helpers_die "${FUNCNAME[0]} failed"
1392 @@ -35,8 +37,10 @@ insinto() {
1393 export INSDESTTREE=""
1394 else
1395 export INSDESTTREE=$1
1396 - if [ ! -d "${D}${INSDESTTREE}" ]; then
1397 - install -d "${D}${INSDESTTREE}"
1398 + local ed=${ED}
1399 + case "$EAPI" in 0|1|2) ed=${D} ;; esac
1400 + if [ ! -d "${ed}${INSDESTTREE}" ]; then
1401 + install -d "${ed}${INSDESTTREE}"
1402 local ret=$?
1403 if [[ $ret -ne 0 ]] ; then
1404 helpers_die "${FUNCNAME[0]} failed"
1405 @@ -51,8 +55,10 @@ exeinto() {
1406 export _E_EXEDESTTREE_=""
1407 else
1408 export _E_EXEDESTTREE_="$1"
1409 - if [ ! -d "${D}${_E_EXEDESTTREE_}" ]; then
1410 - install -d "${D}${_E_EXEDESTTREE_}"
1411 + local ed=${ED}
1412 + case "$EAPI" in 0|1|2) ed=${D} ;; esac
1413 + if [ ! -d "${ed}${_E_EXEDESTTREE_}" ]; then
1414 + install -d "${ed}${_E_EXEDESTTREE_}"
1415 local ret=$?
1416 if [[ $ret -ne 0 ]] ; then
1417 helpers_die "${FUNCNAME[0]} failed"
1418 @@ -67,8 +73,10 @@ docinto() {
1419 export _E_DOCDESTTREE_=""
1420 else
1421 export _E_DOCDESTTREE_="$1"
1422 - if [ ! -d "${D}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" ]; then
1423 - install -d "${D}usr/share/doc/${PF}/${_E_DOCDESTTREE_}"
1424 + local ed=${ED}
1425 + case "$EAPI" in 0|1|2) ed=${D} ;; esac
1426 + if [ ! -d "${ed}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" ]; then
1427 + install -d "${ed}usr/share/doc/${PF}/${_E_DOCDESTTREE_}"
1428 local ret=$?
1429 if [[ $ret -ne 0 ]] ; then
1430 helpers_die "${FUNCNAME[0]} failed"
1431 @@ -133,9 +141,11 @@ docompress() {
1432 keepdir() {
1433 dodir "$@"
1434 local x
1435 + local ed=${ED}
1436 + case "$EAPI" in 0|1|2) ed=${D} ;; esac
1437 if [ "$1" == "-R" ] || [ "$1" == "-r" ]; then
1438 shift
1439 - find "$@" -type d -printf "${D}%p/.keep_${CATEGORY}_${PN}-${SLOT}\n" \
1440 + find "$@" -type d -printf "${ed}%p/.keep_${CATEGORY}_${PN}-${SLOT}\n" \
1441 | tr "\n" "\0" | \
1442 while read -r -d $'\0' ; do
1443 >> "$REPLY" || \
1444 @@ -143,8 +153,8 @@ keepdir() {
1445 done
1446 else
1447 for x in "$@"; do
1448 - >> "${D}${x}/.keep_${CATEGORY}_${PN}-${SLOT}" || \
1449 - die "Failed to create .keep in ${D}${x}"
1450 + >> "${ed}${x}/.keep_${CATEGORY}_${PN}-${SLOT}" || \
1451 + die "Failed to create .keep in ${ed}${x}"
1452 done
1453 fi
1454 }
1455 @@ -369,6 +379,9 @@ unpack() {
1456 econf() {
1457 local x
1458
1459 + local eprefix=${EPREFIX}
1460 + case "$EAPI" in 0|1|2) eprefix= ;; esac
1461 +
1462 _hasg() {
1463 local x s=$1
1464 shift
1465 @@ -398,12 +411,12 @@ econf() {
1466 sed -e "1s:^#![[:space:]]*/bin/sh:#!$CONFIG_SHELL:" -i "$ECONF_SOURCE/configure" || \
1467 die "Substition of shebang in '$ECONF_SOURCE/configure' failed"
1468 fi
1469 - if [ -e /usr/share/gnuconfig/ ]; then
1470 + if [ -e "${eprefix}"/usr/share/gnuconfig/ ]; then
1471 find "${WORKDIR}" -type f '(' \
1472 -name config.guess -o -name config.sub ')' -print0 | \
1473 while read -r -d $'\0' x ; do
1474 - vecho " * econf: updating ${x/${WORKDIR}\/} with /usr/share/gnuconfig/${x##*/}"
1475 - cp -f /usr/share/gnuconfig/"${x##*/}" "${x}"
1476 + vecho " * econf: updating ${x/${WORKDIR}\/} with ${eprefix}/usr/share/gnuconfig/${x##*/}"
1477 + cp -f "${eprefix}"/usr/share/gnuconfig/"${x##*/}" "${x}"
1478 done
1479 fi
1480
1481 @@ -423,7 +436,7 @@ econf() {
1482 if [[ -n ${CONF_LIBDIR} ]] && ! _hasgq --libdir=\* "$@" ; then
1483 export CONF_PREFIX=$(_hasg --exec-prefix=\* "$@")
1484 [[ -z ${CONF_PREFIX} ]] && CONF_PREFIX=$(_hasg --prefix=\* "$@")
1485 - : ${CONF_PREFIX:=/usr}
1486 + : ${CONF_PREFIX:=${eprefix}/usr}
1487 CONF_PREFIX=${CONF_PREFIX#*=}
1488 [[ ${CONF_PREFIX} != /* ]] && CONF_PREFIX="/${CONF_PREFIX}"
1489 [[ ${CONF_LIBDIR} != /* ]] && CONF_LIBDIR="/${CONF_LIBDIR}"
1490 @@ -431,15 +444,15 @@ econf() {
1491 fi
1492
1493 set -- \
1494 - --prefix=/usr \
1495 + --prefix="${eprefix}"/usr \
1496 ${CBUILD:+--build=${CBUILD}} \
1497 --host=${CHOST} \
1498 ${CTARGET:+--target=${CTARGET}} \
1499 - --mandir=/usr/share/man \
1500 - --infodir=/usr/share/info \
1501 - --datadir=/usr/share \
1502 - --sysconfdir=/etc \
1503 - --localstatedir=/var/lib \
1504 + --mandir="${eprefix}"/usr/share/man \
1505 + --infodir="${eprefix}"/usr/share/info \
1506 + --datadir="${eprefix}"/usr/share \
1507 + --sysconfdir="${eprefix}"/etc \
1508 + --localstatedir="${eprefix}"/var/lib \
1509 "$@" \
1510 ${EXTRA_ECONF}
1511 vecho "${ECONF_SOURCE}/configure" "$@"
1512 @@ -463,6 +476,8 @@ econf() {
1513 einstall() {
1514 # CONF_PREFIX is only set if they didn't pass in libdir above.
1515 local LOCAL_EXTRA_EINSTALL="${EXTRA_EINSTALL}"
1516 + local ed=${ED}
1517 + case "$EAPI" in 0|1|2) ed=${D} ;; esac
1518 LIBDIR_VAR="LIBDIR_${ABI}"
1519 if [ -n "${ABI}" -a -n "${!LIBDIR_VAR}" ]; then
1520 CONF_LIBDIR="${!LIBDIR_VAR}"
1521 @@ -477,22 +492,22 @@ einstall() {
1522
1523 if [ -f ./[mM]akefile -o -f ./GNUmakefile ] ; then
1524 if [ "${PORTAGE_DEBUG}" == "1" ]; then
1525 - ${MAKE:-make} -n prefix="${D}usr" \
1526 - datadir="${D}usr/share" \
1527 - infodir="${D}usr/share/info" \
1528 - localstatedir="${D}var/lib" \
1529 - mandir="${D}usr/share/man" \
1530 - sysconfdir="${D}etc" \
1531 + ${MAKE:-make} -n prefix="${ed}usr" \
1532 + datadir="${ed}usr/share" \
1533 + infodir="${ed}usr/share/info" \
1534 + localstatedir="${ed}var/lib" \
1535 + mandir="${ed}usr/share/man" \
1536 + sysconfdir="${ed}etc" \
1537 ${LOCAL_EXTRA_EINSTALL} \
1538 ${MAKEOPTS} ${EXTRA_EMAKE} -j1 \
1539 "$@" install
1540 fi
1541 - ${MAKE:-make} prefix="${D}usr" \
1542 - datadir="${D}usr/share" \
1543 - infodir="${D}usr/share/info" \
1544 - localstatedir="${D}var/lib" \
1545 - mandir="${D}usr/share/man" \
1546 - sysconfdir="${D}etc" \
1547 + ${MAKE:-make} prefix="${ed}usr" \
1548 + datadir="${ed}usr/share" \
1549 + infodir="${ed}usr/share/info" \
1550 + localstatedir="${ed}var/lib" \
1551 + mandir="${ed}usr/share/man" \
1552 + sysconfdir="${ed}etc" \
1553 ${LOCAL_EXTRA_EINSTALL} \
1554 ${MAKEOPTS} ${EXTRA_EMAKE} -j1 \
1555 "$@" install || die "einstall failed"
1556
1557 diff --git a/pym/portage/tests/emerge/test_simple.py b/pym/portage/tests/emerge/test_simple.py
1558 index 7ed679d..d108959 100644
1559 --- a/pym/portage/tests/emerge/test_simple.py
1560 +++ b/pym/portage/tests/emerge/test_simple.py
1561 @@ -36,11 +36,10 @@ pkg_pretend() {
1562
1563 src_install() {
1564 einfo "installing something..."
1565 - # TODO: Add prefix support to shell code/helpers, so we
1566 - # can use things like dodir and doins here.
1567 - mkdir -p "${ED}"/usr/lib/${P} || die
1568 - echo "blah blah blah" > "${ED}"/usr/lib/${P}/regular-file || die
1569 - ln -s regular-file "${ED}"/usr/lib/${P}/symlink || die
1570 + insinto /usr/lib/${P}
1571 + echo "blah blah blah" > "${T}"/regular-file
1572 + doins "${T}"/regular-file
1573 + dosym regular-file /usr/lib/${P}/symlink || die
1574
1575 # Test code for bug #381629, using a copyright symbol encoded with latin-1.
1576 # We use $(printf "\\xa9") rather than $'\\xa9', since printf apparently
1577 @@ -48,10 +47,11 @@ src_install() {
1578 # some conditions. TODO: Find out why it transforms to \\xef\\xbf\\xbd when
1579 # running tests for Python 3.2 (even though it's bash that is ultimately
1580 # responsible for performing the transformation).
1581 - local latin_1_dir=${ED}/usr/lib/${P}/latin-1-$(printf "\\xa9")-directory
1582 - mkdir "${latin_1_dir}"
1583 - echo "blah blah blah" > ${latin_1_dir}/latin-1-$(printf "\\xa9")-regular-file || die
1584 - ln -s latin-1-$(printf "\\xa9")-regular-file ${latin_1_dir}/latin-1-$(printf "\\xa9")-symlink || die
1585 + local latin_1_dir=/usr/lib/${P}/latin-1-$(printf "\\xa9")-directory
1586 + insinto "${latin_1_dir}"
1587 + echo "blah blah blah" > "${T}"/latin-1-$(printf "\\xa9")-regular-file || die
1588 + doins "${T}"/latin-1-$(printf "\\xa9")-regular-file
1589 + dosym latin-1-$(printf "\\xa9")-regular-file ${latin_1_dir}/latin-1-$(printf "\\xa9")-symlink || die
1590 }
1591
1592 pkg_config() {
1593 @@ -80,6 +80,11 @@ pkg_info() {
1594 "LICENSE": "GPL-2",
1595 "MISC_CONTENT": install_something,
1596 },
1597 + "virtual/foo-0": {
1598 + "EAPI" : "4",
1599 + "KEYWORDS": "x86",
1600 + "LICENSE": "GPL-2",
1601 + },
1602 }
1603
1604 installed = {
1605 @@ -201,6 +206,7 @@ pkg_info() {
1606 emerge_cmd + ("--metadata",),
1607 emerge_cmd + ("--metadata",),
1608 rm_cmd + ("-rf", cachedir),
1609 + emerge_cmd + ("--oneshot", "virtual/foo"),
1610 emerge_cmd + ("--pretend", "dev-libs/A"),
1611 ebuild_cmd + (test_ebuild, "manifest", "clean", "package", "merge"),
1612 emerge_cmd + ("--pretend", "--tree", "--complete-graph", "dev-libs/A"),