From: Fabian Groffen Date: Thu, 13 Oct 2011 06:50:59 +0000 (+0200) Subject: Merge remote-tracking branch 'overlays-gentoo-org/master' into prefix X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=aa61149212569507c6c98aaf8be71ac86747bb08;p=portage.git Merge remote-tracking branch 'overlays-gentoo-org/master' into prefix Conflicts: bin/ebuild-helpers/prepstrip --- aa61149212569507c6c98aaf8be71ac86747bb08 diff --cc bin/archive-conf index ff4644488,797866817..149fdc51d --- a/bin/archive-conf +++ b/bin/archive-conf @@@ -12,9 -12,15 +12,9 @@@ from __future__ import print_function import sys -try: - import portage -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 portage import os - import dispatch_conf + from portage import dispatch_conf FIND_EXTANT_CONTENTS = "find %s -name CONTENTS" diff --cc bin/ebuild index 77d576a1a,d4b8b71f6..4eb848696 --- a/bin/ebuild +++ b/bin/ebuild @@@ -54,18 -56,13 +56,15 @@@ parser.add_option("--skip-manifest", he opts, pargs = parser.parse_args(args=sys.argv[1:]) - if len(pargs) < 2: - parser.error("missing required args") - os.environ["PORTAGE_CALLER"]="ebuild" -try: - import portage -except ImportError: - from os import path as osp - sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")) - import portage +# for an explanation on this logic, see pym/_emerge/__init__.py +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 portage.dep._internal_warnings = True from portage import os diff --cc bin/ebuild-helpers/prepstrip index 9c5d9dad6,8c2ca4839..077656f52 --- a/bin/ebuild-helpers/prepstrip +++ b/bin/ebuild-helpers/prepstrip @@@ -2,33 -2,62 +2,62 @@@ # Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh +source "${PORTAGE_BIN_PATH:-@PORTAGE_BASE@/bin}"/isolated-functions.sh + # avoid multiple calls to `has`. this creates things like: + # FEATURES_foo=false + # if "foo" is not in $FEATURES + tf() { "$@" && echo true || echo false ; } + exp_tf() { + local flag var=$1 + shift + for flag in "$@" ; do + eval ${var}_${flag}=$(tf has ${flag} ${!var}) + done + } + exp_tf FEATURES installsources nostrip splitdebug + exp_tf RESTRICT binchecks installsources strip + banner=false SKIP_STRIP=false - if has nostrip ${FEATURES} || \ - has strip ${RESTRICT} - then + if ${RESTRICT_strip} || ${FEATURES_nostrip} ; then SKIP_STRIP=true banner=true - has installsources ${FEATURES} || exit 0 + ${FEATURES_installsources} || exit 0 fi - STRIP=${STRIP:-${CHOST}-strip} - type -P -- ${STRIP} > /dev/null || STRIP=strip - OBJCOPY=${OBJCOPY:-${CHOST}-objcopy} - type -P -- ${OBJCOPY} > /dev/null || OBJCOPY=objcopy + # look up the tools we might be using + for t in STRIP:strip OBJCOPY:objcopy READELF:readelf ; do + v=${t%:*} # STRIP + t=${t#*:} # strip + eval ${v}=\"${!v:-${CHOST}-${t}}\" + type -P -- ${!v} >/dev/null || eval ${v}=${t} + done + + # Figure out what tool set we're using to strip stuff + unset SAFE_STRIP_FLAGS DEF_STRIP_FLAGS SPLIT_STRIP_FLAGS + case $(${STRIP} --version 2>/dev/null) in + *elfutils*) # dev-libs/elfutils + # elfutils default behavior is always safe, so don't need to specify + # any flags at all + SAFE_STRIP_FLAGS="" + DEF_STRIP_FLAGS="--remove-comment" + SPLIT_STRIP_FLAGS="-f" + ;; + *GNU*) # sys-devel/binutils + # We'll leave out -R .note for now until we can check out the relevance + # of the section when it has the ALLOC flag set on it ... + SAFE_STRIP_FLAGS="--strip-unneeded" + DEF_STRIP_FLAGS="-R .comment" + SPLIT_STRIP_FLAGS= + ;; + esac + : ${PORTAGE_STRIP_FLAGS=${SAFE_STRIP_FLAGS} ${DEF_STRIP_FLAGS}} - # We'll leave out -R .note for now until we can check out the relevance - # of the section when it has the ALLOC flag set on it ... - export SAFE_STRIP_FLAGS="--strip-unneeded" - export PORTAGE_STRIP_FLAGS=${PORTAGE_STRIP_FLAGS-${SAFE_STRIP_FLAGS} -R .comment} -prepstrip_sources_dir=/usr/src/debug/${CATEGORY}/${PF} +prepstrip_sources_dir="${EPREFIX}"/usr/src/debug/${CATEGORY}/${PF} - if has installsources ${FEATURES} && ! type -P debugedit >/dev/null ; then - ewarn "FEATURES=installsources is enabled but the debugedit binary could not" - ewarn "be found. This feature will not work unless debugedit is installed!" - fi + type -P debugedit >/dev/null && debugedit_found=true || debugedit_found=false + debugedit_warned=false unset ${!INODE_*} @@@ -53,10 -96,10 +96,10 @@@ save_elf_sources() } save_elf_debug() { - has splitdebug ${FEATURES} || return 0 + ${FEATURES_splitdebug} || return 0 local x=$1 - local y="${D}usr/lib/debug/${x:${#D}}.debug" + local y="${ED}usr/lib/debug/${x:${#D}}.debug" # dont save debug info twice [[ ${x} == *".debug" ]] && return 0 @@@ -158,31 -219,18 +228,22 @@@ d # actually causes problems. install sources for all # elf types though cause that stuff is good. + buildid= if [[ ${f} == *"current ar archive"* ]] ; then - vecho " ${x:${#D}}" + vecho " ${x:${#ED}}" if ${strip_this} ; then # hmm, can we split debug/sources for .a ? ${STRIP} -g "${x}" fi elif [[ ${f} == *"SB executable"* || ${f} == *"SB shared object"* ]] ; then - vecho " ${x:${#ED}}" - save_elf_sources "${x}" - if ${strip_this} ; then - save_elf_debug "${x}" - ${STRIP} ${PORTAGE_STRIP_FLAGS} "${x}" - fi + process_elf "${x}" ${PORTAGE_STRIP_FLAGS} elif [[ ${f} == *"SB relocatable"* ]] ; then - vecho " ${x:${#ED}}" - save_elf_sources "${x}" - if ${strip_this} ; then - [[ ${x} == *.ko ]] && save_elf_debug "${x}" - ${STRIP} ${SAFE_STRIP_FLAGS} "${x}" - fi + process_elf "${x}" ${SAFE_STRIP_FLAGS} fi + + if [[ ${was_not_writable} == "true" ]] ; then + chmod u-w "${x}" + fi done if [[ -s ${T}/debug.sources ]] && \ diff --cc pym/portage/const.py index 7fc034a4c,29c3878a6..63e7c67da --- a/pym/portage/const.py +++ b/pym/portage/const.py @@@ -135,9 -90,8 +134,9 @@@ SUPPORTED_FEATURES = frozenset( "ccache", "chflags", "clean-logs", "collision-protect", "compress-build-logs", "digest", "distcc", "distcc-pump", "distlocks", "ebuild-locks", "fakeroot", - "fail-clean", "fixpackages", "force-mirror", "getbinpkg", + "fail-clean", "force-mirror", "getbinpkg", "installsources", "keeptemp", "keepwork", "fixlafiles", "lmirror", + "macossandbox", "macosprefixsandbox", "macosusersandbox", "metadata-transfer", "mirror", "multilib-strict", "news", "noauto", "noclean", "nodoc", "noinfo", "noman", "nostrip", "notitles", "parallel-fetch", "parallel-install",