commit:     3f9ce6aaf8b9121d942e676cc13bd06ba51907be
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 22 10:07:50 2017 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Fri Sep 22 10:07:50 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=3f9ce6aa

Merge remote-tracking branch 'overlays-gentoo-org/master' into prefix

 RELEASE-NOTES                                      | 19 +++++
 bin/clean_locks                                    |  2 +-
 bin/dispatch-conf                                  |  2 +-
 bin/ebuild                                         |  2 +-
 bin/ebuild.sh                                      |  9 +++
 bin/emaint                                         |  2 +-
 bin/env-update                                     |  2 +-
 bin/isolated-functions.sh                          |  4 +
 bin/misc-functions.sh                              | 59 ++++++++++++++-
 bin/phase-functions.sh                             | 53 +++++++++++++-
 bin/portageq                                       |  2 +-
 bin/postinst-qa-check.d/50gnome2-utils             | 53 ++++++++++++++
 bin/postinst-qa-check.d/50xdg-utils                | 85 ++++++++++++++++++++++
 pym/_emerge/AsynchronousLock.py                    |  6 +-
 pym/portage/dbapi/vartree.py                       |  5 +-
 .../package/ebuild/_config/special_env_vars.py     |  4 +-
 pym/portage/package/ebuild/doebuild.py             |  3 +-
 pym/portage/repository/config.py                   |  4 +-
 pym/portage/sync/syncbase.py                       |  8 +-
 pym/portage/tests/locks/test_asynchronous_lock.py  |  8 +-
 pym/portage/util/digraph.py                        | 12 +--
 repoman/man/repoman.1                              | 18 ++++-
 repoman/pym/repoman/actions.py                     | 17 +----
 setup.py                                           |  2 +-
 24 files changed, 333 insertions(+), 48 deletions(-)

diff --cc bin/clean_locks
index d44162075,fb245972f..ecbedffcb
--- a/bin/clean_locks
+++ b/bin/clean_locks
@@@ -1,4 -1,4 +1,4 @@@
- #!@PREFIX_PORTAGE_PYTHON@ -bO
 -#!/usr/bin/python -b
++#!@PREFIX_PORTAGE_PYTHON@ -b
  # Copyright 1999-2014 Gentoo Foundation
  # Distributed under the terms of the GNU General Public License v2
  
diff --cc bin/dispatch-conf
index 184044930,49e7774bf..1ea3dbcdd
--- a/bin/dispatch-conf
+++ b/bin/dispatch-conf
@@@ -1,4 -1,4 +1,4 @@@
- #!@PREFIX_PORTAGE_PYTHON@ -bO
 -#!/usr/bin/python -b
++#!@PREFIX_PORTAGE_PYTHON@ -b
  # Copyright 1999-2017 Gentoo Foundation
  # Distributed under the terms of the GNU General Public License v2
  
diff --cc bin/ebuild
index d69039d35,bda746f78..d5939db89
--- a/bin/ebuild
+++ b/bin/ebuild
@@@ -1,4 -1,4 +1,4 @@@
- #!@PREFIX_PORTAGE_PYTHON@ -bO
 -#!/usr/bin/python -b
++#!@PREFIX_PORTAGE_PYTHON@ -b
  # Copyright 1999-2015 Gentoo Foundation
  # Distributed under the terms of the GNU General Public License v2
  
diff --cc bin/emaint
index 784d8613e,08e75851a..3515b5fd7
--- a/bin/emaint
+++ b/bin/emaint
@@@ -1,4 -1,4 +1,4 @@@
- #!@PREFIX_PORTAGE_PYTHON@ -bO
 -#!/usr/bin/python -b
++#!@PREFIX_PORTAGE_PYTHON@ -b
  # Copyright 2005-2014 Gentoo Foundation
  # Distributed under the terms of the GNU General Public License v2
  
diff --cc bin/env-update
index 5b99e66dd,03fc5849f..889fc4967
--- a/bin/env-update
+++ b/bin/env-update
@@@ -1,4 -1,4 +1,4 @@@
- #!@PREFIX_PORTAGE_PYTHON@ -bO
 -#!/usr/bin/python -b
