Gentoo Archives: gentoo-commits

From: Fabian Groffen <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:prefix commit in: /
Date: Fri, 01 Jul 2011 17:44:28
Message-Id: 1683b8f2933a2e23785ae2e7e3b23eec831f9d93.grobian@gentoo
1 commit: 1683b8f2933a2e23785ae2e7e3b23eec831f9d93
2 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jul 1 17:42:16 2011 +0000
4 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
5 CommitDate: Fri Jul 1 17:42:16 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=1683b8f2
7
8 Merge remote-tracking branch 'overlays-gentoo-org/master' into prefix
9
10 Conflicts:
11 pym/portage/package/ebuild/prepare_build_dirs.py
12 pym/portage/util/__init__.py
13
14
15 RELEASE-NOTES | 2 +-
16 bin/ebuild | 23 +++-
17 bin/ebuild-helpers/ecompress | 6 +-
18 bin/emaint | 45 +++++-
19 bin/misc-functions.sh | 11 ++
20 bin/portageq | 13 +-
21 bin/repoman | 37 ++++-
22 cnf/make.globals | 2 +-
23 man/ebuild.5 | 5 +-
24 man/env-update.1 | 3 +-
25 man/make.conf.5 | 9 +-
26 man/portage.5 | 7 +
27 man/repoman.1 | 4 +
28 pym/_emerge/EbuildPhase.py | 10 ++
29 pym/_emerge/Package.py | 33 ++++-
30 pym/_emerge/UseFlagDisplay.py | 8 +-
31 pym/_emerge/depgraph.py | 21 ++-
32 pym/_emerge/resolver/circular_dependency.py | 24 ++-
33 pym/_emerge/resolver/output.py | 13 +-
34 pym/portage/checksum.py | 15 ++-
35 pym/portage/const.py | 2 +-
36 pym/portage/dbapi/vartree.py | 30 ++--
37 pym/portage/dep/__init__.py | 4 +-
38 pym/portage/package/ebuild/_config/UseManager.py | 170 +++++++++++++-------
39 .../package/ebuild/_config/special_env_vars.py | 6 +
40 pym/portage/package/ebuild/config.py | 57 +++++++-
41 pym/portage/package/ebuild/doebuild.py | 141 ++++++++++++++++-
42 pym/portage/package/ebuild/prepare_build_dirs.py | 14 ++-
43 pym/portage/repository/config.py | 3 +
44 pym/portage/tests/util/test_varExpand.py | 35 ++++-
45 pym/portage/util/__init__.py | 52 +++----
46 pym/portage/util/_dyn_libs/LinkageMapELF.py | 30 +++-
47 pym/portage/util/env_update.py | 14 +-
48 33 files changed, 668 insertions(+), 181 deletions(-)
49
50 diff --cc bin/emaint
51 index 6d68cb0,fdd01ed..c8a76d5
52 --- a/bin/emaint
53 +++ b/bin/emaint
54 @@@ -10,16 -12,18 +12,20 @@@ import textwra
55 import time
56 from optparse import OptionParser, OptionValueError
57
58 -try:
59 - import portage
60 -except ImportError:
61 - from os import path as osp
62 - sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
63 - import portage
64 +# for an explanation on this logic, see pym/_emerge/__init__.py
65 +import os
66 +import sys
67 +if os.environ.__contains__("PORTAGE_PYTHONPATH"):
68 + sys.path.insert(0, os.environ["PORTAGE_PYTHONPATH"])
69 +else:
70 + sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), "pym"))
71 +import portage
72
73 from portage import os
74 + from portage.util import writemsg
75 +
76 + if sys.hexversion >= 0x3000000:
77 + long = int
78
79 class WorldHandler(object):
80
81 diff --cc bin/misc-functions.sh
82 index dce730a,d708c1d..bfb6b03
83 mode 100644,100755..100644
84 --- a/bin/misc-functions.sh
85 +++ b/bin/misc-functions.sh
86 @@@ -758,490 -715,18 +759,500 @@@ install_qa_check_misc()
87 done
88 [[ ${abort} == yes ]] && die "multilib-strict check failed!"
89 fi
90 +
91 + # ensure packages don't install systemd units automagically
92 + if ! hasq systemd ${INHERITED} && \
93 + [[ -d "${D}"/lib/systemd/system ]]
94 + then
95 + eqawarn "QA Notice: package installs systemd unit files (/lib/systemd/system)"
96 + eqawarn " but does not inherit systemd.eclass."
97 + hasq stricter ${FEATURES} \
98 + && die "install aborted due to missing inherit of systemd.eclass"
99 + fi
100 }
101
102 +install_qa_check_prefix() {
103 + if [[ -d ${ED}/${D} ]] ; then
104 + find "${ED}/${D}" | \
105 + while read i ; do
106 + eqawarn "QA Notice: /${i##${ED}/${D}} installed in \${ED}/\${D}"
107 + done
108 + die "Aborting due to QA concerns: files installed in ${ED}/${D}"
109 + fi
110 +
111 + if [[ -d ${ED}/${EPREFIX} ]] ; then
112 + find "${ED}/${EPREFIX}/" | \
113 + while read i ; do
114 + eqawarn "QA Notice: ${i#${D}} double prefix"
115 + done
116 + die "Aborting due to QA concerns: double prefix files installed"
117 + fi
118 +
119 + if [[ -d ${D} ]] ; then
120 + INSTALLTOD=$(find ${D%/} | egrep -v "^${ED}" | sed -e "s|^${D%/}||" | awk '{if (length($0) <= length("'"${EPREFIX}"'")) { if (substr("'"${EPREFIX}"'", 1, length($0)) != $0) {print $0;} } else if (substr($0, 1, length("'"${EPREFIX}"'")) != "'"${EPREFIX}"'") {print $0;} }')
121 + if [[ -n ${INSTALLTOD} ]] ; then
122 + eqawarn "QA Notice: the following files are outside of the prefix:"
123 + eqawarn "${INSTALLTOD}"
124 + die "Aborting due to QA concerns: there are files installed outside the prefix"
125 + fi
126 + fi
127 +
128 + # all further checks rely on ${ED} existing
129 + [[ -d ${ED} ]] || return
130 +
131 + # this does not really belong here, but it's closely tied to
132 + # the code below; many runscripts generate positives here, and we
133 + # know they don't work (bug #196294) so as long as that one
134 + # remains an issue, simply remove them as they won't work
135 + # anyway, avoid etc/init.d/functions.sh from being thrown away
136 + if [[ ( -d "${ED}"/etc/conf.d || -d "${ED}"/etc/init.d ) && ! -f "${ED}"/etc/init.d/functions.sh ]] ; then
137 + ewarn "removed /etc/init.d and /etc/conf.d directories until bug #196294 has been resolved"
138 + rm -Rf "${ED}"/etc/{conf,init}.d
139 + fi
140 +
141 + # check shebangs, bug #282539
142 + rm -f "${T}"/non-prefix-shebangs-errs
143 + local WHITELIST=" /usr/bin/env "
144 + # this is hell expensive, but how else?
145 + find "${ED}" -executable \! -type d -print0 \
146 + | xargs -0 grep -H -n -m1 "^#!" \
147 + | while read f ;
148 + do
149 + local fn=${f%%:*}
150 + local pos=${f#*:} ; pos=${pos%:*}
151 + local line=${f##*:}
152 + # shebang always appears on the first line ;)
153 + [[ ${pos} != 1 ]] && continue
154 + local oldIFS=${IFS}
155 + IFS=$'\r'$'\n'$'\t'" "
156 + line=( ${line#"#!"} )
157 + IFS=${oldIFS}
158 + [[ ${WHITELIST} == *" ${line[0]} "* ]] && continue
159 + local fp=${fn#${D}} ; fp=/${fp%/*}
160 + # line[0] can be an absolutised path, bug #342929
161 + local eprefix=$(canonicalize ${EPREFIX})
162 + local rf=${fn}
163 + # in case we deal with a symlink, make sure we don't replace it
164 + # with a real file (sed -i does that)
165 + if [[ -L ${fn} ]] ; then
166 + rf=$(readlink ${fn})
167 + [[ ${rf} != /* ]] && rf=${fn%/*}/${rf}
168 + # ignore symlinks pointing to outside prefix
169 + # as seen in sys-devel/native-cctools
170 + [[ ${rf} != ${EPREFIX}/* && $(canonicalize "${rf}") != ${eprefix}/* ]] && continue
171 + fi
172 + # does the shebang start with ${EPREFIX}, and does it exist?
173 + if [[ ${line[0]} == ${EPREFIX}/* || ${line[0]} == ${eprefix}/* ]] ; then
174 + if [[ ! -e ${ROOT%/}${line[0]} && ! -e ${D%/}${line[0]} ]] ; then
175 + # hmm, refers explicitly to $EPREFIX, but doesn't exist,
176 + # if it's in PATH that's wrong in any case
177 + if [[ ":${PATH}:" == *":${fp}:"* ]] ; then
178 + echo "${fn#${D}}:${line[0]} (explicit EPREFIX but target not found)" \
179 + >> "${T}"/non-prefix-shebangs-errs
180 + else
181 + eqawarn "${fn#${D}} has explicit EPREFIX in shebang but target not found (${line[0]})"
182 + fi
183 + fi
184 + continue
185 + fi
186 + # unprefixed shebang, is the script directly in $PATH?
187 + if [[ ":${PATH}:" == *":${fp}:"* ]] ; then
188 + if [[ -e ${EROOT}${line[0]} || -e ${ED}${line[0]} ]] ; then
189 + # is it unprefixed, but we can just fix it because a
190 + # prefixed variant exists
191 + eqawarn "prefixing shebang of ${fn#${D}}"
192 + # statement is made idempotent on purpose, because
193 + # symlinks may point to the same target, and hence the
194 + # same real file may be sedded multiple times since we
195 + # read the shebangs in one go upfront for performance
196 + # reasons
197 + sed -i -e '1s:^#! \?'"${line[0]}"':#!'"${EPREFIX}"${line[0]}':' "${rf}"
198 + continue
199 + else
200 + # this is definitely wrong: script in $PATH and invalid shebang
201 + echo "${fn#${D}}:${line[0]} (script ${fn##*/} installed in PATH but interpreter ${line[0]} not found)" \
202 + >> "${T}"/non-prefix-shebangs-errs
203 + fi
204 + else
205 + # unprefixed/invalid shebang, but outside $PATH, this may be
206 + # intended (e.g. config.guess) so remain silent by default
207 + hasq stricter ${FEATURES} && \
208 + eqawarn "invalid shebang in ${fn#${D}}: ${line[0]}"
209 + fi
210 + done
211 + if [[ -e "${T}"/non-prefix-shebangs-errs ]] ; then
212 + eqawarn "QA Notice: the following files use invalid (possible non-prefixed) shebangs:"
213 + while read line ; do
214 + eqawarn " ${line}"
215 + done < "${T}"/non-prefix-shebangs-errs
216 + rm -f "${T}"/non-prefix-shebangs-errs
217 + die "Aborting due to QA concerns: invalid shebangs found"
218 + fi
219 +}
220 +
221 +install_qa_check_macho() {
222 + if ! hasq binchecks ${RESTRICT} ; then
223 + # on Darwin, dynamic libraries are called .dylibs instead of
224 + # .sos. In addition the version component is before the
225 + # extension, not after it. Check for this, and *only* warn
226 + # about it. Some packages do ship .so files on Darwin and make
227 + # it work (ugly!).
228 + rm -f "${T}/mach-o.check"
229 + find ${ED%/} -name "*.so" -or -name "*.so.*" | \
230 + while read i ; do
231 + [[ $(file $i) == *"Mach-O"* ]] && \
232 + echo "${i#${D}}" >> "${T}/mach-o.check"
233 + done
234 + if [[ -f ${T}/mach-o.check ]] ; then
235 + f=$(< "${T}/mach-o.check")
236 + vecho -ne '\a\n'
237 + eqawarn "QA Notice: Found .so dynamic libraries on Darwin:"
238 + eqawarn " ${f//$'\n'/\n }"
239 + fi
240 + rm -f "${T}/mach-o.check"
241 +
242 + # The naming for dynamic libraries is different on Darwin; the
243 + # version component is before the extention, instead of after
244 + # it, as with .sos. Again, make this a warning only.
245 + rm -f "${T}/mach-o.check"
246 + find ${ED%/} -name "*.dylib.*" | \
247 + while read i ; do
248 + echo "${i#${D}}" >> "${T}/mach-o.check"
249 + done
250 + if [[ -f "${T}/mach-o.check" ]] ; then
251 + f=$(< "${T}/mach-o.check")
252 + vecho -ne '\a\n'
253 + eqawarn "QA Notice: Found wrongly named dynamic libraries on Darwin:"
254 + eqawarn " ${f// /\n }"
255 + fi
256 + rm -f "${T}/mach-o.check"
257 + fi
258 +
259 + # While we generate the NEEDED files, check that we don't get kernel
260 + # traps at runtime because of broken install_names on Darwin.
261 + rm -f "${T}"/.install_name_check_failed
262 + scanmacho -qyRF '%a;%p;%S;%n' "${D}" | { while IFS= read l ; do
263 + arch=${l%%;*}; l=${l#*;}
264 + obj="/${l%%;*}"; l=${l#*;}
265 + install_name=${l%%;*}; l=${l#*;}
266 + needed=${l%%;*}; l=${l#*;}
267 +
268 + # See if the self-reference install_name points to an existing
269 + # and to be installed file. This usually is a symlink for the
270 + # major version.
271 + if [[ ! -e ${D}${install_name} ]] ; then
272 + eqawarn "QA Notice: invalid self-reference install_name ${install_name} in ${obj}"
273 + # remember we are in an implicit subshell, that's
274 + # why we touch a file here ... ideally we should be
275 + # able to die correctly/nicely here
276 + touch "${T}"/.install_name_check_failed
277 + fi
278 +
279 + # this is ugly, paths with spaces won't work
280 + reevaluate=0
281 + for lib in ${needed//,/ } ; do
282 + if [[ ${lib} == ${D}* ]] ; then
283 + eqawarn "QA Notice: install_name references \${D}: ${lib} in ${obj}"
284 + touch "${T}"/.install_name_check_failed
285 + elif [[ ${lib} == ${S}* ]] ; then
286 + eqawarn "QA Notice: install_name references \${S}: ${lib} in ${obj}"
287 + touch "${T}"/.install_name_check_failed
288 + elif [[ ! -e ${lib} && ! -e ${D}${lib} && ${lib} != "@executable_path/"* && ${lib} != "@loader_path/"* ]] ; then
289 + # try to "repair" this if possible, happens because of
290 + # gen_usr_ldscript tactics
291 + s=${lib%usr/*}${lib##*/usr/}
292 + if [[ -e ${D}${s} ]] ; then
293 + ewarn "correcting install_name from ${lib} to ${s} in ${obj}"
294 + install_name_tool -change \
295 + "${lib}" "${s}" "${D}${obj}"
296 + reevaluate=1
297 + else
298 + eqawarn "QA Notice: invalid reference to ${lib} in ${obj}"
299 + # remember we are in an implicit subshell, that's
300 + # why we touch a file here ... ideally we should be
301 + # able to die correctly/nicely here
302 + touch "${T}"/.install_name_check_failed
303 + fi
304 + fi
305 + done
306 + if [[ ${reevaluate} == 1 ]]; then
307 + # install_name(s) have been changed, refresh data so we
308 + # store the correct meta data
309 + l=$(scanmacho -qyF '%a;%p;%S;%n' ${D}${obj})
310 + arch=${l%%;*}; l=${l#*;}
311 + obj="/${l%%;*}"; l=${l#*;}
312 + install_name=${l%%;*}; l=${l#*;}
313 + needed=${l%%;*}; l=${l#*;}
314 + fi
315 +
316 + # backwards compatability
317 + echo "${obj} ${needed}" >> "${PORTAGE_BUILDDIR}"/build-info/NEEDED
318 + # what we use
319 + echo "${arch};${obj};${install_name};${needed}" >> "${PORTAGE_BUILDDIR}"/build-info/NEEDED.MACHO.3
320 + done }
321 + if [[ -f ${T}/.install_name_check_failed ]] ; then
322 + # secret switch "allow_broken_install_names" to get
323 + # around this and install broken crap (not a good idea)
324 + hasq allow_broken_install_names ${FEATURES} || \
325 + die "invalid install_name found, your application or library will crash at runtime"
326 + fi
327 +}
328 +
329 +install_qa_check_pecoff() {
330 + local _pfx_scan="readpecoff ${CHOST}"
331 +
332 + # this one uses readpecoff, which supports multiple prefix platforms!
333 + # this is absolutely _not_ optimized for speed, and there may be plenty
334 + # of possibilities by introducing one or the other cache!
335 + if ! hasq binchecks ${RESTRICT}; then
336 + # copied and adapted from the above scanelf code.
337 + local qa_var insecure_rpath=0 tmp_quiet=${PORTAGE_QUIET}
338 + local f x
339 +
340 + # display warnings when using stricter because we die afterwards
341 + if has stricter ${FEATURES} ; then
342 + unset PORTAGE_QUIET
343 + fi
344 +
345 + local _exec_find_opt="-executable"
346 + [[ ${CHOST} == *-winnt* ]] && _exec_find_opt='-name *.dll -o -name *.exe'
347 +
348 + # Make sure we disallow insecure RUNPATH/RPATH's
349 + # Don't want paths that point to the tree where the package was built
350 + # (older, broken libtools would do this). Also check for null paths
351 + # because the loader will search $PWD when it finds null paths.
352 +
353 + f=$(
354 + find "${ED}" -type f '(' ${_exec_find_opt} ')' -print0 | xargs -0 ${_pfx_scan} | \
355 + while IFS=";" read arch obj soname rpath needed ; do \
356 + echo "${rpath}" | grep -E "(${PORTAGE_BUILDDIR}|: |::|^:|^ )" > /dev/null 2>&1 \
357 + && echo "${obj}"; done;
358 + )
359 + # Reject set*id binaries with $ORIGIN in RPATH #260331
360 + x=$(
361 + find "${ED}" -type f '(' -perm -u+s -o -perm -g+s ')' -print0 | \
362 + xargs -0 ${_pfx_scan} | while IFS=";" read arch obj soname rpath needed; do \
363 + echo "${rpath}" | grep '$ORIGIN' > /dev/null 2>&1 && echo "${obj}"; done;
364 + )
365 + if [[ -n ${f}${x} ]] ; then
366 + vecho -ne '\a\n'
367 + eqawarn "QA Notice: The following files contain insecure RUNPATH's"
368 + eqawarn " Please file a bug about this at http://bugs.gentoo.org/"
369 + eqawarn " with the maintaining herd of the package."
370 + eqawarn "${f}${f:+${x:+\n}}${x}"
371 + vecho -ne '\a\n'
372 + if [[ -n ${x} ]] || has stricter ${FEATURES} ; then
373 + insecure_rpath=1
374 + else
375 + eqawarn "cannot automatically fix runpaths on interix platforms!"
376 + fi
377 + fi
378 +
379 + rm -f "${PORTAGE_BUILDDIR}"/build-info/NEEDED
380 + rm -f "${PORTAGE_BUILDDIR}"/build-info/NEEDED.PECOFF.1
381 +
382 + # Save NEEDED information after removing self-contained providers
383 + find "${ED}" -type f '(' ${_exec_find_opt} ')' -print0 | xargs -0 ${_pfx_scan} | { while IFS=';' read arch obj soname rpath needed; do
384 + # need to strip image dir from object name.
385 + obj="/${obj#${D}}"
386 + if [ -z "${rpath}" -o -n "${rpath//*ORIGIN*}" ]; then
387 + # object doesn't contain $ORIGIN in its runpath attribute
388 + echo "${obj} ${needed}" >> "${PORTAGE_BUILDDIR}"/build-info/NEEDED
389 + echo "${arch};${obj};${soname};${rpath};${needed}" >> "${PORTAGE_BUILDDIR}"/build-info/NEEDED.PECOFF.1
390 + else
391 + dir=${obj%/*}
392 + # replace $ORIGIN with the dirname of the current object for the lookup
393 + opath=$(echo :${rpath}: | sed -e "s#.*:\(.*\)\$ORIGIN\(.*\):.*#\1${dir}\2#")
394 + sneeded=$(echo ${needed} | tr , ' ')
395 + rneeded=""
396 + for lib in ${sneeded}; do
397 + found=0
398 + for path in ${opath//:/ }; do
399 + [ -e "${ED}/${path}/${lib}" ] && found=1 && break
400 + done
401 + [ "${found}" -eq 0 ] && rneeded="${rneeded},${lib}"
402 + done
403 + rneeded=${rneeded:1}
404 + if [ -n "${rneeded}" ]; then
405 + echo "${obj} ${rneeded}" >> "${PORTAGE_BUILDDIR}"/build-info/NEEDED
406 + echo "${arch};${obj};${soname};${rpath};${rneeded}" >> "${PORTAGE_BUILDDIR}"/build-info/NEEDED.PECOFF.1
407 + fi
408 + fi
409 + done }
410 +
411 + if [[ ${insecure_rpath} -eq 1 ]] ; then
412 + die "Aborting due to serious QA concerns with RUNPATH/RPATH"
413 + elif [[ -n ${die_msg} ]] && has stricter ${FEATURES} ; then
414 + die "Aborting due to QA concerns: ${die_msg}"
415 + fi
416 +
417 + local _so_ext='.so*'
418 +
419 + case "${CHOST}" in
420 + *-winnt*) _so_ext=".dll" ;; # no "*" intentionally!
421 + esac
422 +
423 + # Run some sanity checks on shared libraries
424 + for d in "${ED}"lib* "${ED}"usr/lib* ; do
425 + [[ -d "${d}" ]] || continue
426 + f=$(find "${d}" -name "lib*${_so_ext}" -print0 | \
427 + xargs -0 ${_pfx_scan} | while IFS=";" read arch obj soname rpath needed; \
428 + do [[ -z "${soname}" ]] && echo "${obj}"; done)
429 + if [[ -n ${f} ]] ; then
430 + vecho -ne '\a\n'
431 + eqawarn "QA Notice: The following shared libraries lack a SONAME"
432 + eqawarn "${f}"
433 + vecho -ne '\a\n'
434 + sleep 1
435 + fi
436 +
437 + f=$(find "${d}" -name "lib*${_so_ext}" -print0 | \
438 + xargs -0 ${_pfx_scan} | while IFS=";" read arch obj soname rpath needed; \
439 + do [[ -z "${needed}" ]] && echo "${obj}"; done)
440 + if [[ -n ${f} ]] ; then
441 + vecho -ne '\a\n'
442 + eqawarn "QA Notice: The following shared libraries lack NEEDED entries"
443 + eqawarn "${f}"
444 + vecho -ne '\a\n'
445 + sleep 1
446 + fi
447 + done
448 +
449 + PORTAGE_QUIET=${tmp_quiet}
450 + fi
451 +}
452 +
453 +install_qa_check_xcoff() {
454 + if ! hasq binchecks ${RESTRICT}; then
455 + local tmp_quiet=${PORTAGE_QUIET}
456 + local queryline deplib
457 + local insecure_rpath_list= undefined_symbols_list=
458 +
459 + # display warnings when using stricter because we die afterwards
460 + if has stricter ${FEATURES} ; then
461 + unset PORTAGE_QUIET
462 + fi
463 +
464 + rm -f "${PORTAGE_BUILDDIR}"/build-info/NEEDED.XCOFF.1
465 +
466 + local neededfd
467 + for neededfd in {3..1024} none; do ( : <&${neededfd} ) 2>/dev/null || break; done
468 + [[ ${neededfd} != none ]] || die "cannot find free file descriptor handle"
469 +
470 + eval "exec ${neededfd}>\"${PORTAGE_BUILDDIR}\"/build-info/NEEDED.XCOFF.1" || die "cannot open ${PORTAGE_BUILDDIR}/build-info/NEEDED.XCOFF.1"
471 +
472 + ( # work around a problem in /usr/bin/dump (used by aixdll-query)
473 + # dumping core when path names get too long.
474 + cd "${ED}" >/dev/null &&
475 + find . -not -type d -exec \
476 + aixdll-query '{}' FILE MEMBER FLAGS FORMAT RUNPATH DEPLIBS ';'
477 + ) > "${T}"/needed 2>/dev/null
478 +
479 + # Symlinking shared archive libraries is not a good idea on aix,
480 + # as there is nothing like "soname" on pure filesystem level.
481 + # So we create a copy instead of the symlink.
482 + local prev_FILE=
483 + local FILE MEMBER FLAGS FORMAT RUNPATH DEPLIBS
484 + while read queryline
485 + do
486 + FILE= MEMBER= FLAGS= FORMAT= RUNPATH= DEPLIBS=
487 + eval ${queryline}
488 + FILE=${FILE#./}
489 +
490 + if [[ ${prev_FILE} != ${FILE} ]]; then
491 + if [[ " ${FLAGS} " == *" SHROBJ "* && -h ${ED}${FILE} ]]; then
492 + prev_FILE=${FILE}
493 + local target=$(readlink "${ED}${FILE}")
494 + if [[ ${target} == /* ]]; then
495 + target=${D}${target}
496 + else
497 + target=${FILE%/*}/${target}
498 + fi
499 + rm -f "${ED}${FILE}" || die "cannot prune ${FILE}"
500 + cp -f "${ED}${target}" "${ED}${FILE}" || die "cannot copy ${target} to ${FILE}"
501 + fi
502 + fi
503 + done <"${T}"/needed
504 +
505 + prev_FILE=
506 + while read queryline
507 + do
508 + FILE= MEMBER= FLAGS= FORMAT= RUNPATH= DEPLIBS=
509 + eval ${queryline}
510 + FILE=${FILE#./}
511 +
512 + if [[ -n ${MEMBER} && ${prev_FILE} != ${FILE} ]]; then
513 + # Save NEEDED information for each archive library stub
514 + # even if it is static only: the already installed archive
515 + # may contain shared objects to be preserved.
516 + echo "${FORMAT##* }${FORMAT%%-*};${EPREFIX}/${FILE};${FILE##*/};;" >&${neededfd}
517 + fi
518 + prev_FILE=${FILE}
519 +
520 + [[ " ${FLAGS} " == *" SHROBJ "* ]] || continue
521 +
522 + # Make sure we disallow insecure RUNPATH's
523 + # Don't want paths that point to the tree where the package was built
524 + # (older, broken libtools would do this). Also check for null paths
525 + # because the loader will search $PWD when it finds null paths.
526 + # And we really want absolute paths only.
527 + if [[ -n $(echo ":${RUNPATH}:" | grep -E "(${PORTAGE_BUILDDIR}|::|:[^/])") ]]; then
528 + insecure_rpath_list="${insecure_rpath_list}\n${FILE}${MEMBER:+[${MEMBER}]}"
529 + fi
530 +
531 + local needed=
532 + [[ -n ${MEMBER} ]] && needed=${FILE##*/}
533 + for deplib in ${DEPLIBS}; do
534 + eval deplib=${deplib}
535 + if [[ ${deplib} == '.' || ${deplib} == '..' ]]; then
536 + # Although we do have runtime linking, we don't want undefined symbols.
537 + # AIX does indicate this by needing either '.' or '..'
538 + undefined_symbols_list="${undefined_symbols_list}\n${FILE}"
539 + else
540 + needed="${needed}${needed:+,}${deplib}"
541 + fi
542 + done
543 +
544 + FILE=${EPREFIX}/${FILE}
545 +
546 + [[ -n ${MEMBER} ]] && MEMBER="[${MEMBER}]"
547 + # Save NEEDED information
548 + echo "${FORMAT##* }${FORMAT%%-*};${FILE}${MEMBER};${FILE##*/}${MEMBER};${RUNPATH};${needed}" >&${neededfd}
549 + done <"${T}"/needed
550 +
551 + eval "exec ${neededfd}>&-" || die "cannot close handle to ${PORTAGE_BUILDDIR}/build-info/NEEDED.XCOFF.1"
552 +
553 + if [[ -n ${undefined_symbols_list} ]]; then
554 + vecho -ne '\a\n'
555 + eqawarn "QA Notice: The following files contain undefined symbols."
556 + eqawarn " Please file a bug about this at http://bugs.gentoo.org/"
557 + eqawarn " with 'prefix' as the maintaining herd of the package."
558 + eqawarn "${undefined_symbols_list}"
559 + vecho -ne '\a\n'
560 + fi
561 +
562 + if [[ -n ${insecure_rpath_list} ]] ; then
563 + vecho -ne '\a\n'
564 + eqawarn "QA Notice: The following files contain insecure RUNPATH's"
565 + eqawarn " Please file a bug about this at http://bugs.gentoo.org/"
566 + eqawarn " with 'prefix' as the maintaining herd of the package."
567 + eqawarn "${insecure_rpath_list}"
568 + vecho -ne '\a\n'
569 + if has stricter ${FEATURES} ; then
570 + insecure_rpath=1
571 + fi
572 + fi
573 +
574 + if [[ ${insecure_rpath} -eq 1 ]] ; then
575 + die "Aborting due to serious QA concerns with RUNPATH/RPATH"
576 + elif [[ -n ${die_msg} ]] && has stricter ${FEATURES} ; then
577 + die "Aborting due to QA concerns: ${die_msg}"
578 + fi
579 +
580 + PORTAGE_QUIET=${tmp_quiet}
581 + fi
582 +}
583 +
584
585 install_mask() {
586 local root="$1"
587 diff --cc bin/repoman
588 index 25a03f0,0e3820f..74b4f45
589 --- a/bin/repoman
590 +++ b/bin/repoman
591 @@@ -378,9 -376,9 +379,10 @@@ qacats = list(qahelp
592 qacats.sort()
593
594 qawarnings = set((
595 +"changelog.ebuildadded",
596 "changelog.missing",
597 "changelog.notadded",
598 + "dependency.unknown",
599 "digest.assumed",
600 "digest.unused",
601 "ebuild.notadded",
602 diff --cc cnf/make.globals
603 index de05b3b,2892d50..ae98d16
604 --- a/cnf/make.globals
605 +++ b/cnf/make.globals
606 @@@ -108,21 -106,11 +108,21 @@@ CONFIG_PROTECT="/etc
607 CONFIG_PROTECT_MASK="/etc/env.d"
608
609 # Disable auto-use
610 - USE_ORDER="env:pkg:conf:defaults:pkginternal:env.d"
611 + USE_ORDER="env:pkg:conf:defaults:pkginternal:repo:env.d"
612
613 +# Default portage user/group
614 +PORTAGE_USER='@portageuser@'
615 +PORTAGE_GROUP='@portagegroup@'
616 +PORTAGE_ROOT_USER='@rootuser@'
617 +
618 # Default ownership of installed files.
619 -PORTAGE_INST_UID="0"
620 -PORTAGE_INST_GID="0"
621 +PORTAGE_INST_UID="@rootuid@"
622 +PORTAGE_INST_GID="@rootgid@"
623 +
624 +# Default PATH for ebuild env
625 +DEFAULT_PATH="@DEFAULT_PATH@"
626 +# Any extra PATHs to add to the ebuild environment's PATH (if any)
627 +EXTRA_PATH="@EXTRA_PATH@"
628
629 # Mode bits for ${WORKDIR} (see ebuild.5).
630 PORTAGE_WORKDIR_MODE="0700"
631 diff --cc pym/portage/package/ebuild/prepare_build_dirs.py
632 index a1086fd,259bedf..053ebcc
633 --- a/pym/portage/package/ebuild/prepare_build_dirs.py
634 +++ b/pym/portage/package/ebuild/prepare_build_dirs.py
635 @@@ -143,14 -142,22 +143,22 @@@ def _adjust_perms_msg(settings, msg)
636
637 def _prepare_features_dirs(mysettings):
638
639 + # Use default ABI libdir in accordance with bug #355283.
640 + libdir = None
641 + default_abi = mysettings.get("DEFAULT_ABI")
642 + if default_abi:
643 + libdir = mysettings.get("LIBDIR_" + default_abi)
644 + if not libdir:
645 + libdir = "lib"
646 +
647 features_dirs = {
648 "ccache":{
649 - "path_dir": EPREFIX+"/usr/lib/ccache/bin",
650 - "path_dir": "/usr/%s/ccache/bin" % (libdir,),
651 ++ "path_dir": EPREFIX+"/usr/%s/ccache/bin" % (libdir,),
652 "basedir_var":"CCACHE_DIR",
653 "default_dir":os.path.join(mysettings["PORTAGE_TMPDIR"], "ccache"),
654 "always_recurse":False},
655 "distcc":{
656 - "path_dir": EPREFIX+"/usr/lib/distcc/bin",
657 - "path_dir": "/usr/%s/distcc/bin" % (libdir,),
658 ++ "path_dir": EPREFIX+"/usr/%s/distcc/bin" % (libdir,),
659 "basedir_var":"DISTCC_DIR",
660 "default_dir":os.path.join(mysettings["BUILD_PREFIX"], ".distcc"),
661 "subdirs":("lock", "state"),
662 diff --cc pym/portage/util/__init__.py
663 index 0182c76,5468e28..3f202eb
664 --- a/pym/portage/util/__init__.py
665 +++ b/pym/portage/util/__init__.py
666 @@@ -1581,24 -1570,14 +1571,26 @@@ def find_updated_config_files(target_ro
667 else:
668 yield (x, None)
669
670 - def getlibpaths(root):
671 + def getlibpaths(root, env=None):
672 """ Return a list of paths that are used for library lookups """
673 + if env is None:
674 + env = os.environ
675 +
676 + # PREFIX HACK: LD_LIBRARY_PATH isn't portable, and considered
677 + # harmfull, so better not use it. We don't need any host OS lib
678 + # paths either, so do Prefix case.
679 + if EPREFIX != '':
680 + rval = []
681 + rval.append(EPREFIX + "/usr/lib")
682 + rval.append(EPREFIX + "/lib")
683 + # we don't know the CHOST here, so it's a bit hard to guess
684 + # where GCC's and ld's libs are. Though, GCC's libs should be
685 + # in lib and usr/lib, binutils' libs rarely used
686 + else:
687 - # the following is based on the information from ld.so(8)
688 - rval = os.environ.get("LD_LIBRARY_PATH", "").split(":")
689 + # the following is based on the information from ld.so(8)
690 - rval = env.get("LD_LIBRARY_PATH", "").split(":")
691 - rval.extend(grabfile(os.path.join(root, "etc", "ld.so.conf")))
692 - rval.append("/usr/lib")
693 - rval.append("/lib")
694 ++ rval = env.get("LD_LIBRARY_PATH", "").split(":")
695 + rval.extend(grabfile(os.path.join(root, "etc", "ld.so.conf")))
696 + rval.append("/usr/lib")
697 + rval.append("/lib")
698
699 return [normalize_path(x) for x in rval if x]