1 |
commit: e3101f17239f2f3f410e93fc3369c4692d6af7b3 |
2 |
Author: Thomas Sachau <tommy <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Oct 1 13:54:17 2011 +0000 |
4 |
Commit: Thomas Sachau <tommy <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Oct 1 13:54:17 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=e3101f17 |
7 |
|
8 |
Merge v2.2.0_alpha58 |
9 |
|
10 |
|
11 |
bin/bashrc-functions.sh | 140 ++ |
12 |
bin/ebuild | 27 +- |
13 |
bin/ebuild.sh | 2150 ++-------------------- |
14 |
bin/isolated-functions.sh | 163 +-- |
15 |
bin/phase-functions.sh | 1163 ++++++++++++ |
16 |
bin/phase-helpers.sh | 626 +++++++ |
17 |
bin/repoman | 43 +- |
18 |
bin/save-ebuild-env.sh | 97 + |
19 |
man/portage.5 | 4 + |
20 |
pym/_emerge/EbuildFetcher.py | 6 +- |
21 |
pym/_emerge/depgraph.py | 141 +- |
22 |
pym/_emerge/search.py | 5 +- |
23 |
pym/portage/dbapi/porttree.py | 9 +- |
24 |
pym/portage/dep/__init__.py | 8 + |
25 |
pym/portage/manifest.py | 178 ++- |
26 |
pym/portage/package/ebuild/config.py | 13 + |
27 |
pym/portage/package/ebuild/digestcheck.py | 50 +- |
28 |
pym/portage/package/ebuild/digestgen.py | 17 +- |
29 |
pym/portage/package/ebuild/doebuild.py | 39 +- |
30 |
pym/portage/package/ebuild/fetch.py | 4 +- |
31 |
pym/portage/repository/config.py | 216 ++- |
32 |
pym/portage/tests/ebuild/test_config.py | 65 + |
33 |
pym/portage/tests/repoman/test_simple.py | 7 +- |
34 |
pym/portage/tests/resolver/ResolverPlayground.py | 28 +- |
35 |
pym/portage/tests/resolver/test_multislot.py | 16 +- |
36 |
pym/portage/tests/resolver/test_virtual_slot.py | 93 + |
37 |
pym/portage/util/__init__.py | 4 +- |
38 |
pym/repoman/checks.py | 1 + |
39 |
28 files changed, 2844 insertions(+), 2469 deletions(-) |
40 |
|
41 |
diff --cc bin/ebuild.sh |
42 |
index 26cb611,7b77c10..aebdb17 |
43 |
--- a/bin/ebuild.sh |
44 |
+++ b/bin/ebuild.sh |
45 |
@@@ -5,6 -5,48 +5,49 @@@ |
46 |
PORTAGE_BIN_PATH="${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}" |
47 |
PORTAGE_PYM_PATH="${PORTAGE_PYM_PATH:-/usr/lib/portage/pym}" |
48 |
|
49 |
+ ROOTPATH=${ROOTPATH##:} |
50 |
+ ROOTPATH=${ROOTPATH%%:} |
51 |
+ PREROOTPATH=${PREROOTPATH##:} |
52 |
+ PREROOTPATH=${PREROOTPATH%%:} |
53 |
+ PATH=$PORTAGE_BIN_PATH/ebuild-helpers:$PREROOTPATH${PREROOTPATH:+:}/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin${ROOTPATH:+:}$ROOTPATH |
54 |
+ export PATH |
55 |
+ |
56 |
+ # Prevent aliases from causing portage to act inappropriately. |
57 |
+ # Make sure it's before everything so we don't mess aliases that follow. |
58 |
+ unalias -a |
59 |
+ |
60 |
+ source "${PORTAGE_BIN_PATH}/isolated-functions.sh" || exit 1 |
61 |
++source "${PORTAGE_BIN_PATH}/auto-multilib.sh" || exit 1 |
62 |
+ |
63 |
+ if [[ $EBUILD_PHASE != depend ]] ; then |
64 |
+ source "${PORTAGE_BIN_PATH}/phase-functions.sh" || die |
65 |
+ source "${PORTAGE_BIN_PATH}/save-ebuild-env.sh" || die |
66 |
+ source "${PORTAGE_BIN_PATH}/phase-helpers.sh" || die |
67 |
+ source "${PORTAGE_BIN_PATH}/bashrc-functions.sh" || die |
68 |
+ else |
69 |
+ # These dummy functions are for things that are likely to be called |
70 |
+ # in global scope, even though they are completely useless during |
71 |
+ # the "depend" phase. |
72 |
+ for x in diropts docompress exeopts get_KV insopts \ |
73 |
+ keepdir KV_major KV_micro KV_minor KV_to_int \ |
74 |
+ libopts register_die_hook register_success_hook \ |
75 |
+ remove_path_entry set_unless_changed strip_duplicate_slashes \ |
76 |
+ unset_unless_changed use_with use_enable ; do |
77 |
+ eval "${x}() { : ; }" |
78 |
+ done |
79 |
+ # These dummy functions return false, in order to ensure that |
80 |
+ # `use multislot` is false for the "depend" phase. |
81 |
+ for x in use useq usev ; do |
82 |
+ eval "${x}() { return 1; }" |
83 |
+ done |
84 |
+ # These functions die because calls to them during the "depend" phase |
85 |
+ # are considered to be severe QA violations. |
86 |
+ for x in best_version has_version portageq ; do |
87 |
+ eval "${x}() { die \"\${FUNCNAME} calls are not allowed in global scope\"; }" |
88 |
+ done |
89 |
+ unset x |
90 |
+ fi |
91 |
+ |
92 |
if [[ $PORTAGE_SANDBOX_COMPAT_LEVEL -lt 22 ]] ; then |
93 |
# Ensure that /dev/std* streams have appropriate sandbox permission for |
94 |
# bug #288863. This can be removed after sandbox is fixed and portage |
95 |
@@@ -59,1353 -94,72 +95,73 @@@ qa_call() |
96 |
[[ $shopts != $(shopt) ]] && |
97 |
eqawarn "QA Notice: Global shell options changed and were not restored while calling '$*'" |
98 |
[[ "$IFS" != "$OLDIFS" ]] && |
99 |
- eqawarn "QA Notice: Global IFS changed and was not restored while calling '$*'" |
100 |
- return $retval |
101 |
- } |
102 |
- |
103 |
- EBUILD_SH_ARGS="$*" |
104 |
- |
105 |
- shift $# |
106 |
- |
107 |
- # Prevent aliases from causing portage to act inappropriately. |
108 |
- # Make sure it's before everything so we don't mess aliases that follow. |
109 |
- unalias -a |
110 |
- |
111 |
- # Unset some variables that break things. |
112 |
- unset GZIP BZIP BZIP2 CDPATH GREP_OPTIONS GREP_COLOR GLOBIGNORE |
113 |
- |
114 |
- source "${PORTAGE_BIN_PATH}/isolated-functions.sh" &>/dev/null |
115 |
- source "${PORTAGE_BIN_PATH}/auto-multilib.sh" &>/dev/null |
116 |
- |
117 |
- [[ $PORTAGE_QUIET != "" ]] && export PORTAGE_QUIET |
118 |
- |
119 |
- # sandbox support functions; defined prior to profile.bashrc srcing, since the profile might need to add a default exception (/usr/lib64/conftest fex) |
120 |
- _sb_append_var() { |
121 |
- local _v=$1 ; shift |
122 |
- local var="SANDBOX_${_v}" |
123 |
- [[ -z $1 || -n $2 ]] && die "Usage: add$(echo ${_v} | \ |
124 |
- LC_ALL=C tr [:upper:] [:lower:]) <colon-delimited list of paths>" |
125 |
- export ${var}="${!var:+${!var}:}$1" |
126 |
- } |
127 |
- # bash-4 version: |
128 |
- # local var="SANDBOX_${1^^}" |
129 |
- # addread() { _sb_append_var ${0#add} "$@" ; } |
130 |
- addread() { _sb_append_var READ "$@" ; } |
131 |
- addwrite() { _sb_append_var WRITE "$@" ; } |
132 |
- adddeny() { _sb_append_var DENY "$@" ; } |
133 |
- addpredict() { _sb_append_var PREDICT "$@" ; } |
134 |
- |
135 |
- addwrite "${PORTAGE_TMPDIR}" |
136 |
- addread "/:${PORTAGE_TMPDIR}" |
137 |
- [[ -n ${PORTAGE_GPG_DIR} ]] && addpredict "${PORTAGE_GPG_DIR}" |
138 |
- |
139 |
- # Avoid sandbox violations in temporary directories. |
140 |
- if [[ -w $T ]] ; then |
141 |
- export TEMP=$T |
142 |
- export TMP=$T |
143 |
- export TMPDIR=$T |
144 |
- elif [[ $SANDBOX_ON = 1 ]] ; then |
145 |
- for x in TEMP TMP TMPDIR ; do |
146 |
- [[ -n ${!x} ]] && addwrite "${!x}" |
147 |
- done |
148 |
- unset x |
149 |
- fi |
150 |
- |
151 |
- # the sandbox is disabled by default except when overridden in the relevant stages |
152 |
- export SANDBOX_ON=0 |
153 |
- |
154 |
- lchown() { |
155 |
- chown -h "$@" |
156 |
- } |
157 |
- |
158 |
- lchgrp() { |
159 |
- chgrp -h "$@" |
160 |
- } |
161 |
- |
162 |
- esyslog() { |
163 |
- # Custom version of esyslog() to take care of the "Red Star" bug. |
164 |
- # MUST follow functions.sh to override the "" parameter problem. |
165 |
- return 0 |
166 |
- } |
167 |
- |
168 |
- useq() { |
169 |
- has $EBUILD_PHASE prerm postrm || eqawarn \ |
170 |
- "QA Notice: The 'useq' function is deprecated (replaced by 'use')" |
171 |
- use ${1} |
172 |
- } |
173 |
- |
174 |
- usev() { |
175 |
- if use ${1}; then |
176 |
- echo "${1#!}" |
177 |
- return 0 |
178 |
- fi |
179 |
- return 1 |
180 |
- } |
181 |
- |
182 |
- use() { |
183 |
- local u=$1 |
184 |
- local found=0 |
185 |
- |
186 |
- # if we got something like '!flag', then invert the return value |
187 |
- if [[ ${u:0:1} == "!" ]] ; then |
188 |
- u=${u:1} |
189 |
- found=1 |
190 |
- fi |
191 |
- |
192 |
- if [[ $EBUILD_PHASE = depend ]] ; then |
193 |
- # TODO: Add a registration interface for eclasses to register |
194 |
- # any number of phase hooks, so that global scope eclass |
195 |
- # initialization can by migrated to phase hooks in new EAPIs. |
196 |
- # Example: add_phase_hook before pkg_setup $ECLASS_pre_pkg_setup |
197 |
- #if [[ -n $EAPI ]] && ! has "$EAPI" 0 1 2 3 ; then |
198 |
- # die "use() called during invalid phase: $EBUILD_PHASE" |
199 |
- #fi |
200 |
- true |
201 |
- |
202 |
- # Make sure we have this USE flag in IUSE |
203 |
- elif [[ -n $PORTAGE_IUSE && -n $EBUILD_PHASE ]] ; then |
204 |
- if [[ $u != multilib ]]; then |
205 |
- [[ $u =~ $PORTAGE_IUSE ]] || \ |
206 |
- eqawarn "QA Notice: USE Flag '${u}' not" \ |
207 |
- "in IUSE for ${CATEGORY}/${PF}" |
208 |
- fi |
209 |
- fi |
210 |
- |
211 |
- if has ${u} ${USE} ; then |
212 |
- return ${found} |
213 |
- else |
214 |
- return $((!found)) |
215 |
- fi |
216 |
- } |
217 |
- |
218 |
- # Return true if given package is installed. Otherwise return false. |
219 |
- # Takes single depend-type atoms. |
220 |
- has_version() { |
221 |
- if [ "${EBUILD_PHASE}" == "depend" ]; then |
222 |
- die "portageq calls (has_version calls portageq) are not allowed in the global scope" |
223 |
- fi |
224 |
- |
225 |
- if [[ -n $PORTAGE_IPC_DAEMON ]] ; then |
226 |
- "$PORTAGE_BIN_PATH"/ebuild-ipc has_version "$ROOT" "$1" |
227 |
- else |
228 |
- PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \ |
229 |
- "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/portageq" has_version "${ROOT}" "$1" |
230 |
- fi |
231 |
- local retval=$? |
232 |
- case "${retval}" in |
233 |
- 0|1) |
234 |
- return ${retval} |
235 |
- ;; |
236 |
- *) |
237 |
- die "unexpected portageq exit code: ${retval}" |
238 |
- ;; |
239 |
- esac |
240 |
- } |
241 |
- |
242 |
- portageq() { |
243 |
- if [ "${EBUILD_PHASE}" == "depend" ]; then |
244 |
- die "portageq calls are not allowed in the global scope" |
245 |
- fi |
246 |
- |
247 |
- PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \ |
248 |
- "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/portageq" "$@" |
249 |
- } |
250 |
- |
251 |
- |
252 |
- # ---------------------------------------------------------------------------- |
253 |
- # ---------------------------------------------------------------------------- |
254 |
- # ---------------------------------------------------------------------------- |
255 |
- |
256 |
- |
257 |
- # Returns the best/most-current match. |
258 |
- # Takes single depend-type atoms. |
259 |
- best_version() { |
260 |
- if [ "${EBUILD_PHASE}" == "depend" ]; then |
261 |
- die "portageq calls (best_version calls portageq) are not allowed in the global scope" |
262 |
- fi |
263 |
- |
264 |
- if [[ -n $PORTAGE_IPC_DAEMON ]] ; then |
265 |
- "$PORTAGE_BIN_PATH"/ebuild-ipc best_version "$ROOT" "$1" |
266 |
- else |
267 |
- PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \ |
268 |
- "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/portageq" 'best_version' "${ROOT}" "$1" |
269 |
- fi |
270 |
- local retval=$? |
271 |
- case "${retval}" in |
272 |
- 0|1) |
273 |
- return ${retval} |
274 |
- ;; |
275 |
- *) |
276 |
- die "unexpected portageq exit code: ${retval}" |
277 |
- ;; |
278 |
- esac |
279 |
- } |
280 |
- |
281 |
- use_with() { |
282 |
- if [ -z "$1" ]; then |
283 |
- echo "!!! use_with() called without a parameter." >&2 |
284 |
- echo "!!! use_with <USEFLAG> [<flagname> [value]]" >&2 |
285 |
- return 1 |
286 |
- fi |
287 |
- |
288 |
- if ! has "${EAPI:-0}" 0 1 2 3 ; then |
289 |
- local UW_SUFFIX=${3+=$3} |
290 |
- else |
291 |
- local UW_SUFFIX=${3:+=$3} |
292 |
- fi |
293 |
- local UWORD=${2:-$1} |
294 |
- |
295 |
- if use $1; then |
296 |
- echo "--with-${UWORD}${UW_SUFFIX}" |
297 |
- else |
298 |
- echo "--without-${UWORD}" |
299 |
- fi |
300 |
- return 0 |
301 |
- } |
302 |
- |
303 |
- use_enable() { |
304 |
- if [ -z "$1" ]; then |
305 |
- echo "!!! use_enable() called without a parameter." >&2 |
306 |
- echo "!!! use_enable <USEFLAG> [<flagname> [value]]" >&2 |
307 |
- return 1 |
308 |
- fi |
309 |
- |
310 |
- if ! has "${EAPI:-0}" 0 1 2 3 ; then |
311 |
- local UE_SUFFIX=${3+=$3} |
312 |
- else |
313 |
- local UE_SUFFIX=${3:+=$3} |
314 |
- fi |
315 |
- local UWORD=${2:-$1} |
316 |
- |
317 |
- if use $1; then |
318 |
- echo "--enable-${UWORD}${UE_SUFFIX}" |
319 |
- else |
320 |
- echo "--disable-${UWORD}" |
321 |
- fi |
322 |
- return 0 |
323 |
- } |
324 |
- |
325 |
- register_die_hook() { |
326 |
- local x |
327 |
- for x in $* ; do |
328 |
- has $x $EBUILD_DEATH_HOOKS || \ |
329 |
- export EBUILD_DEATH_HOOKS="$EBUILD_DEATH_HOOKS $x" |
330 |
- done |
331 |
- } |
332 |
- |
333 |
- register_success_hook() { |
334 |
- local x |
335 |
- for x in $* ; do |
336 |
- has $x $EBUILD_SUCCESS_HOOKS || \ |
337 |
- export EBUILD_SUCCESS_HOOKS="$EBUILD_SUCCESS_HOOKS $x" |
338 |
- done |
339 |
- } |
340 |
- |
341 |
- # Ensure that $PWD is sane whenever possible, to protect against |
342 |
- # exploitation of insecure search path for python -c in ebuilds. |
343 |
- # See bug #239560. |
344 |
- if ! has "$EBUILD_PHASE" clean cleanrm depend help ; then |
345 |
- cd "$PORTAGE_BUILDDIR" || \ |
346 |
- die "PORTAGE_BUILDDIR does not exist: '$PORTAGE_BUILDDIR'" |
347 |
- fi |
348 |
- |
349 |
- #if no perms are specified, dirs/files will have decent defaults |
350 |
- #(not secretive, but not stupid) |
351 |
- umask 022 |
352 |
- export DESTTREE=/usr |
353 |
- export INSDESTTREE="" |
354 |
- export _E_EXEDESTTREE_="" |
355 |
- export _E_DOCDESTTREE_="" |
356 |
- export INSOPTIONS="-m0644" |
357 |
- export EXEOPTIONS="-m0755" |
358 |
- export LIBOPTIONS="-m0644" |
359 |
- export DIROPTIONS="-m0755" |
360 |
- export MOPREFIX=${PN} |
361 |
- declare -a PORTAGE_DOCOMPRESS=( /usr/share/{doc,info,man} ) |
362 |
- declare -a PORTAGE_DOCOMPRESS_SKIP=( /usr/share/doc/${PF}/html ) |
363 |
- |
364 |
- # adds ".keep" files so that dirs aren't auto-cleaned |
365 |
- keepdir() { |
366 |
- dodir "$@" |
367 |
- local x |
368 |
- if [ "$1" == "-R" ] || [ "$1" == "-r" ]; then |
369 |
- shift |
370 |
- find "$@" -type d -printf "${D}%p/.keep_${CATEGORY}_${PN}-${SLOT}\n" \ |
371 |
- | tr "\n" "\0" | \ |
372 |
- while read -r -d $'\0' ; do |
373 |
- >> "$REPLY" || \ |
374 |
- die "Failed to recursively create .keep files" |
375 |
- done |
376 |
- else |
377 |
- for x in "$@"; do |
378 |
- >> "${D}${x}/.keep_${CATEGORY}_${PN}-${SLOT}" || \ |
379 |
- die "Failed to create .keep in ${D}${x}" |
380 |
- done |
381 |
- fi |
382 |
- } |
383 |
- |
384 |
- unpack() { |
385 |
- local srcdir |
386 |
- local x |
387 |
- local y |
388 |
- local myfail |
389 |
- local eapi=${EAPI:-0} |
390 |
- [ -z "$*" ] && die "Nothing passed to the 'unpack' command" |
391 |
- |
392 |
- for x in "$@"; do |
393 |
- vecho ">>> Unpacking ${x} to ${PWD}" |
394 |
- y=${x%.*} |
395 |
- y=${y##*.} |
396 |
- |
397 |
- if [[ ${x} == "./"* ]] ; then |
398 |
- srcdir="" |
399 |
- elif [[ ${x} == ${DISTDIR%/}/* ]] ; then |
400 |
- die "Arguments to unpack() cannot begin with \${DISTDIR}." |
401 |
- elif [[ ${x} == "/"* ]] ; then |
402 |
- die "Arguments to unpack() cannot be absolute" |
403 |
- else |
404 |
- srcdir="${DISTDIR}/" |
405 |
- fi |
406 |
- [[ ! -s ${srcdir}${x} ]] && die "${x} does not exist" |
407 |
- |
408 |
- _unpack_tar() { |
409 |
- if [ "${y}" == "tar" ]; then |
410 |
- $1 -c -- "$srcdir$x" | tar xof - |
411 |
- assert_sigpipe_ok "$myfail" |
412 |
- else |
413 |
- local cwd_dest=${x##*/} |
414 |
- cwd_dest=${cwd_dest%.*} |
415 |
- $1 -c -- "${srcdir}${x}" > "${cwd_dest}" || die "$myfail" |
416 |
- fi |
417 |
- } |
418 |
- |
419 |
- myfail="failure unpacking ${x}" |
420 |
- case "${x##*.}" in |
421 |
- tar) |
422 |
- tar xof "$srcdir$x" || die "$myfail" |
423 |
- ;; |
424 |
- tgz) |
425 |
- tar xozf "$srcdir$x" || die "$myfail" |
426 |
- ;; |
427 |
- tbz|tbz2) |
428 |
- ${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d} -c -- "$srcdir$x" | tar xof - |
429 |
- assert_sigpipe_ok "$myfail" |
430 |
- ;; |
431 |
- ZIP|zip|jar) |
432 |
- # unzip will interactively prompt under some error conditions, |
433 |
- # as reported in bug #336285 |
434 |
- ( while true ; do echo n || break ; done ) | \ |
435 |
- unzip -qo "${srcdir}${x}" || die "$myfail" |
436 |
- ;; |
437 |
- gz|Z|z) |
438 |
- _unpack_tar "gzip -d" |
439 |
- ;; |
440 |
- bz2|bz) |
441 |
- _unpack_tar "${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d}" |
442 |
- ;; |
443 |
- 7Z|7z) |
444 |
- local my_output |
445 |
- my_output="$(7z x -y "${srcdir}${x}")" |
446 |
- if [ $? -ne 0 ]; then |
447 |
- echo "${my_output}" >&2 |
448 |
- die "$myfail" |
449 |
- fi |
450 |
- ;; |
451 |
- RAR|rar) |
452 |
- unrar x -idq -o+ "${srcdir}${x}" || die "$myfail" |
453 |
- ;; |
454 |
- LHa|LHA|lha|lzh) |
455 |
- lha xfq "${srcdir}${x}" || die "$myfail" |
456 |
- ;; |
457 |
- a) |
458 |
- ar x "${srcdir}${x}" || die "$myfail" |
459 |
- ;; |
460 |
- deb) |
461 |
- # Unpacking .deb archives can not always be done with |
462 |
- # `ar`. For instance on AIX this doesn't work out. If |
463 |
- # we have `deb2targz` installed, prefer it over `ar` for |
464 |
- # that reason. We just make sure on AIX `deb2targz` is |
465 |
- # installed. |
466 |
- if type -P deb2targz > /dev/null; then |
467 |
- y=${x##*/} |
468 |
- local created_symlink=0 |
469 |
- if [ ! "$srcdir$x" -ef "$y" ] ; then |
470 |
- # deb2targz always extracts into the same directory as |
471 |
- # the source file, so create a symlink in the current |
472 |
- # working directory if necessary. |
473 |
- ln -sf "$srcdir$x" "$y" || die "$myfail" |
474 |
- created_symlink=1 |
475 |
- fi |
476 |
- deb2targz "$y" || die "$myfail" |
477 |
- if [ $created_symlink = 1 ] ; then |
478 |
- # Clean up the symlink so the ebuild |
479 |
- # doesn't inadvertently install it. |
480 |
- rm -f "$y" |
481 |
- fi |
482 |
- mv -f "${y%.deb}".tar.gz data.tar.gz || die "$myfail" |
483 |
- else |
484 |
- ar x "$srcdir$x" || die "$myfail" |
485 |
- fi |
486 |
- ;; |
487 |
- lzma) |
488 |
- _unpack_tar "lzma -d" |
489 |
- ;; |
490 |
- xz) |
491 |
- if has $eapi 0 1 2 ; then |
492 |
- vecho "unpack ${x}: file format not recognized. Ignoring." |
493 |
- else |
494 |
- _unpack_tar "xz -d" |
495 |
- fi |
496 |
- ;; |
497 |
- *) |
498 |
- vecho "unpack ${x}: file format not recognized. Ignoring." |
499 |
- ;; |
500 |
- esac |
501 |
- done |
502 |
- # Do not chmod '.' since it's probably ${WORKDIR} and PORTAGE_WORKDIR_MODE |
503 |
- # should be preserved. |
504 |
- find . -mindepth 1 -maxdepth 1 ! -type l -print0 | \ |
505 |
- ${XARGS} -0 chmod -fR a+rX,u+w,g-w,o-w |
506 |
- } |
507 |
- |
508 |
- strip_duplicate_slashes() { |
509 |
- if [[ -n $1 ]] ; then |
510 |
- local removed=$1 |
511 |
- while [[ ${removed} == *//* ]] ; do |
512 |
- removed=${removed//\/\///} |
513 |
- done |
514 |
- echo ${removed} |
515 |
- fi |
516 |
- } |
517 |
- |
518 |
- hasg() { |
519 |
- local x s=$1 |
520 |
- shift |
521 |
- for x ; do [[ ${x} == ${s} ]] && echo "${x}" && return 0 ; done |
522 |
- return 1 |
523 |
- } |
524 |
- hasgq() { hasg "$@" >/dev/null ; } |
525 |
- econf() { |
526 |
- local x |
527 |
- |
528 |
- local phase_func=$(_ebuild_arg_to_phase "$EAPI" "$EBUILD_PHASE") |
529 |
- if [[ -n $phase_func ]] ; then |
530 |
- if has "$EAPI" 0 1 ; then |
531 |
- [[ $phase_func != src_compile ]] && \ |
532 |
- eqawarn "QA Notice: econf called in" \ |
533 |
- "$phase_func instead of src_compile" |
534 |
- else |
535 |
- [[ $phase_func != src_configure ]] && \ |
536 |
- eqawarn "QA Notice: econf called in" \ |
537 |
- "$phase_func instead of src_configure" |
538 |
- fi |
539 |
- fi |
540 |
- |
541 |
- : ${ECONF_SOURCE:=.} |
542 |
- if [ -x "${ECONF_SOURCE}/configure" ]; then |
543 |
- if [[ -n $CONFIG_SHELL && \ |
544 |
- "$(head -n1 "$ECONF_SOURCE/configure")" =~ ^'#!'[[:space:]]*/bin/sh([[:space:]]|$) ]] ; then |
545 |
- sed -e "1s:^#![[:space:]]*/bin/sh:#!$CONFIG_SHELL:" -i "$ECONF_SOURCE/configure" || \ |
546 |
- die "Substition of shebang in '$ECONF_SOURCE/configure' failed" |
547 |
- fi |
548 |
- if [ -e /usr/share/gnuconfig/ ]; then |
549 |
- find "${WORKDIR}" -type f '(' \ |
550 |
- -name config.guess -o -name config.sub ')' -print0 | \ |
551 |
- while read -r -d $'\0' x ; do |
552 |
- vecho " * econf: updating ${x/${WORKDIR}\/} with /usr/share/gnuconfig/${x##*/}" |
553 |
- cp -f /usr/share/gnuconfig/"${x##*/}" "${x}" |
554 |
- done |
555 |
- fi |
556 |
- |
557 |
- # EAPI=4 adds --disable-dependency-tracking to econf |
558 |
- if ! has "$EAPI" 0 1 2 3 3_pre2 && \ |
559 |
- "${ECONF_SOURCE}/configure" --help 2>/dev/null | \ |
560 |
- grep -q disable-dependency-tracking ; then |
561 |
- set -- --disable-dependency-tracking "$@" |
562 |
- fi |
563 |
- |
564 |
- # if the profile defines a location to install libs to aside from default, pass it on. |
565 |
- # if the ebuild passes in --libdir, they're responsible for the conf_libdir fun. |
566 |
- local CONF_LIBDIR LIBDIR_VAR="LIBDIR_${ABI}" |
567 |
- if [[ -n ${ABI} && -n ${!LIBDIR_VAR} ]] ; then |
568 |
- CONF_LIBDIR=${!LIBDIR_VAR} |
569 |
- fi |
570 |
- if [[ -n ${CONF_LIBDIR} ]] && ! hasgq --libdir=\* "$@" ; then |
571 |
- export CONF_PREFIX=$(hasg --exec-prefix=\* "$@") |
572 |
- [[ -z ${CONF_PREFIX} ]] && CONF_PREFIX=$(hasg --prefix=\* "$@") |
573 |
- : ${CONF_PREFIX:=/usr} |
574 |
- CONF_PREFIX=${CONF_PREFIX#*=} |
575 |
- [[ ${CONF_PREFIX} != /* ]] && CONF_PREFIX="/${CONF_PREFIX}" |
576 |
- [[ ${CONF_LIBDIR} != /* ]] && CONF_LIBDIR="/${CONF_LIBDIR}" |
577 |
- set -- --libdir="$(strip_duplicate_slashes ${CONF_PREFIX}${CONF_LIBDIR})" "$@" |
578 |
- fi |
579 |
- |
580 |
- set -- \ |
581 |
- --prefix=/usr \ |
582 |
- ${CBUILD:+--build=${CBUILD}} \ |
583 |
- --host=${CHOST} \ |
584 |
- ${CTARGET:+--target=${CTARGET}} \ |
585 |
- --mandir=/usr/share/man \ |
586 |
- --infodir=/usr/share/info \ |
587 |
- --datadir=/usr/share \ |
588 |
- --sysconfdir=/etc \ |
589 |
- --localstatedir=/var/lib \ |
590 |
- "$@" \ |
591 |
- ${EXTRA_ECONF} |
592 |
- vecho "${ECONF_SOURCE}/configure" "$@" |
593 |
- |
594 |
- if ! "${ECONF_SOURCE}/configure" "$@" ; then |
595 |
- |
596 |
- if [ -s config.log ]; then |
597 |
- echo |
598 |
- echo "!!! Please attach the following file when seeking support:" |
599 |
- echo "!!! ${PWD}/config.log" |
600 |
- fi |
601 |
- die "econf failed" |
602 |
- fi |
603 |
- elif [ -f "${ECONF_SOURCE}/configure" ]; then |
604 |
- die "configure is not executable" |
605 |
- else |
606 |
- die "no configure script found" |
607 |
- fi |
608 |
- } |
609 |
- |
610 |
- einstall() { |
611 |
- # CONF_PREFIX is only set if they didn't pass in libdir above. |
612 |
- local LOCAL_EXTRA_EINSTALL="${EXTRA_EINSTALL}" |
613 |
- LIBDIR_VAR="LIBDIR_${ABI}" |
614 |
- if [ -n "${ABI}" -a -n "${!LIBDIR_VAR}" ]; then |
615 |
- CONF_LIBDIR="${!LIBDIR_VAR}" |
616 |
- fi |
617 |
- unset LIBDIR_VAR |
618 |
- if [ -n "${CONF_LIBDIR}" ] && [ "${CONF_PREFIX:+set}" = set ]; then |
619 |
- EI_DESTLIBDIR="${D}/${CONF_PREFIX}/${CONF_LIBDIR}" |
620 |
- EI_DESTLIBDIR="$(strip_duplicate_slashes ${EI_DESTLIBDIR})" |
621 |
- LOCAL_EXTRA_EINSTALL="libdir=${EI_DESTLIBDIR} ${LOCAL_EXTRA_EINSTALL}" |
622 |
- unset EI_DESTLIBDIR |
623 |
- fi |
624 |
- |
625 |
- if [ -f ./[mM]akefile -o -f ./GNUmakefile ] ; then |
626 |
- if [ "${PORTAGE_DEBUG}" == "1" ]; then |
627 |
- ${MAKE:-make} -n prefix="${D}usr" \ |
628 |
- datadir="${D}usr/share" \ |
629 |
- infodir="${D}usr/share/info" \ |
630 |
- localstatedir="${D}var/lib" \ |
631 |
- mandir="${D}usr/share/man" \ |
632 |
- sysconfdir="${D}etc" \ |
633 |
- ${LOCAL_EXTRA_EINSTALL} \ |
634 |
- ${MAKEOPTS} ${EXTRA_EMAKE} -j1 \ |
635 |
- "$@" install |
636 |
- fi |
637 |
- ${MAKE:-make} prefix="${D}usr" \ |
638 |
- datadir="${D}usr/share" \ |
639 |
- infodir="${D}usr/share/info" \ |
640 |
- localstatedir="${D}var/lib" \ |
641 |
- mandir="${D}usr/share/man" \ |
642 |
- sysconfdir="${D}etc" \ |
643 |
- ${LOCAL_EXTRA_EINSTALL} \ |
644 |
- ${MAKEOPTS} ${EXTRA_EMAKE} -j1 \ |
645 |
- "$@" install || die "einstall failed" |
646 |
- else |
647 |
- die "no Makefile found" |
648 |
- fi |
649 |
- } |
650 |
- |
651 |
- _eapi0_pkg_nofetch() { |
652 |
- [ -z "${SRC_URI}" ] && return |
653 |
- |
654 |
- elog "The following are listed in SRC_URI for ${PN}:" |
655 |
- local x |
656 |
- for x in $(echo ${SRC_URI}); do |
657 |
- elog " ${x}" |
658 |
- done |
659 |
- } |
660 |
- |
661 |
- _eapi0_src_unpack() { |
662 |
- [[ -n ${A} ]] && unpack ${A} |
663 |
- } |
664 |
- |
665 |
- _eapi0_src_compile() { |
666 |
- if [ -x ./configure ] ; then |
667 |
- econf |
668 |
- fi |
669 |
- _eapi2_src_compile |
670 |
- } |
671 |
- |
672 |
- _eapi0_src_test() { |
673 |
- # Since we don't want emake's automatic die |
674 |
- # support (EAPI 4 and later), and we also don't |
675 |
- # want the warning messages that it produces if |
676 |
- # we call it in 'nonfatal' mode, we use emake_cmd |
677 |
- # to emulate the desired parts of emake behavior. |
678 |
- local emake_cmd="${MAKE:-make} ${MAKEOPTS} ${EXTRA_EMAKE}" |
679 |
- if $emake_cmd -j1 check -n &> /dev/null; then |
680 |
- vecho ">>> Test phase [check]: ${CATEGORY}/${PF}" |
681 |
- if ! $emake_cmd -j1 check; then |
682 |
- has test $FEATURES && die "Make check failed. See above for details." |
683 |
- has test $FEATURES || eerror "Make check failed. See above for details." |
684 |
- fi |
685 |
- elif $emake_cmd -j1 test -n &> /dev/null; then |
686 |
- vecho ">>> Test phase [test]: ${CATEGORY}/${PF}" |
687 |
- if ! $emake_cmd -j1 test; then |
688 |
- has test $FEATURES && die "Make test failed. See above for details." |
689 |
- has test $FEATURES || eerror "Make test failed. See above for details." |
690 |
- fi |
691 |
- else |
692 |
- vecho ">>> Test phase [none]: ${CATEGORY}/${PF}" |
693 |
- fi |
694 |
- } |
695 |
- |
696 |
- _eapi1_src_compile() { |
697 |
- _eapi2_src_configure |
698 |
- _eapi2_src_compile |
699 |
- } |
700 |
- |
701 |
- _eapi2_src_configure() { |
702 |
- if [[ -x ${ECONF_SOURCE:-.}/configure ]] ; then |
703 |
- econf |
704 |
- fi |
705 |
- } |
706 |
- |
707 |
- _eapi2_src_compile() { |
708 |
- if [ -f Makefile ] || [ -f GNUmakefile ] || [ -f makefile ]; then |
709 |
- emake || die "emake failed" |
710 |
- fi |
711 |
- } |
712 |
- |
713 |
- _eapi4_src_install() { |
714 |
- if [[ -f Makefile || -f GNUmakefile || -f makefile ]] ; then |
715 |
- emake DESTDIR="${D}" install |
716 |
- fi |
717 |
- |
718 |
- if ! declare -p DOCS &>/dev/null ; then |
719 |
- local d |
720 |
- for d in README* ChangeLog AUTHORS NEWS TODO CHANGES \ |
721 |
- THANKS BUGS FAQ CREDITS CHANGELOG ; do |
722 |
- [[ -s "${d}" ]] && dodoc "${d}" |
723 |
- done |
724 |
- elif [[ $(declare -p DOCS) == "declare -a "* ]] ; then |
725 |
- dodoc "${DOCS[@]}" |
726 |
- else |
727 |
- dodoc ${DOCS} |
728 |
- fi |
729 |
- } |
730 |
- |
731 |
- ebuild_phase() { |
732 |
- declare -F "$1" >/dev/null && qa_call $1 |
733 |
- } |
734 |
- |
735 |
- ebuild_phase_with_hooks() { |
736 |
- local x phase_name=${1} |
737 |
- for x in {pre_,,post_}${phase_name} ; do |
738 |
- ebuild_phase ${x} |
739 |
- done |
740 |
- } |
741 |
- |
742 |
- dyn_pretend() { |
743 |
- if [[ -e $PORTAGE_BUILDDIR/.pretended ]] ; then |
744 |
- vecho ">>> It appears that '$PF' is already pretended; skipping." |
745 |
- vecho ">>> Remove '$PORTAGE_BUILDDIR/.pretended' to force pretend." |
746 |
- return 0 |
747 |
- fi |
748 |
- ebuild_phase pre_pkg_pretend |
749 |
- ebuild_phase pkg_pretend |
750 |
- >> "$PORTAGE_BUILDDIR/.pretended" || \ |
751 |
- die "Failed to create $PORTAGE_BUILDDIR/.pretended" |
752 |
- ebuild_phase post_pkg_pretend |
753 |
- } |
754 |
- |
755 |
- dyn_setup() { |
756 |
- if ! is_auto-multilib && ! use multilib_abi_"${DEFAULT_ABI}" ; then |
757 |
- ewarn |
758 |
- ewarn "You disabled all ABIs" |
759 |
- ewarn "You should enable at least one ABI" |
760 |
- ewarn "Enabling the default ABI now" |
761 |
- ewarn |
762 |
- fi |
763 |
- for LOOP_ABI in $(get_abi_list); do |
764 |
- set_abi ${LOOP_ABI} |
765 |
- if is_ebuild; then |
766 |
- source "${T}"/environment || die |
767 |
- else |
768 |
- rm -f "${T}"/environment |
769 |
- fi |
770 |
- |
771 |
- if [[ -e $PORTAGE_BUILDDIR/.setuped.${ABI} ]] ; then |
772 |
- vecho ">>> It appears that '$PF' is already setup; skipping." |
773 |
- vecho ">>> Remove '$PORTAGE_BUILDDIR/.setuped.${ABI}' to force setup." |
774 |
- return 0 |
775 |
- fi |
776 |
- ebuild_phase pre_pkg_setup |
777 |
- ebuild_phase pkg_setup |
778 |
- >> "$PORTAGE_BUILDDIR/.setuped.${ABI}" || \ |
779 |
- die "Failed to create $PORTAGE_BUILDDIR/.setuped" |
780 |
- ebuild_phase post_pkg_setup |
781 |
- |
782 |
- is_ebuild && { unset_abi; source "${T}"/environment || die ; } |
783 |
- done |
784 |
- is_ebuild && { rm "${T}"/environment || die ; } |
785 |
- } |
786 |
- |
787 |
- dyn_unpack() { |
788 |
- if [[ -f ${PORTAGE_BUILDDIR}/.unpacked ]] ; then |
789 |
- vecho ">>> WORKDIR is up-to-date, keeping..." |
790 |
- return 0 |
791 |
- fi |
792 |
- if [ ! -d "${WORKDIR}" ]; then |
793 |
- install -m${PORTAGE_WORKDIR_MODE:-0700} -d "${WORKDIR}" || die "Failed to create dir '${WORKDIR}'" |
794 |
- fi |
795 |
- cd "${WORKDIR}" || die "Directory change failed: \`cd '${WORKDIR}'\`" |
796 |
- ebuild_phase pre_src_unpack |
797 |
- vecho ">>> Unpacking source$(_get_abi_string)..." |
798 |
- ebuild_phase src_unpack |
799 |
- |
800 |
- if is_auto-multilib && is_ebuild; then |
801 |
- >> "$PORTAGE_BUILDDIR"/.unpacked."${LOOP_ABI}" || die "IO Failure -- Failed to 'touch .unpacked.${LOOP_ABI}'" |
802 |
- fi |
803 |
- is_ebuild && { unset_abi; source "${T}"/environment || die ; } |
804 |
- |
805 |
- is_ebuild && { rm "${T}"/environment || die ; } |
806 |
- >> "$PORTAGE_BUILDDIR/.unpacked" || \ |
807 |
- die "Failed to create $PORTAGE_BUILDDIR/.unpacked" |
808 |
- vecho ">>> Source unpacked in ${WORKDIR}" |
809 |
- ebuild_phase post_src_unpack |
810 |
- } |
811 |
- |
812 |
- dyn_clean() { |
813 |
- if [ -z "${PORTAGE_BUILDDIR}" ]; then |
814 |
- echo "Aborting clean phase because PORTAGE_BUILDDIR is unset!" |
815 |
- return 1 |
816 |
- elif [ ! -d "${PORTAGE_BUILDDIR}" ] ; then |
817 |
- return 0 |
818 |
- fi |
819 |
- if has chflags $FEATURES ; then |
820 |
- chflags -R noschg,nouchg,nosappnd,nouappnd "${PORTAGE_BUILDDIR}" |
821 |
- chflags -R nosunlnk,nouunlnk "${PORTAGE_BUILDDIR}" 2>/dev/null |
822 |
- fi |
823 |
- |
824 |
- rm -rf "${PORTAGE_BUILDDIR}"/image* "${PORTAGE_BUILDDIR}/homedir" |
825 |
- rm -f "${PORTAGE_BUILDDIR}"/.installed* |
826 |
- |
827 |
- if [[ $EMERGE_FROM = binary ]] || \ |
828 |
- ! has keeptemp $FEATURES && ! has keepwork $FEATURES ; then |
829 |
- rm -rf "${T}" |
830 |
- fi |
831 |
- |
832 |
- if [[ $EMERGE_FROM = binary ]] || ! has keepwork $FEATURES; then |
833 |
- rm -f "$PORTAGE_BUILDDIR"/.{ebuild_changed,logid,pretended*,setuped*,unpacked*,prepared*} \ |
834 |
- "$PORTAGE_BUILDDIR"/.{configured*,compiled*,tested*,packaged*} \ |
835 |
- "$PORTAGE_BUILDDIR"/.{die_hooks,abi} \ |
836 |
- "$PORTAGE_BUILDDIR"/.ipc_{in,out,lock} \ |
837 |
- "$PORTAGE_BUILDDIR"/.exit_status |
838 |
- |
839 |
- rm -rf "${PORTAGE_BUILDDIR}/"{build-info,abi-code} |
840 |
- rm -rf "${WORKDIR}"* |
841 |
- fi |
842 |
- |
843 |
- if [ -f "${PORTAGE_BUILDDIR}/.unpacked" ]; then |
844 |
- find "${PORTAGE_BUILDDIR}" -type d ! -regex "^${WORKDIR}" | sort -r | tr "\n" "\0" | $XARGS -0 rmdir &>/dev/null |
845 |
- fi |
846 |
- |
847 |
- # do not bind this to doebuild defined DISTDIR; don't trust doebuild, and if mistakes are made it'll |
848 |
- # result in it wiping the users distfiles directory (bad). |
849 |
- rm -rf "${PORTAGE_BUILDDIR}/distdir" |
850 |
- |
851 |
- # Some kernels, such as Solaris, return EINVAL when an attempt |
852 |
- # is made to remove the current working directory. |
853 |
- cd "$PORTAGE_BUILDDIR"/../.. |
854 |
- rmdir "$PORTAGE_BUILDDIR" 2>/dev/null |
855 |
- |
856 |
- true |
857 |
- } |
858 |
- |
859 |
- into() { |
860 |
- if [ "$1" == "/" ]; then |
861 |
- export DESTTREE="" |
862 |
- else |
863 |
- export DESTTREE=$1 |
864 |
- if [ ! -d "${D}${DESTTREE}" ]; then |
865 |
- install -d "${D}${DESTTREE}" |
866 |
- local ret=$? |
867 |
- if [[ $ret -ne 0 ]] ; then |
868 |
- helpers_die "${FUNCNAME[0]} failed" |
869 |
- return $ret |
870 |
- fi |
871 |
- fi |
872 |
- fi |
873 |
- } |
874 |
- |
875 |
- insinto() { |
876 |
- if [ "$1" == "/" ]; then |
877 |
- export INSDESTTREE="" |
878 |
- else |
879 |
- export INSDESTTREE=$1 |
880 |
- if [ ! -d "${D}${INSDESTTREE}" ]; then |
881 |
- install -d "${D}${INSDESTTREE}" |
882 |
- local ret=$? |
883 |
- if [[ $ret -ne 0 ]] ; then |
884 |
- helpers_die "${FUNCNAME[0]} failed" |
885 |
- return $ret |
886 |
- fi |
887 |
- fi |
888 |
- fi |
889 |
- } |
890 |
- |
891 |
- exeinto() { |
892 |
- if [ "$1" == "/" ]; then |
893 |
- export _E_EXEDESTTREE_="" |
894 |
- else |
895 |
- export _E_EXEDESTTREE_="$1" |
896 |
- if [ ! -d "${D}${_E_EXEDESTTREE_}" ]; then |
897 |
- install -d "${D}${_E_EXEDESTTREE_}" |
898 |
- local ret=$? |
899 |
- if [[ $ret -ne 0 ]] ; then |
900 |
- helpers_die "${FUNCNAME[0]} failed" |
901 |
- return $ret |
902 |
- fi |
903 |
- fi |
904 |
- fi |
905 |
- } |
906 |
- |
907 |
- docinto() { |
908 |
- if [ "$1" == "/" ]; then |
909 |
- export _E_DOCDESTTREE_="" |
910 |
- else |
911 |
- export _E_DOCDESTTREE_="$1" |
912 |
- if [ ! -d "${D}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" ]; then |
913 |
- install -d "${D}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" |
914 |
- local ret=$? |
915 |
- if [[ $ret -ne 0 ]] ; then |
916 |
- helpers_die "${FUNCNAME[0]} failed" |
917 |
- return $ret |
918 |
- fi |
919 |
- fi |
920 |
- fi |
921 |
- } |
922 |
- |
923 |
- insopts() { |
924 |
- export INSOPTIONS="$@" |
925 |
- |
926 |
- # `install` should never be called with '-s' ... |
927 |
- has -s ${INSOPTIONS} && die "Never call insopts() with -s" |
928 |
- } |
929 |
- |
930 |
- diropts() { |
931 |
- export DIROPTIONS="$@" |
932 |
- } |
933 |
- |
934 |
- exeopts() { |
935 |
- export EXEOPTIONS="$@" |
936 |
- |
937 |
- # `install` should never be called with '-s' ... |
938 |
- has -s ${EXEOPTIONS} && die "Never call exeopts() with -s" |
939 |
- } |
940 |
- |
941 |
- libopts() { |
942 |
- export LIBOPTIONS="$@" |
943 |
- |
944 |
- # `install` should never be called with '-s' ... |
945 |
- has -s ${LIBOPTIONS} && die "Never call libopts() with -s" |
946 |
- } |
947 |
- |
948 |
- docompress() { |
949 |
- has "${EAPI}" 0 1 2 3 && die "'docompress' not supported in this EAPI" |
950 |
- |
951 |
- local f g |
952 |
- if [[ $1 = "-x" ]]; then |
953 |
- shift |
954 |
- for f; do |
955 |
- f=$(strip_duplicate_slashes "${f}"); f=${f%/} |
956 |
- [[ ${f:0:1} = / ]] || f="/${f}" |
957 |
- for g in "${PORTAGE_DOCOMPRESS_SKIP[@]}"; do |
958 |
- [[ ${f} = "${g}" ]] && continue 2 |
959 |
- done |
960 |
- PORTAGE_DOCOMPRESS_SKIP[${#PORTAGE_DOCOMPRESS_SKIP[@]}]=${f} |
961 |
- done |
962 |
- else |
963 |
- for f; do |
964 |
- f=$(strip_duplicate_slashes "${f}"); f=${f%/} |
965 |
- [[ ${f:0:1} = / ]] || f="/${f}" |
966 |
- for g in "${PORTAGE_DOCOMPRESS[@]}"; do |
967 |
- [[ ${f} = "${g}" ]] && continue 2 |
968 |
- done |
969 |
- PORTAGE_DOCOMPRESS[${#PORTAGE_DOCOMPRESS[@]}]=${f} |
970 |
- done |
971 |
- fi |
972 |
- } |
973 |
- |
974 |
- abort_handler() { |
975 |
- local msg |
976 |
- if [ "$2" != "fail" ]; then |
977 |
- msg="${EBUILD}: ${1} aborted; exiting." |
978 |
- else |
979 |
- msg="${EBUILD}: ${1} failed; exiting." |
980 |
- fi |
981 |
- echo |
982 |
- echo "$msg" |
983 |
- echo |
984 |
- eval ${3} |
985 |
- #unset signal handler |
986 |
- trap - SIGINT SIGQUIT |
987 |
- } |
988 |
- |
989 |
- abort_prepare() { |
990 |
- abort_handler src_prepare $1 |
991 |
- rm -f "$PORTAGE_BUILDDIR/.prepared" |
992 |
- exit 1 |
993 |
- } |
994 |
- |
995 |
- abort_configure() { |
996 |
- abort_handler src_configure $1 |
997 |
- rm -f "$PORTAGE_BUILDDIR/.configured" |
998 |
- exit 1 |
999 |
- } |
1000 |
- |
1001 |
- abort_compile() { |
1002 |
- abort_handler "src_compile" $1 |
1003 |
- rm -f "${PORTAGE_BUILDDIR}/.compiled" |
1004 |
- exit 1 |
1005 |
- } |
1006 |
- |
1007 |
- abort_test() { |
1008 |
- abort_handler "dyn_test" $1 |
1009 |
- rm -f "${PORTAGE_BUILDDIR}/.tested" |
1010 |
- exit 1 |
1011 |
- } |
1012 |
- |
1013 |
- abort_install() { |
1014 |
- abort_handler "src_install" $1 |
1015 |
- rm -rf "${PORTAGE_BUILDDIR}"/{image,image.*} |
1016 |
- exit 1 |
1017 |
- } |
1018 |
- |
1019 |
- has_phase_defined_up_to() { |
1020 |
- local phase |
1021 |
- for phase in unpack prepare configure compile install; do |
1022 |
- has ${phase} ${DEFINED_PHASES} && return 0 |
1023 |
- [[ ${phase} == $1 ]] && return 1 |
1024 |
- done |
1025 |
- # We shouldn't actually get here |
1026 |
- return 1 |
1027 |
- } |
1028 |
- |
1029 |
- dyn_prepare() { |
1030 |
- |
1031 |
- if [[ -e $PORTAGE_BUILDDIR/.prepared ]] ; then |
1032 |
- vecho ">>> It appears that '$PF' is already prepared; skipping." |
1033 |
- vecho ">>> Remove '$PORTAGE_BUILDDIR/.prepared' to force prepare." |
1034 |
- return 0 |
1035 |
- fi |
1036 |
- |
1037 |
- for LOOP_ABI in $(get_abi_list); do |
1038 |
- is_ebuild && { set_abi ${LOOP_ABI}; source "${T}"/environment || die ; } |
1039 |
- |
1040 |
- if [ "${PORTAGE_BUILDDIR}"/.prepared.${LOOP_ABI} -nt "${WORKDIR}" ]; then |
1041 |
- echo ">>> It appears that ${PN} is already prepared for ABI=${LOOP_ABI}; skipping." |
1042 |
- echo ">>> Remove '$PORTAGE_BUILDDIR/.prepared.${LOOP_ABI}' to force prepare." |
1043 |
- continue |
1044 |
- fi |
1045 |
- if [[ -d $S ]] ; then |
1046 |
- cd "${S}" |
1047 |
- elif has $EAPI 0 1 2 3 3_pre2 ; then |
1048 |
- cd "${WORKDIR}" |
1049 |
- elif [[ -z ${A} ]] && ! has_phase_defined_up_to prepare; then |
1050 |
- cd "${WORKDIR}" |
1051 |
- else |
1052 |
- die "The source directory '${S}' doesn't exist" |
1053 |
- fi |
1054 |
- |
1055 |
- trap abort_prepare SIGINT SIGQUIT |
1056 |
- |
1057 |
- ebuild_phase pre_src_prepare |
1058 |
- vecho ">>> Preparing source in ${PWD}$(_get_abi_string) ..." |
1059 |
- ebuild_phase src_prepare |
1060 |
- |
1061 |
- if is_auto-multilib && is_ebuild; then |
1062 |
- >> "$PORTAGE_BUILDDIR"/.prepared."${LOOP_ABI}" || die "IO Failure -- Failed to 'touch .prepared.${LOOP_ABI}'" |
1063 |
- fi |
1064 |
- is_ebuild && { unset_abi; source "${T}"/environment || die ; } |
1065 |
- done |
1066 |
- is_ebuild && { rm "${T}"/environment || die ; } |
1067 |
- |
1068 |
- >> "$PORTAGE_BUILDDIR/.prepared" || \ |
1069 |
- die "Failed to create $PORTAGE_BUILDDIR/.prepared" |
1070 |
- vecho ">>> Source prepared." |
1071 |
- ebuild_phase post_src_prepare |
1072 |
- |
1073 |
- trap - SIGINT SIGQUIT |
1074 |
- } |
1075 |
- |
1076 |
- dyn_configure() { |
1077 |
- |
1078 |
- if [[ -e $PORTAGE_BUILDDIR/.configured ]] ; then |
1079 |
- vecho ">>> It appears that '$PF' is already configured; skipping." |
1080 |
- vecho ">>> Remove '$PORTAGE_BUILDDIR/.configured' to force configuration." |
1081 |
- return 0 |
1082 |
- fi |
1083 |
- |
1084 |
- for LOOP_ABI in $(get_abi_list); do |
1085 |
- is_ebuild && { set_abi ${LOOP_ABI}; source "${T}"/environment || die ; } |
1086 |
- |
1087 |
- if [ ${PORTAGE_BUILDDIR}/.configured.${LOOP_ABI} -nt "${WORKDIR}" ]; then |
1088 |
- echo ">>> It appears that ${PN} is already configured for ABI=${LOOP_ABI}; skipping." |
1089 |
- echo ">>> Remove '$PORTAGE_BUILDDIR/.configured.${LOOP_ABI}' to force configuration." |
1090 |
- continue |
1091 |
- fi |
1092 |
- if [[ -d $S ]] ; then |
1093 |
- cd "${S}" |
1094 |
- elif has $EAPI 0 1 2 3 3_pre2 ; then |
1095 |
- cd "${WORKDIR}" |
1096 |
- elif [[ -z ${A} ]] && ! has_phase_defined_up_to configure; then |
1097 |
- cd "${WORKDIR}" |
1098 |
- else |
1099 |
- die "The source directory '${S}' doesn't exist" |
1100 |
- fi |
1101 |
- |
1102 |
- trap abort_configure SIGINT SIGQUIT |
1103 |
- |
1104 |
- ebuild_phase pre_src_configure |
1105 |
- |
1106 |
- vecho ">>> Configuring source in ${PWD}$(_get_abi_string) ..." |
1107 |
- ebuild_phase src_configure |
1108 |
- |
1109 |
- if is_auto-multilib && is_ebuild; then |
1110 |
- >> "$PORTAGE_BUILDDIR"/.configured."${LOOP_ABI}" || die "IO Failure -- Failed to 'touch .configured.${LOOP_ABI}'" |
1111 |
- fi |
1112 |
- is_ebuild && { unset_abi; source "${T}"/environment || die ; } |
1113 |
- done |
1114 |
- is_ebuild && { rm "${T}"/environment || die ; } |
1115 |
- >> "$PORTAGE_BUILDDIR/.configured" || \ |
1116 |
- die "Failed to create $PORTAGE_BUILDDIR/.configured" |
1117 |
- vecho ">>> Source configured." |
1118 |
- |
1119 |
- ebuild_phase post_src_configure |
1120 |
- |
1121 |
- trap - SIGINT SIGQUIT |
1122 |
- } |
1123 |
- |
1124 |
- dyn_compile() { |
1125 |
- |
1126 |
- if [[ -e $PORTAGE_BUILDDIR/.compiled ]] ; then |
1127 |
- vecho ">>> It appears that '${PF}' is already compiled; skipping." |
1128 |
- vecho ">>> Remove '$PORTAGE_BUILDDIR/.compiled' to force compilation." |
1129 |
- return 0 |
1130 |
- fi |
1131 |
- |
1132 |
- for LOOP_ABI in $(get_abi_list); do |
1133 |
- is_ebuild && { set_abi ${LOOP_ABI}; source "${T}"/environment || die ; } |
1134 |
- |
1135 |
- if [ ${PORTAGE_BUILDDIR}/.compiled.${LOOP_ABI} -nt "${WORKDIR}" ]; then |
1136 |
- echo ">>> It appears that ${PN} is already compiled for ABI=${LOOP_ABI}; skipping." |
1137 |
- echo ">>> Remove '$PORTAGE_BUILDDIR/.compiled.${LOOP_ABI}' to force compilation." |
1138 |
- continue |
1139 |
- fi |
1140 |
- if [[ -d $S ]] ; then |
1141 |
- cd "${S}" |
1142 |
- elif has $EAPI 0 1 2 3 3_pre2 ; then |
1143 |
- cd "${WORKDIR}" |
1144 |
- elif [[ -z ${A} ]] && ! has_phase_defined_up_to compile; then |
1145 |
- cd "${WORKDIR}" |
1146 |
- else |
1147 |
- die "The source directory '${S}' doesn't exist" |
1148 |
- fi |
1149 |
- |
1150 |
- trap abort_compile SIGINT SIGQUIT |
1151 |
- |
1152 |
- if has distcc $FEATURES && has distcc-pump $FEATURES ; then |
1153 |
- if [[ -z $INCLUDE_SERVER_PORT ]] || [[ ! -w $INCLUDE_SERVER_PORT ]] ; then |
1154 |
- eval $(pump --startup) |
1155 |
- trap "pump --shutdown" EXIT |
1156 |
- fi |
1157 |
- fi |
1158 |
- |
1159 |
- ebuild_phase pre_src_compile |
1160 |
- |
1161 |
- vecho ">>> Compiling source in ${PWD}$(_get_abi_string) ..." |
1162 |
- ebuild_phase src_compile |
1163 |
- |
1164 |
- if is_auto-multilib && is_ebuild; then |
1165 |
- >> "$PORTAGE_BUILDDIR"/.compiled."${LOOP_ABI}" || die "IO Failure -- Failed to 'touch .compiled.${LOOP_ABI}'" |
1166 |
- fi |
1167 |
- is_ebuild && { unset_abi; source "${T}"/environment || die ; } |
1168 |
- done |
1169 |
- is_ebuild && { rm "${T}"/environment || die ; } |
1170 |
- >> "$PORTAGE_BUILDDIR/.compiled" || \ |
1171 |
- die "Failed to create $PORTAGE_BUILDDIR/.compiled" |
1172 |
- vecho ">>> Source compiled." |
1173 |
- |
1174 |
- ebuild_phase post_src_compile |
1175 |
- |
1176 |
- trap - SIGINT SIGQUIT |
1177 |
- } |
1178 |
- |
1179 |
- dyn_test() { |
1180 |
- |
1181 |
- if [[ -e $PORTAGE_BUILDDIR/.tested ]] ; then |
1182 |
- vecho ">>> It appears that ${PN} has already been tested; skipping." |
1183 |
- vecho ">>> Remove '${PORTAGE_BUILDDIR}/.tested' to force test." |
1184 |
- return |
1185 |
- fi |
1186 |
- |
1187 |
- if [ "${EBUILD_FORCE_TEST}" == "1" ] ; then |
1188 |
- # If USE came from ${T}/environment then it might not have USE=test |
1189 |
- # like it's supposed to here. |
1190 |
- ! has test ${USE} && export USE="${USE} test" |
1191 |
- fi |
1192 |
- |
1193 |
- trap "abort_test" SIGINT SIGQUIT |
1194 |
- for LOOP_ABI in $(get_abi_list); do |
1195 |
- is_ebuild && { set_abi ${LOOP_ABI}; source "${T}"/environment || die ; } |
1196 |
- |
1197 |
- if [ -d "${S}" ]; then |
1198 |
- cd "${S}" |
1199 |
- else |
1200 |
- cd "${WORKDIR}" |
1201 |
- fi |
1202 |
- |
1203 |
- if ! has test $FEATURES && [ "${EBUILD_FORCE_TEST}" != "1" ]; then |
1204 |
- vecho ">>> Test phase [not enabled]: ${CATEGORY}/${PF}" |
1205 |
- elif has test $RESTRICT; then |
1206 |
- einfo "Skipping make test/check due to ebuild restriction." |
1207 |
- vecho ">>> Test phase [explicitly disabled]: ${CATEGORY}/${PF}" |
1208 |
- else |
1209 |
- if [ ${PORTAGE_BUILDDIR}/.tested.${LOOP_ABI} -nt "${WORKDIR}" ]; then |
1210 |
- echo ">>> It appears that ${PN} is already tested for ABI=${LOOP_ABI}; skipping." |
1211 |
- echo ">>> Remove '$PORTAGE_BUILDDIR/.tested.${LOOP_ABI}' to force testing." |
1212 |
- continue |
1213 |
- fi |
1214 |
- |
1215 |
- local save_sp=${SANDBOX_PREDICT} |
1216 |
- addpredict / |
1217 |
- ebuild_phase pre_src_test |
1218 |
- ebuild_phase src_test |
1219 |
- |
1220 |
- if is_auto-multilib && is_ebuild; then |
1221 |
- >> "$PORTAGE_BUILDDIR"/.tested."${LOOP_ABI}" || die "IO Failure -- Failed to 'touch .tested.${LOOP_ABI}'" |
1222 |
- fi |
1223 |
- >> "$PORTAGE_BUILDDIR/.tested" || \ |
1224 |
- die "Failed to create $PORTAGE_BUILDDIR/.tested" |
1225 |
- ebuild_phase post_src_test |
1226 |
- SANDBOX_PREDICT=${save_sp} |
1227 |
- fi |
1228 |
- |
1229 |
- is_ebuild && { unset_abi; source "${T}"/environment || die ; } |
1230 |
- done |
1231 |
- is_ebuild && { rm "${T}"/environment || die ; } |
1232 |
- |
1233 |
- trap - SIGINT SIGQUIT |
1234 |
- } |
1235 |
- |
1236 |
- dyn_install() { |
1237 |
- [ -z "$PORTAGE_BUILDDIR" ] && die "${FUNCNAME}: PORTAGE_BUILDDIR is unset" |
1238 |
- if has noauto $FEATURES ; then |
1239 |
- rm -f "${PORTAGE_BUILDDIR}/.installed" |
1240 |
- elif [[ -e $PORTAGE_BUILDDIR/.installed ]] ; then |
1241 |
- vecho ">>> It appears that '${PF}' is already installed; skipping." |
1242 |
- vecho ">>> Remove '${PORTAGE_BUILDDIR}/.installed' to force install." |
1243 |
- return 0 |
1244 |
- fi |
1245 |
- trap "abort_install" SIGINT SIGQUIT |
1246 |
- ebuild_phase pre_src_install |
1247 |
- rm -rf "${PORTAGE_BUILDDIR}/image" |
1248 |
- is_auto-multilib && rm -rf "${PORTAGE_BUILDDIR}"/image.${ABI} |
1249 |
- mkdir "${PORTAGE_BUILDDIR}/image" |
1250 |
- for LOOP_ABI in $(get_abi_list); do |
1251 |
- is_ebuild && { set_abi ${LOOP_ABI}; source "${T}"/environment || die ; } |
1252 |
- |
1253 |
- if [[ -d $S ]] ; then |
1254 |
- cd "${S}" |
1255 |
- elif has $EAPI 0 1 2 3 3_pre2 ; then |
1256 |
- cd "${WORKDIR}" |
1257 |
- elif [[ -z ${A} ]] && ! has_phase_defined_up_to install; then |
1258 |
- cd "${WORKDIR}" |
1259 |
- else |
1260 |
- die "The source directory '${S}' doesn't exist" |
1261 |
- fi |
1262 |
- |
1263 |
- vecho |
1264 |
- vecho ">>> Install ${PF} into ${D} category ${CATEGORY}" |
1265 |
- #our custom version of libtool uses $S and $D to fix |
1266 |
- #invalid paths in .la files |
1267 |
- export S D |
1268 |
- |
1269 |
- # Reset exeinto(), docinto(), insinto(), and into() state variables |
1270 |
- # in case the user is running the install phase multiple times |
1271 |
- # consecutively via the ebuild command. |
1272 |
- export DESTTREE=/usr |
1273 |
- export INSDESTTREE="" |
1274 |
- export _E_EXEDESTTREE_="" |
1275 |
- export _E_DOCDESTTREE_="" |
1276 |
- |
1277 |
- ebuild_phase src_install |
1278 |
- |
1279 |
- if is_auto-multilib ; then |
1280 |
- _finalize_abi_install |
1281 |
- cp "${T}"/environment "${PORTAGE_BUILDDIR}"/build-info/environment.${LOOP_ABI} || die |
1282 |
- if is_ebuild; then |
1283 |
- unset_abi; source "${T}"/environment || die |
1284 |
- touch "$PORTAGE_BUILDDIR"/.installed."${LOOP_ABI}" || die "IO Failure -- Failed to 'touch .installed.${LOOP_ABI}'" |
1285 |
- fi |
1286 |
- fi |
1287 |
- done |
1288 |
- if [[ -d "${D}" ]]; then |
1289 |
- if [[ "${CATEGORY}/${PN}" == "sys-devel/libtool" ]] ; then |
1290 |
- ewarn "Preserving libltdl.la because of extensive usage" |
1291 |
- ewarn "even in m4 macros of libtool" |
1292 |
- else |
1293 |
- find "${D}" -name '*.la' ! -exec grep -q shouldnotlink=yes {} \; -exec rm {} \; |
1294 |
- /usr/bin/lafilefixer "${D}" |
1295 |
- fi |
1296 |
- |
1297 |
- >> "$PORTAGE_BUILDDIR/.installed" || \ |
1298 |
- die "Failed to create $PORTAGE_BUILDDIR/.installed" |
1299 |
- vecho ">>> Completed installing ${PF} into ${D}" |
1300 |
- vecho |
1301 |
- ebuild_phase post_src_install |
1302 |
- |
1303 |
- cd "${PORTAGE_BUILDDIR}"/build-info |
1304 |
- set -f |
1305 |
- local f x |
1306 |
- IFS=$' \t\n\r' |
1307 |
- for f in CATEGORY DEFINED_PHASES FEATURES INHERITED IUSE REQUIRED_USE \ |
1308 |
- PF PKGUSE SLOT KEYWORDS HOMEPAGE DESCRIPTION ; do |
1309 |
- x=$(echo -n ${!f}) |
1310 |
- [[ -n $x ]] && echo "$x" > $f |
1311 |
- done |
1312 |
- if [[ $CATEGORY != virtual ]] ; then |
1313 |
- for f in ASFLAGS CBUILD CC CFLAGS CHOST CTARGET CXX \ |
1314 |
- CXXFLAGS EXTRA_ECONF EXTRA_EINSTALL EXTRA_MAKE \ |
1315 |
- LDFLAGS LIBCFLAGS LIBCXXFLAGS ; do |
1316 |
- x=$(echo -n ${!f}) |
1317 |
- [[ -n $x ]] && echo "$x" > $f |
1318 |
- done |
1319 |
- fi |
1320 |
- if has_multilib_profile ; then |
1321 |
- local i= x= |
1322 |
- for i in ${MULTILIB_ABIS} ; do |
1323 |
- x+=" multilib_abi_${i}" |
1324 |
- done |
1325 |
- echo "${IUSE}${x}" > IUSE |
1326 |
- fi |
1327 |
- echo "${USE}" > USE |
1328 |
- echo "${EAPI:-0}" > EAPI |
1329 |
- if is_auto-multilib; then |
1330 |
- echo "$(get_abi_order)" > MULTILIB_ABIS |
1331 |
- fi |
1332 |
- set +f |
1333 |
- |
1334 |
- # local variables can leak into the saved environment. |
1335 |
- unset f |
1336 |
- |
1337 |
- save_ebuild_env --exclude-init-phases | filter_readonly_variables \ |
1338 |
- --filter-path --filter-sandbox --allow-extra-vars > environment |
1339 |
- assert "save_ebuild_env failed" |
1340 |
+ eqawarn "QA Notice: Global IFS changed and was not restored while calling '$*'" |
1341 |
+ return $retval |
1342 |
+ } |
1343 |
|
1344 |
- ${PORTAGE_BZIP2_COMMAND} -f9 environment* |
1345 |
+ EBUILD_SH_ARGS="$*" |
1346 |
|
1347 |
- cp "${EBUILD}" "${PF}.ebuild" |
1348 |
- [ -n "${PORTAGE_REPO_NAME}" ] && echo "${PORTAGE_REPO_NAME}" > repository |
1349 |
- if has nostrip ${FEATURES} ${RESTRICT} || has strip ${RESTRICT} |
1350 |
- then |
1351 |
- >> DEBUGBUILD |
1352 |
- fi |
1353 |
+ shift $# |
1354 |
|
1355 |
- else |
1356 |
- cd "${PORTAGE_BUILDDIR}" |
1357 |
- if [[ $EMERGE_FROM = binary ]] || ! has keepwork $FEATURES; then |
1358 |
- rm -f "$PORTAGE_BUILDDIR"/.{ebuild_changed,exit_status,logid,unpacked,prepared} \ |
1359 |
- "$PORTAGE_BUILDDIR"/.{configured,compiled,tested,packaged} \ |
1360 |
- "$PORTAGE_BUILDDIR"/.die_hooks |
1361 |
- |
1362 |
- # rm -rf "${PORTAGE_BUILDDIR}/build-info" |
1363 |
- rm -rf "${WORKDIR}" |
1364 |
- fi |
1365 |
+ # Unset some variables that break things. |
1366 |
+ unset GZIP BZIP BZIP2 CDPATH GREP_OPTIONS GREP_COLOR GLOBIGNORE |
1367 |
|
1368 |
- if [ -f "${PORTAGE_BUILDDIR}/.unpacked" ]; then |
1369 |
- find "${PORTAGE_BUILDDIR}" -type d ! -regex "^${WORKDIR}" | sort -r | tr "\n" "\0" | $XARGS -0 rmdir &>/dev/null |
1370 |
- fi |
1371 |
- fi |
1372 |
+ [[ $PORTAGE_QUIET != "" ]] && export PORTAGE_QUIET |
1373 |
|
1374 |
- trap - SIGINT SIGQUIT |
1375 |
+ # sandbox support functions; defined prior to profile.bashrc srcing, since the profile might need to add a default exception (/usr/lib64/conftest fex) |
1376 |
+ _sb_append_var() { |
1377 |
+ local _v=$1 ; shift |
1378 |
+ local var="SANDBOX_${_v}" |
1379 |
+ [[ -z $1 || -n $2 ]] && die "Usage: add$(echo ${_v} | \ |
1380 |
+ LC_ALL=C tr [:upper:] [:lower:]) <colon-delimited list of paths>" |
1381 |
+ export ${var}="${!var:+${!var}:}$1" |
1382 |
} |
1383 |
+ # bash-4 version: |
1384 |
+ # local var="SANDBOX_${1^^}" |
1385 |
+ # addread() { _sb_append_var ${0#add} "$@" ; } |
1386 |
+ addread() { _sb_append_var READ "$@" ; } |
1387 |
+ addwrite() { _sb_append_var WRITE "$@" ; } |
1388 |
+ adddeny() { _sb_append_var DENY "$@" ; } |
1389 |
+ addpredict() { _sb_append_var PREDICT "$@" ; } |
1390 |
|
1391 |
- dyn_preinst() { |
1392 |
- if [ -z "${D}" ]; then |
1393 |
- eerror "${FUNCNAME}: D is unset" |
1394 |
- return 1 |
1395 |
- fi |
1396 |
- for LOOP_ABI in $(get_abi_order); do |
1397 |
- set_abi ${LOOP_ABI}; source "${T}"/environment || die |
1398 |
- |
1399 |
- ebuild_phase_with_hooks pkg_preinst |
1400 |
+ addwrite "${PORTAGE_TMPDIR}" |
1401 |
+ addread "/:${PORTAGE_TMPDIR}" |
1402 |
+ [[ -n ${PORTAGE_GPG_DIR} ]] && addpredict "${PORTAGE_GPG_DIR}" |
1403 |
|
1404 |
- unset_abi; source "${T}"/environment || die |
1405 |
+ # Avoid sandbox violations in temporary directories. |
1406 |
+ if [[ -w $T ]] ; then |
1407 |
+ export TEMP=$T |
1408 |
+ export TMP=$T |
1409 |
+ export TMPDIR=$T |
1410 |
+ elif [[ $SANDBOX_ON = 1 ]] ; then |
1411 |
+ for x in TEMP TMP TMPDIR ; do |
1412 |
+ [[ -n ${!x} ]] && addwrite "${!x}" |
1413 |
done |
1414 |
- } |
1415 |
+ unset x |
1416 |
+ fi |
1417 |
|
1418 |
- dyn_help() { |
1419 |
- echo |
1420 |
- echo "Portage" |
1421 |
- echo "Copyright 1999-2010 Gentoo Foundation" |
1422 |
- echo |
1423 |
- echo "How to use the ebuild command:" |
1424 |
- echo |
1425 |
- echo "The first argument to ebuild should be an existing .ebuild file." |
1426 |
- echo |
1427 |
- echo "One or more of the following options can then be specified. If more" |
1428 |
- echo "than one option is specified, each will be executed in order." |
1429 |
- echo |
1430 |
- echo " help : show this help screen" |
1431 |
- echo " pretend : execute package specific pretend actions" |
1432 |
- echo " setup : execute package specific setup actions" |
1433 |
- echo " fetch : download source archive(s) and patches" |
1434 |
- echo " digest : create a manifest file for the package" |
1435 |
- echo " manifest : create a manifest file for the package" |
1436 |
- echo " unpack : unpack sources (auto-dependencies if needed)" |
1437 |
- echo " prepare : prepare sources (auto-dependencies if needed)" |
1438 |
- echo " configure : configure sources (auto-fetch/unpack if needed)" |
1439 |
- echo " compile : compile sources (auto-fetch/unpack/configure if needed)" |
1440 |
- echo " test : test package (auto-fetch/unpack/configure/compile if needed)" |
1441 |
- echo " preinst : execute pre-install instructions" |
1442 |
- echo " postinst : execute post-install instructions" |
1443 |
- echo " install : install the package to the temporary install directory" |
1444 |
- echo " qmerge : merge image into live filesystem, recording files in db" |
1445 |
- echo " merge : do fetch, unpack, compile, install and qmerge" |
1446 |
- echo " prerm : execute pre-removal instructions" |
1447 |
- echo " postrm : execute post-removal instructions" |
1448 |
- echo " unmerge : remove package from live filesystem" |
1449 |
- echo " config : execute package specific configuration actions" |
1450 |
- echo " package : create a tarball package in ${PKGDIR}/All" |
1451 |
- echo " rpm : build a RedHat RPM package" |
1452 |
- echo " clean : clean up all source and temporary files" |
1453 |
- echo |
1454 |
- echo "The following settings will be used for the ebuild process:" |
1455 |
- echo |
1456 |
- echo " package : ${PF}" |
1457 |
- echo " slot : ${SLOT}" |
1458 |
- echo " category : ${CATEGORY}" |
1459 |
- echo " description : ${DESCRIPTION}" |
1460 |
- echo " system : ${CHOST}" |
1461 |
- echo " c flags : ${CFLAGS}" |
1462 |
- echo " c++ flags : ${CXXFLAGS}" |
1463 |
- echo " make flags : ${MAKEOPTS}" |
1464 |
- echo -n " build mode : " |
1465 |
- if has nostrip ${FEATURES} ${RESTRICT} || has strip ${RESTRICT} ; |
1466 |
- then |
1467 |
- echo "debug (large)" |
1468 |
- else |
1469 |
- echo "production (stripped)" |
1470 |
- fi |
1471 |
- echo " merge to : ${ROOT}" |
1472 |
- echo |
1473 |
- if [ -n "$USE" ]; then |
1474 |
- echo "Additionally, support for the following optional features will be enabled:" |
1475 |
- echo |
1476 |
- echo " ${USE}" |
1477 |
- fi |
1478 |
- echo |
1479 |
+ # the sandbox is disabled by default except when overridden in the relevant stages |
1480 |
+ export SANDBOX_ON=0 |
1481 |
+ |
1482 |
+ esyslog() { |
1483 |
+ # Custom version of esyslog() to take care of the "Red Star" bug. |
1484 |
+ # MUST follow functions.sh to override the "" parameter problem. |
1485 |
+ return 0 |
1486 |
} |
1487 |
|
1488 |
+ # Ensure that $PWD is sane whenever possible, to protect against |
1489 |
+ # exploitation of insecure search path for python -c in ebuilds. |
1490 |
+ # See bug #239560. |
1491 |
+ if ! has "$EBUILD_PHASE" clean cleanrm depend help ; then |
1492 |
+ cd "$PORTAGE_BUILDDIR" || \ |
1493 |
+ die "PORTAGE_BUILDDIR does not exist: '$PORTAGE_BUILDDIR'" |
1494 |
+ fi |
1495 |
++>>>>>>> v2.2.0_alpha58 |
1496 |
+ |
1497 |
+ #if no perms are specified, dirs/files will have decent defaults |
1498 |
+ #(not secretive, but not stupid) |
1499 |
+ umask 022 |
1500 |
+ |
1501 |
# debug-print() gets called from many places with verbose status information useful |
1502 |
# for tracking down problems. The output is in $T/eclass-debug.log. |
1503 |
# You can set ECLASS_DEBUG_OUTPUT to redirect the output somewhere else as well. |
1504 |
diff --cc bin/phase-functions.sh |
1505 |
index 0000000,164b309..6fc8b51 |
1506 |
mode 000000,100644..100644 |
1507 |
--- a/bin/phase-functions.sh |
1508 |
+++ b/bin/phase-functions.sh |
1509 |
@@@ -1,0 -1,970 +1,1163 @@@ |
1510 |
+ #!/bin/bash |
1511 |
+ # Copyright 1999-2011 Gentoo Foundation |
1512 |
+ # Distributed under the terms of the GNU General Public License v2 |
1513 |
+ |
1514 |
+ # Hardcoded bash lists are needed for backward compatibility with |
1515 |
+ # <portage-2.1.4 since they assume that a newly installed version |
1516 |
+ # of ebuild.sh will work for pkg_postinst, pkg_prerm, and pkg_postrm |
1517 |
+ # when portage is upgrading itself. |
1518 |
+ |
1519 |
+ PORTAGE_READONLY_METADATA="DEFINED_PHASES DEPEND DESCRIPTION |
1520 |
+ EAPI HOMEPAGE INHERITED IUSE REQUIRED_USE KEYWORDS LICENSE |
1521 |
+ PDEPEND PROVIDE RDEPEND RESTRICT SLOT SRC_URI" |
1522 |
+ |
1523 |
+ PORTAGE_READONLY_VARS="D EBUILD EBUILD_PHASE \ |
1524 |
+ EBUILD_SH_ARGS ECLASSDIR EMERGE_FROM FILESDIR MERGE_TYPE \ |
1525 |
+ PM_EBUILD_HOOK_DIR \ |
1526 |
+ PORTAGE_ACTUAL_DISTDIR PORTAGE_ARCHLIST PORTAGE_BASHRC \ |
1527 |
+ PORTAGE_BINPKG_FILE PORTAGE_BINPKG_TAR_OPTS PORTAGE_BINPKG_TMPFILE \ |
1528 |
+ PORTAGE_BIN_PATH PORTAGE_BUILDDIR PORTAGE_BUNZIP2_COMMAND \ |
1529 |
+ PORTAGE_BZIP2_COMMAND PORTAGE_COLORMAP PORTAGE_CONFIGROOT \ |
1530 |
+ PORTAGE_DEBUG PORTAGE_DEPCACHEDIR PORTAGE_EBUILD_EXIT_FILE \ |
1531 |
+ PORTAGE_GID PORTAGE_GRPNAME PORTAGE_INST_GID PORTAGE_INST_UID \ |
1532 |
+ PORTAGE_IPC_DAEMON PORTAGE_IUSE PORTAGE_LOG_FILE \ |
1533 |
+ PORTAGE_MUTABLE_FILTERED_VARS PORTAGE_PYM_PATH PORTAGE_PYTHON \ |
1534 |
+ PORTAGE_READONLY_METADATA PORTAGE_READONLY_VARS \ |
1535 |
+ PORTAGE_REPO_NAME PORTAGE_RESTRICT PORTAGE_SANDBOX_COMPAT_LEVEL \ |
1536 |
+ PORTAGE_SAVED_READONLY_VARS PORTAGE_SIGPIPE_STATUS \ |
1537 |
+ PORTAGE_TMPDIR PORTAGE_UPDATE_ENV PORTAGE_USERNAME \ |
1538 |
+ PORTAGE_VERBOSE PORTAGE_WORKDIR_MODE PORTDIR PORTDIR_OVERLAY \ |
1539 |
+ PROFILE_PATHS REPLACING_VERSIONS REPLACED_BY_VERSION T WORKDIR" |
1540 |
+ |
1541 |
+ PORTAGE_SAVED_READONLY_VARS="A CATEGORY P PF PN PR PV PVR" |
1542 |
+ |
1543 |
+ # Variables that portage sets but doesn't mark readonly. |
1544 |
+ # In order to prevent changed values from causing unexpected |
1545 |
+ # interference, they are filtered out of the environment when |
1546 |
+ # it is saved or loaded (any mutations do not persist). |
1547 |
+ PORTAGE_MUTABLE_FILTERED_VARS="AA HOSTNAME" |
1548 |
+ |
1549 |
+ # @FUNCTION: filter_readonly_variables |
1550 |
+ # @DESCRIPTION: [--filter-sandbox] [--allow-extra-vars] |
1551 |
+ # Read an environment from stdin and echo to stdout while filtering variables |
1552 |
+ # with names that are known to cause interference: |
1553 |
+ # |
1554 |
+ # * some specific variables for which bash does not allow assignment |
1555 |
+ # * some specific variables that affect portage or sandbox behavior |
1556 |
+ # * variable names that begin with a digit or that contain any |
1557 |
+ # non-alphanumeric characters that are not be supported by bash |
1558 |
+ # |
1559 |
+ # --filter-sandbox causes all SANDBOX_* variables to be filtered, which |
1560 |
+ # is only desired in certain cases, such as during preprocessing or when |
1561 |
+ # saving environment.bz2 for a binary or installed package. |
1562 |
+ # |
1563 |
+ # --filter-features causes the special FEATURES variable to be filtered. |
1564 |
+ # Generally, we want it to persist between phases since the user might |
1565 |
+ # want to modify it via bashrc to enable things like splitdebug and |
1566 |
+ # installsources for specific packages. They should be able to modify it |
1567 |
+ # in pre_pkg_setup() and have it persist all the way through the install |
1568 |
+ # phase. However, if FEATURES exist inside environment.bz2 then they |
1569 |
+ # should be overridden by current settings. |
1570 |
+ # |
1571 |
+ # --filter-locale causes locale related variables such as LANG and LC_* |
1572 |
+ # variables to be filtered. These variables should persist between phases, |
1573 |
+ # in case they are modified by the ebuild. However, the current user |
1574 |
+ # settings should be used when loading the environment from a binary or |
1575 |
+ # installed package. |
1576 |
+ # |
1577 |
+ # --filter-path causes the PATH variable to be filtered. This variable |
1578 |
+ # should persist between phases, in case it is modified by the ebuild. |
1579 |
+ # However, old settings should be overridden when loading the |
1580 |
+ # environment from a binary or installed package. |
1581 |
+ # |
1582 |
+ # ---allow-extra-vars causes some extra vars to be allowd through, such |
1583 |
+ # as ${PORTAGE_SAVED_READONLY_VARS} and ${PORTAGE_MUTABLE_FILTERED_VARS}. |
1584 |
+ # |
1585 |
+ # In bash-3.2_p20+ an attempt to assign BASH_*, FUNCNAME, GROUPS or any |
1586 |
+ # readonly variable cause the shell to exit while executing the "source" |
1587 |
+ # builtin command. To avoid this problem, this function filters those |
1588 |
+ # variables out and discards them. See bug #190128. |
1589 |
+ filter_readonly_variables() { |
1590 |
+ local x filtered_vars |
1591 |
+ local readonly_bash_vars="BASHOPTS BASHPID DIRSTACK EUID |
1592 |
+ FUNCNAME GROUPS PIPESTATUS PPID SHELLOPTS UID" |
1593 |
+ local bash_misc_vars="BASH BASH_.* COMP_WORDBREAKS HISTCMD |
1594 |
+ HISTFILE HOSTNAME HOSTTYPE IFS LINENO MACHTYPE OLDPWD |
1595 |
+ OPTERR OPTIND OSTYPE POSIXLY_CORRECT PS4 PWD RANDOM |
1596 |
+ SECONDS SHELL SHLVL" |
1597 |
+ local filtered_sandbox_vars="SANDBOX_ACTIVE SANDBOX_BASHRC |
1598 |
+ SANDBOX_DEBUG_LOG SANDBOX_DISABLED SANDBOX_LIB |
1599 |
+ SANDBOX_LOG SANDBOX_ON" |
1600 |
+ local misc_garbage_vars="_portage_filter_opts" |
1601 |
+ filtered_vars="$readonly_bash_vars $bash_misc_vars |
1602 |
+ $PORTAGE_READONLY_VARS $misc_garbage_vars" |
1603 |
+ |
1604 |
+ # Don't filter/interfere with prefix variables unless they are |
1605 |
+ # supported by the current EAPI. |
1606 |
+ case "${EAPI:-0}" in |
1607 |
+ 0|1|2) |
1608 |
+ ;; |
1609 |
+ *) |
1610 |
+ filtered_vars+=" ED EPREFIX EROOT" |
1611 |
+ ;; |
1612 |
+ esac |
1613 |
+ |
1614 |
+ if has --filter-sandbox $* ; then |
1615 |
+ filtered_vars="${filtered_vars} SANDBOX_.*" |
1616 |
+ else |
1617 |
+ filtered_vars="${filtered_vars} ${filtered_sandbox_vars}" |
1618 |
+ fi |
1619 |
+ if has --filter-features $* ; then |
1620 |
+ filtered_vars="${filtered_vars} FEATURES PORTAGE_FEATURES" |
1621 |
+ fi |
1622 |
+ if has --filter-path $* ; then |
1623 |
+ filtered_vars+=" PATH" |
1624 |
+ fi |
1625 |
+ if has --filter-locale $* ; then |
1626 |
+ filtered_vars+=" LANG LC_ALL LC_COLLATE |
1627 |
+ LC_CTYPE LC_MESSAGES LC_MONETARY |
1628 |
+ LC_NUMERIC LC_PAPER LC_TIME" |
1629 |
+ fi |
1630 |
+ if ! has --allow-extra-vars $* ; then |
1631 |
+ filtered_vars=" |
1632 |
+ ${filtered_vars} |
1633 |
+ ${PORTAGE_SAVED_READONLY_VARS} |
1634 |
+ ${PORTAGE_MUTABLE_FILTERED_VARS} |
1635 |
+ " |
1636 |
+ fi |
1637 |
++ if has --filter-metadata $* ; then |
1638 |
++ filtered_vars+=" ${PORTAGE_READONLY_METADATA} filter_opts" |
1639 |
++ fi |
1640 |
+ |
1641 |
+ "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}"/filter-bash-environment.py "${filtered_vars}" || die "filter-bash-environment.py failed" |
1642 |
+ } |
1643 |
+ |
1644 |
+ # @FUNCTION: preprocess_ebuild_env |
1645 |
+ # @DESCRIPTION: |
1646 |
+ # Filter any readonly variables from ${T}/environment, source it, and then |
1647 |
+ # save it via save_ebuild_env(). This process should be sufficient to prevent |
1648 |
+ # any stale variables or functions from an arbitrary environment from |
1649 |
+ # interfering with the current environment. This is useful when an existing |
1650 |
+ # environment needs to be loaded from a binary or installed package. |
1651 |
+ preprocess_ebuild_env() { |
1652 |
+ local _portage_filter_opts="--filter-features --filter-locale --filter-path --filter-sandbox" |
1653 |
+ |
1654 |
+ # If environment.raw is present, this is a signal from the python side, |
1655 |
+ # indicating that the environment may contain stale FEATURES and |
1656 |
+ # SANDBOX_{DENY,PREDICT,READ,WRITE} variables that should be filtered out. |
1657 |
+ # Otherwise, we don't need to filter the environment. |
1658 |
+ [ -f "${T}/environment.raw" ] || return 0 |
1659 |
+ |
1660 |
+ filter_readonly_variables $_portage_filter_opts < "${T}"/environment \ |
1661 |
+ >> "$T/environment.filtered" || return $? |
1662 |
+ unset _portage_filter_opts |
1663 |
+ mv "${T}"/environment.filtered "${T}"/environment || return $? |
1664 |
+ rm -f "${T}/environment.success" || return $? |
1665 |
+ # WARNING: Code inside this subshell should avoid making assumptions |
1666 |
+ # about variables or functions after source "${T}"/environment has been |
1667 |
+ # called. Any variables that need to be relied upon should already be |
1668 |
+ # filtered out above. |
1669 |
+ ( |
1670 |
+ export SANDBOX_ON=1 |
1671 |
+ source "${T}/environment" || exit $? |
1672 |
+ # We have to temporarily disable sandbox since the |
1673 |
+ # SANDBOX_{DENY,READ,PREDICT,WRITE} values we've just loaded |
1674 |
+ # may be unusable (triggering in spurious sandbox violations) |
1675 |
+ # until we've merged them with our current values. |
1676 |
+ export SANDBOX_ON=0 |
1677 |
+ |
1678 |
+ # It's remotely possible that save_ebuild_env() has been overridden |
1679 |
+ # by the above source command. To protect ourselves, we override it |
1680 |
+ # here with our own version. ${PORTAGE_BIN_PATH} is safe to use here |
1681 |
+ # because it's already filtered above. |
1682 |
+ source "${PORTAGE_BIN_PATH}/save-ebuild-env.sh" || exit $? |
1683 |
+ |
1684 |
+ # Rely on save_ebuild_env() to filter out any remaining variables |
1685 |
+ # and functions that could interfere with the current environment. |
1686 |
+ save_ebuild_env || exit $? |
1687 |
+ >> "$T/environment.success" || exit $? |
1688 |
+ ) > "${T}/environment.filtered" |
1689 |
+ local retval |
1690 |
+ if [ -e "${T}/environment.success" ] ; then |
1691 |
+ filter_readonly_variables --filter-features < \ |
1692 |
+ "${T}/environment.filtered" > "${T}/environment" |
1693 |
+ retval=$? |
1694 |
+ else |
1695 |
+ retval=1 |
1696 |
+ fi |
1697 |
+ rm -f "${T}"/environment.{filtered,raw,success} |
1698 |
+ return ${retval} |
1699 |
+ } |
1700 |
+ |
1701 |
+ ebuild_phase() { |
1702 |
+ declare -F "$1" >/dev/null && qa_call $1 |
1703 |
+ } |
1704 |
+ |
1705 |
+ ebuild_phase_with_hooks() { |
1706 |
+ local x phase_name=${1} |
1707 |
+ for x in {pre_,,post_}${phase_name} ; do |
1708 |
+ ebuild_phase ${x} |
1709 |
+ done |
1710 |
+ } |
1711 |
+ |
1712 |
+ dyn_pretend() { |
1713 |
+ if [[ -e $PORTAGE_BUILDDIR/.pretended ]] ; then |
1714 |
+ vecho ">>> It appears that '$PF' is already pretended; skipping." |
1715 |
+ vecho ">>> Remove '$PORTAGE_BUILDDIR/.pretended' to force pretend." |
1716 |
+ return 0 |
1717 |
+ fi |
1718 |
+ ebuild_phase pre_pkg_pretend |
1719 |
+ ebuild_phase pkg_pretend |
1720 |
+ >> "$PORTAGE_BUILDDIR/.pretended" || \ |
1721 |
+ die "Failed to create $PORTAGE_BUILDDIR/.pretended" |
1722 |
+ ebuild_phase post_pkg_pretend |
1723 |
+ } |
1724 |
+ |
1725 |
+ dyn_setup() { |
1726 |
- if [[ -e $PORTAGE_BUILDDIR/.setuped ]] ; then |
1727 |
++ if ! is_auto-multilib && ! use multilib_abi_"${DEFAULT_ABI}" ; then |
1728 |
++ ewarn |
1729 |
++ ewarn "You disabled all ABIs" |
1730 |
++ ewarn "You should enable at least one ABI" |
1731 |
++ ewarn "Enabling the default ABI now" |
1732 |
++ ewarn |
1733 |
++ fi |
1734 |
++ for LOOP_ABI in $(get_abi_list); do |
1735 |
++ set_abi ${LOOP_ABI} |
1736 |
++ if is_ebuild; then |
1737 |
++ source "${T}"/environment || die |
1738 |
++ else |
1739 |
++ rm -f "${T}"/environment |
1740 |
++ fi |
1741 |
++ if [[ -e $PORTAGE_BUILDDIR/.setuped.${ABI} ]] ; then |
1742 |
+ vecho ">>> It appears that '$PF' is already setup; skipping." |
1743 |
- vecho ">>> Remove '$PORTAGE_BUILDDIR/.setuped' to force setup." |
1744 |
++ vecho ">>> Remove '$PORTAGE_BUILDDIR/.setuped.${ABI}' to force setup." |
1745 |
+ return 0 |
1746 |
+ fi |
1747 |
+ ebuild_phase pre_pkg_setup |
1748 |
+ ebuild_phase pkg_setup |
1749 |
- >> "$PORTAGE_BUILDDIR/.setuped" || \ |
1750 |
++ >> "$PORTAGE_BUILDDIR/.setuped.${ABI}" || \ |
1751 |
+ die "Failed to create $PORTAGE_BUILDDIR/.setuped" |
1752 |
+ ebuild_phase post_pkg_setup |
1753 |
++ |
1754 |
++ is_ebuild && { unset_abi; source "${T}"/environment || die ; } |
1755 |
++ done |
1756 |
++ is_ebuild && { rm "${T}"/environment || die ; } |
1757 |
+ } |
1758 |
+ |
1759 |
+ dyn_unpack() { |
1760 |
+ if [[ -f ${PORTAGE_BUILDDIR}/.unpacked ]] ; then |
1761 |
+ vecho ">>> WORKDIR is up-to-date, keeping..." |
1762 |
+ return 0 |
1763 |
+ fi |
1764 |
+ if [ ! -d "${WORKDIR}" ]; then |
1765 |
+ install -m${PORTAGE_WORKDIR_MODE:-0700} -d "${WORKDIR}" || die "Failed to create dir '${WORKDIR}'" |
1766 |
+ fi |
1767 |
+ cd "${WORKDIR}" || die "Directory change failed: \`cd '${WORKDIR}'\`" |
1768 |
+ ebuild_phase pre_src_unpack |
1769 |
- vecho ">>> Unpacking source..." |
1770 |
++ vecho ">>> Unpacking source$(_get_abi_string)..." |
1771 |
+ ebuild_phase src_unpack |
1772 |
++ |
1773 |
++ if is_auto-multilib && is_ebuild; then |
1774 |
++ >> "$PORTAGE_BUILDDIR"/.unpacked."${LOOP_ABI}" || die "IO Failure -- Failed to 'touch .unpacked.${LOOP_ABI}'" |
1775 |
++ fi |
1776 |
++ is_ebuild && { unset_abi; source "${T}"/environment || die ; } |
1777 |
++ |
1778 |
++ is_ebuild && { rm "${T}"/environment || die ; } |
1779 |
+ >> "$PORTAGE_BUILDDIR/.unpacked" || \ |
1780 |
+ die "Failed to create $PORTAGE_BUILDDIR/.unpacked" |
1781 |
+ vecho ">>> Source unpacked in ${WORKDIR}" |
1782 |
+ ebuild_phase post_src_unpack |
1783 |
+ } |
1784 |
+ |
1785 |
+ dyn_clean() { |
1786 |
+ if [ -z "${PORTAGE_BUILDDIR}" ]; then |
1787 |
+ echo "Aborting clean phase because PORTAGE_BUILDDIR is unset!" |
1788 |
+ return 1 |
1789 |
+ elif [ ! -d "${PORTAGE_BUILDDIR}" ] ; then |
1790 |
+ return 0 |
1791 |
+ fi |
1792 |
+ if has chflags $FEATURES ; then |
1793 |
+ chflags -R noschg,nouchg,nosappnd,nouappnd "${PORTAGE_BUILDDIR}" |
1794 |
+ chflags -R nosunlnk,nouunlnk "${PORTAGE_BUILDDIR}" 2>/dev/null |
1795 |
+ fi |
1796 |
+ |
1797 |
- rm -rf "${PORTAGE_BUILDDIR}/image" "${PORTAGE_BUILDDIR}/homedir" |
1798 |
- rm -f "${PORTAGE_BUILDDIR}/.installed" |
1799 |
++ rm -rf "${PORTAGE_BUILDDIR}"/image* "${PORTAGE_BUILDDIR}/homedir" |
1800 |
++ rm -f "${PORTAGE_BUILDDIR}"/.installed* |
1801 |
+ |
1802 |
+ if [[ $EMERGE_FROM = binary ]] || \ |
1803 |
+ ! has keeptemp $FEATURES && ! has keepwork $FEATURES ; then |
1804 |
+ rm -rf "${T}" |
1805 |
+ fi |
1806 |
+ |
1807 |
+ if [[ $EMERGE_FROM = binary ]] || ! has keepwork $FEATURES; then |
1808 |
- rm -f "$PORTAGE_BUILDDIR"/.{ebuild_changed,logid,pretended,setuped,unpacked,prepared} \ |
1809 |
- "$PORTAGE_BUILDDIR"/.{configured,compiled,tested,packaged} \ |
1810 |
++ rm -f "$PORTAGE_BUILDDIR"/.{ebuild_changed,logid,pretended*,setuped*,unpacked*,prepared*} \ |
1811 |
++ "$PORTAGE_BUILDDIR"/.{configured*,compiled*,tested*,packaged*} \ |
1812 |
+ "$PORTAGE_BUILDDIR"/.die_hooks \ |
1813 |
+ "$PORTAGE_BUILDDIR"/.ipc_{in,out,lock} \ |
1814 |
+ "$PORTAGE_BUILDDIR"/.exit_status |
1815 |
+ |
1816 |
- rm -rf "${PORTAGE_BUILDDIR}/build-info" |
1817 |
- rm -rf "${WORKDIR}" |
1818 |
++ rm -rf "${PORTAGE_BUILDDIR}"/{build-info,abi-code} |
1819 |
++ rm -rf "${WORKDIR}"* |
1820 |
+ fi |
1821 |
+ |
1822 |
+ if [ -f "${PORTAGE_BUILDDIR}/.unpacked" ]; then |
1823 |
+ find "${PORTAGE_BUILDDIR}" -type d ! -regex "^${WORKDIR}" | sort -r | tr "\n" "\0" | $XARGS -0 rmdir &>/dev/null |
1824 |
+ fi |
1825 |
+ |
1826 |
+ # do not bind this to doebuild defined DISTDIR; don't trust doebuild, and if mistakes are made it'll |
1827 |
+ # result in it wiping the users distfiles directory (bad). |
1828 |
+ rm -rf "${PORTAGE_BUILDDIR}/distdir" |
1829 |
+ |
1830 |
+ # Some kernels, such as Solaris, return EINVAL when an attempt |
1831 |
+ # is made to remove the current working directory. |
1832 |
+ cd "$PORTAGE_BUILDDIR"/../.. |
1833 |
+ rmdir "$PORTAGE_BUILDDIR" 2>/dev/null |
1834 |
+ |
1835 |
+ true |
1836 |
+ } |
1837 |
+ |
1838 |
+ abort_handler() { |
1839 |
+ local msg |
1840 |
+ if [ "$2" != "fail" ]; then |
1841 |
+ msg="${EBUILD}: ${1} aborted; exiting." |
1842 |
+ else |
1843 |
+ msg="${EBUILD}: ${1} failed; exiting." |
1844 |
+ fi |
1845 |
+ echo |
1846 |
+ echo "$msg" |
1847 |
+ echo |
1848 |
+ eval ${3} |
1849 |
+ #unset signal handler |
1850 |
+ trap - SIGINT SIGQUIT |
1851 |
+ } |
1852 |
+ |
1853 |
+ abort_prepare() { |
1854 |
+ abort_handler src_prepare $1 |
1855 |
+ rm -f "$PORTAGE_BUILDDIR/.prepared" |
1856 |
+ exit 1 |
1857 |
+ } |
1858 |
+ |
1859 |
+ abort_configure() { |
1860 |
+ abort_handler src_configure $1 |
1861 |
+ rm -f "$PORTAGE_BUILDDIR/.configured" |
1862 |
+ exit 1 |
1863 |
+ } |
1864 |
+ |
1865 |
+ abort_compile() { |
1866 |
+ abort_handler "src_compile" $1 |
1867 |
+ rm -f "${PORTAGE_BUILDDIR}/.compiled" |
1868 |
+ exit 1 |
1869 |
+ } |
1870 |
+ |
1871 |
+ abort_test() { |
1872 |
+ abort_handler "dyn_test" $1 |
1873 |
+ rm -f "${PORTAGE_BUILDDIR}/.tested" |
1874 |
+ exit 1 |
1875 |
+ } |
1876 |
+ |
1877 |
+ abort_install() { |
1878 |
+ abort_handler "src_install" $1 |
1879 |
+ rm -rf "${PORTAGE_BUILDDIR}/image" |
1880 |
+ exit 1 |
1881 |
+ } |
1882 |
+ |
1883 |
+ has_phase_defined_up_to() { |
1884 |
+ local phase |
1885 |
+ for phase in unpack prepare configure compile install; do |
1886 |
+ has ${phase} ${DEFINED_PHASES} && return 0 |
1887 |
+ [[ ${phase} == $1 ]] && return 1 |
1888 |
+ done |
1889 |
+ # We shouldn't actually get here |
1890 |
+ return 1 |
1891 |
+ } |
1892 |
+ |
1893 |
+ dyn_prepare() { |
1894 |
+ |
1895 |
+ if [[ -e $PORTAGE_BUILDDIR/.prepared ]] ; then |
1896 |
+ vecho ">>> It appears that '$PF' is already prepared; skipping." |
1897 |
+ vecho ">>> Remove '$PORTAGE_BUILDDIR/.prepared' to force prepare." |
1898 |
+ return 0 |
1899 |
+ fi |
1900 |
+ |
1901 |
++ for LOOP_ABI in $(get_abi_list); do |
1902 |
++ is_ebuild && { set_abi ${LOOP_ABI}; source "${T}"/environment || die ; } |
1903 |
++ |
1904 |
++ if [ "${PORTAGE_BUILDDIR}"/.prepared.${LOOP_ABI} -nt "${WORKDIR}" ]; then |
1905 |
++ echo ">>> It appears that ${PN} is already prepared for ABI=${LOOP_ABI}; skipping." |
1906 |
++ echo ">>> Remove '$PORTAGE_BUILDDIR/.prepared.${LOOP_ABI}' to force prepare." |
1907 |
++ continue |
1908 |
++ fi |
1909 |
+ if [[ -d $S ]] ; then |
1910 |
+ cd "${S}" |
1911 |
+ elif has $EAPI 0 1 2 3 3_pre2 ; then |
1912 |
+ cd "${WORKDIR}" |
1913 |
+ elif [[ -z ${A} ]] && ! has_phase_defined_up_to prepare; then |
1914 |
+ cd "${WORKDIR}" |
1915 |
+ else |
1916 |
+ die "The source directory '${S}' doesn't exist" |
1917 |
+ fi |
1918 |
+ |
1919 |
+ trap abort_prepare SIGINT SIGQUIT |
1920 |
+ |
1921 |
+ ebuild_phase pre_src_prepare |
1922 |
- vecho ">>> Preparing source in $PWD ..." |
1923 |
++ vecho ">>> Preparing source in $PWD$(_get_abi_string) ..." |
1924 |
+ ebuild_phase src_prepare |
1925 |
++ |
1926 |
++ if is_auto-multilib && is_ebuild; then |
1927 |
++ >> "$PORTAGE_BUILDDIR"/.prepared."${LOOP_ABI}" || die "IO Failure -- Failed to 'touch .prepared.${LOOP_ABI}'" |
1928 |
++ fi |
1929 |
++ is_ebuild && { unset_abi; source "${T}"/environment || die ; } |
1930 |
++ done |
1931 |
++ is_ebuild && { rm "${T}"/environment || die ; } |
1932 |
++ |
1933 |
+ >> "$PORTAGE_BUILDDIR/.prepared" || \ |
1934 |
+ die "Failed to create $PORTAGE_BUILDDIR/.prepared" |
1935 |
+ vecho ">>> Source prepared." |
1936 |
+ ebuild_phase post_src_prepare |
1937 |
+ |
1938 |
+ trap - SIGINT SIGQUIT |
1939 |
+ } |
1940 |
+ |
1941 |
+ dyn_configure() { |
1942 |
+ |
1943 |
+ if [[ -e $PORTAGE_BUILDDIR/.configured ]] ; then |
1944 |
+ vecho ">>> It appears that '$PF' is already configured; skipping." |
1945 |
+ vecho ">>> Remove '$PORTAGE_BUILDDIR/.configured' to force configuration." |
1946 |
+ return 0 |
1947 |
+ fi |
1948 |
+ |
1949 |
++ for LOOP_ABI in $(get_abi_list); do |
1950 |
++ is_ebuild && { set_abi ${LOOP_ABI}; source "${T}"/environment || die ; } |
1951 |
++ |
1952 |
++ if [ ${PORTAGE_BUILDDIR}/.configured.${LOOP_ABI} -nt "${WORKDIR}" ]; then |
1953 |
++ echo ">>> It appears that ${PN} is already configured for ABI=${LOOP_ABI}; skipping." |
1954 |
++ echo ">>> Remove '$PORTAGE_BUILDDIR/.configured.${LOOP_ABI}' to force configuration." |
1955 |
++ continue |
1956 |
++ fi |
1957 |
+ if [[ -d $S ]] ; then |
1958 |
+ cd "${S}" |
1959 |
+ elif has $EAPI 0 1 2 3 3_pre2 ; then |
1960 |
+ cd "${WORKDIR}" |
1961 |
+ elif [[ -z ${A} ]] && ! has_phase_defined_up_to configure; then |
1962 |
+ cd "${WORKDIR}" |
1963 |
+ else |
1964 |
+ die "The source directory '${S}' doesn't exist" |
1965 |
+ fi |
1966 |
+ |
1967 |
+ trap abort_configure SIGINT SIGQUIT |
1968 |
+ |
1969 |
+ ebuild_phase pre_src_configure |
1970 |
+ |
1971 |
- vecho ">>> Configuring source in $PWD ..." |
1972 |
++ vecho ">>> Configuring source in $PWD$(_get_abi_string) ..." |
1973 |
+ ebuild_phase src_configure |
1974 |
++ |
1975 |
++ if is_auto-multilib && is_ebuild; then |
1976 |
++ >> "$PORTAGE_BUILDDIR"/.configured."${LOOP_ABI}" || die "IO Failure -- Failed to 'touch .configured.${LOOP_ABI}'" |
1977 |
++ fi |
1978 |
++ is_ebuild && { unset_abi; source "${T}"/environment || die ; } |
1979 |
++ done |
1980 |
++ is_ebuild && { rm "${T}"/environment || die ; } |
1981 |
+ >> "$PORTAGE_BUILDDIR/.configured" || \ |
1982 |
+ die "Failed to create $PORTAGE_BUILDDIR/.configured" |
1983 |
+ vecho ">>> Source configured." |
1984 |
+ |
1985 |
+ ebuild_phase post_src_configure |
1986 |
+ |
1987 |
+ trap - SIGINT SIGQUIT |
1988 |
+ } |
1989 |
+ |
1990 |
+ dyn_compile() { |
1991 |
+ |
1992 |
+ if [[ -e $PORTAGE_BUILDDIR/.compiled ]] ; then |
1993 |
+ vecho ">>> It appears that '${PF}' is already compiled; skipping." |
1994 |
+ vecho ">>> Remove '$PORTAGE_BUILDDIR/.compiled' to force compilation." |
1995 |
+ return 0 |
1996 |
+ fi |
1997 |
+ |
1998 |
++ for LOOP_ABI in $(get_abi_list); do |
1999 |
++ is_ebuild && { set_abi ${LOOP_ABI}; source "${T}"/environment || die ; } |
2000 |
++ |
2001 |
++ if [ ${PORTAGE_BUILDDIR}/.compiled.${LOOP_ABI} -nt "${WORKDIR}" ]; then |
2002 |
++ echo ">>> It appears that ${PN} is already compiled for ABI=${LOOP_ABI}; skipping." |
2003 |
++ echo ">>> Remove '$PORTAGE_BUILDDIR/.compiled.${LOOP_ABI}' to force compilation." |
2004 |
++ continue |
2005 |
++ fi |
2006 |
+ if [[ -d $S ]] ; then |
2007 |
+ cd "${S}" |
2008 |
+ elif has $EAPI 0 1 2 3 3_pre2 ; then |
2009 |
+ cd "${WORKDIR}" |
2010 |
+ elif [[ -z ${A} ]] && ! has_phase_defined_up_to compile; then |
2011 |
+ cd "${WORKDIR}" |
2012 |
+ else |
2013 |
+ die "The source directory '${S}' doesn't exist" |
2014 |
+ fi |
2015 |
+ |
2016 |
+ trap abort_compile SIGINT SIGQUIT |
2017 |
+ |
2018 |
+ if has distcc $FEATURES && has distcc-pump $FEATURES ; then |
2019 |
+ if [[ -z $INCLUDE_SERVER_PORT ]] || [[ ! -w $INCLUDE_SERVER_PORT ]] ; then |
2020 |
+ eval $(pump --startup) |
2021 |
+ trap "pump --shutdown" EXIT |
2022 |
+ fi |
2023 |
+ fi |
2024 |
+ |
2025 |
+ ebuild_phase pre_src_compile |
2026 |
+ |
2027 |
- vecho ">>> Compiling source in $PWD ..." |
2028 |
++ vecho ">>> Compiling source in $PWD$(_get_abi_string) ..." |
2029 |
+ ebuild_phase src_compile |
2030 |
++ |
2031 |
++ if is_auto-multilib && is_ebuild; then |
2032 |
++ >> "$PORTAGE_BUILDDIR"/.compiled."${LOOP_ABI}" || die "IO Failure -- Failed to 'touch .compiled.${LOOP_ABI}'" |
2033 |
++ fi |
2034 |
++ is_ebuild && { unset_abi; source "${T}"/environment || die ; } |
2035 |
++ done |
2036 |
++ is_ebuild && { rm "${T}"/environment || die ; } |
2037 |
+ >> "$PORTAGE_BUILDDIR/.compiled" || \ |
2038 |
+ die "Failed to create $PORTAGE_BUILDDIR/.compiled" |
2039 |
+ vecho ">>> Source compiled." |
2040 |
+ |
2041 |
+ ebuild_phase post_src_compile |
2042 |
+ |
2043 |
+ trap - SIGINT SIGQUIT |
2044 |
+ } |
2045 |
+ |
2046 |
+ dyn_test() { |
2047 |
+ |
2048 |
+ if [[ -e $PORTAGE_BUILDDIR/.tested ]] ; then |
2049 |
+ vecho ">>> It appears that ${PN} has already been tested; skipping." |
2050 |
+ vecho ">>> Remove '${PORTAGE_BUILDDIR}/.tested' to force test." |
2051 |
+ return |
2052 |
+ fi |
2053 |
+ |
2054 |
+ if [ "${EBUILD_FORCE_TEST}" == "1" ] ; then |
2055 |
+ # If USE came from ${T}/environment then it might not have USE=test |
2056 |
+ # like it's supposed to here. |
2057 |
+ ! has test ${USE} && export USE="${USE} test" |
2058 |
+ fi |
2059 |
+ |
2060 |
+ trap "abort_test" SIGINT SIGQUIT |
2061 |
++ for LOOP_ABI in $(get_abi_list); do |
2062 |
++ is_ebuild && { set_abi ${LOOP_ABI}; source "${T}"/environment || die ; } |
2063 |
++ |
2064 |
+ if [ -d "${S}" ]; then |
2065 |
+ cd "${S}" |
2066 |
+ else |
2067 |
+ cd "${WORKDIR}" |
2068 |
+ fi |
2069 |
+ |
2070 |
+ if ! has test $FEATURES && [ "${EBUILD_FORCE_TEST}" != "1" ]; then |
2071 |
+ vecho ">>> Test phase [not enabled]: ${CATEGORY}/${PF}" |
2072 |
+ elif has test $RESTRICT; then |
2073 |
+ einfo "Skipping make test/check due to ebuild restriction." |
2074 |
+ vecho ">>> Test phase [explicitly disabled]: ${CATEGORY}/${PF}" |
2075 |
+ else |
2076 |
++ if [ ${PORTAGE_BUILDDIR}/.tested.${LOOP_ABI} -nt "${WORKDIR}" ]; then |
2077 |
++ echo ">>> It appears that ${PN} is already tested for ABI=${LOOP_ABI}; skipping." |
2078 |
++ echo ">>> Remove '$PORTAGE_BUILDDIR/.tested.${LOOP_ABI}' to force testing." |
2079 |
++ continue |
2080 |
++ fi |
2081 |
++ |
2082 |
+ local save_sp=${SANDBOX_PREDICT} |
2083 |
+ addpredict / |
2084 |
+ ebuild_phase pre_src_test |
2085 |
+ ebuild_phase src_test |
2086 |
++ |
2087 |
++ if is_auto-multilib && is_ebuild; then |
2088 |
++ >> "$PORTAGE_BUILDDIR"/.tested."${LOOP_ABI}" || die "IO Failure -- Failed to 'touch .tested.${LOOP_ABI}'" |
2089 |
++ fi |
2090 |
+ >> "$PORTAGE_BUILDDIR/.tested" || \ |
2091 |
+ die "Failed to create $PORTAGE_BUILDDIR/.tested" |
2092 |
+ ebuild_phase post_src_test |
2093 |
+ SANDBOX_PREDICT=${save_sp} |
2094 |
+ fi |
2095 |
+ |
2096 |
++ is_ebuild && { unset_abi; source "${T}"/environment || die ; } |
2097 |
++ done |
2098 |
++ is_ebuild && { rm "${T}"/environment || die ; } |
2099 |
++ |
2100 |
+ trap - SIGINT SIGQUIT |
2101 |
+ } |
2102 |
+ |
2103 |
+ dyn_install() { |
2104 |
+ [ -z "$PORTAGE_BUILDDIR" ] && die "${FUNCNAME}: PORTAGE_BUILDDIR is unset" |
2105 |
+ if has noauto $FEATURES ; then |
2106 |
+ rm -f "${PORTAGE_BUILDDIR}/.installed" |
2107 |
+ elif [[ -e $PORTAGE_BUILDDIR/.installed ]] ; then |
2108 |
+ vecho ">>> It appears that '${PF}' is already installed; skipping." |
2109 |
+ vecho ">>> Remove '${PORTAGE_BUILDDIR}/.installed' to force install." |
2110 |
+ return 0 |
2111 |
+ fi |
2112 |
+ trap "abort_install" SIGINT SIGQUIT |
2113 |
+ ebuild_phase pre_src_install |
2114 |
+ rm -rf "${PORTAGE_BUILDDIR}/image" |
2115 |
++ is_auto-multilib && rm -rf "${PORTAGE_BUILDDIR}"/image.${ABI} |
2116 |
+ mkdir "${PORTAGE_BUILDDIR}/image" |
2117 |
++ for LOOP_ABI in $(get_abi_list); do |
2118 |
++ is_ebuild && { set_abi ${LOOP_ABI}; source "${T}"/environment || die ; } |
2119 |
++ |
2120 |
+ if [[ -d $S ]] ; then |
2121 |
+ cd "${S}" |
2122 |
+ elif has $EAPI 0 1 2 3 3_pre2 ; then |
2123 |
+ cd "${WORKDIR}" |
2124 |
+ elif [[ -z ${A} ]] && ! has_phase_defined_up_to install; then |
2125 |
+ cd "${WORKDIR}" |
2126 |
+ else |
2127 |
+ die "The source directory '${S}' doesn't exist" |
2128 |
+ fi |
2129 |
+ |
2130 |
+ vecho |
2131 |
+ vecho ">>> Install ${PF} into ${D} category ${CATEGORY}" |
2132 |
+ #our custom version of libtool uses $S and $D to fix |
2133 |
+ #invalid paths in .la files |
2134 |
+ export S D |
2135 |
+ |
2136 |
+ # Reset exeinto(), docinto(), insinto(), and into() state variables |
2137 |
+ # in case the user is running the install phase multiple times |
2138 |
+ # consecutively via the ebuild command. |
2139 |
+ export DESTTREE=/usr |
2140 |
+ export INSDESTTREE="" |
2141 |
+ export _E_EXEDESTTREE_="" |
2142 |
+ export _E_DOCDESTTREE_="" |
2143 |
+ |
2144 |
+ ebuild_phase src_install |
2145 |
++ |
2146 |
++ if is_auto-multilib ; then |
2147 |
++ _finalize_abi_install |
2148 |
++ cp "${T}"/environment "${PORTAGE_BUILDDIR}"/build-info/environment.${LOOP_ABI} || die |
2149 |
++ if is_ebuild; then |
2150 |
++ unset_abi; source "${T}"/environment || die |
2151 |
++ touch "$PORTAGE_BUILDDIR"/.installed."${LOOP_ABI}" || die "IO Failure -- Failed to 'touch .installed.${LOOP_ABI}'" |
2152 |
++ fi |
2153 |
++ fi |
2154 |
++ done |
2155 |
++ if [[ -d "${D}" ]]; then |
2156 |
++ if [[ "${CATEGORY}/${PN}" == "sys-devel/libtool" ]] ; then |
2157 |
++ ewarn "Preserving libltdl.la because of extensive usage" |
2158 |
++ ewarn "even in m4 macros of libtool" |
2159 |
++ else |
2160 |
++ find "${D}" -name '*.la' ! -exec grep -q shouldnotlink=yes {} \; -exec rm {} \; |
2161 |
++ fi |
2162 |
++ |
2163 |
+ >> "$PORTAGE_BUILDDIR/.installed" || \ |
2164 |
+ die "Failed to create $PORTAGE_BUILDDIR/.installed" |
2165 |
+ vecho ">>> Completed installing ${PF} into ${D}" |
2166 |
+ vecho |
2167 |
+ ebuild_phase post_src_install |
2168 |
+ |
2169 |
+ cd "${PORTAGE_BUILDDIR}"/build-info |
2170 |
+ set -f |
2171 |
+ local f x |
2172 |
+ IFS=$' \t\n\r' |
2173 |
+ for f in CATEGORY DEFINED_PHASES FEATURES INHERITED IUSE REQUIRED_USE \ |
2174 |
+ PF PKGUSE SLOT KEYWORDS HOMEPAGE DESCRIPTION ; do |
2175 |
+ x=$(echo -n ${!f}) |
2176 |
+ [[ -n $x ]] && echo "$x" > $f |
2177 |
+ done |
2178 |
+ if [[ $CATEGORY != virtual ]] ; then |
2179 |
+ for f in ASFLAGS CBUILD CC CFLAGS CHOST CTARGET CXX \ |
2180 |
+ CXXFLAGS EXTRA_ECONF EXTRA_EINSTALL EXTRA_MAKE \ |
2181 |
+ LDFLAGS LIBCFLAGS LIBCXXFLAGS ; do |
2182 |
+ x=$(echo -n ${!f}) |
2183 |
+ [[ -n $x ]] && echo "$x" > $f |
2184 |
+ done |
2185 |
+ fi |
2186 |
++ if has_multilib_profile ; then |
2187 |
++ local i= x= |
2188 |
++ for i in ${MULTILIB_ABIS} ; do |
2189 |
++ x+=" multilib_abi_${i}" |
2190 |
++ done |
2191 |
++ echo "${IUSE}${x}" > IUSE |
2192 |
++ fi |
2193 |
+ echo "${USE}" > USE |
2194 |
+ echo "${EAPI:-0}" > EAPI |
2195 |
++ if is_auto-multilib; then |
2196 |
++ echo "$(get_abi_order)" > MULTILIB_ABIS |
2197 |
++ fi |
2198 |
+ set +f |
2199 |
+ |
2200 |
+ # local variables can leak into the saved environment. |
2201 |
+ unset f |
2202 |
+ |
2203 |
+ save_ebuild_env --exclude-init-phases | filter_readonly_variables \ |
2204 |
+ --filter-path --filter-sandbox --allow-extra-vars > environment |
2205 |
+ assert "save_ebuild_env failed" |
2206 |
+ |
2207 |
+ ${PORTAGE_BZIP2_COMMAND} -f9 environment |
2208 |
+ |
2209 |
+ cp "${EBUILD}" "${PF}.ebuild" |
2210 |
+ [ -n "${PORTAGE_REPO_NAME}" ] && echo "${PORTAGE_REPO_NAME}" > repository |
2211 |
+ if has nostrip ${FEATURES} ${RESTRICT} || has strip ${RESTRICT} |
2212 |
+ then |
2213 |
+ >> DEBUGBUILD |
2214 |
+ fi |
2215 |
++ |
2216 |
++ else |
2217 |
++ cd "${PORTAGE_BUILDDIR}" |
2218 |
++ if [[ $EMERGE_FROM = binary ]] || ! has keepwork $FEATURES; then |
2219 |
++ rm -f "$PORTAGE_BUILDDIR"/.{ebuild_changed,exit_status,logid,unpacked,prepared} \ |
2220 |
++ "$PORTAGE_BUILDDIR"/.{configured,compiled,tested,packaged} \ |
2221 |
++ "$PORTAGE_BUILDDIR"/.die_hooks |
2222 |
++ |
2223 |
++# rm -rf "${PORTAGE_BUILDDIR}/build-info" |
2224 |
++ rm -rf "${WORKDIR}" |
2225 |
++ fi |
2226 |
++ |
2227 |
++ if [ -f "${PORTAGE_BUILDDIR}/.unpacked" ]; then |
2228 |
++ find "${PORTAGE_BUILDDIR}" -type d ! -regex "^${WORKDIR}" | sort -r | tr "\n" "\0" | $XARGS -0 rmdir &>/dev/null |
2229 |
++ fi |
2230 |
++ fi |
2231 |
++ |
2232 |
+ trap - SIGINT SIGQUIT |
2233 |
+ } |
2234 |
+ |
2235 |
+ dyn_preinst() { |
2236 |
+ if [ -z "${D}" ]; then |
2237 |
+ eerror "${FUNCNAME}: D is unset" |
2238 |
+ return 1 |
2239 |
+ fi |
2240 |
++ for LOOP_ABI in $(get_abi_order); do |
2241 |
++ set_abi ${LOOP_ABI}; source "${T}"/environment || die |
2242 |
++ |
2243 |
+ ebuild_phase_with_hooks pkg_preinst |
2244 |
++ |
2245 |
++ unset_abi; source "${T}"/environment || die |
2246 |
++ done |
2247 |
+ } |
2248 |
+ |
2249 |
+ dyn_help() { |
2250 |
+ echo |
2251 |
+ echo "Portage" |
2252 |
+ echo "Copyright 1999-2010 Gentoo Foundation" |
2253 |
+ echo |
2254 |
+ echo "How to use the ebuild command:" |
2255 |
+ echo |
2256 |
+ echo "The first argument to ebuild should be an existing .ebuild file." |
2257 |
+ echo |
2258 |
+ echo "One or more of the following options can then be specified. If more" |
2259 |
+ echo "than one option is specified, each will be executed in order." |
2260 |
+ echo |
2261 |
+ echo " help : show this help screen" |
2262 |
+ echo " pretend : execute package specific pretend actions" |
2263 |
+ echo " setup : execute package specific setup actions" |
2264 |
+ echo " fetch : download source archive(s) and patches" |
2265 |
+ echo " digest : create a manifest file for the package" |
2266 |
+ echo " manifest : create a manifest file for the package" |
2267 |
+ echo " unpack : unpack sources (auto-dependencies if needed)" |
2268 |
+ echo " prepare : prepare sources (auto-dependencies if needed)" |
2269 |
+ echo " configure : configure sources (auto-fetch/unpack if needed)" |
2270 |
+ echo " compile : compile sources (auto-fetch/unpack/configure if needed)" |
2271 |
+ echo " test : test package (auto-fetch/unpack/configure/compile if needed)" |
2272 |
+ echo " preinst : execute pre-install instructions" |
2273 |
+ echo " postinst : execute post-install instructions" |
2274 |
+ echo " install : install the package to the temporary install directory" |
2275 |
+ echo " qmerge : merge image into live filesystem, recording files in db" |
2276 |
+ echo " merge : do fetch, unpack, compile, install and qmerge" |
2277 |
+ echo " prerm : execute pre-removal instructions" |
2278 |
+ echo " postrm : execute post-removal instructions" |
2279 |
+ echo " unmerge : remove package from live filesystem" |
2280 |
+ echo " config : execute package specific configuration actions" |
2281 |
+ echo " package : create a tarball package in ${PKGDIR}/All" |
2282 |
+ echo " rpm : build a RedHat RPM package" |
2283 |
+ echo " clean : clean up all source and temporary files" |
2284 |
+ echo |
2285 |
+ echo "The following settings will be used for the ebuild process:" |
2286 |
+ echo |
2287 |
+ echo " package : ${PF}" |
2288 |
+ echo " slot : ${SLOT}" |
2289 |
+ echo " category : ${CATEGORY}" |
2290 |
+ echo " description : ${DESCRIPTION}" |
2291 |
+ echo " system : ${CHOST}" |
2292 |
+ echo " c flags : ${CFLAGS}" |
2293 |
+ echo " c++ flags : ${CXXFLAGS}" |
2294 |
+ echo " make flags : ${MAKEOPTS}" |
2295 |
+ echo -n " build mode : " |
2296 |
+ if has nostrip ${FEATURES} ${RESTRICT} || has strip ${RESTRICT} ; |
2297 |
+ then |
2298 |
+ echo "debug (large)" |
2299 |
+ else |
2300 |
+ echo "production (stripped)" |
2301 |
+ fi |
2302 |
+ echo " merge to : ${ROOT}" |
2303 |
+ echo |
2304 |
+ if [ -n "$USE" ]; then |
2305 |
+ echo "Additionally, support for the following optional features will be enabled:" |
2306 |
+ echo |
2307 |
+ echo " ${USE}" |
2308 |
+ fi |
2309 |
+ echo |
2310 |
+ } |
2311 |
+ |
2312 |
+ # @FUNCTION: _ebuild_arg_to_phase |
2313 |
+ # @DESCRIPTION: |
2314 |
+ # Translate a known ebuild(1) argument into the precise |
2315 |
+ # name of it's corresponding ebuild phase. |
2316 |
+ _ebuild_arg_to_phase() { |
2317 |
+ [ $# -ne 2 ] && die "expected exactly 2 args, got $#: $*" |
2318 |
+ local eapi=$1 |
2319 |
+ local arg=$2 |
2320 |
+ local phase_func="" |
2321 |
+ |
2322 |
+ case "$arg" in |
2323 |
+ pretend) |
2324 |
+ ! has $eapi 0 1 2 3 3_pre2 && \ |
2325 |
+ phase_func=pkg_pretend |
2326 |
+ ;; |
2327 |
+ setup) |
2328 |
+ phase_func=pkg_setup |
2329 |
+ ;; |
2330 |
+ nofetch) |
2331 |
+ phase_func=pkg_nofetch |
2332 |
+ ;; |
2333 |
+ unpack) |
2334 |
+ phase_func=src_unpack |
2335 |
+ ;; |
2336 |
+ prepare) |
2337 |
+ ! has $eapi 0 1 && \ |
2338 |
+ phase_func=src_prepare |
2339 |
+ ;; |
2340 |
+ configure) |
2341 |
+ ! has $eapi 0 1 && \ |
2342 |
+ phase_func=src_configure |
2343 |
+ ;; |
2344 |
+ compile) |
2345 |
+ phase_func=src_compile |
2346 |
+ ;; |
2347 |
+ test) |
2348 |
+ phase_func=src_test |
2349 |
+ ;; |
2350 |
+ install) |
2351 |
+ phase_func=src_install |
2352 |
+ ;; |
2353 |
+ preinst) |
2354 |
+ phase_func=pkg_preinst |
2355 |
+ ;; |
2356 |
+ postinst) |
2357 |
+ phase_func=pkg_postinst |
2358 |
+ ;; |
2359 |
+ prerm) |
2360 |
+ phase_func=pkg_prerm |
2361 |
+ ;; |
2362 |
+ postrm) |
2363 |
+ phase_func=pkg_postrm |
2364 |
+ ;; |
2365 |
+ esac |
2366 |
+ |
2367 |
+ [[ -z $phase_func ]] && return 1 |
2368 |
+ echo "$phase_func" |
2369 |
+ return 0 |
2370 |
+ } |
2371 |
+ |
2372 |
+ _ebuild_phase_funcs() { |
2373 |
+ [ $# -ne 2 ] && die "expected exactly 2 args, got $#: $*" |
2374 |
+ local eapi=$1 |
2375 |
+ local phase_func=$2 |
2376 |
+ local default_phases="pkg_nofetch src_unpack src_prepare src_configure |
2377 |
+ src_compile src_install src_test" |
2378 |
+ local x y default_func="" |
2379 |
+ |
2380 |
+ for x in pkg_nofetch src_unpack src_test ; do |
2381 |
+ declare -F $x >/dev/null || \ |
2382 |
+ eval "$x() { _eapi0_$x \"\$@\" ; }" |
2383 |
+ done |
2384 |
+ |
2385 |
+ case $eapi in |
2386 |
+ |
2387 |
+ 0|1) |
2388 |
+ |
2389 |
+ if ! declare -F src_compile >/dev/null ; then |
2390 |
+ case $eapi in |
2391 |
+ 0) |
2392 |
+ src_compile() { _eapi0_src_compile "$@" ; } |
2393 |
+ ;; |
2394 |
+ *) |
2395 |
+ src_compile() { _eapi1_src_compile "$@" ; } |
2396 |
+ ;; |
2397 |
+ esac |
2398 |
+ fi |
2399 |
+ |
2400 |
+ for x in $default_phases ; do |
2401 |
+ eval "default_$x() { |
2402 |
+ die \"default_$x() is not supported with EAPI='$eapi' during phase $phase_func\" |
2403 |
+ }" |
2404 |
+ done |
2405 |
+ |
2406 |
+ eval "default() { |
2407 |
+ die \"default() is not supported with EAPI='$eapi' during phase $phase_func\" |
2408 |
+ }" |
2409 |
+ |
2410 |
+ ;; |
2411 |
+ |
2412 |
+ *) |
2413 |
+ |
2414 |
+ declare -F src_configure >/dev/null || \ |
2415 |
+ src_configure() { _eapi2_src_configure "$@" ; } |
2416 |
+ |
2417 |
+ declare -F src_compile >/dev/null || \ |
2418 |
+ src_compile() { _eapi2_src_compile "$@" ; } |
2419 |
+ |
2420 |
+ has $eapi 2 3 3_pre2 || declare -F src_install >/dev/null || \ |
2421 |
+ src_install() { _eapi4_src_install "$@" ; } |
2422 |
+ |
2423 |
+ if has $phase_func $default_phases ; then |
2424 |
+ |
2425 |
+ _eapi2_pkg_nofetch () { _eapi0_pkg_nofetch "$@" ; } |
2426 |
+ _eapi2_src_unpack () { _eapi0_src_unpack "$@" ; } |
2427 |
+ _eapi2_src_prepare () { true ; } |
2428 |
+ _eapi2_src_test () { _eapi0_src_test "$@" ; } |
2429 |
+ _eapi2_src_install () { die "$FUNCNAME is not supported" ; } |
2430 |
+ |
2431 |
+ for x in $default_phases ; do |
2432 |
+ eval "default_$x() { _eapi2_$x \"\$@\" ; }" |
2433 |
+ done |
2434 |
+ |
2435 |
+ eval "default() { _eapi2_$phase_func \"\$@\" ; }" |
2436 |
+ |
2437 |
+ case $eapi in |
2438 |
+ 2|3) |
2439 |
+ ;; |
2440 |
+ *) |
2441 |
+ eval "default_src_install() { _eapi4_src_install \"\$@\" ; }" |
2442 |
+ [[ $phase_func = src_install ]] && \ |
2443 |
+ eval "default() { _eapi4_$phase_func \"\$@\" ; }" |
2444 |
+ ;; |
2445 |
+ esac |
2446 |
+ |
2447 |
+ else |
2448 |
+ |
2449 |
+ for x in $default_phases ; do |
2450 |
+ eval "default_$x() { |
2451 |
+ die \"default_$x() is not supported in phase $default_func\" |
2452 |
+ }" |
2453 |
+ done |
2454 |
+ |
2455 |
+ eval "default() { |
2456 |
+ die \"default() is not supported with EAPI='$eapi' during phase $phase_func\" |
2457 |
+ }" |
2458 |
+ |
2459 |
+ fi |
2460 |
+ |
2461 |
+ ;; |
2462 |
+ esac |
2463 |
+ } |
2464 |
+ |
2465 |
+ ebuild_main() { |
2466 |
+ |
2467 |
+ # Subshell/helper die support (must export for the die helper). |
2468 |
+ # Since this function is typically executed in a subshell, |
2469 |
+ # setup EBUILD_MASTER_PID to refer to the current $BASHPID, |
2470 |
+ # which seems to give the best results when further |
2471 |
+ # nested subshells call die. |
2472 |
+ export EBUILD_MASTER_PID=$BASHPID |
2473 |
+ trap 'exit 1' SIGTERM |
2474 |
+ |
2475 |
+ #a reasonable default for $S |
2476 |
+ [[ -z ${S} ]] && export S=${WORKDIR}/${P} |
2477 |
+ |
2478 |
+ if [[ -s $SANDBOX_LOG ]] ; then |
2479 |
+ # We use SANDBOX_LOG to check for sandbox violations, |
2480 |
+ # so we ensure that there can't be a stale log to |
2481 |
+ # interfere with our logic. |
2482 |
+ local x= |
2483 |
+ if [[ -n SANDBOX_ON ]] ; then |
2484 |
+ x=$SANDBOX_ON |
2485 |
+ export SANDBOX_ON=0 |
2486 |
+ fi |
2487 |
+ |
2488 |
+ rm -f "$SANDBOX_LOG" || \ |
2489 |
+ die "failed to remove stale sandbox log: '$SANDBOX_LOG'" |
2490 |
+ |
2491 |
+ if [[ -n $x ]] ; then |
2492 |
+ export SANDBOX_ON=$x |
2493 |
+ fi |
2494 |
+ unset x |
2495 |
+ fi |
2496 |
+ |
2497 |
+ # Force configure scripts that automatically detect ccache to |
2498 |
+ # respect FEATURES="-ccache". |
2499 |
+ has ccache $FEATURES || export CCACHE_DISABLE=1 |
2500 |
+ |
2501 |
+ local phase_func=$(_ebuild_arg_to_phase "$EAPI" "$EBUILD_PHASE") |
2502 |
+ [[ -n $phase_func ]] && _ebuild_phase_funcs "$EAPI" "$phase_func" |
2503 |
+ unset phase_func |
2504 |
+ |
2505 |
+ source_all_bashrcs |
2506 |
+ |
2507 |
+ case ${1} in |
2508 |
+ nofetch) |
2509 |
+ ebuild_phase_with_hooks pkg_nofetch |
2510 |
+ ;; |
2511 |
- prerm|postrm|postinst|config|info) |
2512 |
++ config|info) |
2513 |
+ if has "${1}" config info && \ |
2514 |
+ ! declare -F "pkg_${1}" >/dev/null ; then |
2515 |
+ ewarn "pkg_${1}() is not defined: '${EBUILD##*/}'" |
2516 |
+ fi |
2517 |
+ export SANDBOX_ON="0" |
2518 |
+ if [ "${PORTAGE_DEBUG}" != "1" ] || [ "${-/x/}" != "$-" ]; then |
2519 |
+ ebuild_phase_with_hooks pkg_${1} |
2520 |
+ else |
2521 |
+ set -x |
2522 |
+ ebuild_phase_with_hooks pkg_${1} |
2523 |
+ set +x |
2524 |
+ fi |
2525 |
- if [[ $EBUILD_PHASE == postinst ]] && [[ -n $PORTAGE_UPDATE_ENV ]]; then |
2526 |
- # Update environment.bz2 in case installation phases |
2527 |
- # need to pass some variables to uninstallation phases. |
2528 |
- save_ebuild_env --exclude-init-phases | \ |
2529 |
- filter_readonly_variables --filter-path \ |
2530 |
- --filter-sandbox --allow-extra-vars \ |
2531 |
- | ${PORTAGE_BZIP2_COMMAND} -c -f9 > "$PORTAGE_UPDATE_ENV" |
2532 |
- assert "save_ebuild_env failed" |
2533 |
- fi |
2534 |
++ ;; |
2535 |
++ prerm|postrm|postinst) |
2536 |
++ for LOOP_ABI in $(get_abi_order); do |
2537 |
++ if is_auto-multilib ; then |
2538 |
++ case ${1} in |
2539 |
++ postinst) |
2540 |
++ set_abi ${LOOP_ABI} |
2541 |
++ ;; |
2542 |
++ prerm|postrm) |
2543 |
++ # if = backward compactibility for previous versions, which did not |
2544 |
++ # install a per-ABI environment |
2545 |
++ if [[ -f "${ROOT}"var/db/pkg/${CATEGORY}/${PF}/environment.${LOOP_ABI}.bz2 ]] ; then |
2546 |
++ bzcat "${ROOT}"var/db/pkg/${CATEGORY}/${PF}/environment.${LOOP_ABI}.bz2 > "${T}"/environment || die |
2547 |
++ preprocess_ebuild_env --filter-metadata |
2548 |
++ fi |
2549 |
++ ;; |
2550 |
++ esac |
2551 |
++ # >/dev/null = backward compactibility for prerm/postrm |
2552 |
++ source "${T}"/environment 2>/dev/null || die |
2553 |
++ fi |
2554 |
++ export SANDBOX_ON="0" |
2555 |
++ if [ "${PORTAGE_DEBUG}" != "1" ] || [ "${-/x/}" != "$-" ]; then |
2556 |
++ ebuild_phase_with_hooks pkg_${1} |
2557 |
++ else |
2558 |
++ set -x |
2559 |
++ ebuild_phase_with_hooks pkg_${1} |
2560 |
++ set +x |
2561 |
++ fi |
2562 |
++ |
2563 |
++ if [[ $EBUILD_PHASE == postinst ]] && [[ -n $PORTAGE_UPDATE_ENV ]]; then |
2564 |
++ # Update environment.bz2 in case installation phases |
2565 |
++ # need to pass some variables to uninstallation phases. |
2566 |
++ save_ebuild_env --exclude-init-phases | \ |
2567 |
++ filter_readonly_variables --filter-path \ |
2568 |
++ --filter-sandbox --allow-extra-vars \ |
2569 |
++ | ${PORTAGE_BZIP2_COMMAND} -c -f9 > "$PORTAGE_UPDATE_ENV" |
2570 |
++ assert "save_ebuild_env failed" |
2571 |
++ fi |
2572 |
++ if is_auto-multilib ; then |
2573 |
++ case ${1} in |
2574 |
++ postinst) |
2575 |
++ unset_abi |
2576 |
++ ;; |
2577 |
++ prerm|postrm) |
2578 |
++ #if = backward compactibility for previous versions, which did not |
2579 |
++ #install a per-ABI environment |
2580 |
++ if [[ -f "${ROOT}"var/db/pkg/${CATEGORY}/${PF}/environment.${LOOP_ABI}.bz2 ]] ; then |
2581 |
++ preprocess_ebuild_env --filter-metadata |
2582 |
++ bzcat "${ROOT}"var/db/pkg/${CATEGORY}/${PF}/environment.${LOOP_ABI}.bz2 > "${T}"/environment || die |
2583 |
++ fi |
2584 |
++ ;; |
2585 |
++ esac |
2586 |
++ # >/dev/null = backward compactibility for prerm/postrm |
2587 |
++ source "${T}"/environment 2>/dev/null || die |
2588 |
++ fi |
2589 |
++ done |
2590 |
+ ;; |
2591 |
+ unpack|prepare|configure|compile|test|clean|install) |
2592 |
+ if [[ ${SANDBOX_DISABLED:-0} = 0 ]] ; then |
2593 |
+ export SANDBOX_ON="1" |
2594 |
+ else |
2595 |
+ export SANDBOX_ON="0" |
2596 |
+ fi |
2597 |
+ |
2598 |
+ case "${1}" in |
2599 |
+ configure|compile) |
2600 |
+ |
2601 |
+ local x |
2602 |
+ for x in ASFLAGS CCACHE_DIR CCACHE_SIZE \ |
2603 |
+ CFLAGS CXXFLAGS LDFLAGS LIBCFLAGS LIBCXXFLAGS ; do |
2604 |
+ [[ ${!x+set} = set ]] && export $x |
2605 |
+ done |
2606 |
+ unset x |
2607 |
+ |
2608 |
+ has distcc $FEATURES && [[ -n $DISTCC_DIR ]] && \ |
2609 |
+ [[ ${SANDBOX_WRITE/$DISTCC_DIR} = $SANDBOX_WRITE ]] && \ |
2610 |
+ addwrite "$DISTCC_DIR" |
2611 |
+ |
2612 |
+ x=LIBDIR_$ABI |
2613 |
+ [ -z "$PKG_CONFIG_PATH" -a -n "$ABI" -a -n "${!x}" ] && \ |
2614 |
+ export PKG_CONFIG_PATH=/usr/${!x}/pkgconfig |
2615 |
+ |
2616 |
+ if has noauto $FEATURES && \ |
2617 |
+ [[ ! -f $PORTAGE_BUILDDIR/.unpacked ]] ; then |
2618 |
+ echo |
2619 |
+ echo "!!! We apparently haven't unpacked..." \ |
2620 |
+ "This is probably not what you" |
2621 |
+ echo "!!! want to be doing... You are using" \ |
2622 |
+ "FEATURES=noauto so I'll assume" |
2623 |
+ echo "!!! that you know what you are doing..." \ |
2624 |
+ "You have 5 seconds to abort..." |
2625 |
+ echo |
2626 |
+ |
2627 |
+ local x |
2628 |
+ for x in 1 2 3 4 5 6 7 8; do |
2629 |
+ LC_ALL=C sleep 0.25 |
2630 |
+ done |
2631 |
+ |
2632 |
+ sleep 3 |
2633 |
+ fi |
2634 |
+ |
2635 |
+ cd "$PORTAGE_BUILDDIR" |
2636 |
+ if [ ! -d build-info ] ; then |
2637 |
+ mkdir build-info |
2638 |
+ cp "$EBUILD" "build-info/$PF.ebuild" |
2639 |
+ fi |
2640 |
+ |
2641 |
+ #our custom version of libtool uses $S and $D to fix |
2642 |
+ #invalid paths in .la files |
2643 |
+ export S D |
2644 |
+ |
2645 |
+ ;; |
2646 |
+ esac |
2647 |
+ |
2648 |
+ if [ "${PORTAGE_DEBUG}" != "1" ] || [ "${-/x/}" != "$-" ]; then |
2649 |
+ dyn_${1} |
2650 |
+ else |
2651 |
+ set -x |
2652 |
+ dyn_${1} |
2653 |
+ set +x |
2654 |
+ fi |
2655 |
+ export SANDBOX_ON="0" |
2656 |
+ ;; |
2657 |
+ help|pretend|setup|preinst) |
2658 |
+ #pkg_setup needs to be out of the sandbox for tmp file creation; |
2659 |
+ #for example, awking and piping a file in /tmp requires a temp file to be created |
2660 |
+ #in /etc. If pkg_setup is in the sandbox, both our lilo and apache ebuilds break. |
2661 |
+ export SANDBOX_ON="0" |
2662 |
+ if [ "${PORTAGE_DEBUG}" != "1" ] || [ "${-/x/}" != "$-" ]; then |
2663 |
+ dyn_${1} |
2664 |
+ else |
2665 |
+ set -x |
2666 |
+ dyn_${1} |
2667 |
+ set +x |
2668 |
+ fi |
2669 |
+ ;; |
2670 |
+ _internal_test) |
2671 |
+ ;; |
2672 |
+ *) |
2673 |
+ export SANDBOX_ON="1" |
2674 |
+ echo "Unrecognized arg '${1}'" |
2675 |
+ echo |
2676 |
+ dyn_help |
2677 |
+ exit 1 |
2678 |
+ ;; |
2679 |
+ esac |
2680 |
+ |
2681 |
+ # Save the env only for relevant phases. |
2682 |
+ if ! has "${1}" clean help info nofetch ; then |
2683 |
+ umask 002 |
2684 |
+ save_ebuild_env | filter_readonly_variables \ |
2685 |
+ --filter-features > "$T/environment" |
2686 |
+ assert "save_ebuild_env failed" |
2687 |
+ chown portage:portage "$T/environment" &>/dev/null |
2688 |
+ chmod g+w "$T/environment" &>/dev/null |
2689 |
+ fi |
2690 |
+ [[ -n $PORTAGE_EBUILD_EXIT_FILE ]] && > "$PORTAGE_EBUILD_EXIT_FILE" |
2691 |
+ if [[ -n $PORTAGE_IPC_DAEMON ]] ; then |
2692 |
+ [[ ! -s $SANDBOX_LOG ]] |
2693 |
+ "$PORTAGE_BIN_PATH"/ebuild-ipc exit $? |
2694 |
+ fi |
2695 |
+ } |
2696 |
diff --cc bin/phase-helpers.sh |
2697 |
index 0000000,a033fa8..c8f4262 |
2698 |
mode 000000,100644..100644 |
2699 |
--- a/bin/phase-helpers.sh |
2700 |
+++ b/bin/phase-helpers.sh |
2701 |
@@@ -1,0 -1,624 +1,626 @@@ |
2702 |
+ #!/bin/bash |
2703 |
+ # Copyright 1999-2011 Gentoo Foundation |
2704 |
+ # Distributed under the terms of the GNU General Public License v2 |
2705 |
+ |
2706 |
+ export DESTTREE=/usr |
2707 |
+ export INSDESTTREE="" |
2708 |
+ export _E_EXEDESTTREE_="" |
2709 |
+ export _E_DOCDESTTREE_="" |
2710 |
+ export INSOPTIONS="-m0644" |
2711 |
+ export EXEOPTIONS="-m0755" |
2712 |
+ export LIBOPTIONS="-m0644" |
2713 |
+ export DIROPTIONS="-m0755" |
2714 |
+ export MOPREFIX=${PN} |
2715 |
+ declare -a PORTAGE_DOCOMPRESS=( /usr/share/{doc,info,man} ) |
2716 |
+ declare -a PORTAGE_DOCOMPRESS_SKIP=( /usr/share/doc/${PF}/html ) |
2717 |
+ |
2718 |
+ into() { |
2719 |
+ if [ "$1" == "/" ]; then |
2720 |
+ export DESTTREE="" |
2721 |
+ else |
2722 |
+ export DESTTREE=$1 |
2723 |
+ if [ ! -d "${D}${DESTTREE}" ]; then |
2724 |
+ install -d "${D}${DESTTREE}" |
2725 |
+ local ret=$? |
2726 |
+ if [[ $ret -ne 0 ]] ; then |
2727 |
+ helpers_die "${FUNCNAME[0]} failed" |
2728 |
+ return $ret |
2729 |
+ fi |
2730 |
+ fi |
2731 |
+ fi |
2732 |
+ } |
2733 |
+ |
2734 |
+ insinto() { |
2735 |
+ if [ "$1" == "/" ]; then |
2736 |
+ export INSDESTTREE="" |
2737 |
+ else |
2738 |
+ export INSDESTTREE=$1 |
2739 |
+ if [ ! -d "${D}${INSDESTTREE}" ]; then |
2740 |
+ install -d "${D}${INSDESTTREE}" |
2741 |
+ local ret=$? |
2742 |
+ if [[ $ret -ne 0 ]] ; then |
2743 |
+ helpers_die "${FUNCNAME[0]} failed" |
2744 |
+ return $ret |
2745 |
+ fi |
2746 |
+ fi |
2747 |
+ fi |
2748 |
+ } |
2749 |
+ |
2750 |
+ exeinto() { |
2751 |
+ if [ "$1" == "/" ]; then |
2752 |
+ export _E_EXEDESTTREE_="" |
2753 |
+ else |
2754 |
+ export _E_EXEDESTTREE_="$1" |
2755 |
+ if [ ! -d "${D}${_E_EXEDESTTREE_}" ]; then |
2756 |
+ install -d "${D}${_E_EXEDESTTREE_}" |
2757 |
+ local ret=$? |
2758 |
+ if [[ $ret -ne 0 ]] ; then |
2759 |
+ helpers_die "${FUNCNAME[0]} failed" |
2760 |
+ return $ret |
2761 |
+ fi |
2762 |
+ fi |
2763 |
+ fi |
2764 |
+ } |
2765 |
+ |
2766 |
+ docinto() { |
2767 |
+ if [ "$1" == "/" ]; then |
2768 |
+ export _E_DOCDESTTREE_="" |
2769 |
+ else |
2770 |
+ export _E_DOCDESTTREE_="$1" |
2771 |
+ if [ ! -d "${D}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" ]; then |
2772 |
+ install -d "${D}usr/share/doc/${PF}/${_E_DOCDESTTREE_}" |
2773 |
+ local ret=$? |
2774 |
+ if [[ $ret -ne 0 ]] ; then |
2775 |
+ helpers_die "${FUNCNAME[0]} failed" |
2776 |
+ return $ret |
2777 |
+ fi |
2778 |
+ fi |
2779 |
+ fi |
2780 |
+ } |
2781 |
+ |
2782 |
+ insopts() { |
2783 |
+ export INSOPTIONS="$@" |
2784 |
+ |
2785 |
+ # `install` should never be called with '-s' ... |
2786 |
+ has -s ${INSOPTIONS} && die "Never call insopts() with -s" |
2787 |
+ } |
2788 |
+ |
2789 |
+ diropts() { |
2790 |
+ export DIROPTIONS="$@" |
2791 |
+ } |
2792 |
+ |
2793 |
+ exeopts() { |
2794 |
+ export EXEOPTIONS="$@" |
2795 |
+ |
2796 |
+ # `install` should never be called with '-s' ... |
2797 |
+ has -s ${EXEOPTIONS} && die "Never call exeopts() with -s" |
2798 |
+ } |
2799 |
+ |
2800 |
+ libopts() { |
2801 |
+ export LIBOPTIONS="$@" |
2802 |
+ |
2803 |
+ # `install` should never be called with '-s' ... |
2804 |
+ has -s ${LIBOPTIONS} && die "Never call libopts() with -s" |
2805 |
+ } |
2806 |
+ |
2807 |
+ docompress() { |
2808 |
+ has "${EAPI}" 0 1 2 3 && die "'docompress' not supported in this EAPI" |
2809 |
+ |
2810 |
+ local f g |
2811 |
+ if [[ $1 = "-x" ]]; then |
2812 |
+ shift |
2813 |
+ for f; do |
2814 |
+ f=$(strip_duplicate_slashes "${f}"); f=${f%/} |
2815 |
+ [[ ${f:0:1} = / ]] || f="/${f}" |
2816 |
+ for g in "${PORTAGE_DOCOMPRESS_SKIP[@]}"; do |
2817 |
+ [[ ${f} = "${g}" ]] && continue 2 |
2818 |
+ done |
2819 |
+ PORTAGE_DOCOMPRESS_SKIP[${#PORTAGE_DOCOMPRESS_SKIP[@]}]=${f} |
2820 |
+ done |
2821 |
+ else |
2822 |
+ for f; do |
2823 |
+ f=$(strip_duplicate_slashes "${f}"); f=${f%/} |
2824 |
+ [[ ${f:0:1} = / ]] || f="/${f}" |
2825 |
+ for g in "${PORTAGE_DOCOMPRESS[@]}"; do |
2826 |
+ [[ ${f} = "${g}" ]] && continue 2 |
2827 |
+ done |
2828 |
+ PORTAGE_DOCOMPRESS[${#PORTAGE_DOCOMPRESS[@]}]=${f} |
2829 |
+ done |
2830 |
+ fi |
2831 |
+ } |
2832 |
+ |
2833 |
+ # adds ".keep" files so that dirs aren't auto-cleaned |
2834 |
+ keepdir() { |
2835 |
+ dodir "$@" |
2836 |
+ local x |
2837 |
+ if [ "$1" == "-R" ] || [ "$1" == "-r" ]; then |
2838 |
+ shift |
2839 |
+ find "$@" -type d -printf "${D}%p/.keep_${CATEGORY}_${PN}-${SLOT}\n" \ |
2840 |
+ | tr "\n" "\0" | \ |
2841 |
+ while read -r -d $'\0' ; do |
2842 |
+ >> "$REPLY" || \ |
2843 |
+ die "Failed to recursively create .keep files" |
2844 |
+ done |
2845 |
+ else |
2846 |
+ for x in "$@"; do |
2847 |
+ >> "${D}${x}/.keep_${CATEGORY}_${PN}-${SLOT}" || \ |
2848 |
+ die "Failed to create .keep in ${D}${x}" |
2849 |
+ done |
2850 |
+ fi |
2851 |
+ } |
2852 |
+ |
2853 |
+ |
2854 |
+ useq() { |
2855 |
+ has $EBUILD_PHASE prerm postrm || eqawarn \ |
2856 |
+ "QA Notice: The 'useq' function is deprecated (replaced by 'use')" |
2857 |
+ use ${1} |
2858 |
+ } |
2859 |
+ |
2860 |
+ usev() { |
2861 |
+ if use ${1}; then |
2862 |
+ echo "${1#!}" |
2863 |
+ return 0 |
2864 |
+ fi |
2865 |
+ return 1 |
2866 |
+ } |
2867 |
+ |
2868 |
+ use() { |
2869 |
+ local u=$1 |
2870 |
+ local found=0 |
2871 |
+ |
2872 |
+ # if we got something like '!flag', then invert the return value |
2873 |
+ if [[ ${u:0:1} == "!" ]] ; then |
2874 |
+ u=${u:1} |
2875 |
+ found=1 |
2876 |
+ fi |
2877 |
+ |
2878 |
+ if [[ $EBUILD_PHASE = depend ]] ; then |
2879 |
+ # TODO: Add a registration interface for eclasses to register |
2880 |
+ # any number of phase hooks, so that global scope eclass |
2881 |
+ # initialization can by migrated to phase hooks in new EAPIs. |
2882 |
+ # Example: add_phase_hook before pkg_setup $ECLASS_pre_pkg_setup |
2883 |
+ #if [[ -n $EAPI ]] && ! has "$EAPI" 0 1 2 3 ; then |
2884 |
+ # die "use() called during invalid phase: $EBUILD_PHASE" |
2885 |
+ #fi |
2886 |
+ true |
2887 |
+ |
2888 |
+ # Make sure we have this USE flag in IUSE |
2889 |
+ elif [[ -n $PORTAGE_IUSE && -n $EBUILD_PHASE ]] ; then |
2890 |
++ if [[ $u != multilib ]]; then |
2891 |
+ [[ $u =~ $PORTAGE_IUSE ]] || \ |
2892 |
+ eqawarn "QA Notice: USE Flag '${u}' not" \ |
2893 |
+ "in IUSE for ${CATEGORY}/${PF}" |
2894 |
++ fi |
2895 |
+ fi |
2896 |
+ |
2897 |
+ if has ${u} ${USE} ; then |
2898 |
+ return ${found} |
2899 |
+ else |
2900 |
+ return $((!found)) |
2901 |
+ fi |
2902 |
+ } |
2903 |
+ |
2904 |
+ use_with() { |
2905 |
+ if [ -z "$1" ]; then |
2906 |
+ echo "!!! use_with() called without a parameter." >&2 |
2907 |
+ echo "!!! use_with <USEFLAG> [<flagname> [value]]" >&2 |
2908 |
+ return 1 |
2909 |
+ fi |
2910 |
+ |
2911 |
+ if ! has "${EAPI:-0}" 0 1 2 3 ; then |
2912 |
+ local UW_SUFFIX=${3+=$3} |
2913 |
+ else |
2914 |
+ local UW_SUFFIX=${3:+=$3} |
2915 |
+ fi |
2916 |
+ local UWORD=${2:-$1} |
2917 |
+ |
2918 |
+ if use $1; then |
2919 |
+ echo "--with-${UWORD}${UW_SUFFIX}" |
2920 |
+ else |
2921 |
+ echo "--without-${UWORD}" |
2922 |
+ fi |
2923 |
+ return 0 |
2924 |
+ } |
2925 |
+ |
2926 |
+ use_enable() { |
2927 |
+ if [ -z "$1" ]; then |
2928 |
+ echo "!!! use_enable() called without a parameter." >&2 |
2929 |
+ echo "!!! use_enable <USEFLAG> [<flagname> [value]]" >&2 |
2930 |
+ return 1 |
2931 |
+ fi |
2932 |
+ |
2933 |
+ if ! has "${EAPI:-0}" 0 1 2 3 ; then |
2934 |
+ local UE_SUFFIX=${3+=$3} |
2935 |
+ else |
2936 |
+ local UE_SUFFIX=${3:+=$3} |
2937 |
+ fi |
2938 |
+ local UWORD=${2:-$1} |
2939 |
+ |
2940 |
+ if use $1; then |
2941 |
+ echo "--enable-${UWORD}${UE_SUFFIX}" |
2942 |
+ else |
2943 |
+ echo "--disable-${UWORD}" |
2944 |
+ fi |
2945 |
+ return 0 |
2946 |
+ } |
2947 |
+ |
2948 |
+ unpack() { |
2949 |
+ local srcdir |
2950 |
+ local x |
2951 |
+ local y |
2952 |
+ local myfail |
2953 |
+ local eapi=${EAPI:-0} |
2954 |
+ [ -z "$*" ] && die "Nothing passed to the 'unpack' command" |
2955 |
+ |
2956 |
+ for x in "$@"; do |
2957 |
+ vecho ">>> Unpacking ${x} to ${PWD}" |
2958 |
+ y=${x%.*} |
2959 |
+ y=${y##*.} |
2960 |
+ |
2961 |
+ if [[ ${x} == "./"* ]] ; then |
2962 |
+ srcdir="" |
2963 |
+ elif [[ ${x} == ${DISTDIR%/}/* ]] ; then |
2964 |
+ die "Arguments to unpack() cannot begin with \${DISTDIR}." |
2965 |
+ elif [[ ${x} == "/"* ]] ; then |
2966 |
+ die "Arguments to unpack() cannot be absolute" |
2967 |
+ else |
2968 |
+ srcdir="${DISTDIR}/" |
2969 |
+ fi |
2970 |
+ [[ ! -s ${srcdir}${x} ]] && die "${x} does not exist" |
2971 |
+ |
2972 |
+ _unpack_tar() { |
2973 |
+ if [ "${y}" == "tar" ]; then |
2974 |
+ $1 -c -- "$srcdir$x" | tar xof - |
2975 |
+ assert_sigpipe_ok "$myfail" |
2976 |
+ else |
2977 |
+ local cwd_dest=${x##*/} |
2978 |
+ cwd_dest=${cwd_dest%.*} |
2979 |
+ $1 -c -- "${srcdir}${x}" > "${cwd_dest}" || die "$myfail" |
2980 |
+ fi |
2981 |
+ } |
2982 |
+ |
2983 |
+ myfail="failure unpacking ${x}" |
2984 |
+ case "${x##*.}" in |
2985 |
+ tar) |
2986 |
+ tar xof "$srcdir$x" || die "$myfail" |
2987 |
+ ;; |
2988 |
+ tgz) |
2989 |
+ tar xozf "$srcdir$x" || die "$myfail" |
2990 |
+ ;; |
2991 |
+ tbz|tbz2) |
2992 |
+ ${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d} -c -- "$srcdir$x" | tar xof - |
2993 |
+ assert_sigpipe_ok "$myfail" |
2994 |
+ ;; |
2995 |
+ ZIP|zip|jar) |
2996 |
+ # unzip will interactively prompt under some error conditions, |
2997 |
+ # as reported in bug #336285 |
2998 |
+ ( while true ; do echo n || break ; done ) | \ |
2999 |
+ unzip -qo "${srcdir}${x}" || die "$myfail" |
3000 |
+ ;; |
3001 |
+ gz|Z|z) |
3002 |
+ _unpack_tar "gzip -d" |
3003 |
+ ;; |
3004 |
+ bz2|bz) |
3005 |
+ _unpack_tar "${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d}" |
3006 |
+ ;; |
3007 |
+ 7Z|7z) |
3008 |
+ local my_output |
3009 |
+ my_output="$(7z x -y "${srcdir}${x}")" |
3010 |
+ if [ $? -ne 0 ]; then |
3011 |
+ echo "${my_output}" >&2 |
3012 |
+ die "$myfail" |
3013 |
+ fi |
3014 |
+ ;; |
3015 |
+ RAR|rar) |
3016 |
+ unrar x -idq -o+ "${srcdir}${x}" || die "$myfail" |
3017 |
+ ;; |
3018 |
+ LHa|LHA|lha|lzh) |
3019 |
+ lha xfq "${srcdir}${x}" || die "$myfail" |
3020 |
+ ;; |
3021 |
+ a) |
3022 |
+ ar x "${srcdir}${x}" || die "$myfail" |
3023 |
+ ;; |
3024 |
+ deb) |
3025 |
+ # Unpacking .deb archives can not always be done with |
3026 |
+ # `ar`. For instance on AIX this doesn't work out. If |
3027 |
+ # we have `deb2targz` installed, prefer it over `ar` for |
3028 |
+ # that reason. We just make sure on AIX `deb2targz` is |
3029 |
+ # installed. |
3030 |
+ if type -P deb2targz > /dev/null; then |
3031 |
+ y=${x##*/} |
3032 |
+ local created_symlink=0 |
3033 |
+ if [ ! "$srcdir$x" -ef "$y" ] ; then |
3034 |
+ # deb2targz always extracts into the same directory as |
3035 |
+ # the source file, so create a symlink in the current |
3036 |
+ # working directory if necessary. |
3037 |
+ ln -sf "$srcdir$x" "$y" || die "$myfail" |
3038 |
+ created_symlink=1 |
3039 |
+ fi |
3040 |
+ deb2targz "$y" || die "$myfail" |
3041 |
+ if [ $created_symlink = 1 ] ; then |
3042 |
+ # Clean up the symlink so the ebuild |
3043 |
+ # doesn't inadvertently install it. |
3044 |
+ rm -f "$y" |
3045 |
+ fi |
3046 |
+ mv -f "${y%.deb}".tar.gz data.tar.gz || die "$myfail" |
3047 |
+ else |
3048 |
+ ar x "$srcdir$x" || die "$myfail" |
3049 |
+ fi |
3050 |
+ ;; |
3051 |
+ lzma) |
3052 |
+ _unpack_tar "lzma -d" |
3053 |
+ ;; |
3054 |
+ xz) |
3055 |
+ if has $eapi 0 1 2 ; then |
3056 |
+ vecho "unpack ${x}: file format not recognized. Ignoring." |
3057 |
+ else |
3058 |
+ _unpack_tar "xz -d" |
3059 |
+ fi |
3060 |
+ ;; |
3061 |
+ *) |
3062 |
+ vecho "unpack ${x}: file format not recognized. Ignoring." |
3063 |
+ ;; |
3064 |
+ esac |
3065 |
+ done |
3066 |
+ # Do not chmod '.' since it's probably ${WORKDIR} and PORTAGE_WORKDIR_MODE |
3067 |
+ # should be preserved. |
3068 |
+ find . -mindepth 1 -maxdepth 1 ! -type l -print0 | \ |
3069 |
+ ${XARGS} -0 chmod -fR a+rX,u+w,g-w,o-w |
3070 |
+ } |
3071 |
+ |
3072 |
+ econf() { |
3073 |
+ local x |
3074 |
+ |
3075 |
+ _hasg() { |
3076 |
+ local x s=$1 |
3077 |
+ shift |
3078 |
+ for x ; do [[ ${x} == ${s} ]] && echo "${x}" && return 0 ; done |
3079 |
+ return 1 |
3080 |
+ } |
3081 |
+ |
3082 |
+ _hasgq() { _hasg "$@" >/dev/null ; } |
3083 |
+ |
3084 |
+ local phase_func=$(_ebuild_arg_to_phase "$EAPI" "$EBUILD_PHASE") |
3085 |
+ if [[ -n $phase_func ]] ; then |
3086 |
+ if has "$EAPI" 0 1 ; then |
3087 |
+ [[ $phase_func != src_compile ]] && \ |
3088 |
+ eqawarn "QA Notice: econf called in" \ |
3089 |
+ "$phase_func instead of src_compile" |
3090 |
+ else |
3091 |
+ [[ $phase_func != src_configure ]] && \ |
3092 |
+ eqawarn "QA Notice: econf called in" \ |
3093 |
+ "$phase_func instead of src_configure" |
3094 |
+ fi |
3095 |
+ fi |
3096 |
+ |
3097 |
+ : ${ECONF_SOURCE:=.} |
3098 |
+ if [ -x "${ECONF_SOURCE}/configure" ]; then |
3099 |
+ if [[ -n $CONFIG_SHELL && \ |
3100 |
+ "$(head -n1 "$ECONF_SOURCE/configure")" =~ ^'#!'[[:space:]]*/bin/sh([[:space:]]|$) ]] ; then |
3101 |
+ sed -e "1s:^#![[:space:]]*/bin/sh:#!$CONFIG_SHELL:" -i "$ECONF_SOURCE/configure" || \ |
3102 |
+ die "Substition of shebang in '$ECONF_SOURCE/configure' failed" |
3103 |
+ fi |
3104 |
+ if [ -e /usr/share/gnuconfig/ ]; then |
3105 |
+ find "${WORKDIR}" -type f '(' \ |
3106 |
+ -name config.guess -o -name config.sub ')' -print0 | \ |
3107 |
+ while read -r -d $'\0' x ; do |
3108 |
+ vecho " * econf: updating ${x/${WORKDIR}\/} with /usr/share/gnuconfig/${x##*/}" |
3109 |
+ cp -f /usr/share/gnuconfig/"${x##*/}" "${x}" |
3110 |
+ done |
3111 |
+ fi |
3112 |
+ |
3113 |
+ # EAPI=4 adds --disable-dependency-tracking to econf |
3114 |
+ if ! has "$EAPI" 0 1 2 3 3_pre2 && \ |
3115 |
+ "${ECONF_SOURCE}/configure" --help 2>/dev/null | \ |
3116 |
+ grep -q disable-dependency-tracking ; then |
3117 |
+ set -- --disable-dependency-tracking "$@" |
3118 |
+ fi |
3119 |
+ |
3120 |
+ # if the profile defines a location to install libs to aside from default, pass it on. |
3121 |
+ # if the ebuild passes in --libdir, they're responsible for the conf_libdir fun. |
3122 |
+ local CONF_LIBDIR LIBDIR_VAR="LIBDIR_${ABI}" |
3123 |
+ if [[ -n ${ABI} && -n ${!LIBDIR_VAR} ]] ; then |
3124 |
+ CONF_LIBDIR=${!LIBDIR_VAR} |
3125 |
+ fi |
3126 |
+ if [[ -n ${CONF_LIBDIR} ]] && ! _hasgq --libdir=\* "$@" ; then |
3127 |
+ export CONF_PREFIX=$(_hasg --exec-prefix=\* "$@") |
3128 |
+ [[ -z ${CONF_PREFIX} ]] && CONF_PREFIX=$(_hasg --prefix=\* "$@") |
3129 |
+ : ${CONF_PREFIX:=/usr} |
3130 |
+ CONF_PREFIX=${CONF_PREFIX#*=} |
3131 |
+ [[ ${CONF_PREFIX} != /* ]] && CONF_PREFIX="/${CONF_PREFIX}" |
3132 |
+ [[ ${CONF_LIBDIR} != /* ]] && CONF_LIBDIR="/${CONF_LIBDIR}" |
3133 |
+ set -- --libdir="$(strip_duplicate_slashes ${CONF_PREFIX}${CONF_LIBDIR})" "$@" |
3134 |
+ fi |
3135 |
+ |
3136 |
+ set -- \ |
3137 |
+ --prefix=/usr \ |
3138 |
+ ${CBUILD:+--build=${CBUILD}} \ |
3139 |
+ --host=${CHOST} \ |
3140 |
+ ${CTARGET:+--target=${CTARGET}} \ |
3141 |
+ --mandir=/usr/share/man \ |
3142 |
+ --infodir=/usr/share/info \ |
3143 |
+ --datadir=/usr/share \ |
3144 |
+ --sysconfdir=/etc \ |
3145 |
+ --localstatedir=/var/lib \ |
3146 |
+ "$@" \ |
3147 |
+ ${EXTRA_ECONF} |
3148 |
+ vecho "${ECONF_SOURCE}/configure" "$@" |
3149 |
+ |
3150 |
+ if ! "${ECONF_SOURCE}/configure" "$@" ; then |
3151 |
+ |
3152 |
+ if [ -s config.log ]; then |
3153 |
+ echo |
3154 |
+ echo "!!! Please attach the following file when seeking support:" |
3155 |
+ echo "!!! ${PWD}/config.log" |
3156 |
+ fi |
3157 |
+ die "econf failed" |
3158 |
+ fi |
3159 |
+ elif [ -f "${ECONF_SOURCE}/configure" ]; then |
3160 |
+ die "configure is not executable" |
3161 |
+ else |
3162 |
+ die "no configure script found" |
3163 |
+ fi |
3164 |
+ } |
3165 |
+ |
3166 |
+ einstall() { |
3167 |
+ # CONF_PREFIX is only set if they didn't pass in libdir above. |
3168 |
+ local LOCAL_EXTRA_EINSTALL="${EXTRA_EINSTALL}" |
3169 |
+ LIBDIR_VAR="LIBDIR_${ABI}" |
3170 |
+ if [ -n "${ABI}" -a -n "${!LIBDIR_VAR}" ]; then |
3171 |
+ CONF_LIBDIR="${!LIBDIR_VAR}" |
3172 |
+ fi |
3173 |
+ unset LIBDIR_VAR |
3174 |
+ if [ -n "${CONF_LIBDIR}" ] && [ "${CONF_PREFIX:+set}" = set ]; then |
3175 |
+ EI_DESTLIBDIR="${D}/${CONF_PREFIX}/${CONF_LIBDIR}" |
3176 |
+ EI_DESTLIBDIR="$(strip_duplicate_slashes ${EI_DESTLIBDIR})" |
3177 |
+ LOCAL_EXTRA_EINSTALL="libdir=${EI_DESTLIBDIR} ${LOCAL_EXTRA_EINSTALL}" |
3178 |
+ unset EI_DESTLIBDIR |
3179 |
+ fi |
3180 |
+ |
3181 |
+ if [ -f ./[mM]akefile -o -f ./GNUmakefile ] ; then |
3182 |
+ if [ "${PORTAGE_DEBUG}" == "1" ]; then |
3183 |
+ ${MAKE:-make} -n prefix="${D}usr" \ |
3184 |
+ datadir="${D}usr/share" \ |
3185 |
+ infodir="${D}usr/share/info" \ |
3186 |
+ localstatedir="${D}var/lib" \ |
3187 |
+ mandir="${D}usr/share/man" \ |
3188 |
+ sysconfdir="${D}etc" \ |
3189 |
+ ${LOCAL_EXTRA_EINSTALL} \ |
3190 |
+ ${MAKEOPTS} ${EXTRA_EMAKE} -j1 \ |
3191 |
+ "$@" install |
3192 |
+ fi |
3193 |
+ ${MAKE:-make} prefix="${D}usr" \ |
3194 |
+ datadir="${D}usr/share" \ |
3195 |
+ infodir="${D}usr/share/info" \ |
3196 |
+ localstatedir="${D}var/lib" \ |
3197 |
+ mandir="${D}usr/share/man" \ |
3198 |
+ sysconfdir="${D}etc" \ |
3199 |
+ ${LOCAL_EXTRA_EINSTALL} \ |
3200 |
+ ${MAKEOPTS} ${EXTRA_EMAKE} -j1 \ |
3201 |
+ "$@" install || die "einstall failed" |
3202 |
+ else |
3203 |
+ die "no Makefile found" |
3204 |
+ fi |
3205 |
+ } |
3206 |
+ |
3207 |
+ _eapi0_pkg_nofetch() { |
3208 |
+ [ -z "${SRC_URI}" ] && return |
3209 |
+ |
3210 |
+ elog "The following are listed in SRC_URI for ${PN}:" |
3211 |
+ local x |
3212 |
+ for x in $(echo ${SRC_URI}); do |
3213 |
+ elog " ${x}" |
3214 |
+ done |
3215 |
+ } |
3216 |
+ |
3217 |
+ _eapi0_src_unpack() { |
3218 |
+ [[ -n ${A} ]] && unpack ${A} |
3219 |
+ } |
3220 |
+ |
3221 |
+ _eapi0_src_compile() { |
3222 |
+ if [ -x ./configure ] ; then |
3223 |
+ econf |
3224 |
+ fi |
3225 |
+ _eapi2_src_compile |
3226 |
+ } |
3227 |
+ |
3228 |
+ _eapi0_src_test() { |
3229 |
+ # Since we don't want emake's automatic die |
3230 |
+ # support (EAPI 4 and later), and we also don't |
3231 |
+ # want the warning messages that it produces if |
3232 |
+ # we call it in 'nonfatal' mode, we use emake_cmd |
3233 |
+ # to emulate the desired parts of emake behavior. |
3234 |
+ local emake_cmd="${MAKE:-make} ${MAKEOPTS} ${EXTRA_EMAKE}" |
3235 |
+ if $emake_cmd -j1 check -n &> /dev/null; then |
3236 |
+ vecho ">>> Test phase [check]: ${CATEGORY}/${PF}" |
3237 |
+ if ! $emake_cmd -j1 check; then |
3238 |
+ has test $FEATURES && die "Make check failed. See above for details." |
3239 |
+ has test $FEATURES || eerror "Make check failed. See above for details." |
3240 |
+ fi |
3241 |
+ elif $emake_cmd -j1 test -n &> /dev/null; then |
3242 |
+ vecho ">>> Test phase [test]: ${CATEGORY}/${PF}" |
3243 |
+ if ! $emake_cmd -j1 test; then |
3244 |
+ has test $FEATURES && die "Make test failed. See above for details." |
3245 |
+ has test $FEATURES || eerror "Make test failed. See above for details." |
3246 |
+ fi |
3247 |
+ else |
3248 |
+ vecho ">>> Test phase [none]: ${CATEGORY}/${PF}" |
3249 |
+ fi |
3250 |
+ } |
3251 |
+ |
3252 |
+ _eapi1_src_compile() { |
3253 |
+ _eapi2_src_configure |
3254 |
+ _eapi2_src_compile |
3255 |
+ } |
3256 |
+ |
3257 |
+ _eapi2_src_configure() { |
3258 |
+ if [[ -x ${ECONF_SOURCE:-.}/configure ]] ; then |
3259 |
+ econf |
3260 |
+ fi |
3261 |
+ } |
3262 |
+ |
3263 |
+ _eapi2_src_compile() { |
3264 |
+ if [ -f Makefile ] || [ -f GNUmakefile ] || [ -f makefile ]; then |
3265 |
+ emake || die "emake failed" |
3266 |
+ fi |
3267 |
+ } |
3268 |
+ |
3269 |
+ _eapi4_src_install() { |
3270 |
+ if [[ -f Makefile || -f GNUmakefile || -f makefile ]] ; then |
3271 |
+ emake DESTDIR="${D}" install |
3272 |
+ fi |
3273 |
+ |
3274 |
+ if ! declare -p DOCS &>/dev/null ; then |
3275 |
+ local d |
3276 |
+ for d in README* ChangeLog AUTHORS NEWS TODO CHANGES \ |
3277 |
+ THANKS BUGS FAQ CREDITS CHANGELOG ; do |
3278 |
+ [[ -s "${d}" ]] && dodoc "${d}" |
3279 |
+ done |
3280 |
+ elif [[ $(declare -p DOCS) == "declare -a "* ]] ; then |
3281 |
+ dodoc "${DOCS[@]}" |
3282 |
+ else |
3283 |
+ dodoc ${DOCS} |
3284 |
+ fi |
3285 |
+ } |
3286 |
+ |
3287 |
+ # Return true if given package is installed. Otherwise return false. |
3288 |
+ # Takes single depend-type atoms. |
3289 |
+ has_version() { |
3290 |
+ |
3291 |
+ if [[ -n $PORTAGE_IPC_DAEMON ]] ; then |
3292 |
+ "$PORTAGE_BIN_PATH"/ebuild-ipc has_version "$ROOT" "$1" |
3293 |
+ else |
3294 |
+ PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \ |
3295 |
+ "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/portageq" has_version "${ROOT}" "$1" |
3296 |
+ fi |
3297 |
+ local retval=$? |
3298 |
+ case "${retval}" in |
3299 |
+ 0|1) |
3300 |
+ return ${retval} |
3301 |
+ ;; |
3302 |
+ *) |
3303 |
+ die "unexpected portageq exit code: ${retval}" |
3304 |
+ ;; |
3305 |
+ esac |
3306 |
+ } |
3307 |
+ |
3308 |
+ # Returns the best/most-current match. |
3309 |
+ # Takes single depend-type atoms. |
3310 |
+ best_version() { |
3311 |
+ |
3312 |
+ if [[ -n $PORTAGE_IPC_DAEMON ]] ; then |
3313 |
+ "$PORTAGE_BIN_PATH"/ebuild-ipc best_version "$ROOT" "$1" |
3314 |
+ else |
3315 |
+ PYTHONPATH=${PORTAGE_PYM_PATH}${PYTHONPATH:+:}${PYTHONPATH} \ |
3316 |
+ "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}/portageq" best_version "${ROOT}" "$1" |
3317 |
+ fi |
3318 |
+ local retval=$? |
3319 |
+ case "${retval}" in |
3320 |
+ 0|1) |
3321 |
+ return ${retval} |
3322 |
+ ;; |
3323 |
+ *) |
3324 |
+ die "unexpected portageq exit code: ${retval}" |
3325 |
+ ;; |
3326 |
+ esac |
3327 |
+ } |