From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1RNvuv-000212-EL for garchives@archives.gentoo.org; Wed, 09 Nov 2011 00:21:25 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D87F421C06E; Wed, 9 Nov 2011 00:21:16 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 8D5B421C06E for ; Wed, 9 Nov 2011 00:21:16 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 8BFA21B4027 for ; Wed, 9 Nov 2011 00:21:15 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id B529C80042 for ; Wed, 9 Nov 2011 00:21:14 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <75768ea8c922c0266829458025e4b2d35ff49804.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, bin/ X-VCS-Repository: proj/portage X-VCS-Files: bin/ebuild.sh bin/phase-functions.sh pym/portage/package/ebuild/doebuild.py X-VCS-Directories: pym/portage/package/ebuild/ bin/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 75768ea8c922c0266829458025e4b2d35ff49804 Date: Wed, 9 Nov 2011 00:21:14 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 9a45b24e-36fd-43f3-b359-38ed9c752178 X-Archives-Hash: 7838b241887611da72f3deb971efeccb commit: 75768ea8c922c0266829458025e4b2d35ff49804 Author: Zac Medico gentoo org> AuthorDate: Wed Nov 9 00:21:07 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Wed Nov 9 00:21:07 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D75768ea8 Include EPREFIX directories in PATH. This relocates the PATH generation code from ebuild.sh to doebuild_environment, which helps to eliminate duplicate code. --- bin/ebuild.sh | 19 ------------- bin/phase-functions.sh | 1 + pym/portage/package/ebuild/doebuild.py | 46 +++++++++++++++++++++++++-= ------ 3 files changed, 37 insertions(+), 29 deletions(-) diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 8ca7a41..226b9f6 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -5,13 +5,6 @@ PORTAGE_BIN_PATH=3D"${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}" PORTAGE_PYM_PATH=3D"${PORTAGE_PYM_PATH:-/usr/lib/portage/pym}" =20 -ROOTPATH=3D${ROOTPATH##:} -ROOTPATH=3D${ROOTPATH%%:} -PREROOTPATH=3D${PREROOTPATH##:} -PREROOTPATH=3D${PREROOTPATH%%:} -PATH=3D$PORTAGE_BIN_PATH/ebuild-helpers:$PREROOTPATH${PREROOTPATH:+:}/us= r/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin${ROOTPATH:+:}$R= OOTPATH -export PATH - # Prevent aliases from causing portage to act inappropriately. # Make sure it's before everything so we don't mess aliases that follow. unalias -a @@ -585,18 +578,6 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then =20 if [[ $EBUILD_PHASE !=3D depend ]] ; then =20 - case "$EAPI" in - 0|1|2|3) - _ebuild_helpers_path=3D"$PORTAGE_BIN_PATH/ebuild-helpers" - ;; - *) - _ebuild_helpers_path=3D"$PORTAGE_BIN_PATH/ebuild-helpers/4:$PORTAGE= _BIN_PATH/ebuild-helpers" - ;; - esac - - PATH=3D$_ebuild_helpers_path:$PREROOTPATH${PREROOTPATH:+:}/usr/local/= sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin${ROOTPATH:+:}$ROOTPATH - unset _ebuild_helpers_path - _eprefix=3D${EPREFIX} case "$EAPI" in 0|1|2) _eprefix=3D ;; esac # Use default ABI libdir in accordance with bug #355283. diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh index f46368d..a686dcd 100644 --- a/bin/phase-functions.sh +++ b/bin/phase-functions.sh @@ -229,6 +229,7 @@ dyn_unpack() { return 0 fi if [ ! -d "${WORKDIR}" ]; then + echo PATH=3D$PATH install -m${PORTAGE_WORKDIR_MODE:-0700} -d "${WORKDIR}" || die "Failed= to create dir '${WORKDIR}'" fi cd "${WORKDIR}" || die "Directory change failed: \`cd '${WORKDIR}'\`" diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package= /ebuild/doebuild.py index cb7da78..da95a63 100644 --- a/pym/portage/package/ebuild/doebuild.py +++ b/pym/portage/package/ebuild/doebuild.py @@ -115,6 +115,38 @@ def _spawn_phase(phase, settings, actionmap=3DNone, = **kwargs): ebuild_phase.wait() return ebuild_phase.returncode =20 +def _doebuild_path(settings, eapi=3DNone): + """ + Generate the PATH variable. + """ + + # Note: PORTAGE_BIN_PATH may differ from the global constant + # when portage is reinstalling itself. + portage_bin_path =3D settings["PORTAGE_BIN_PATH"] + eprefix =3D settings["EPREFIX"] + prerootpath =3D [x for x in settings.get("PREROOTPATH", "").split(":") = if x] + rootpath =3D [x for x in settings.get("ROOTPATH", "").split(":") if x] + + prefixes =3D [] + if eprefix: + prefixes.append(eprefix) + prefixes.append("/") + + path =3D [] + + if eapi not in (None, "0", "1", "2"): + path.append(os.path.join(portage_bin_path, "ebuild-helpers", "4")) + + path.append(os.path.join(portage_bin_path, "ebuild-helpers")) + path.extend(prerootpath) + + for prefix in prefixes: + for x in ("usr/local/sbin", "usr/local/bin", "usr/sbin", "usr/bin", "s= bin", "bin"): + path.append(os.path.join(prefix, x)) + + path.extend(rootpath) + settings["PATH"] =3D ":".join(path) + def doebuild_environment(myebuild, mydo, myroot=3DNone, settings=3DNone, debug=3DFalse, use_cache=3DNone, db=3DNone): """ @@ -234,16 +266,6 @@ def doebuild_environment(myebuild, mydo, myroot=3DNo= ne, settings=3DNone, else: mysettings["PVR"]=3Dmysplit[1]+"-"+mysplit[2] =20 - if "PATH" in mysettings: - mysplit=3Dmysettings["PATH"].split(":") - else: - mysplit=3D[] - # Note: PORTAGE_BIN_PATH may differ from the global constant - # when portage is reinstalling itself. - portage_bin_path =3D mysettings["PORTAGE_BIN_PATH"] - if portage_bin_path not in mysplit: - mysettings["PATH"] =3D portage_bin_path + ":" + mysettings["PATH"] - # All temporary directories should be subdirectories of # $PORTAGE_TMPDIR/portage, since it's common for /tmp and /var/tmp # to be mounted with the "noexec" option (see bug #346899). @@ -311,6 +333,7 @@ def doebuild_environment(myebuild, mydo, myroot=3DNon= e, settings=3DNone, =20 if eapi is not None: if not eapi_is_supported(eapi): + _doebuild_path(mysettings) raise UnsupportedAPIException(mycpv, eapi) mysettings.configdict['pkg']['EAPI'] =3D eapi =20 @@ -320,6 +343,7 @@ def doebuild_environment(myebuild, mydo, myroot=3DNon= e, settings=3DNone, eapi =3D mysettings["EAPI"] if not eapi_is_supported(eapi): # can't do anything with this. + _doebuild_path(mysettings) raise UnsupportedAPIException(mycpv, eapi) =20 if hasattr(mydbapi, "getFetchMap") and \ @@ -346,6 +370,8 @@ def doebuild_environment(myebuild, mydo, myroot=3DNon= e, settings=3DNone, else: mysettings.configdict["pkg"]["AA"] =3D " ".join(uri_map) =20 + _doebuild_path(mysettings, eapi=3Deapi) + if not eapi_exports_KV(eapi): # Discard KV for EAPIs that don't support it. Cache KV is restored # from the backupenv whenever config.reset() is called.