From: Fabian Groffen Date: Mon, 2 May 2011 17:38:24 +0000 (+0200) Subject: Merge remote-tracking branch 'overlays-gentoo-org/master' into prefix X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6a851bcab5cab34dba3a1d89ce603480989e02a1;p=portage.git Merge remote-tracking branch 'overlays-gentoo-org/master' into prefix Conflicts: bin/misc-functions.sh pym/portage/package/ebuild/doebuild.py runtests.sh --- 6a851bcab5cab34dba3a1d89ce603480989e02a1 diff --cc bin/misc-functions.sh index 3bf506054,b28b73fff..dce730ac1 mode 100644,100755..100644 --- a/bin/misc-functions.sh +++ b/bin/misc-functions.sh @@@ -1249,220 -741,6 +1267,204 @@@ install_mask() set -${shopts} } - preinst_bsdflags() { - hasq chflags $FEATURES || return - # Save all the file flags for restoration after installation. - mtree -c -p "${D}" -k flags > "${T}/bsdflags.mtree" - # Remove all the file flags so that the merge phase can do anything - # necessary. - chflags -R noschg,nouchg,nosappnd,nouappnd "${D}" - chflags -R nosunlnk,nouunlnk "${D}" 2>/dev/null - } - - postinst_bsdflags() { - hasq chflags $FEATURES || return - # Restore all the file flags that were saved before installation. - mtree -e -p "${ROOT}" -U -k flags < "${T}/bsdflags.mtree" &> /dev/null - } - +preinst_aix() { + if [[ ${CHOST} != *-aix* ]] || hasq 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=() chmod400files=() + 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. + { echo "Please leave this file alone, it is an important helper" + echo "for portage to implement the 'preserve-libs' feature on AIX." + } > "${ED}${contentmember}" || die "cannot create ${contentmember}" + chmod400files[${#chmod400files[@]}]=${ED}${contentmember} + done < "${PORTAGE_BUILDDIR}"/build-info/NEEDED.XCOFF.1 + [[ ${#chmod400files[@]} == 0 ]] || + chmod 0400 "${chmod400files[@]}" || die "cannot chmod ${chmod400files[@]}" + + 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* ]] || hasq 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() { if [ -z "${D}" ]; then eerror "${FUNCNAME}: D is unset" diff --cc pym/_emerge/actions.py index a15f5e4de,6379b368a..1672d4753 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@@ -28,10 -28,10 +28,10 @@@ from portage import o from portage import digraph from portage import _unicode_decode from portage.cache.cache_errors import CacheError -from portage.const import GLOBAL_CONFIG_PATH, NEWS_LIB_PATH +from portage.const import GLOBAL_CONFIG_PATH, NEWS_LIB_PATH, EPREFIX from portage.const import _ENABLE_DYN_LINK_MAP, _ENABLE_SET_CONFIG from portage.dbapi.dep_expand import dep_expand - from portage.dep import Atom, extended_cp_match + from portage.dep import Atom, extended_cp_match, _get_useflag_re from portage.exception import InvalidAtom from portage.output import blue, bold, colorize, create_color_func, darkgreen, \ red, yellow diff --cc pym/portage/package/ebuild/doebuild.py index 94c0961f8,1c0482224..ad483989e --- a/pym/portage/package/ebuild/doebuild.py +++ b/pym/portage/package/ebuild/doebuild.py @@@ -1274,16 -1233,10 +1274,14 @@@ _post_phase_cmds = "install_symlink_html_docs"], "preinst" : [ + "preinst_aix", - "preinst_bsdflags", "preinst_sfperms", "preinst_selinux_labels", "preinst_suid_scan", - "preinst_mask"] + "preinst_mask"], + + "postinst" : [ - "postinst_aix", - "postinst_bsdflags"] ++ "postinst_aix"] } def _post_phase_userpriv_perms(mysettings): diff --cc runtests.sh index 0ae49315f,11aec60f5..dadd32db1 --- a/runtests.sh +++ b/runtests.sh @@@ -1,4 -1,6 +1,6 @@@ -#!/bin/bash +#!@PORTAGE_BASH@ + # Copyright 2010-2011 Gentoo Foundation + # Distributed under the terms of the GNU General Public License v2 PYTHON_VERSIONS="2.6 2.7 3.1 3.2 3.3" @@@ -24,9 -26,9 +26,9 @@@ trap interrupted SIGIN exit_status="0" for version in ${PYTHON_VERSIONS}; do - if [[ -x /usr/bin/python${version} ]]; then + if [[ -x @PREFIX_PORTAGE_PYTHON@${version} ]]; then echo -e "${GOOD}Testing with Python ${version}...${NORMAL}" - if ! @PREFIX_PORTAGE_PYTHON@${version} pym/portage/tests/runTests; then - if ! /usr/bin/python${version} pym/portage/tests/runTests "$@" ; then ++ if ! @PREFIX_PORTAGE_PYTHON@${version} pym/portage/tests/runTests "$@" ; then echo -e "${BAD}Testing with Python ${version} failed${NORMAL}" exit_status="1" fi