* [gentoo-commits] proj/portage:prefix commit in: lib/portage/package/ebuild/_config/, lib/portage/package/ebuild/, ...
@ 2022-07-24 19:56 Fabian Groffen
0 siblings, 0 replies; only message in thread
From: Fabian Groffen @ 2022-07-24 19:56 UTC (permalink / raw
To: gentoo-commits
commit: 11ddc8c2e74eb34c10887d006af248edb3ca7fb6
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 24 19:55:07 2022 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Jul 24 19:55:07 2022 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=11ddc8c2
*: drop support for AIX, HP-UX and FreeMiNT
Support for these arches was long ago dropped from the tree, drop the
additional burden on the Portage codebase.
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
bin/install-qa-check.d/80libraries | 7 +-
bin/misc-functions.sh | 348 +--------------------
lib/portage/dbapi/vartree.py | 5 -
.../package/ebuild/_config/special_env_vars.py | 2 -
lib/portage/package/ebuild/doebuild.py | 2 -
lib/portage/util/_dyn_libs/LinkageMapXCoff.py | 312 ------------------
lib/portage/util/_pty.py | 10 +-
7 files changed, 6 insertions(+), 680 deletions(-)
diff --git a/bin/install-qa-check.d/80libraries b/bin/install-qa-check.d/80libraries
index 15249f67e..a477ec9cb 100644
--- a/bin/install-qa-check.d/80libraries
+++ b/bin/install-qa-check.d/80libraries
@@ -157,12 +157,7 @@ lib_check() {
[[ ${abort} == "yes" ]] && die "add those ldscripts"
# Make sure people don't store libtool files or static libs in /lib
- # PREFIX LOCAL: on AIX, "dynamic libs" have extension .a, so don't
- # get false positives
- [[ ${CHOST} == *-aix* ]] \
- && f=$(ls "${ED%/}"lib*/*.la 2>/dev/null || true) \
- || f=$(ls "${ED%/}"lib*/*.{a,la} 2>/dev/null)
- # END PREFIX LOCAL
+ f=$(ls "${ED%/}"/lib*/*.{a,la} 2>/dev/null)
if [[ -n ${f} ]] ; then
__vecho -ne '\n'
eqawarn "QA Notice: Excessive files found in the / partition"
diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
index a77b3bcfc..8fcc23588 100755
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@ -169,17 +169,13 @@ install_qa_check() {
if [[ -d ${ED} ]] ; then
case ${CHOST} in
*-darwin*)
- # Mach-O platforms (NeXT, Darwin, OSX)
+ # Mach-O platforms (NeXT, Darwin, OSX/macOS)
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.)
@@ -565,139 +561,6 @@ install_qa_check_pecoff() {
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
-}
-
__dyn_instprep() {
if [[ -e ${PORTAGE_BUILDDIR}/.instprepped ]] ; then
__vecho ">>> It appears that '$PF' is already instprepped; skipping."
@@ -848,215 +711,6 @@ install_mask() {
set -${shopts}
}
-preinst_aix() {
- if [[ ${CHOST} != *-aix* ]] || has binchecks ${RESTRICT}; then
- return 0
- fi
- local ar strip
- if type ${CHOST}-ar >/dev/null 2>&1 && type ${CHOST}-strip >/dev/null 2>&1; then
- ar=${CHOST}-ar
- strip=${CHOST}-strip
- elif [[ ${CBUILD} == "${CHOST}" ]] && type ar >/dev/null 2>&1 && type strip >/dev/null 2>&1; then
- ar=ar
- strip=strip
- elif [[ -x /usr/ccs/bin/ar && -x /usr/ccs/bin/strip ]]; then
- ar=/usr/ccs/bin/ar
- strip=/usr/ccs/bin/strip
- else
- die "cannot find where to use 'ar' and 'strip' from"
- fi
- local archives_members= archives=() helperfiles=()
- local archive_member soname runpath needed archive contentmember
- while read archive_member; do
- archive_member=${archive_member#*;${EPREFIX}/} # drop "^type;EPREFIX/"
- soname=${archive_member#*;}
- runpath=${soname#*;}
- needed=${runpath#*;}
- soname=${soname%%;*}
- runpath=${runpath%%;*}
- archive_member=${archive_member%%;*} # drop ";soname;runpath;needed$"
- archive=${archive_member%[*}
- if [[ ${archive_member} != *'['*']' ]]; then
- if [[ "${soname};${runpath};${needed}" == "${archive##*/};;" && -e ${EROOT}${archive} ]]; then
- # most likely is an archive stub that already exists,
- # may have to preserve members being a shared object.
- archives[${#archives[@]}]=${archive}
- fi
- continue
- fi
- archives_members="${archives_members}:(${archive_member}):"
- contentmember="${archive%/*}/.${archive##*/}${archive_member#${archive}}"
- # portage does os.lstat() on merged files every now
- # and then, so keep stamp-files for archive members
- # around to get the preserve-libs feature working.
- helperfiles[${#helperfiles[@]}]=${ED}${contentmember}
- done < "${PORTAGE_BUILDDIR}"/build-info/NEEDED.XCOFF.1
- if [[ ${#helperfiles[@]} > 0 ]]; then
- rm -f "${helperfiles[@]}" || die "cannot prune ${helperfiles[@]}"
- local f prev=
- for f in "${helperfiles[@]}"
- do
- if [[ -z ${prev} ]]; then
- { echo "Please leave this file alone, it is an important helper"
- echo "for portage to implement the 'preserve-libs' feature on AIX."
- } > "${f}" || die "cannot create ${f}"
- chmod 0400 "${f}" || die "cannot chmod ${f}"
- prev=${f}
- else
- ln "${prev}" "${f}" || die "cannot create hardlink ${f}"
- fi
- done
- fi
-
- local preservemembers libmetadir prunedirs=()
- local FILE MEMBER FLAGS
- for archive in "${archives[@]}"; do
- preservemembers=
- while read line; do
- [[ -n ${line} ]] || continue
- FILE= MEMBER= FLAGS=
- eval ${line}
- [[ ${FILE} == ${EROOT}${archive} ]] ||
- die "invalid result of aixdll-query for ${EROOT}${archive}"
- [[ -n ${MEMBER} && " ${FLAGS} " == *" SHROBJ "* ]] || continue
- [[ ${archives_members} == *":(${archive}[${MEMBER}]):"* ]] && continue
- preservemembers="${preservemembers} ${MEMBER}"
- done <<-EOF
- $(aixdll-query "${EROOT}${archive}" FILE MEMBER FLAGS)
- EOF
- [[ -n ${preservemembers} ]] || continue
- einfo "preserving (on spec) ${archive}[${preservemembers# }]"
- libmetadir=${ED}${archive%/*}/.${archive##*/}
- mkdir "${libmetadir}" || die "cannot create ${libmetadir}"
- pushd "${libmetadir}" >/dev/null || die "cannot cd to ${libmetadir}"
- ${ar} -X32_64 -x "${EROOT}${archive}" ${preservemembers} || die "cannot unpack ${EROOT}${archive}"
- chmod u+w ${preservemembers} || die "cannot chmod${preservemembers}"
- ${strip} -X32_64 -e ${preservemembers} || die "cannot strip${preservemembers}"
- ${ar} -X32_64 -q "${ED}${archive}" ${preservemembers} || die "cannot update ${archive}"
- eend $?
- popd >/dev/null || die "cannot leave ${libmetadir}"
- prunedirs[${#prunedirs[@]}]=${libmetadir}
- done
- [[ ${#prunedirs[@]} == 0 ]] ||
- rm -rf "${prunedirs[@]}" || die "cannot prune ${prunedirs[@]}"
- return 0
-}
-
-postinst_aix() {
- if [[ ${CHOST} != *-aix* ]] || has binchecks ${RESTRICT}; then
- return 0
- fi
- local MY_PR=${PR%r0}
- local ar strip
- if type ${CHOST}-ar >/dev/null 2>&1 && type ${CHOST}-strip >/dev/null 2>&1; then
- ar=${CHOST}-ar
- strip=${CHOST}-strip
- elif [[ ${CBUILD} == "${CHOST}" ]] && type ar >/dev/null 2>&1 && type strip >/dev/null 2>&1; then
- ar=ar
- strip=strip
- elif [[ -x /usr/ccs/bin/ar && -x /usr/ccs/bin/strip ]]; then
- ar=/usr/ccs/bin/ar
- strip=/usr/ccs/bin/strip
- else
- die "cannot find where to use 'ar' and 'strip' from"
- fi
- local archives_members= archives=() activearchives=
- local archive_member soname runpath needed
- while read archive_member; do
- archive_member=${archive_member#*;${EPREFIX}/} # drop "^type;EPREFIX/"
- soname=${archive_member#*;}
- runpath=${soname#*;}
- needed=${runpath#*;}
- soname=${soname%%;*}
- runpath=${runpath%%;*}
- archive_member=${archive_member%%;*} # drop ";soname;runpath;needed$"
- [[ ${archive_member} == *'['*']' ]] && continue
- [[ "${soname};${runpath};${needed}" == "${archive_member##*/};;" ]] || continue
- # most likely is an archive stub, we might have to
- # drop members being preserved shared objects.
- archives[${#archives[@]}]=${archive_member}
- activearchives="${activearchives}:(${archive_member}):"
- done < "${PORTAGE_BUILDDIR}"/build-info/NEEDED.XCOFF.1
-
- local type allcontentmembers= oldarchives=()
- local contentmember
- while read type contentmember; do
- [[ ${type} == 'obj' ]] || continue
- contentmember=${contentmember% *} # drop " timestamp$"
- contentmember=${contentmember% *} # drop " hash$"
- [[ ${contentmember##*/} == *'['*']' ]] || continue
- contentmember=${contentmember#${EPREFIX}/}
- allcontentmembers="${allcontentmembers}:(${contentmember}):"
- contentmember=${contentmember%[*}
- contentmember=${contentmember%/.*}/${contentmember##*/.}
- [[ ${activearchives} == *":(${contentmember}):"* ]] && continue
- oldarchives[${#oldarchives[@]}]=${contentmember}
- done < "${EPREFIX}/var/db/pkg/${CATEGORY}/${P}${MY_PR:+-}${MY_PR}/CONTENTS"
-
- local archive line delmembers
- local FILE MEMBER FLAGS
- for archive in "${archives[@]}"; do
- [[ -r ${EROOT}${archive} && -w ${EROOT}${archive} ]] ||
- chmod a+r,u+w "${EROOT}${archive}" || die "cannot chmod ${EROOT}${archive}"
- delmembers=
- while read line; do
- [[ -n ${line} ]] || continue
- FILE= MEMBER= FLAGS=
- eval ${line}
- [[ ${FILE} == "${EROOT}${archive}" ]] ||
- die "invalid result '${FILE}' of aixdll-query, expected '${EROOT}${archive}'"
- [[ -n ${MEMBER} && " ${FLAGS} " == *" SHROBJ "* ]] || continue
- [[ ${allcontentmembers} == *":(${archive%/*}/.${archive##*/}[${MEMBER}]):"* ]] && continue
- delmembers="${delmembers} ${MEMBER}"
- done <<-EOF
- $(aixdll-query "${EROOT}${archive}" FILE MEMBER FLAGS)
- EOF
- [[ -n ${delmembers} ]] || continue
- einfo "dropping ${archive}[${delmembers# }]"
- rm -f "${EROOT}${archive}".new || die "cannot prune ${EROOT}${archive}.new"
- cp "${EROOT}${archive}" "${EROOT}${archive}".new || die "cannot backup ${archive}"
- ${ar} -X32_64 -z -o -d "${EROOT}${archive}".new ${delmembers} || die "cannot remove${delmembers} from ${archive}.new"
- mv -f "${EROOT}${archive}".new "${EROOT}${archive}" || die "cannot put ${EROOT}${archive} in place"
- eend $?
- done
- local libmetadir keepmembers prunedirs=()
- for archive in "${oldarchives[@]}"; do
- [[ -r ${EROOT}${archive} && -w ${EROOT}${archive} ]] ||
- chmod a+r,u+w "${EROOT}${archive}" || die "cannot chmod ${EROOT}${archive}"
- keepmembers=
- while read line; do
- FILE= MEMBER= FLAGS=
- eval ${line}
- [[ ${FILE} == "${EROOT}${archive}" ]] ||
- die "invalid result of aixdll-query for ${EROOT}${archive}"
- [[ -n ${MEMBER} && " ${FLAGS} " == *" SHROBJ "* ]] || continue
- [[ ${allcontentmembers} == *":(${archive%/*}/.${archive##*/}[${MEMBER}]):"* ]] || continue
- keepmembers="${keepmembers} ${MEMBER}"
- done <<-EOF
- $(aixdll-query "${EROOT}${archive}" FILE MEMBER FLAGS)
- EOF
-
- if [[ -n ${keepmembers} ]]; then
- einfo "preserving (extra)${keepmembers}"
- libmetadir=${EROOT}${archive%/*}/.${archive##*/}
- [[ ! -e ${libmetadir} ]] || rm -rf "${libmetadir}" || die "cannot prune ${libmetadir}"
- mkdir "${libmetadir}" || die "cannot create ${libmetadir}"
- pushd "${libmetadir}" >/dev/null || die "cannot cd to ${libmetadir}"
- ${ar} -X32_64 -x "${EROOT}${archive}" ${keepmembers} || die "cannot unpack ${archive}"
- ${strip} -X32_64 -e ${keepmembers} || die "cannot strip ${keepmembers}"
- rm -f "${EROOT}${archive}.new" || die "cannot prune ${EROOT}${archive}.new"
- ${ar} -X32_64 -q "${EROOT}${archive}.new" ${keepmembers} || die "cannot create ${EROOT}${archive}.new"
- mv -f "${EROOT}${archive}.new" "${EROOT}${archive}" || die "cannot put ${EROOT}${archive} in place"
- popd > /dev/null || die "cannot leave ${libmetadir}"
- prunedirs[${#prunedirs[@]}]=${libmetadir}
- eend $?
- fi
- done
- [[ ${#prunedirs[@]} == 0 ]] ||
- rm -rf "${prunedirs[@]}" || die "cannot prune ${prunedirs[@]}"
- return 0
-}
-
preinst_mask() {
# Remove man pages, info pages, docs if requested. This is
# implemented in bash in order to respect INSTALL_MASK settings
diff --git a/lib/portage/dbapi/vartree.py b/lib/portage/dbapi/vartree.py
index c9a4b19ab..7a41fae01 100644
--- a/lib/portage/dbapi/vartree.py
+++ b/lib/portage/dbapi/vartree.py
@@ -41,7 +41,6 @@ portage.proxy.lazyimport.lazyimport(
# BEGIN PREFIX LOCAL
'portage.util._dyn_libs.LinkageMapMachO:LinkageMapMachO',
'portage.util._dyn_libs.LinkageMapPeCoff:LinkageMapPeCoff',
- 'portage.util._dyn_libs.LinkageMapXCoff:LinkageMapXCoff',
# END PREFIX LOCAL
"portage.util._dyn_libs.NeededEntry:NeededEntry",
"portage.util._async.SchedulerInterface:SchedulerInterface",
@@ -249,8 +248,6 @@ class vardbapi(dbapi):
self._linkmap = LinkageMapMachO(self)
elif chost.find('interix') >= 0 or chost.find('winnt') >= 0:
self._linkmap = LinkageMapPeCoff(self)
- elif chost.find('aix') >= 0:
- self._linkmap = LinkageMapXCoff(self)
else:
self._linkmap = LinkageMap(self)
# END PREFIX LOCAL
@@ -3777,8 +3774,6 @@ class dblink:
node = LinkageMapMachO._LibGraphNode(linkmap._obj_key(path))
elif chost.find('interix') >= 0 or chost.find('winnt') >= 0:
node = LinkageMapPeCoff._LibGraphNode(linkmap._obj_key(path))
- elif chost.find('aix') >= 0:
- node = LinkageMapXCoff._LibGraphNode(linkmap._obj_key(path))
else:
node = LinkageMap._LibGraphNode(linkmap._obj_key(path))
# END PREFIX LOCAL
diff --git a/lib/portage/package/ebuild/_config/special_env_vars.py b/lib/portage/package/ebuild/_config/special_env_vars.py
index a192fa80b..d974325e0 100644
--- a/lib/portage/package/ebuild/_config/special_env_vars.py
+++ b/lib/portage/package/ebuild/_config/special_env_vars.py
@@ -247,8 +247,6 @@ environ_whitelist += [
"STY",
"WINDOW",
"XAUTHORITY",
- # PREFIX LOCAL: UNIXMODE is necessary for MiNT
- "UNIXMODE",
]
environ_whitelist = frozenset(environ_whitelist)
diff --git a/lib/portage/package/ebuild/doebuild.py b/lib/portage/package/ebuild/doebuild.py
index 6f48dfd2d..e9d7a858f 100644
--- a/lib/portage/package/ebuild/doebuild.py
+++ b/lib/portage/package/ebuild/doebuild.py
@@ -2316,7 +2316,6 @@ _post_phase_cmds = {
{},
[
# PREFIX LOCAL
- "preinst_aix",
"preinst_sfperms",
"preinst_suid_scan",
"preinst_qa_check",
@@ -2325,7 +2324,6 @@ _post_phase_cmds = {
),
"postinst": [
# PREFIX LOCAL
- "postinst_aix",
"postinst_qa_check",
],
}
diff --git a/lib/portage/util/_dyn_libs/LinkageMapXCoff.py b/lib/portage/util/_dyn_libs/LinkageMapXCoff.py
deleted file mode 100644
index 6c4c994b5..000000000
--- a/lib/portage/util/_dyn_libs/LinkageMapXCoff.py
+++ /dev/null
@@ -1,312 +0,0 @@
-# Copyright 1998-2011 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-import errno
-import logging
-import subprocess
-
-import portage
-from portage import _encodings
-from portage import _os_merge
-from portage import _unicode_decode
-from portage import _unicode_encode
-from portage.cache.mappings import slot_dict_class
-from portage.exception import CommandNotFound
-from portage.localization import _
-from portage.util import getlibpaths
-from portage.util import grabfile
-from portage.util import normalize_path
-from portage.util import writemsg_level
-from portage.const import EPREFIX, BASH_BINARY
-from portage.util._dyn_libs.LinkageMapELF import LinkageMapELF
-
-class LinkageMapXCoff(LinkageMapELF):
-
- """Models dynamic linker dependencies."""
-
- _needed_aux_key = "NEEDED.XCOFF.1"
-
- class _ObjectKey(LinkageMapELF._ObjectKey):
-
- def __init__(self, obj, root):
- LinkageMapELF._ObjectKey.__init__(self, obj, root)
-
- def _generate_object_key(self, obj, root):
- """
- Generate object key for a given object.
-
- @param object: path to a file
- @type object: string (example: '/usr/bin/bar')
- @rtype: 2-tuple of types (long, int) if object exists. string if
- object does not exist.
- @return:
- 1. 2-tuple of object's inode and device from a stat call, if object
- exists.
- 2. realpath of object if object does not exist.
-
- """
-
- os = _os_merge
-
- try:
- _unicode_encode(obj,
- encoding=_encodings['merge'], errors='strict')
- except UnicodeEncodeError:
- # The package appears to have been merged with a
- # different value of sys.getfilesystemencoding(),
- # so fall back to utf_8 if appropriate.
- try:
- _unicode_encode(obj,
- encoding=_encodings['fs'], errors='strict')
- except UnicodeEncodeError:
- pass
- else:
- os = portage.os
-
- abs_path = os.path.join(root, obj.lstrip(os.sep))
- try:
- object_stat = os.stat(abs_path)
- except OSError:
- # Use the realpath as the key if the file does not exists on the
- # filesystem.
- return os.path.realpath(abs_path)
- # Return a tuple of the device and inode, as well as the basename,
- # because of hardlinks (notably for the .libNAME[shr.o] helpers)
- # the device and inode might be identical.
- return (object_stat.st_dev, object_stat.st_ino, os.path.basename(abs_path.rstrip(os.sep)))
-
- class _LibGraphNode(_ObjectKey):
- __slots__ = ("alt_paths",)
-
- def __init__(self, key):
- """
- Create a _LibGraphNode from an existing _ObjectKey.
- This re-uses the _key attribute in order to avoid repeating
- any previous stat calls, which helps to avoid potential race
- conditions due to inconsistent stat results when the
- file system is being modified concurrently.
- """
- self._key = key._key
- self.alt_paths = set()
-
- def __str__(self):
- return str(sorted(self.alt_paths))
-
- def rebuild(self, exclude_pkgs=None, include_file=None,
- preserve_paths=None):
- """
- Raises CommandNotFound if there are preserved libs
- and the scanelf binary is not available.
-
- @param exclude_pkgs: A set of packages that should be excluded from
- the LinkageMap, since they are being unmerged and their NEEDED
- entries are therefore irrelevant and would only serve to corrupt
- the LinkageMap.
- @type exclude_pkgs: set
- @param include_file: The path of a file containing NEEDED entries for
- a package which does not exist in the vardbapi yet because it is
- currently being merged.
- @type include_file: String
- @param preserve_paths: Libraries preserved by a package instance that
- is currently being merged. They need to be explicitly passed to the
- LinkageMap, since they are not registered in the
- PreservedLibsRegistry yet.
- @type preserve_paths: set
- """
-
- os = _os_merge
- root = self._root
- root_len = len(root) - 1
- self._clear_cache()
- self._defpath.update(getlibpaths(self._root, env=self._dbapi.settings))
- libs = self._libs
- obj_properties = self._obj_properties
-
- lines = []
-
- # Data from include_file is processed first so that it
- # overrides any data from previously installed files.
- if include_file is not None:
- for line in grabfile(include_file):
- lines.append((None, include_file, line))
-
- aux_keys = [self._needed_aux_key]
- can_lock = os.access(os.path.dirname(self._dbapi._dbroot), os.W_OK)
- if can_lock:
- self._dbapi.lock()
- try:
- for cpv in self._dbapi.cpv_all():
- if exclude_pkgs is not None and cpv in exclude_pkgs:
- continue
- needed_file = self._dbapi.getpath(cpv,
- filename=self._needed_aux_key)
- for line in self._dbapi.aux_get(cpv, aux_keys)[0].splitlines():
- lines.append((cpv, needed_file, line))
- finally:
- if can_lock:
- self._dbapi.unlock()
-
- # have to call scanelf for preserved libs here as they aren't
- # registered in NEEDED.XCOFF.1 files
- plibs = {}
- if preserve_paths is not None:
- plibs.update((x, None) for x in preserve_paths)
- if self._dbapi._plib_registry and \
- self._dbapi._plib_registry.hasEntries():
- for cpv, items in \
- self._dbapi._plib_registry.getPreservedLibs().items():
- if exclude_pkgs is not None and cpv in exclude_pkgs:
- # These preserved libs will either be unmerged,
- # rendering them irrelevant, or they will be
- # preserved in the replacement package and are
- # already represented via the preserve_paths
- # parameter.
- continue
- plibs.update((x, cpv) for x in items)
- if plibs:
- args = [BASH_BINARY , "-c" , ':'
- + '; for member in "$@"'
- + '; do archive=${member}'
- + '; if [[ ${member##*/} == .*"["*"]" ]]'
- + '; then member=${member%/.*}/${member##*/.}'
- + '; archive=${member%[*}'
- + '; fi'
- + '; member=${member#${archive}}'
- + '; [[ -r ${archive} ]] || chmod a+r "${archive}"'
- + '; eval $(aixdll-query "${archive}${member}" FILE MEMBER FLAGS FORMAT RUNPATH DEPLIBS)'
- + '; [[ -n ${member} ]] && needed=${FILE##*/} || needed='
- + '; for deplib in ${DEPLIBS}'
- + '; do eval deplib=${deplib}'
- + '; if [[ ${deplib} != "." && ${deplib} != ".." ]]'
- + '; then needed="${needed}${needed:+,}${deplib}"'
- + '; fi'
- + '; done'
- + '; [[ -n ${MEMBER} ]] && MEMBER="[${MEMBER}]"'
- + '; [[ " ${FLAGS} " == *" SHROBJ "* ]] && soname=${FILE##*/}${MEMBER} || soname='
- + '; case ${member:+y}:${MEMBER:+y}'
- # member requested, member found: show shared archive member
- + ' in y:y) echo "${FORMAT##* }${FORMAT%%-*};${FILE#${ROOT%/}}${MEMBER};${soname};${RUNPATH};${needed}"'
- # no member requested, member found: show archive
- + ' ;; :y) echo "${FORMAT##* }${FORMAT%%-*};${FILE#${ROOT%/}};${FILE##*/};;"'
- # no member requested, no member found: show standalone shared object
- + ' ;; : ) echo "${FORMAT##* }${FORMAT%%-*};${FILE#${ROOT%/}};${FILE##*/};${RUNPATH};${needed}"'
- # member requested, no member found: ignore archive replaced by standalone shared object
- + ' ;; y: )'
- + ' ;; esac'
- + '; done'
- , 'aixdll-query'
- ]
- args.extend(os.path.join(root, x.lstrip("." + os.sep)) \
- for x in plibs)
- try:
- proc = subprocess.Popen(args, stdout=subprocess.PIPE)
- except EnvironmentError as e:
- if e.errno != errno.ENOENT:
- raise
- raise CommandNotFound(args[0])
- else:
- for l in proc.stdout:
- try:
- l = _unicode_decode(l,
- encoding=_encodings['content'], errors='strict')
- except UnicodeDecodeError:
- l = _unicode_decode(l,
- encoding=_encodings['content'], errors='replace')
- writemsg_level(_("\nError decoding characters " \
- "returned from aixdll-query: %s\n\n") % (l,),
- level=logging.ERROR, noiselevel=-1)
- l = l.rstrip("\n")
- if not l:
- continue
- fields = l.split(";")
- if len(fields) < 5:
- writemsg_level(_("\nWrong number of fields " \
- "returned from aixdll-query: %s\n\n") % (l,),
- level=logging.ERROR, noiselevel=-1)
- continue
- fields[1] = fields[1][root_len:]
- owner = plibs.pop(fields[1], None)
- lines.append((owner, "aixdll-query", ";".join(fields)))
- proc.wait()
- proc.stdout.close()
-
- # Share identical frozenset instances when available,
- # in order to conserve memory.
- frozensets = {}
-
- for owner, location, l in lines:
- l = l.rstrip("\n")
- if not l:
- continue
- fields = l.split(";")
- if len(fields) < 5:
- writemsg_level(_("\nWrong number of fields " \
- "in %s: %s\n\n") % (location, l),
- level=logging.ERROR, noiselevel=-1)
- continue
- arch = fields[0]
-
- def as_contentmember(obj):
- if obj.endswith("]"):
- if obj.find("/") >= 0:
- if obj[obj.rfind("/")+1] == ".":
- return obj
- return obj[:obj.rfind("/")] + "/." + obj[obj.rfind("/")+1:]
- if obj[0] == ".":
- return obj
- return "." + obj
- return obj
-
- obj = as_contentmember(fields[1])
- soname = as_contentmember(fields[2])
- path = frozenset(normalize_path(x) \
- for x in filter(None, fields[3].replace(
- "${ORIGIN}", os.path.dirname(obj)).replace(
- "$ORIGIN", os.path.dirname(obj)).split(":")))
- path = frozensets.setdefault(path, path)
- needed = frozenset(as_contentmember(x) for x in fields[4].split(",") if x)
- needed = frozensets.setdefault(needed, needed)
-
- obj_key = self._obj_key(obj)
- indexed = True
- myprops = obj_properties.get(obj_key)
- if myprops is None:
- indexed = False
- myprops = self._obj_properties_class(
- arch, needed, path, soname, [], owner)
- obj_properties[obj_key] = myprops
- # All object paths are added into the obj_properties tuple.
- myprops.alt_paths.append(obj)
-
- # Don't index the same file more that once since only one
- # set of data can be correct and therefore mixing data
- # may corrupt the index (include_file overrides previously
- # installed).
- if indexed:
- continue
-
- arch_map = libs.get(arch)
- if arch_map is None:
- arch_map = {}
- libs[arch] = arch_map
- if soname:
- soname_map = arch_map.get(soname)
- if soname_map is None:
- soname_map = self._soname_map_class(
- providers=[], consumers=[])
- arch_map[soname] = soname_map
- soname_map.providers.append(obj_key)
- for needed_soname in needed:
- soname_map = arch_map.get(needed_soname)
- if soname_map is None:
- soname_map = self._soname_map_class(
- providers=[], consumers=[])
- arch_map[needed_soname] = soname_map
- soname_map.consumers.append(obj_key)
-
- for arch, sonames in libs.items():
- for soname_node in sonames.values():
- soname_node.providers = tuple(set(soname_node.providers))
- soname_node.consumers = tuple(set(soname_node.consumers))
-
- pass
diff --git a/lib/portage/util/_pty.py b/lib/portage/util/_pty.py
index 1fd846dd1..e58f95e0a 100644
--- a/lib/portage/util/_pty.py
+++ b/lib/portage/util/_pty.py
@@ -9,14 +9,12 @@ from portage import os
from portage.output import get_term_size, set_term_size
from portage.util import writemsg
-# BEGIN PREFIX LOCAL: disable on more platforms
-# Disable the use of openpty on Solaris (and others) as it seems Python's
-# openpty implementation doesn't play nice with Portage's behaviour,
-# causing hangs/deadlocks.
+# Disable the use of openpty on Solaris as it seems Python's openpty
+# implementation doesn't play nice on Solaris with Portage's
+# behaviour causing hangs/deadlocks.
# Additional note for the future: on Interix, pipes do NOT work, so
# _disable_openpty on Interix must *never* be True
-_disable_openpty = platform.system() in ("AIX","FreeMiNT","HP-UX","SunOS",)
-# END PREFIX LOCAL
+_disable_openpty = platform.system() in ("SunOS",)
_fbsd_test_pty = platform.system() == "FreeBSD"
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-07-24 19:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-24 19:56 [gentoo-commits] proj/portage:prefix commit in: lib/portage/package/ebuild/_config/, lib/portage/package/ebuild/, Fabian Groffen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox