from __future__ import print_function
- if not hasattr(__builtins__, "set"):
- from sets import Set as set
-
- from stat import *
- from random import *
+ from stat import ST_GID, ST_MODE, ST_UID
+ from random import random
import atexit, re, shutil, stat, sys
-
try:
- import portage
+ from subprocess import getoutput as subprocess_getoutput
+ from subprocess import getstatusoutput as subprocess_getstatusoutput
except ImportError:
- from os import path as osp
- sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
- import portage
+ from commands import getoutput as subprocess_getoutput
+ from commands import getstatusoutput as subprocess_getstatusoutput
+from os import environ as ose
+from os import path as osp
+if ose.__contains__("PORTAGE_PYTHONPATH"):
+ sys.path.insert(0, ose["PORTAGE_PYTHONPATH"])
+else:
+ sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp. realpath(__file__))), "pym"))
+import portage
from portage import os
from portage import dispatch_conf
# Build list of extant configs
#
- for path in config_paths.split ():
+ for path in config_paths:
- path = portage.normalize_path(path)
+ path = portage.normalize_path(EPREFIX + path)
try:
mymode = os.stat(path).st_mode
except OSError:
sleep 1
done
+ # anything outside the prefix should be caught by the Prefix QA
+ # check, so if there's nothing in ED, we skip searching for QA
+ # checks there, the specific QA funcs can hence rely on ED existing
+ if [[ -d ${ED} ]] ; then
+ case ${CHOST} in
+ *-darwin*)
+ # Mach-O platforms (NeXT, Darwin, OSX)
+ install_qa_check_macho
+ ;;
+ *-interix*|*-winnt*)
+ # PECOFF platforms (Windows/Interix)
+ install_qa_check_pecoff
+ ;;
+ *-aix*)
+ # XCOFF platforms (AIX)
+ install_qa_check_xcoff
+ ;;
+ *)
+ # because this is the majority: ELF platforms (Linux,
+ # Solaris, *BSD, IRIX, etc.)
+ install_qa_check_elf
+ ;;
+ esac
+ fi
+
+ # this is basically here such that the diff with trunk remains just
+ # offsetted and not out of order
+ install_qa_check_misc
+
+ # Prefix specific checks
+ [[ -n ${EPREFIX} ]] && install_qa_check_prefix
+}
+
+install_qa_check_elf() {
if type -P scanelf > /dev/null && ! hasq binchecks ${RESTRICT}; then
local qa_var insecure_rpath=0 tmp_quiet=${PORTAGE_QUIET}
- local f x
+ local x
# display warnings when using stricter because we die afterwards
if has stricter ${FEATURES} ; then
fi
# Sanity check syntax errors in init.d scripts
+ local d
for d in /etc/conf.d /etc/init.d ; do
- [[ -d ${D}/${d} ]] || continue
- for i in "${D}"/${d}/* ; do
+ [[ -d ${ED}/${d} ]] || continue
+ for i in "${ED}"/${d}/* ; do
[[ -L ${i} ]] && continue
# if empty conf.d/init.d dir exists (baselayout), then i will be "/etc/conf.d/*" and not exist
[[ ! -e ${i} ]] && continue
# this should help to ensure that all (most?) shared libraries are executable
# and that all libtool scripts / static libraries are not executable
- for i in "${D}"opt/*/lib{,32,64} \
- "${D}"lib{,32,64} \
- "${D}"usr/lib{,32,64} \
- "${D}"usr/X11R6/lib{,32,64} ; do
+ local j
+ for i in "${ED}"opt/*/lib{,32,64} \
+ "${ED}"lib{,32,64} \
+ "${ED}"usr/lib{,32,64} \
+ "${ED}"usr/X11R6/lib{,32,64} ; do
[[ ! -d ${i} ]] && continue
- for j in "${i}"/*.so.* "${i}"/*.so ; do
+ for j in "${i}"/*.so.* "${i}"/*.so "${i}"/*.dylib "${i}"/*.dll ; do
[[ ! -e ${j} ]] && continue
[[ -L ${j} ]] && continue
[[ -x ${j} ]] && continue
# the static library, or gcc will utilize the static lib when linking :(.
# http://bugs.gentoo.org/4411
abort="no"
- for a in "${D}"usr/lib*/*.a ; do
- s=${a%.a}.so
+ local a s
+ for a in "${ED}"usr/lib*/*.a ; do
+ [[ ${CHOST} == *-darwin* ]] \
+ && s=${a%.a}.dylib \
+ || s=${a%.a}.so
if [[ ! -e ${s} ]] ; then
s=${s%usr/*}${s##*/usr/}
if [[ -e ${s} ]] ; then
fi
fi
- # Compiled python objects do not belong in /usr/share (FHS violation)
- # and can be a pain when upgrading python
- f=$([ -d "${ED}"/usr/share ] && \
- find "${ED}"usr/share -name '*.py[co]' | sed "s:${D}:/:")
- f=$(find "${D}" -name '*.py[co]' | sed "s:${D}:/:")
++ f=$(find "${ED}" -name '*.py[co]' | sed "s:${D}:/:")
if [[ -n ${f} ]] ; then
vecho -ne '\a\n'
- eqawarn "QA Notice: Precompiled python object files do not belong in /usr/share"
+ eqawarn "QA Notice: Byte-compiled Python modules have been found. python_mod_optimize()"
+ eqawarn " and python_mod_cleanup() functions python.eclass should be used to"
+ eqawarn " handle byte-compiled Python modules."
eqawarn "${f}"
vecho -ne '\a\n'
fi
# Portage regenerates this on the installed system.
- rm -f "${D}"/usr/share/info/dir{,.gz,.bz2}
+ rm -f "${ED}"/usr/share/info/dir{,.gz,.bz2}
if hasq multilib-strict ${FEATURES} && \
- [[ -x /usr/bin/file && -x /usr/bin/find ]] && \
+ [[ -x ${EPREFIX}/usr/bin/file && -x ${EPREFIX}/usr/bin/find ]] && \
[[ -n ${MULTILIB_STRICT_DIRS} && -n ${MULTILIB_STRICT_DENY} ]]
then
- local abort=no firstrun=yes
+ local abort=no dir file firstrun=yes
MULTILIB_STRICT_EXEMPT=$(echo ${MULTILIB_STRICT_EXEMPT} | sed -e 's:\([(|)]\):\\\1:g')
for dir in ${MULTILIB_STRICT_DIRS} ; do
- [[ -d ${D}/${dir} ]] || continue
- for file in $(find ${D}/${dir} -type f | grep -v "^${D}/${dir}/${MULTILIB_STRICT_EXEMPT}"); do
+ [[ -d ${ED}/${dir} ]] || continue
+ for file in $(find ${ED}/${dir} -type f | grep -v "^${ED}/${dir}/${MULTILIB_STRICT_EXEMPT}"); do
if file ${file} | egrep -q "${MULTILIB_STRICT_DENY}" ; then
if [[ ${firstrun} == yes ]] ; then
echo "Files matching a file type that is not allowed:"
cd "${T}"
# remove man pages, info pages, docs if requested
+ local f
for f in man info doc; do
if hasq no${f} $FEATURES; then
- INSTALL_MASK="${INSTALL_MASK} /usr/share/${f}"
+ INSTALL_MASK="${INSTALL_MASK} ${EPREFIX}/usr/share/${f}"
fi
done
fi
# total suid control.
if hasq suidctl $FEATURES; then
- local sfconf
+ local i sfconf x
- sfconf=${PORTAGE_CONFIGROOT}etc/portage/suidctl.conf
+ sfconf=${PORTAGE_CONFIGROOT}${EPREFIX#/}/etc/portage/suidctl.conf
# sandbox prevents us from writing directly
# to files outside of the sandbox, but this
# can easly be bypassed using the addwrite() function