++#!@PREFIX_PORTAGE_PYTHON@ -b
  # Copyright 1999-2014 Gentoo Foundation
  # Distributed under the terms of the GNU General Public License v2
  
diff --cc bin/misc-functions.sh
index d143b6b7e,b0506bde7..20fd4eef8
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@@ -297,389 -256,63 +297,446 @@@ install_qa_check_misc() 
        rm -f "${ED}"/usr/share/info/dir{,.gz,.bz2} || die "rm failed!"
  }
  
 +install_qa_check_macho() {
 +      if ! has binchecks ${RESTRICT} ; then
 +              # on Darwin, dynamic libraries are called .dylibs instead of
 +              # .sos.  In addition the version component is before the
 +              # extension, not after it.  Check for this, and *only* warn
 +              # about it.  Some packages do ship .so files on Darwin and make
 +              # it work (ugly!).
 +              rm -f "${T}/mach-o.check"
 +              find ${ED%/} -name "*.so" -or -name "*.so.*" | \
 +              while read i ; do
 +                      [[ $(file $i) == *"Mach-O"* ]] && \
 +                              echo "${i#${D}}" >> "${T}/mach-o.check"
 +              done
 +              if [[ -f ${T}/mach-o.check ]] ; then
 +                      f=$(< "${T}/mach-o.check")
 +                      __vecho -ne '\a\n'
 +                      eqawarn "QA Notice: Found .so dynamic libraries on 
Darwin:"
 +                      eqawarn "    ${f//$'\n'/\n    }"
 +              fi
 +              rm -f "${T}/mach-o.check"
 +
 +              # The naming for dynamic libraries is different on Darwin; the
 +              # version component is before the extention, instead of after
 +              # it, as with .sos.  Again, make this a warning only.
 +              rm -f "${T}/mach-o.check"
 +              find ${ED%/} -name "*.dylib.*" | \
 +              while read i ; do
 +                      echo "${i#${D}}" >> "${T}/mach-o.check"
 +              done
 +              if [[ -f "${T}/mach-o.check" ]] ; then
 +                      f=$(< "${T}/mach-o.check")
 +                      __vecho -ne '\a\n'
 +                      eqawarn "QA Notice: Found wrongly named dynamic 
libraries on Darwin:"
 +                      eqawarn "    ${f// /\n    }"
 +              fi
 +              rm -f "${T}/mach-o.check"
 +      fi
 +
 +      install_name_is_relative() {
 +              case $1 in
 +                      "@executable_path/"*)  return 0  ;;
 +                      "@loader_path"/*)      return 0  ;;
 +                      "@rpath/"*)            return 0  ;;
 +                      *)                     return 1  ;;
 +              esac
 +      }
 +
 +      # While we generate the NEEDED files, check that we don't get kernel
 +      # traps at runtime because of broken install_names on Darwin.
 +      rm -f "${T}"/.install_name_check_failed
 +      scanmacho -qyRF '%a;%p;%S;%n' "${D}" | { while IFS= read l ; do
 +              arch=${l%%;*}; l=${l#*;}
 +              obj="/${l%%;*}"; l=${l#*;}
 +              install_name=${l%%;*}; l=${l#*;}
 +              needed=${l%%;*}; l=${l#*;}
 +
 +              ignore=
 +              qa_var="QA_IGNORE_INSTALL_NAME_FILES_${ARCH/-/_}"
 +              eval "[[ -n \${!qa_var} ]] &&
 +                      QA_IGNORE_INSTALL_NAME_FILES=(\"\${${qa_var}[@]}\")"
 +
 +              if [[ ${#QA_IGNORE_INSTALL_NAME_FILES[@]} -gt 1 ]] ; then
 +                      for x in "${QA_IGNORE_INSTALL_NAME_FILES[@]}" ; do
 +                              [[ ${obj##*/} == ${x} ]] && \
 +                                      ignore=true
 +                      done
 +              else
 +                      local shopts=$-
 +                      set -o noglob
 +                      for x in ${QA_IGNORE_INSTALL_NAME_FILES} ; do
 +                              [[ ${obj##*/} == ${x} ]] && \
 +                                      ignore=true
 +                      done
 +                      set +o noglob
 +                      set -${shopts}
 +              fi
 +
 +              # See if the self-reference install_name points to an existing
 +              # and to be installed file.  This usually is a symlink for the
 +              # major version.
 +              if install_name_is_relative ${install_name} ; then
 +                      # try to locate the library in the installed image
 +                      local inpath=${install_name#@*/}
 +                      local libl
 +                      for libl in $(find "${ED}" -name "${inpath##*/}") ; do
 +                              if [[ ${libl} == */${inpath} ]] ; then
 +                                      install_name=/${libl#${D}}
 +                                      break
 +                              fi
 +                      done
 +              fi
 +              if [[ ! -e ${D}${install_name} ]] ; then
 +                      eqawarn "QA Notice: invalid self-reference install_name 
${install_name} in ${obj}"
 +                      # remember we are in an implicit subshell, that's
 +                      # why we touch a file here ... ideally we should be
 +                      # able to die correctly/nicely here
 +                      [[ -z ${ignore} ]] && touch 
"${T}"/.install_name_check_failed
 +              fi
 +
 +              # this is ugly, paths with spaces won't work
 +              for lib in ${needed//,/ } ; do
 +                      if [[ ${lib} == ${D}* ]] ; then
 +                              eqawarn "QA Notice: install_name references 
\${D}: ${lib} in ${obj}"
 +                              [[ -z ${ignore} ]] && touch 
"${T}"/.install_name_check_failed
 +                      elif [[ ${lib} == ${S}* ]] ; then
 +                              eqawarn "QA Notice: install_name references 
\${S}: ${lib} in ${obj}"
 +                              [[ -z ${ignore} ]] && touch 
"${T}"/.install_name_check_failed
 +                      elif ! install_name_is_relative ${lib} && [[ ! -e 
${lib} && ! -e ${D}${lib} ]] ; then
 +                              eqawarn "QA Notice: invalid reference to ${lib} 
in ${obj}"
 +                              [[ -z ${ignore} ]] && touch 
"${T}"/.install_name_check_failed
 +                      fi
 +              done
 +
 +              # backwards compatibility
 +              echo "${obj} ${needed}" >> 
"${PORTAGE_BUILDDIR}"/build-info/NEEDED
 +              # what we use
 +              echo "${arch};${obj};${install_name};${needed}" >> 
"${PORTAGE_BUILDDIR}"/build-info/NEEDED.MACHO.3
 +      done }
 +      if [[ -f ${T}/.install_name_check_failed ]] ; then
 +              # secret switch "allow_broken_install_names" to get
 +              # around this and install broken crap (not a good idea)
 +              has allow_broken_install_names ${FEATURES} || \
 +                      die "invalid install_name found, your application or 
library will crash at runtime"
 +      fi
 +}
 +
 +install_qa_check_pecoff() {
 +      local _pfx_scan="readpecoff ${CHOST}"
 +
 +      # this one uses readpecoff, which supports multiple prefix platforms!
 +      # this is absolutely _not_ optimized for speed, and there may be plenty
 +      # of possibilities by introducing one or the other cache!
 +      if ! has binchecks ${RESTRICT}; then
 +              # copied and adapted from the above scanelf code.
 +              local qa_var insecure_rpath=0 tmp_quiet=${PORTAGE_QUIET}
 +              local f x
 +
 +              # display warnings when using stricter because we die afterwards
 +              if has stricter ${FEATURES} ; then
 +                      unset PORTAGE_QUIET
 +              fi
 +
 +              local _exec_find_opt="-executable"
 +              [[ ${CHOST} == *-winnt* ]] && _exec_find_opt='-name *.dll -o 
-name *.exe'
 +
 +              # Make sure we disallow insecure RUNPATH/RPATH's
 +              # Don't want paths that point to the tree where the package was 
built
 +              # (older, broken libtools would do this).  Also check for null 
paths
 +              # because the loader will search $PWD when it finds null paths.
 +
 +              f=$(
 +                      find "${ED}" -type f '(' ${_exec_find_opt} ')' -print0 
| xargs -0 ${_pfx_scan} | \
 +                      while IFS=";" read arch obj soname rpath needed ; do \
 +                      echo "${rpath}" | grep -E "(${PORTAGE_BUILDDIR}|: 
|::|^:|^ )" > /dev/null 2>&1 \
 +                              && echo "${obj}"; done;
 +              )
 +              # Reject set*id binaries with $ORIGIN in RPATH #260331
 +              x=$(
 +                      find "${ED}" -type f '(' -perm -u+s -o -perm -g+s ')' 
-print0 | \
 +                      xargs -0 ${_pfx_scan} | while IFS=";" read arch obj 
soname rpath needed; do \
 +                      echo "${rpath}" | grep '$ORIGIN' > /dev/null 2>&1 && 
echo "${obj}"; done;
 +              )
 +              if [[ -n ${f}${x} ]] ; then
 +                      __vecho -ne '\a\n'
 +                      eqawarn "QA Notice: The following files contain 
insecure RUNPATH's"
 +                      eqawarn " Please file a bug about this at 
http://bugs.gentoo.org/";
 +                      eqawarn " with the maintaining herd of the package."
 +                      eqawarn "${f}${f:+${x:+\n}}${x}"
 +                      __vecho -ne '\a\n'
 +                      if [[ -n ${x} ]] || has stricter ${FEATURES} ; then
 +                              insecure_rpath=1
 +                      else
 +                              eqawarn "cannot automatically fix runpaths on 
interix platforms!"
 +                      fi
 +              fi
 +
 +              rm -f "${PORTAGE_BUILDDIR}"/build-info/NEEDED
 +              rm -f "${PORTAGE_BUILDDIR}"/build-info/NEEDED.PECOFF.1
 +
 +              # Save NEEDED information after removing self-contained 
providers
 +              find "${ED}" -type f '(' ${_exec_find_opt} ')' -print0 | xargs 
-0 ${_pfx_scan} | { while IFS=';' read arch obj soname rpath needed; do
 +                      # need to strip image dir from object name.
 +                      obj="/${obj#${D}}"
 +                      if [ -z "${rpath}" -o -n "${rpath//*ORIGIN*}" ]; then
 +                              # object doesn't contain $ORIGIN in its runpath 
attribute
 +                              echo "${obj} ${needed}" >> 
"${PORTAGE_BUILDDIR}"/build-info/NEEDED
 +                              echo 
"${arch};${obj};${soname};${rpath};${needed}" >> 
"${PORTAGE_BUILDDIR}"/build-info/NEEDED.PECOFF.1
 +                      else
 +                              dir=${obj%/*}
 +                              # replace $ORIGIN with the dirname of the 
current object for the lookup
 +                              opath=$(echo :${rpath}: | sed -e 
"s#.*:\(.*\)\$ORIGIN\(.*\):.*#\1${dir}\2#")
 +                              sneeded=$(echo ${needed} | tr , ' ')
 +                              rneeded=""
 +                              for lib in ${sneeded}; do
 +                                      found=0
 +                                      for path in ${opath//:/ }; do
 +                                              [ -e "${ED}/${path}/${lib}" ] 
&& found=1 && break
 +                                      done
 +                                      [ "${found}" -eq 0 ] && 
rneeded="${rneeded},${lib}"
 +                              done
 +                              rneeded=${rneeded:1}
 +                              if [ -n "${rneeded}" ]; then
 +                                      echo "${obj} ${rneeded}" >> 
"${PORTAGE_BUILDDIR}"/build-info/NEEDED
 +                                      echo 
"${arch};${obj};${soname};${rpath};${rneeded}" >> 
"${PORTAGE_BUILDDIR}"/build-info/NEEDED.PECOFF.1
 +                              fi
 +                      fi
 +              done }
 +              
 +              if [[ ${insecure_rpath} -eq 1 ]] ; then
 +                      die "Aborting due to serious QA concerns with 
RUNPATH/RPATH"
 +              elif [[ -n ${die_msg} ]] && has stricter ${FEATURES} ; then
 +                      die "Aborting due to QA concerns: ${die_msg}"
 +              fi
 +
 +              local _so_ext='.so*'
 +
 +              case "${CHOST}" in
 +                      *-winnt*) _so_ext=".dll" ;; # no "*" intentionally!
 +              esac
 +
 +              # Run some sanity checks on shared libraries
 +              for d in "${ED}"lib* "${ED}"usr/lib* ; do
 +                      [[ -d "${d}" ]] || continue
 +                      f=$(find "${d}" -name "lib*${_so_ext}" -print0 | \
 +                              xargs -0 ${_pfx_scan} | while IFS=";" read arch 
obj soname rpath needed; \
 +                              do [[ -z "${soname}" ]] && echo "${obj}"; done)
 +                      if [[ -n ${f} ]] ; then
 +                              __vecho -ne '\a\n'
 +                              eqawarn "QA Notice: The following shared 
libraries lack a SONAME"
 +                              eqawarn "${f}"
 +                              __vecho -ne '\a\n'
 +                              sleep 1
 +                      fi
 +
 +                      f=$(find "${d}" -name "lib*${_so_ext}" -print0 | \
 +                              xargs -0 ${_pfx_scan} | while IFS=";" read arch 
obj soname rpath needed; \
 +                              do [[ -z "${needed}" ]] && echo "${obj}"; done)
 +                      if [[ -n ${f} ]] ; then
 +                              __vecho -ne '\a\n'
 +                              eqawarn "QA Notice: The following shared 
libraries lack NEEDED entries"
 +                              eqawarn "${f}"
 +                              __vecho -ne '\a\n'
 +                              sleep 1
 +                      fi
 +              done
 +
 +              PORTAGE_QUIET=${tmp_quiet}
 +      fi
 +}
 +
 +install_qa_check_xcoff() {
 +      if ! has binchecks ${RESTRICT}; then
 +              local tmp_quiet=${PORTAGE_QUIET}
 +              local queryline deplib
 +              local insecure_rpath_list= undefined_symbols_list=
 +
 +              # display warnings when using stricter because we die afterwards
 +              if has stricter ${FEATURES} ; then
 +                      unset PORTAGE_QUIET
 +              fi
 +
 +              rm -f "${PORTAGE_BUILDDIR}"/build-info/NEEDED.XCOFF.1
 +
 +              local neededfd
 +              for neededfd in {3..1024} none; do ( : <&${neededfd} ) 
2>/dev/null || break; done
 +              [[ ${neededfd} != none ]] || die "cannot find free file 
descriptor handle"
 +
 +              eval "exec 
${neededfd}>\"${PORTAGE_BUILDDIR}\"/build-info/NEEDED.XCOFF.1" || die "cannot 
open ${PORTAGE_BUILDDIR}/build-info/NEEDED.XCOFF.1"
 +
 +              (       # work around a problem in /usr/bin/dump (used by 
aixdll-query)
 +                      # dumping core when path names get too long.
 +                      cd "${ED}" >/dev/null &&
 +                      find . -not -type d -exec \
 +                              aixdll-query '{}' FILE MEMBER FLAGS FORMAT 
RUNPATH DEPLIBS ';'
 +              ) > "${T}"/needed 2>/dev/null
 +
 +              # Symlinking shared archive libraries is not a good idea on aix,
 +              # as there is nothing like "soname" on pure filesystem level.
 +              # So we create a copy instead of the symlink.
 +              local prev_FILE=
 +              local FILE MEMBER FLAGS FORMAT RUNPATH DEPLIBS
 +              while read queryline
 +              do
 +                      FILE= MEMBER= FLAGS= FORMAT= RUNPATH= DEPLIBS=
 +                      eval ${queryline}
 +                      FILE=${FILE#./}
 +
 +                      if [[ ${prev_FILE} != ${FILE} ]]; then
 +                              if [[ " ${FLAGS} " == *" SHROBJ "* && -h 
${ED}${FILE} ]]; then
 +                                      prev_FILE=${FILE}
 +                                      local target=$(readlink "${ED}${FILE}")
 +                                      if [[ ${target} == /* ]]; then
 +                                              target=${D}${target}
 +                                      else
 +                                              target=${FILE%/*}/${target}
 +                                      fi
 +                                      rm -f "${ED}${FILE}" || die "cannot 
prune ${FILE}"
 +                                      cp -f "${ED}${target}" "${ED}${FILE}" 
|| die "cannot copy ${target} to ${FILE}"
 +                              fi
 +                      fi
 +              done <"${T}"/needed
 +
 +              prev_FILE=
 +              while read queryline
 +              do
 +                      FILE= MEMBER= FLAGS= FORMAT= RUNPATH= DEPLIBS=
 +                      eval ${queryline}
 +                      FILE=${FILE#./}
 +
 +                      if [[ -n ${MEMBER} && ${prev_FILE} != ${FILE} ]]; then
 +                              # Save NEEDED information for each archive 
library stub
 +                              # even if it is static only: the already 
installed archive
 +                              # may contain shared objects to be preserved.
 +                              echo "${FORMAT##* 
}${FORMAT%%-*};${EPREFIX}/${FILE};${FILE##*/};;" >&${neededfd}
 +                      fi
 +                      prev_FILE=${FILE}
 +
 +                      # shared objects have both EXEC and SHROBJ flags,
 +                      # while executables have EXEC flag only.
 +                      [[ " ${FLAGS} " == *" EXEC "* ]] || continue
 +
 +                      # Make sure we disallow insecure RUNPATH's
 +                      # Don't want paths that point to the tree where the 
package was built
 +                      # (older, broken libtools would do this).  Also check 
for null paths
 +                      # because the loader will search $PWD when it finds 
null paths.
 +                      # And we really want absolute paths only.
 +                      if [[ -n $(echo ":${RUNPATH}:" | grep -E 
"(${PORTAGE_BUILDDIR}|::|:[^/])") ]]; then
 +                              
insecure_rpath_list="${insecure_rpath_list}\n${FILE}${MEMBER:+[${MEMBER}]}"
 +                      fi
 +
 +                      local needed=
 +                      [[ -n ${MEMBER} ]] && needed=${FILE##*/}
 +                      for deplib in ${DEPLIBS}; do
 +                              eval deplib=${deplib}
 +                              if [[ ${deplib} == '.' || ${deplib} == '..' ]]; 
then
 +                                      # Although we do have runtime linking, 
we don't want undefined symbols.
 +                                      # AIX does indicate this by needing 
either '.' or '..'
 +                                      
undefined_symbols_list="${undefined_symbols_list}\n${FILE}"
 +                              else
 +                                      needed="${needed}${needed:+,}${deplib}"
 +                              fi
 +                      done
 +
 +                      FILE=${EPREFIX}/${FILE}
 +
 +                      [[ -n ${MEMBER} ]] && MEMBER="[${MEMBER}]"
 +                      # Save NEEDED information
 +                      echo "${FORMAT##* 
}${FORMAT%%-*};${FILE}${MEMBER};${FILE##*/}${MEMBER};${RUNPATH};${needed}" 
>&${neededfd}
 +              done <"${T}"/needed
 +
 +              eval "exec ${neededfd}>&-" || die "cannot close handle to 
${PORTAGE_BUILDDIR}/build-info/NEEDED.XCOFF.1"
 +
 +              if [[ -n ${undefined_symbols_list} ]]; then
 +                      __vecho -ne '\a\n'
 +                      eqawarn "QA Notice: The following files contain 
undefined symbols."
 +                      eqawarn " Please file a bug about this at 
http://bugs.gentoo.org/";
 +                      eqawarn " with 'prefix' as the maintaining herd of the 
package."
 +                      eqawarn "${undefined_symbols_list}"
 +                      __vecho -ne '\a\n'
 +              fi
 +
 +              if [[ -n ${insecure_rpath_list} ]] ; then
 +                      __vecho -ne '\a\n'
 +                      eqawarn "QA Notice: The following files contain 
insecure RUNPATH's"
 +                      eqawarn " Please file a bug about this at 
http://bugs.gentoo.org/";
 +                      eqawarn " with 'prefix' as the maintaining herd of the 
package."
 +                      eqawarn "${insecure_rpath_list}"
 +                      __vecho -ne '\a\n'
 +                      if has stricter ${FEATURES} ; then
 +                              insecure_rpath=1
 +                      fi
 +              fi
 +
 +              if [[ ${insecure_rpath} -eq 1 ]] ; then
 +                      die "Aborting due to serious QA concerns with 
RUNPATH/RPATH"
 +              elif [[ -n ${die_msg} ]] && has stricter ${FEATURES} ; then
 +                      die "Aborting due to QA concerns: ${die_msg}"
 +              fi
 +
 +              PORTAGE_QUIET=${tmp_quiet}
 +      fi
 +}
 +
+ postinst_qa_check() {
+       local d f paths qa_checks=()
+       if ! ___eapi_has_prefix_variables; then
+               local EPREFIX= EROOT=${ROOT}
+       fi
+ 
+       cd "${EROOT}" || die "cd failed"
+ 
+       # Collect the paths for QA checks, highest prio first.
+       paths=(
+               # sysadmin overrides
+               "${PORTAGE_OVERRIDE_EPREFIX}"/usr/local/lib/postinst-qa-check.d
+               # system-wide package installs
+               "${PORTAGE_OVERRIDE_EPREFIX}"/usr/lib/postinst-qa-check.d
+       )
+ 
+       # Now repo-specific checks.
+       # (yes, PORTAGE_ECLASS_LOCATIONS contains repo paths...)
+       for d in "${PORTAGE_ECLASS_LOCATIONS[@]}"; do
+               paths+=(
+                       "${d}"/metadata/postinst-qa-check.d
+               )
+       done
+ 
+       paths+=(
+               # Portage built-in checks
+               
"${PORTAGE_OVERRIDE_EPREFIX}"/usr/lib/portage/postinst-qa-check.d
+               "${PORTAGE_BIN_PATH}"/postinst-qa-check.d
+       )
+ 
+       # Collect file names of QA checks. We need them early to support
+       # overrides properly.
+       for d in "${paths[@]}"; do
+               for f in "${d}"/*; do
+                       [[ -f ${f} ]] && qa_checks+=( "${f##*/}" )
+               done
+       done
+ 
+       # Now we need to sort the filenames lexically, and process
+       # them in order.
+       while read -r -d '' f; do
+               # Find highest priority file matching the basename.
+               for d in "${paths[@]}"; do
+                       [[ -f ${d}/${f} ]] && break
+               done
+ 
+               # Run in a subshell to treat it like external script,
+               # but use 'source' to pass all variables through.
+               (
+                       # Allow inheriting eclasses.
+                       # XXX: we want this only in repository-wide checks.
+                       _IN_INSTALL_QA_CHECK=1
+                       source "${d}/${f}" || eerror "Post-postinst QA check 
${f} failed to run"
+               )
+       done < <(printf "%s\0" "${qa_checks[@]}" | LC_ALL=C sort -u -z)
+ }
+ 
  install_mask() {
        local root="$1"
        shift
diff --cc bin/portageq
index 616aee085,0ac124fde..3518a0af0
--- a/bin/portageq
+++ b/bin/portageq
@@@ -1,4 -1,4 +1,4 @@@
- #!@PREFIX_PORTAGE_PYTHON@ -bO
 -#!/usr/bin/python -b
++#!@PREFIX_PORTAGE_PYTHON@ -b
  # Copyright 1999-2016 Gentoo Foundation
  # Distributed under the terms of the GNU General Public License v2
  
diff --cc pym/portage/package/ebuild/doebuild.py
index c6d613311,ac697a763..a5adf2c92
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@@ -1817,7 -1741,7 +1817,8 @@@ _post_phase_cmds = 
                ],
  
        "postinst" : [
-               "postinst_aix"]
++              "postinst_aix",
+               "postinst_qa_check"],
  }
  
  def _post_phase_userpriv_perms(mysettings):

Reply via email to