aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Harring <ferringb@gentoo.org>2005-07-20 14:22:48 +0000
committerBrian Harring <ferringb@gentoo.org>2005-07-20 14:22:48 +0000
commitfecca34c6407f76d27fffdaeb87ef0348b28069c (patch)
tree3cb657230d8e3b7ccfff2a44cbede33fffa15c79
parentexists in portage.util.dicts now (diff)
downloadportage-cvs-fecca34c6407f76d27fffdaeb87ef0348b28069c.tar.gz
portage-cvs-fecca34c6407f76d27fffdaeb87ef0348b28069c.tar.bz2
portage-cvs-fecca34c6407f76d27fffdaeb87ef0348b28069c.zip
removed hardcoded paths, split inherit into two seperate chunks (internal, and external), and moved daemon overrides into
ebuild-daemon.lib
-rw-r--r--ChangeLog6
-rwxr-xr-xbin/ebuild-daemon.lib126
-rwxr-xr-xbin/ebuild-daemon.sh139
-rwxr-xr-xbin/ebuild-default-functions.sh347
-rwxr-xr-xbin/ebuild-functions.sh79
-rwxr-xr-xbin/ebuild.sh91
6 files changed, 417 insertions, 371 deletions
diff --git a/ChangeLog b/ChangeLog
index 555dbce..bfa57ac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,12 +1,16 @@
# ChangeLog for Portage; the Gentoo Linux ports system
# Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Id: ChangeLog,v 1.993 2005/07/04 08:14:30 vapier Exp $
+# $Id: ChangeLog,v 1.994 2005/07/20 14:22:48 ferringb Exp $
MAJOR CHANGES in 2.0.51:
1. /var/cache/edb/virtuals is no longer used at all. It's calculated now.
2. /var/cache/edb/world is now /var/lib/portage/world.
3. /etc/portage/profile/virtuals is _USER_ configs only.
+ 20 Jul 2005; Brian Harring <ferringb@gentoo.org> bin/ebuild*.{sh,lib}:
+ Harring broke cvs. If people ignored the warnings, I'll fix it till the
+ next time changes in rewrite cause it to break again.
+
04 Jul 2005; Mike Frysinger <vapier@gentoo.org>
bin/ebuild-default-functions.sh:
Fix gnuconfig find expression #93363 by TGL.
diff --git a/bin/ebuild-daemon.lib b/bin/ebuild-daemon.lib
new file mode 100755
index 0000000..7781b42
--- /dev/null
+++ b/bin/ebuild-daemon.lib
@@ -0,0 +1,126 @@
+#!/bin/bash
+# ebuild-daemon.lib; daemon lib code.
+# Copyright 2005 Gentoo Foundation
+# Author(s): Brian Harring (ferringb@gentoo.org)
+# License: GPL2
+$Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/ebuild-daemon.lib,v 1.1 2005/07/20 14:22:48 ferringb Exp $
+
+alias die='diefunc "$FUNCNAME" "$LINENO" "$?"'
+#alias listen='read -u 3 -t 10'
+alias assert='_pipestatus="${PIPESTATUS[*]}"; [[ "${_pipestatus// /}" -eq 0 ]] || diefunc "$FUNCNAME" "$LINENO" "$_pipestatus"'
+
+
+# portageq hijack- redirects all requests back through the pipes and has the python side execute it.
+# much faster, also avoids the gpg/sandbox being active issues.
+portageq() {
+ local line e alive
+ if [ "${EBUILD_PHASE}" == "depend" ]; then
+ echo "QA Notice: portageq() in global scope for ${CATEGORY}/${PF}" >&2
+ fi
+ speak "portageq $*"
+ listen line
+ declare -i e
+ e=$(( ${line/return_code=} + 0 ))
+ alive=1
+ while [ $alive == 1 ]; do
+ listen line
+ if [ "$line" == "stop_text" ]; then
+ alive=0
+ else
+ echo "portageq: $line"
+ fi
+ done
+ return $e
+}
+
+# ask the python side to display sandbox complaints.
+request_sandbox_summary() {
+ local line
+ speak "request_sandbox_summary ${SANDBOX_LOG}"
+ listen line
+ while [ "$line" != "end_sandbox_summary" ]; do
+ echo "$line"
+ listen line
+ done
+}
+
+# request the global confcache be transferred to $1 for usage.
+# flips the sandbox vars as needed.
+request_confcache() {
+ if ! hasq confcache $FEATURES || ! hasq sandbox $FEATURES || hasq confcache $RESTRICT; then
+ return 1
+ fi
+ local line
+ speak "request_confcache $1"
+ listen line s
+ while [ "${line#request}" != "${line}" ]; do
+ # var requests for updating the cache's ac_cv_env
+ # send set, then val
+ line="$(echo ${line#request})"
+ if [ "${!line:+set}" == "set" ]; then
+ speak set
+ speak "${!line}"
+ else
+ speak unset
+ fi
+ listen line
+ done
+ if [ "${line:0:9}" == "location:" ]; then
+ cp -v "${line:10}" $1
+ elif [ "${line}" == "empty" ]; then
+ echo ">>> Confcache is empty, starting anew"
+ fi
+ if hasq "${line/: *}" location empty; then
+ echo ">>> Temporary configure cache file is $1"
+ export PORTAGE_CONFCACHE_STATE=1
+ export SANDBOX_DEBUG_LOG="${T}/debug_log"
+ export SANDBOX_DEBUG=1
+ return 0
+ fi
+ return 1
+}
+
+# notify python side configure calls are finished.
+update_confcache() {
+ local line
+ if [ "$PORTAGE_CONFCACHE_STATE" != "1" ]; then
+ return 0
+ fi
+ unset SANDBOX_DEBUG
+ unset PORTAGE_CONFCACHE_STATE
+ if ! hasq sandbox $FEATURES; then
+ echo "not updating confcache, sandbox isn't set in features" >&2
+ return 1
+ fi
+ speak "update_confcache $SANDBOX_DEBUG_LOG $1"
+ unset SANDBOX_DEBUG_LOG
+ listen line
+ if [ "$line" == "updated" ]; then
+ return 0
+ fi
+ return 1
+}
+
+internal_inherit() {
+ local line x
+ if [ "$#" != "1" ]; then
+ die "internal_inherit accepts one arg, requested eclass location. $* is a bit much"
+ fi
+ speak "request_inherit $1"
+ listen line
+ if [ $line == "path" ]; then
+ listen line;
+ source "${line}" || die "failed sources inherit: ${line}"
+ elif [ $line == "transfer" ]; then
+ listen line;
+ eval "$line" || die "failed evaluating eclass $x on an inherit transfer"
+ else
+ speak "failed"
+ die "unknown inherit command from pythonic side, '$line' for eclass $x"
+ fi
+}
+
+DONT_EXPORT_FUNCS="${DONT_EXPORT_FUNCS} $(declare -F | cut -s -d ' ' -f 3)"
+DONT_EXPORT_VARS="${DONT_EXPORT_VARS} ${DONT_EXPORT_VARS}"
+
+:
diff --git a/bin/ebuild-daemon.sh b/bin/ebuild-daemon.sh
index 1a211d3..3a05b0e 100755
--- a/bin/ebuild-daemon.sh
+++ b/bin/ebuild-daemon.sh
@@ -2,14 +2,14 @@
# ebuild-daemon.sh; core ebuild processor handling code
# Copyright 2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-$Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/ebuild-daemon.sh,v 1.9 2005/03/09 02:46:20 genone Exp $
-
-source /usr/lib/portage/bin/ebuild.sh daemonize
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/ebuild-daemon.sh,v 1.10 2005/07/20 14:22:48 ferringb Exp $
+
alias die='diefunc "$FUNCNAME" "$LINENO" "$?"'
#alias listen='read -u 3 -t 10'
alias assert='_pipestatus="${PIPESTATUS[*]}"; [[ "${_pipestatus// /}" -eq 0 ]] || diefunc "$FUNCNAME" "$LINENO" "$_pipestatus"'
+
# use listen/speak for talking to the running portage instance instead of echo'ing to the fd yourself.
# this allows us to move the open fd's w/out issues down the line.
listen() {
@@ -32,6 +32,14 @@ if [ "$com" != "dude?" ]; then
exit 1
fi
speak "dude!"
+listen PORTAGE_BIN_PATH
+[ -z "$PORTAGE_BIN_PATH" ] && die "PORTAGE_BIN_PATH=$PORTAGE_BIN_PATH , bailing"
+declare -rx PORTAGE_BIN_PATH
+
+if ! source "${PORTAGE_BIN_PATH}/ebuild.sh" daemonize; then
+ speak "failed"
+ die "failed sourcing ${PORTAGE_BIN_PATH}/ebuild.sh"
+fi
if [ ! -z "$SANDBOX_LOG" ]; then
listen com
@@ -44,30 +52,6 @@ if [ ! -z "$SANDBOX_LOG" ]; then
addwrite $SANDBOX_LOG
fi
-# portageq hijack- redirects all requests back through the pipes and has the python side execute it.
-# much faster, also avoids the gpg/sandbox being active issues.
-portageq() {
- local line e alive
- if [ "${EBUILD_PHASE}" == "depend" ]; then
- echo "QA Notice: portageq() in global scope for ${CATEGORY}/${PF}" >&2
- fi
- speak "portageq $*"
- listen line
- declare -i e
- e=$(( ${line/return_code=} + 0 ))
- alive=1
- while [ $alive == 1 ]; do
- listen line
- if [ "$line" == "stop_text" ]; then
- alive=0
- else
- echo "$line"
- fi
- done
- return $e
-}
-declare -fr portageq
-
alive='1'
re="$(readonly | cut -s -d '=' -f 1 | cut -s -d ' ' -f 3)"
for x in $re; do
@@ -77,74 +61,12 @@ for x in $re; do
done
speak $re
unset x re
-
-# ask the python side to display sandbox complaints.
-request_sandbox_summary() {
- local line
- speak "request_sandbox_summary ${SANDBOX_LOG}"
- listen line
- while [ "$line" != "end_sandbox_summary" ]; do
- echo "$line"
- listen line
- done
-}
-# request the global confcache be transferred to $1 for usage.
-# flips the sandbox vars as needed.
-request_confcache() {
- if ! hasq confcache $FEATURES || ! hasq sandbox $FEATURES || hasq confcache $RESTRICT; then
- return 1
- fi
- local line
- speak "request_confcache $1"
- listen line s
- while [ "${line#request}" != "${line}" ]; do
- # var requests for updating the cache's ac_cv_env
- # send set, then val
- line="$(echo ${line#request})"
- if [ "${!line:+set}" == "set" ]; then
- speak set
- speak "${!line}"
- else
- speak unset
- fi
- listen line
- done
- if [ "${line:0:9}" == "location:" ]; then
- cp -v "${line:10}" $1
- elif [ "${line}" == "empty" ]; then
- echo ">>> Confcache is empty, starting anew"
- fi
- if hasq "${line/: *}" location empty; then
- echo ">>> Temporary configure cache file is $1"
- export PORTAGE_CONFCACHE_STATE=1
- export SANDBOX_DEBUG_LOG="${T}/debug_log"
- export SANDBOX_DEBUG=1
- return 0
- fi
- return 1
-}
-# notify python side configure calls are finished.
-update_confcache() {
- local line
- if [ "$PORTAGE_CONFCACHE_STATE" != "1" ]; then
- return 0
- fi
- unset SANDBOX_DEBUG
- unset PORTAGE_CONFCACHE_STATE
- if ! hasq sandbox $FEATURES; then
- echo "not updating confcache, sandbox isn't set in features" >&2
- return 1
- fi
- speak "update_confcache $SANDBOX_DEBUG_LOG $1"
- unset SANDBOX_DEBUG_LOG
- listen line
- if [ "$line" == "updated" ]; then
- return 0
- fi
- return 1
-}
+if ! source "${PORTAGE_BIN_PATH}/ebuild-daemon.lib"; then
+ speak failed
+ die "failed source ${PORTAGE_BIN_PATH}/ebuild-daemon.lib"
+fi
DONT_EXPORT_FUNCS="$(declare -F | cut -s -d ' ' -f 3)"
DONT_EXPORT_VARS="${DONT_EXPORT_VARS} alive com PORTAGE_LOGFILE cont"
@@ -154,13 +76,17 @@ DONT_EXPORT_VARS="${DONT_EXPORT_VARS} alive com PORTAGE_LOGFILE cont"
export QA_CONTROLLED_EXTERNALLY="yes"
enable_qa_interceptors
-source "/usr/lib/portage/bin/ebuild-functions.sh" || die "failed sourcing ebuild-functions.sh"
+if ! source "${PORTAGE_BIN_PATH}/ebuild-functions.sh"; then
+ speak failed
+ die "failed sourcing ${PORTAGE_LIB}/ebuild-functions.sh"
+fi
export PORTAGE_PRELOADED_ECLASSES=''
unset_colors
-PATH='/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/lib/portage/bin'
+# XXX this sucks even more then the rest, we're talking loss of chrome on a trailer hitch type suck.
+PATH='/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:${PORTAGE_BIN_PATH}'
while [ "$alive" == "1" ]; do
com=''
listen com
@@ -176,19 +102,35 @@ while [ "$alive" == "1" ]; do
fi
line=''
cont=0
+
while [ "$cont" == 0 ]; do
line=''
listen line
if [ "$line" == "start_receiving_env" ]; then
while listen line && [ "$line" != "end_receiving_env" ]; do #[ "$line" != "end_receiving_env" ]; do
- eval "$line"
- if [ $? != "0" ]; then
+# if [[ "${line/SUDO_COMMAND}" != "${line}" ]] &&
+# [[ "${line/export}" == "${line}" ]]; then
+# on=1
+# echo "received $line" >&2
+# fi
+ save_IFS
+ IFS=$'\0'
+ eval ${line};
+ val=$?;
+ restore_IFS
+ if [ $val != "0" ]; then
echo "err, env receiving threw an error for '$line': $?" >&2
echo "env_receiving_failed" >&2
speak "env_receiving_failed"
cont=1
break
fi
+ if [ "${on:-unset}" != "unset" ]; then
+ echo "sudo = ${SUDO_COMMAND}" >&2
+ declare | grep -i sudo_command >&@
+ echo "disabling" >&2
+ unset on
+ fi
done
if [ "$cont" == "0" ]; then
speak "env_received"
@@ -226,6 +168,9 @@ while [ "$alive" == "1" ]; do
set_colors
fi
DONT_EXPORT_FUNCS="${DONT_EXPORT_FUNCS} ${PORTAGE_PRELOADED_ECLASSES}"
+ for x in $DONT_EXPORT_FUNCS; do
+ declare -fr $x &> /dev/null
+ done
for e in $phases; do
if [ -z $PORTAGE_LOGFILE ]; then
execute_phases ${e}
diff --git a/bin/ebuild-default-functions.sh b/bin/ebuild-default-functions.sh
index 7598547..af1c351 100755
--- a/bin/ebuild-default-functions.sh
+++ b/bin/ebuild-default-functions.sh
@@ -1,8 +1,8 @@
#!/bin/bash
# ebuild-default-functions.sh; default functions for ebuild env that aren't saved- specific to the portage instance.
-# Copyright 2005 Gentoo Foundation
+# Copyright 2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/ebuild-default-functions.sh,v 1.32 2005/06/23 23:49:53 vapier Exp $
+$Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/ebuild-default-functions.sh,v 1.33 2005/07/20 14:22:48 ferringb Exp $
has_version() {
# if there is a predefined portageq call, use it.
@@ -15,29 +15,32 @@ has_version() {
# return shell-true/shell-false if exists.
# Takes single depend-type atoms.
- if declare -F portageq &> /dev/null; then
+ # XXX: harring; portageq should be in path if there isn't a func. if not, well, tough cookies
+# if declare -F portageq &> /dev/null; then
portageq 'has_version' "${ROOT}" "$1"
e=$?
- else
- /usr/lib/portage/bin/portageq 'has_version' "${ROOT}" "$1"
- e=$?
- fi
+# else
+# /usr/lib/portage/bin/portageq 'has_version' "${ROOT}" "$1"
+# e=$?
+# fi
return $e
}
best_version() {
local -i e
- if declare -F portageq &> /dev/null; then
+ # see above
+# if declare -F portageq &> /dev/null; then
portageq 'best_version' "${ROOT}" "$1"
e=$?
- else
- /usr/lib/portage/bin/portageq 'best_version' "${ROOT}" "$1"
- e=$?
- fi
+# else
+# /usr/lib/portage/bin/portageq 'best_version' "${ROOT}" "$1"
+# e=$?
+# fi
return $e
}
-check_KV() {
+check_KV()
+{
if [ -z "${KV}" ]; then
eerror ""
eerror "Could not determine your kernel version."
@@ -52,7 +55,8 @@ check_KV() {
}
# adds ".keep" files so that dirs aren't auto-cleaned
-keepdir() {
+keepdir()
+{
dodir "$@"
local x
if [ "$1" == "-R" ] || [ "$1" == "-r" ]; then
@@ -66,75 +70,71 @@ keepdir() {
}
# sandbox support functions
-addread() {
+addread()
+{
export SANDBOX_READ="$SANDBOX_READ:$1"
}
-addwrite() {
+addwrite()
+{
export SANDBOX_WRITE="$SANDBOX_WRITE:$1"
}
-adddeny() {
+adddeny()
+{
export SANDBOX_DENY="$SANDBOX_DENY:$1"
}
-addpredict() {
+addpredict()
+{
export SANDBOX_PREDICT="$SANDBOX_PREDICT:$1"
}
unpack() {
- local x y
+ local x
+ local y
local myfail
local tarvars
- local srcdir
- if [ "$USERLAND" == "BSD" ] ; then
+ if [ "$USERLAND" == "BSD" ]; then
tarvars=""
else
- tarvars="--no-same-owner"
- fi
+ tarvars="--no-same-owner"
+ fi
[ -z "$*" ] && die "Nothing passed to the 'unpack' command"
for x in "$@"; do
- echo ">>> Unpacking ${x} to ${PWD}"
- y=${x%.*}
- y=${y##*.}
-
- myfail="${x} does not exist"
- if [ "${x:0:2}" = "./" ] ; then
- srcdir=""
- else
- srcdir="${DISTDIR}/"
- fi
- [ ! -s "${srcdir}${x}" ] && die "$myfail"
-
myfail="failure unpacking ${x}"
+ echo ">>> Unpacking ${x} to $(pwd)"
+ y="${x%.*}"
+ y="${y##*.}"
+
case "${x##*.}" in
- tar)
- tar ${tarvars} -xf "${srcdir}${x}" || die "$myfail"
+ tar)
+ tar ${tarvars} -xf "${DISTDIR}/${x}" || die "$myfail"
;;
- tgz)
- tar ${tarvars} -xzf "${srcdir}${x}" || die "$myfail"
+ tgz)
+ tar ${tarvars} -xzf "${DISTDIR}/${x}" || die "$myfail"
;;
- tbz2)
- bzip2 -dc "${srcdir}${x}" | tar ${tarvars} -xf - || die "$myfail"
+ tbz2)
+ bzip2 -dc "${DISTDIR}/${x}" | tar ${tarvars} -xf - || die "$myfail"
;;
- ZIP|zip)
- unzip -qo "${srcdir}${x}" || die "$myfail"
+ ZIP|zip)
+ unzip -qo "${DISTDIR}/${x}" || die "$myfail"
;;
- gz|Z|z)
- if [ "${y}" == "tar" ] ; then
- tar ${tarvars} -xzf "${srcdir}${x}" || die "$myfail"
+ gz|Z|z)
+ if [ "${y}" == "tar" ]; then
+ tar ${tarvars} -xzf "${DISTDIR}/${x}" || die "$myfail"
else
- gzip -dc "${srcdir}${x}" > ${x%.*} || die "$myfail"
+ gzip -dc "${DISTDIR}/${x}" > ${x%.*} || die "$myfail"
fi
;;
- bz2)
- if [ "${y}" == "tar" ] ; then
- bzip2 -dc "${srcdir}${x}" | tar ${tarvars} -xf - || die "$myfail"
+ bz2)
+ if [ "${y}" == "tar" ]; then
+ bzip2 -dc "${DISTDIR}/${x}" | tar ${tarvars} -xf - || die "$myfail"
else
- bzip2 -dc "${srcdir}${x}" > ${x%.*} || die "$myfail"
+ bzip2 -dc "${DISTDIR}/${x}" > ${x%.*} || die "$myfail"
fi
;;
*)
@@ -144,18 +144,19 @@ unpack() {
done
}
-dyn_setup() {
+dyn_setup()
+{
if hasq setup ${COMPLETED_EBUILD_PHASES:-unset}; then
echo ">>> looks like ${PF} has already been setup, bypassing."
MUST_EXPORT_ENV="no"
return
fi
MUST_EXPORT_ENV="yes"
- if [ "$USERLAND" == "Linux" ]; then
+ if [ "$USERLAND" == "Linux" ]; then
# The next bit is to ease the broken pkg_postrm()'s
# some of the gcc ebuilds have that nuke the new
# /lib/cpp and /usr/bin/cc wrappers ...
-
+
# Make sure we can have it disabled somehow ....
if [ "${DISABLE_GEN_GCC_WRAPPERS}" != "yes" ]; then
# Create /lib/cpp if missing or a symlink
@@ -205,13 +206,13 @@ dyn_unpack() {
rm -rf "${WORKDIR}"
fi
fi
-
+
install -m0700 -d "${WORKDIR}" || die "Failed to create dir '${WORKDIR}'"
[ -d "$WORKDIR" ] && cd "${WORKDIR}"
echo ">>> Unpacking source..."
src_unpack
echo ">>> Source unpacked."
- cd "${PORTAGE_BUILDDIR}"
+ cd "$BUILDDIR"
trap SIGINT SIGQUIT
}
@@ -222,8 +223,8 @@ abort_handler() {
else
msg="${EBUILD}: ${1} failed; exiting."
fi
- echo
- echo "$msg"
+ echo
+ echo "$msg"
echo
eval ${3}
#unset signal handler
@@ -237,7 +238,7 @@ abort_compile() {
abort_unpack() {
abort_handler "src_unpack" $1
- rm -rf "${PORTAGE_BUILDDIR}/work"
+ rm -rf "${BUILDDIR}/work"
exit 1
}
@@ -254,7 +255,7 @@ abort_test() {
abort_install() {
abort_handler "src_install" $1
- rm -rf "${PORTAGE_BUILDDIR}/image"
+ rm -rf "${BUILDDIR}/image"
exit 1
}
@@ -293,14 +294,12 @@ dyn_compile() {
sleep 3
fi
- echo ">>> Compiling source ..."
-
- cd "${PORTAGE_BUILDDIR}"
+ cd "${BUILDDIR}"
if [ ! -e "build-info" ]; then
mkdir build-info
fi
cp "${EBUILD}" "build-info/${PF}.ebuild"
-
+
if [ -d "${S}" ]; then
cd "${S}"
fi
@@ -310,9 +309,9 @@ dyn_compile() {
#some packages use an alternative to $S to build in, cause
#our libtool to create problematic .la files
export PWORKDIR="$WORKDIR"
- src_compile
- #|| abort_compile "fail"
- cd "${PORTAGE_BUILDDIR}"
+ src_compile
+ #|| abort_compile "fail"
+ cd "${BUILDDIR}"
cd build-info
echo "$ASFLAGS" > ASFLAGS
@@ -341,26 +340,23 @@ dyn_compile() {
echo "$RESTRICT" > RESTRICT
echo "$SLOT" > SLOT
echo "$USE" > USE
- export_environ "${PORTAGE_BUILDDIR}/build-info/environment.bz2" 'bzip2 -c9'
+ export_environ "${BUILDDIR}/build-info/environment.bz2" 'bzip2 -c9'
cp "${EBUILD}" "${PF}.ebuild"
if hasq nostrip $FEATURES $RESTRICT; then
touch DEBUGBUILD
fi
trap SIGINT SIGQUIT
-
- echo ">>> Finished compiling"
}
dyn_package() {
trap "abort_package" SIGINT SIGQUIT
- echo ">>> Generating binary package ..."
- cd "${PORTAGE_BUILDDIR}/image"
+ cd "${BUILDDIR}/image"
tar cpvf - ./ | bzip2 -f > ../bin.tar.bz2 || die "Failed to create tarball"
cd ..
xpak build-info inf.xpak
tbz2tool join bin.tar.bz2 inf.xpak "${PF}.tbz2"
echo ">>> Done."
- cd "${PORTAGE_BUILDDIR}"
+ cd "${BUILDDIR}"
MUST_EXPORT_ENV="yes"
trap SIGINT SIGQUIT
}
@@ -386,7 +382,7 @@ dyn_test() {
cd "${S}"
fi
src_test
- cd "${PORTAGE_BUILDDIR}"
+ cd "${BUILDDIR}"
fi
trap SIGINT SIGQUIT
}
@@ -395,15 +391,15 @@ function stat_perms() {
local f
f=$(stat -c '%f' "$1")
f=$(printf "%o" 0x$f)
- f=${f:${#f}-4}
+ f="${f:${#f}-4}"
echo $f
}
dyn_install() {
trap "abort_install" SIGINT SIGQUIT
- rm -rf "${PORTAGE_BUILDDIR}/image"
- mkdir "${PORTAGE_BUILDDIR}/image"
+ rm -rf "${BUILDDIR}/image"
+ mkdir "${BUILDDIR}/image"
if [ -d "${S}" ]; then
cd "${S}"
fi
@@ -415,105 +411,59 @@ dyn_install() {
#some packages uses an alternative to $S to build in, cause
#our libtool to create problematic .la files
export PWORKDIR="$WORKDIR"
- src_install
+ src_install
#|| abort_install "fail"
prepall
cd "${D}"
declare -i UNSAFE=0
for i in $(find "${D}/" -type f -perm -2002); do
- ((UNSAFE++))
+ UNSAFE=$(($UNSAFE + 1))
echo "UNSAFE SetGID: $i"
done
for i in $(find "${D}/" -type f -perm -4002); do
- ((UNSAFE++))
+ UNSAFE=$(($UNSAFE + 1))
echo "UNSAFE SetUID: $i"
done
-
- if type -p scanelf > /dev/null ; then
- # 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=$(scanelf -qyRF '%r %p' "${D}" | grep -E "(${PORTAGE_BUILDDIR}|: |::|^ )")
- if [[ -n ${f} ]] ; then
- echo -ne '\a\n'
- echo "QA Notice: the following files contain insecure RUNPATH's"
- echo " Please file a bug about this at http://bugs.gentoo.org/"
- echo " For more information on this issue, kindly review:"
- echo " http://bugs.gentoo.org/81745"
- echo "${f}"
- echo -ne '\a\n'
- die "Insecure binaries detected"
- fi
-
- # Check for setid binaries but are not built with BIND_NOW
- f=$(scanelf -qyRF '%b %p' "${D}")
- if [[ -n ${f} ]] ; then
- echo -ne '\a\n'
- echo "QA Notice: the following files are setXid, dyn linked, and using lazy bindings"
- echo " This combination is generally discouraged. Try re-emerging the package:"
- echo " LDFLAGS='-Wl,-z,now' emerge ${PN}"
- echo "${f}"
- echo -ne '\a\n'
- [[ ${FEATURES/stricter} != "${FEATURES}" ]] \
- && die "Aborting due to lazy bindings"
- sleep 1
- fi
-
- # TEXTREL's are baaaaaaaad
- f=$(scanelf -qyRF '%t %p' "${D}")
- if [[ -n ${f} ]] ; then
- echo -ne '\a\n'
- echo "QA Notice: the following files contain runtime text relocations"
- echo " Text relocations require a lot of extra work to be preformed by the"
- echo " dynamic linker which will cause serious performance impact on IA-32"
- echo " and might not function properly on other architectures hppa for example."
- echo " If you are a programmer please take a closer look at this package and"
- echo " consider writing a patch which addresses this problem."
- echo "${f}"
- echo -ne '\a\n'
- [[ ${FEATURES/stricter} != "${FEATURES}" ]] \
- && die "Aborting due to textrels"
- sleep 1
- fi
-
- # Check for files with executable stacks
- f=$(scanelf -qyRF '%e %p' "${D}")
- if [[ -n ${f} ]] ; then
- echo -ne '\a\n'
- echo "QA Notice: the following files contain executable stacks"
- echo " Files with executable stacks will not work properly (or at all!)"
- echo " on some architectures/operating systems. A bug should be filed"
- echo " at http://bugs.gentoo.org/ to make sure the file is fixed."
- echo "${f}"
- echo -ne '\a\n'
- [[ ${FEATURES/stricter} != "${FEATURES}" ]] \
- && die "Aborting due to +x stack"
- sleep 1
- fi
-
- # Save NEEDED information
- scanelf -qyRF '%p %n' "${D}" | sed -e 's:^:/:' > "${PORTAGE_BUILDDIR}"/build-info/NEEDED
+
+ if [ -x /usr/bin/readelf -a -x /usr/bin/file ]; then
+ for x in $(find "${D}/" -type f \( -perm -04000 -o -perm -02000 \) ); do
+ f=$(file "${x}")
+ if [ -z "${f/*SB executable*/}" -o -z "${f/*SB shared object*/}" ]; then
+ /usr/bin/readelf -d "${x}" | egrep '\(FLAGS(.*)NOW' > /dev/null
+ if [ "$?" != "0" ]; then
+ if [ ! -z "${f/*statically linked*/}" ]; then
+ #uncomment this line out after developers have had ample time to fix pkgs.
+ #UNSAFE=$(($UNSAFE + 1))
+ echo -ne '\a'
+ echo "QA Notice: ${x:${#D}:${#x}} is setXid, dynamically linked and using lazy bindings."
+ echo "This combination is generally discouraged. Try: CFLAGS='-Wl,-z,now' emerge ${PN}"
+ echo -ne '\a'
+ sleep 1
+ fi
+ fi
+ fi
+ done
fi
- if [[ ${UNSAFE} > 0 ]] ; then
- die "There are ${UNSAFE} unsafe files. Portage will not install them."
+
+ if [[ $UNSAFE > 0 ]]; then
+ die "There are ${UNSAFE} unsafe files. Portage will not install them."
fi
local file s
find "${D}/" -user portage -print | while read file; do
ewarn "file $file was installed with user portage!"
- s=$(stat_perms "$file")
+ s=$(stat_perms $file)
chown root "$file"
#XXX: Stable does not have the symlink test
[ -h "$file" ] || chmod "$s" "$file"
done
find "${D}/" -group portage -print | while read file; do
- # Too annoying - uncommenting this as it's a regression - it's not, commenting again
- #ewarn "file $file was installed with group portage!"
+ # Too annoying - uncommenting this as it's a regression
+ ewarn "file $file was installed with group portage!"
s=$(stat_perms "$file")
if [ "$USERLAND" == "BSD" ]; then
chgrp wheel "$file"
@@ -537,7 +487,7 @@ dyn_install() {
echo ">>> Completed installing ${PF} into ${D}"
echo
- cd ${PORTAGE_BUILDDIR}
+ cd ${BUILDDIR}
MUST_EXPORT_ENV="yes"
trap SIGINT SIGQUIT
}
@@ -703,10 +653,10 @@ dyn_rpm() {
dyn_help() {
echo
echo "Portage"
- echo "Copyright 1999-2005 Gentoo Foundation"
- echo
+ echo "Copyright 1999-2004 Gentoo Foundation"
+ echo
echo "How to use the ebuild command:"
- echo
+ echo
echo "The first argument to ebuild should be an existing .ebuild file."
echo
echo "One or more of the following options can then be specified. If more"
@@ -734,25 +684,25 @@ dyn_help() {
echo
echo "The following settings will be used for the ebuild process:"
echo
- echo " package : ${PF}"
- echo " slot : ${SLOT}"
- echo " category : ${CATEGORY}"
+ echo " package : ${PF}"
+ echo " slot : ${SLOT}"
+ echo " category : ${CATEGORY}"
echo " description : ${DESCRIPTION}"
- echo " system : ${CHOST}"
- echo " c flags : ${CFLAGS}"
- echo " c++ flags : ${CXXFLAGS}"
- echo " make flags : ${MAKEOPTS}"
+ echo " system : ${CHOST}"
+ echo " c flags : ${CFLAGS}"
+ echo " c++ flags : ${CXXFLAGS}"
+ echo " make flags : ${MAKEOPTS}"
echo -n " build mode : "
if hasq nostrip $FEATURES $RESTRICT; then
echo "debug (large)"
else
echo "production (stripped)"
fi
- echo " merge to : ${ROOT}"
+ echo " merge to : ${ROOT}"
echo
if [ -n "$USE" ]; then
echo "Additionally, support for the following optional features will be enabled:"
- echo
+ echo
echo " ${USE}"
fi
echo
@@ -771,24 +721,24 @@ debug-print() {
if [ "$EBUILD_PHASE" == "depend" ] && [ -z "${PORTAGE_DEBUG}" ]; then
return
fi
- # if $T isn't defined, we're in dep calculation mode and
+ # if $T isn't defined, we're in dep calculation mode and
# shouldn't do anything
[ -z "$T" ] && return 0
while [ "$1" ]; do
-
+
# extra user-configurable targets
if [ "$ECLASS_DEBUG_OUTPUT" == "on" ]; then
echo "debug: $1"
elif [ -n "$ECLASS_DEBUG_OUTPUT" ]; then
echo "debug: $1" >> $ECLASS_DEBUG_OUTPUT
fi
-
+
# default target
echo "$1" >> "${T}/eclass-debug.log"
# let the portage user own/write to this file
chmod g+w "${T}/eclass-debug.log" &>/dev/null
-
+
shift
done
}
@@ -796,7 +746,7 @@ debug-print() {
# The following 2 functions are debug-print() wrappers
debug-print-function() {
- str="$1: entering function"
+ str="$1: entering function"
shift
debug-print "$str, parameters: $*"
}
@@ -805,6 +755,26 @@ debug-print-section() {
debug-print "now in section $*"
}
+
+internal_inherit() {
+ # default, backwards compatible beast.
+ local location overlay
+ location="${ECLASSDIR}/${1}.eclass"
+
+ if [ -n "$PORTDIR_OVERLAY" ]; then
+ local overlay
+ for overlay in ${PORTDIR_OVERLAY}; do
+ if [ -e "${overlay}/eclass/${1}.eclass" ]; then
+ location="${overlay}/eclass/${1}.eclass"
+ debug-print " eclass exists: ${location}"
+ fi
+ done
+ fi
+ debug-print "inherit: $1 -> $location"
+ source "$location" || die "died sourcing $location in inherit()"
+ return 0
+}
+
# Sources all eclasses in parameters
declare -ix ECLASS_DEPTH=0
inherit() {
@@ -833,7 +803,6 @@ inherit() {
local B_CDEPEND
local B_PDEPEND
while [ "$1" ]; do
- location="${ECLASSDIR}/${1}.eclass"
# PECLASS is used to restore the ECLASS var after recursion.
PECLASS="$ECLASS"
@@ -847,22 +816,9 @@ inherit() {
fi
fi
- # any future resolution code goes here
- if [ -n "$PORTDIR_OVERLAY" ]; then
- local overlay
- for overlay in ${PORTDIR_OVERLAY}; do
- olocation="${overlay}/eclass/${1}.eclass"
- if [ -e "$olocation" ]; then
- location="${olocation}"
- debug-print " eclass exists: ${location}"
- fi
- done
- fi
- debug-print "inherit: $1 -> $location"
-
#We need to back up the value of DEPEND and RDEPEND to B_DEPEND and B_RDEPEND
#(if set).. and then restore them after the inherit call.
-
+
#turn off glob expansion
set -f
@@ -876,12 +832,9 @@ inherit() {
unset IUSE DEPEND RDEPEND CDEPEND PDEPEND
#turn on glob expansion
set +f
- if type -p eclass_${1}_inherit; then
- eclass_${1}_inherit
- else
- source "$location" || export ERRORMSG="died sourcing $location in inherit()"
+ if ! internal_inherit $1; then
+ die "failed sourcing $1 in inherit()"
fi
- [ -z "${ERRORMSG}" ] || die "${ERRORMSG}"
#turn off glob expansion
set -f
@@ -911,10 +864,10 @@ inherit() {
#turn on glob expansion
set +f
-
+
if hasq $1 $INHERITED && [ $INHERITED_ALREADY == 0 ]; then
#
-# enable this one eclasses no longer full with eclass and inherited.
+# enable this one eclasses no longer fool with eclass and inherited.
# if [ "${EBUILD_PHASE}" == "depend" ]; then
# echo "QA Notice: ${CATEGORY}/${PF}: eclass $1 is incorrectly setting \$INHERITED." >&2
# fi
@@ -928,7 +881,7 @@ inherit() {
done
ECLASS_DEPTH=$(($ECLASS_DEPTH - 1))
if [[ $ECLASS_DEPTH == 0 ]]; then
- ECLASS_DEPTH=$(($SAVED_INHERIT_COUNT - 1))
+ ECLASS_DEPTH=$(($SAVED_INHERIT_COUNT - 1))
fi
}
@@ -942,7 +895,7 @@ EXPORT_FUNCTIONS() {
exit 1
fi
while [ "$1" ]; do
- debug-print "EXPORT_FUNCTIONS: ${1} -> ${ECLASS}_${1}"
+ debug-print "EXPORT_FUNCTIONS: ${1} -> ${ECLASS}_${1}"
eval "$1() { ${ECLASS}_$1 "\$@" ; }" > /dev/null
shift
done
@@ -1015,7 +968,7 @@ do_newdepend() {
done
}
-# this is a function for removing any directory matching a passed in pattern from
+# this is a function for removing any directory matching a passed in pattern from
# PATH
remove_path_entry() {
save_IFS
@@ -1040,7 +993,7 @@ enable_qa_interceptors() {
# Turn of extended glob matching so that g++ doesn't get incorrectly matched.
shopt -u extglob
-
+
# QA INTERCEPTORS
local FUNC_SRC BIN BODY BIN_PATH
for BIN in ${QA_INTERCEPTORS}; do
@@ -1054,7 +1007,7 @@ enable_qa_interceptors() {
echo -n \"QA Notice: ${BIN} in global scope: \" >&2
if [ \$ECLASS_DEPTH -gt 0 ]; then
echo \"eclass \${ECLASS}\" >&2
- else
+ else
echo \"\${CATEGORY}/\${PF}\" >&2
fi
${BODY}
@@ -1077,7 +1030,7 @@ useq() {
neg=1
fi
local x
-
+
# Make sure we have this USE flag in IUSE
if ! hasq "${u}" ${IUSE} ${E_IUSE} && ! hasq "${u}" ${PORTAGE_ARCHLIST} selinux; then
echo "QA Notice: USE Flag '${u}' not in IUSE for ${CATEGORY}/${PF}" >&2
diff --git a/bin/ebuild-functions.sh b/bin/ebuild-functions.sh
index 89211e2..b2f3eb5 100755
--- a/bin/ebuild-functions.sh
+++ b/bin/ebuild-functions.sh
@@ -1,8 +1,8 @@
#!/bin/bash
# ebuild-functions.sh; ebuild env functions, saved with the ebuild (not specific to the portage version).
-# Copyright 2004-2005 Gentoo Foundation
+# Copyright 2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/ebuild-functions.sh,v 1.12 2005/07/04 08:14:30 vapier Exp $
+$Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/ebuild-functions.sh,v 1.13 2005/07/20 14:22:48 ferringb Exp $
use() {
if useq ${1}; then
@@ -24,7 +24,7 @@ use_with() {
return
fi
- local UW_SUFFIX=""
+ local UW_SUFFIX=""
if [ ! -z "${3}" ]; then
UW_SUFFIX="=${3}"
fi
@@ -33,7 +33,7 @@ use_with() {
if [ -z "${UWORD}" ]; then
UWORD="$1"
fi
-
+
if useq $1; then
echo "--with-${UWORD}${UW_SUFFIX}"
return 0
@@ -50,7 +50,7 @@ use_enable() {
return
fi
- local UE_SUFFIX=""
+ local UE_SUFFIX=""
if [ ! -z "${3}" ]; then
UE_SUFFIX="=${3}"
fi
@@ -59,7 +59,7 @@ use_enable() {
if [ -z "${UWORD}" ]; then
UWORD="$1"
fi
-
+
if useq $1; then
echo "--enable-${UWORD}${UE_SUFFIX}"
return 0
@@ -71,17 +71,16 @@ use_enable() {
econf() {
local ret
- ECONF_SOURCE="${ECONF_SOURCE:-.}"
- if [ -x "${ECONF_SOURCE}/configure" ]; then
- if [ -e /usr/share/gnuconfig/ ]; then
- local x
- for x in $(find "${WORKDIR}" -type f '(' -name config.guess -o -name config.sub ')') ; do
- echo " * econf: updating ${x/${WORKDIR}\/} with /usr/share/gnuconfig/${x##*/}"
- cp -f "/usr/share/gnuconfig/${x##*/}" "${x}"
- chmod a+x "${x}"
- done
+ if [ -x ./configure ]; then
+ if hasq autoconfig $FEATURES && ! hasq autoconfig $RESTRICT; then
+ if [ -e /usr/share/gnuconfig/ ]; then
+ local x
+ for x in $(find ${WORKDIR} -type f -name config.guess -o -name config.sub); do
+ echo " * econf: updating ${x/${WORKDIR}\/} with /usr/share/gnuconfig/${x##*/}"
+ cp "/usr/share/gnuconfig/${x##*/}" "${x}"
+ done
+ fi
fi
-
if [ ! -z "${CBUILD}" ]; then
EXTRA_ECONF="--build=${CBUILD} ${EXTRA_ECONF}"
fi
@@ -122,7 +121,7 @@ econf() {
if request_confcache "${T}/local_cache"; then
EECONF_CACHE="--cache-file=${T}/local_cache"
fi
- echo "${ECONF_SOURCE}/configure" \
+ echo ./configure \
--prefix=/usr \
--host=${CHOST} \
--mandir=/usr/share/man \
@@ -134,7 +133,8 @@ econf() {
${EECONF_CACHE} \
"$@"
- if ! "${ECONF_SOURCE}/configure" \
+ #XXX: This is "${ECONF_SOURCE}/configure" in stable
+ if ! ./configure \
--prefix=/usr \
--host=${CHOST} \
--mandir=/usr/share/man \
@@ -163,7 +163,7 @@ econf() {
fi
}
-strip_duplicate_slashes() {
+strip_duplicate_slashes () {
if [ -n "${1}" ]; then
local removed="${1/\/\///}"
[ "${removed}" != "${removed/\/\///}" ] && removed=$(strip_duplicate_slashes "${removed}")
@@ -171,7 +171,8 @@ strip_duplicate_slashes() {
fi
}
-einstall() {
+einstall()
+{
# CONF_PREFIX is only set if they didn't pass in libdir above
LIBDIR_VAR="LIBDIR_${ABI}"
if [ -n "${ABI}" -a -n "${!LIBDIR_VAR}" ]; then
@@ -203,17 +204,19 @@ einstall() {
mandir=${D}/usr/share/man \
sysconfdir=${D}/etc \
${EXTRA_EINSTALL} \
- "$@" install || die "einstall failed"
+ "$@" install || die "einstall failed"
else
die "no Makefile found"
fi
}
-pkg_setup() {
- return
+pkg_setup()
+{
+ return
}
-pkg_nofetch() {
+pkg_nofetch()
+{
[ -z "${SRC_URI}" ] && return
echo "!!! The following are listed in SRC_URI for ${PN}:"
@@ -222,22 +225,23 @@ pkg_nofetch() {
done
}
-src_unpack() {
+src_unpack() {
if [ "${A}" != "" ]; then
unpack ${A}
- fi
+ fi
}
-src_compile() {
+src_compile() {
if [ -x ./configure ]; then
- econf || die "econf failed"
+ econf
fi
if [ -f Makefile ] || [ -f GNUmakefile ] || [ -f makefile ]; then
emake || die "emake failed"
fi
}
-src_test() {
+src_test()
+{
addpredict /
if make check -n &> /dev/null; then
echo ">>> Test phase [check]: ${CATEGORY}/${PF}"
@@ -257,23 +261,28 @@ src_test() {
SANDBOX_PREDICT="${SANDBOX_PREDICT%:/}"
}
-src_install() {
- return
+src_install()
+{
+ return
}
-pkg_preinst() {
+pkg_preinst()
+{
return
}
-pkg_postinst() {
+pkg_postinst()
+{
return
}
-pkg_prerm() {
+pkg_prerm()
+{
return
}
-pkg_postrm() {
+pkg_postrm()
+{
return
}
diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index e91b48d..7b97383 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -1,8 +1,8 @@
#!/bin/bash
# ebuild.sh; ebuild phase processing, env handling
-# Copyright 2005 Gentoo Foundation
+# Copyright 2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-$Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/ebuild.sh,v 1.212 2005/05/04 01:07:04 vapier Exp $
+$Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/ebuild.sh,v 1.213 2005/07/20 14:22:48 ferringb Exp $
# general phase execution path-
# execute_phases is called, which sets EBUILD_PHASE, and then depending on the phase,
@@ -29,12 +29,17 @@ DONT_EXPORT_FUNCS='portageq speak'
DONT_EXPORT_VARS="ORIG_VARS GROUPS ORIG_FUNCS FUNCNAME DAEMONIZED CCACHE.* DISTCC.* AUTOCLEAN CLEAN_DELAY SYNC
COMPLETED_EBUILD_PHASES (TMP|)DIR FEATURES CONFIG_PROTECT.* (P|)WORKDIR (FETCH|RESUME) COMMAND RSYNC_.* GENTOO_MIRRORS
(DIST|FILES|RPM|ECLASS)DIR HOME MUST_EXPORT_ENV QA_CONTROLLED_EXTERNALLY COLORTERM COLS ROWS HOSTNAME
-ROOTPATH myarg SANDBOX_.* BASH.* EUID PPID SHELLOPTS UID ACCEPT_(KEYWORDS|LICENSE) BUILD(_PREFIX|DIR) T DIRSTACK
+myarg SANDBOX_.* BASH.* EUID PPID SHELLOPTS UID ACCEPT_(KEYWORDS|LICENSE) BUILD(_PREFIX|DIR) T DIRSTACK
DISPLAY (EBUILD|)_PHASE PORTAGE_.* RC_.* SUDO_.* IFS PATH LD_PRELOAD ret line phases D EMERGE_FROM
PORT(_LOGDIR|DIR(|_OVERLAY)) ROOT TERM _ done e ENDCOLS PROFILE_.* BRACKET BAD WARN GOOD NORMAL"
# flip this on to enable extra noisy output for debugging.
#DEBUGGING="yes"
+# XXX: required for migration from .51 to this.
+if [ -z "$PORTAGE_BIN_PATH" ]; then
+ declare -rx PORTAGE_BIN_PATH="/usr/lib/portage/bin"
+fi
+
# knock the sandbox vars back to the defaults.
reset_sandbox() {
export SANDBOX_ON="1"
@@ -252,7 +257,8 @@ load_environ() {
local SANDBOX_STATE=$SANDBOX_ON
local EBUILD_PHASE=$EBUILD_PHASE
SANDBOX_ON=0
- SANDBOX_READ="/bin:${SANDBOX_READ}:/dev/urandom:/dev/random:/usr/lib/portage/bin/"
+
+ SANDBOX_READ="/bin:${SANDBOX_READ}:/dev/urandom:/dev/random:$PORTAGE_BIN_PATH"
SANDBOX_ON=$SANDBOX_STATE
if [ ! -z $DEBUGGING ]; then
@@ -262,7 +268,7 @@ load_environ() {
if [ -n "$1" ]; then
src="$1"
local c=COMPLETED_EBUILD_PHASES
- COMPLETED_EBUILD_PHASES="`cat ${PORTAGE_BUILDDIR}/.completed_stages 2> /dev/null`"
+ COMPLETED_EBUILD_PHASES="`cat ${BUILDDIR}/.completed_stages 2> /dev/null`"
[ -z "$COMPLETED_EBUILD_PHASES" ] && COMPLETED_EBUILD_PHASES="$c"
fi
[ ! -z $DEBUGGING ] && echo "loading environment from $src" >&2
@@ -287,8 +293,8 @@ load_environ() {
return 1
fi
unset declare
- if [ -f "${PORTAGE_BUILDDIR}/.completed_stages" ]; then
- COMPLETED_EBUILD_PHASES=`cat ${PORTAGE_BUILDDIR}/.completed_stages`
+ if [ -f "${BUILDDIR}/.completed_stages" ]; then
+ COMPLETED_EBUILD_PHASES=`cat ${BUILDDIR}/.completed_stages`
else
COMPLETED_EBUILD_PHASES=''
fi
@@ -299,6 +305,7 @@ load_environ() {
source_profiles() {
local dir
save_IFS
+
# XXX: Given the following unset, is this set needed?
IFS=$'\n'
for dir in ${PROFILE_PATHS}; do
@@ -322,7 +329,8 @@ init_environ() {
OCXX="$CXX"
- export PATH="/sbin:/usr/sbin:/usr/lib/portage/bin:/bin:/usr/bin${ROOTPATH:+:${ROOTPATH}}"
+ # XXX this too, sucks.
+ export PATH="/sbin:/usr/sbin:/usr/lib/portage/bin:/bin:/usr/bin"
if [ "${EBUILD_PHASE}" == "setup" ]; then
#we specifically save the env so it's not stomped on by sourcing.
#bug 51552
@@ -351,9 +359,6 @@ init_environ() {
fi
- [ ! -z "$PREROOTPATH" ] && export PATH="${PREROOTPATH%%:}:$PATH"
-
-
export DESTTREE=/usr
export INSDESTTREE=""
export EXEDESTTREE=""
@@ -366,7 +371,7 @@ init_environ() {
# if daemonized, it's already loaded these funcs.
if [ "$DAEMONIZED" != "yes" ]; then
- source "/usr/lib/portage/bin/ebuild-functions.sh" || die "failed sourcing ebuild-functions.sh"
+ source "${PORTAGE_BIN_PATH}/ebuild-functions.sh" || die "failed sourcing ebuild-functions.sh"
fi
SANDBOX_ON="1"
export S=${WORKDIR}/${P}
@@ -382,7 +387,7 @@ init_environ() {
unset E_IUSE E_DEPEND E_RDEPEND E_CDEPEND E_PDEPEND
if [ ! -f "${EBUILD}" ]; then
- echo "bailing, ebuild not found"
+ echo "bailing, ebuild not found at '$EBUILD'"
die "EBUILD=${EBUILD}; problem is, it doesn't exist. bye." >&2
fi
@@ -435,8 +440,9 @@ init_environ() {
# echo "DONT_EXPORT_FUNCS=$DONT_EXPORT_FUNCS" >&2
}
-source "/usr/lib/portage/bin/ebuild-default-functions.sh" || die "failed sourcing ebuild-default-functions.sh"
-source "/usr/lib/portage/bin/isolated-functions.sh" || die "failed sourcing stripped down functions.sh"
+# short version. think these should be sourced via at the daemons choice, rather then defacto.
+source "${PORTAGE_BIN_PATH}/ebuild-default-functions.sh" || die "failed sourcing ebuild-default-functions.sh"
+source "${PORTAGE_BIN_PATH}/isolated-functions.sh" || die "failed sourcing stripped down functions.sh"
# general func to call for phase execution. this handles necessary env loading/dumping, and executing pre/post/dyn
# calls.
@@ -513,7 +519,7 @@ execute_phases() {
export SANDBOX_ON="0"
- temp_ebuild_phase=`cat "${PORTAGE_BUILDDIR}/.completed_stages" 2> /dev/null`
+ temp_ebuild_phase=`cat "${BUILDDIR}/.completed_stages" 2> /dev/null`
# echo "temp_ebuild_phase=$temp_ebuild_phase"
if hasq setup ${temp_ebuild_phase}; then
unset temp_ebuild_phase
@@ -609,7 +615,7 @@ execute_phases() {
COMPLETED_EBUILD_PHASES="${COMPLETED_EBUILD_PHASES} ${EBUILD_PHASE}"
;;
depend)
- SANDBOX_ON="0"
+ SANDBOX_ON="1"
MUST_EXPORT_ENV="no"
trap 'killparent' INT
@@ -625,22 +631,20 @@ execute_phases() {
trap - INT
set -f
- speak 'sending_keys'
- [ "${DEPEND:-unset}" != "unset" ] && speak "DEPEND=$(echo $DEPEND)"
- [ "${RDEPEND:-unset}" != "unset" ] && speak "RDEPEND=$(echo $RDEPEND)"
- [ "$SLOT:-unset}" != "unset" ] && speak "SLOT=$(echo $SLOT)"
- [ "$SRC_URI:-unset}" != "unset" ] && speak "SRC_URI=$(echo $SRC_URI)"
- [ "$RESTRICT:-unset}" != "unset" ] && speak "RESTRICT=$(echo $RESTRICT)"
- [ "$HOMEPAGE:-unset}" != "unset" ] && speak "HOMEPAGE=$(echo $HOMEPAGE)"
- [ "$LICENSE:-unset}" != "unset" ] && speak "LICENSE=$(echo $LICENSE)"
- [ "$DESCRIPTION:-unset}" != "unset" ] && speak "DESCRIPTION=$(echo $DESCRIPTION)"
- [ "$KEYWORDS:-unset}" != "unset" ] && speak "KEYWORDS=$(echo $KEYWORDS)"
- [ "$INHERITED:-unset}" != "unset" ] && speak "INHERITED=$(echo $INHERITED)"
- [ "$IUSE:-unset}" != "unset" ] && speak "IUSE=$(echo $IUSE)"
- [ "$CDEPEND:-unset}" != "unset" ] && speak "CDEPEND=$(echo $CDEPEND)"
- [ "$PDEPEND:-unset}" != "unset" ] && speak "PDEPEND=$(echo $PDEPEND)"
- [ "$PROVIDE:-unset}" != "unset" ] && speak "PROVIDE=$(echo $PROVIDE)"
- speak 'end_keys'
+ [ "${DEPEND:-unset}" != "unset" ] && speak "key DEPEND=$(echo $DEPEND)"
+ [ "${RDEPEND:-unset}" != "unset" ] && speak "key RDEPEND=$(echo $RDEPEND)"
+ [ "$SLOT:-unset}" != "unset" ] && speak "key SLOT=$(echo $SLOT)"
+ [ "$SRC_URI:-unset}" != "unset" ] && speak "key SRC_URI=$(echo $SRC_URI)"
+ [ "$RESTRICT:-unset}" != "unset" ] && speak "key RESTRICT=$(echo $RESTRICT)"
+ [ "$HOMEPAGE:-unset}" != "unset" ] && speak "key HOMEPAGE=$(echo $HOMEPAGE)"
+ [ "$LICENSE:-unset}" != "unset" ] && speak "key LICENSE=$(echo $LICENSE)"
+ [ "$DESCRIPTION:-unset}" != "unset" ] && speak "key DESCRIPTION=$(echo $DESCRIPTION)"
+ [ "$KEYWORDS:-unset}" != "unset" ] && speak "key KEYWORDS=$(echo $KEYWORDS)"
+ [ "$INHERITED:-unset}" != "unset" ] && speak "key INHERITED=$(echo $INHERITED)"
+ [ "$IUSE:-unset}" != "unset" ] && speak "key IUSE=$(echo $IUSE)"
+ [ "$CDEPEND:-unset}" != "unset" ] && speak "key CDEPEND=$(echo $CDEPEND)"
+ [ "$PDEPEND:-unset}" != "unset" ] && speak "key PDEPEND=$(echo $PDEPEND)"
+ [ "$PROVIDE:-unset}" != "unset" ] && speak "key PROVIDE=$(echo $PROVIDE)"
set +f
;;
*)
@@ -652,7 +656,7 @@ execute_phases() {
;;
esac
- cd ${PORTAGE_BUILDDIR} &> /dev/null
+ cd ${BUILDDIR} &> /dev/null
if [ "${MUST_EXPORT_ENV}" == "yes" ]; then
# echo "exporting environ ${EBUILD_PHASE} to ${T}/environment" >&2
export_environ "${T}/environment"
@@ -664,9 +668,9 @@ execute_phases() {
done
COMPLETED_EBUILD_PHASES="${list}"
unset list
- echo "$COMPLETED_EBUILD_PHASES" > "${PORTAGE_BUILDDIR}/.completed_stages"
- chown portage:portage "${PORTAGE_BUILDDIR}/.completed_stages" &> /dev/null
- chmod g+w "${PORTAGE_BUILDDIR}/.completed_stages" &> /dev/null
+ echo "$COMPLETED_EBUILD_PHASES" > "${BUILDDIR}/.completed_stages"
+ chown portage:portage "${BUILDDIR}/.completed_stages" &> /dev/null
+ chmod g+w "${BUILDDIR}/.completed_stages" &> /dev/null
MUST_EXPORT_ENV="no"
fi
done
@@ -674,9 +678,12 @@ execute_phases() {
}
#echo, everything has been sourced. now level the read-only's.
-for x in ${DONT_EXPORT_FUNCS}; do
- declare -fr "$x"
-done
+if [ "$*" != "daemonize" ]; then
+ for x in ${DONT_EXPORT_FUNCS}; do
+ declare -fr "$x"
+ done
+ unset x
+fi
f="$(declare | {
read l;
@@ -694,7 +701,8 @@ else
DONT_EXPORT_VARS="${DONT_EXPORT_VARS} $(echo "${f}" | egrep -v "^`gen_filter ${ORIG_VARS}`\$")"
fi
unset f
-
+
+# I see no differance here...
if [ -z "${ORIG_FUNCS}" ]; then
DONT_EXPORT_FUNCS="${DONT_EXPORT_FUNCS} $(declare -F | cut -s -d ' ' -f 3)"
else
@@ -721,6 +729,7 @@ if [ "$*" != "daemonize" ]; then
else
unset_colors
fi
+ unset x
execute_phases $*
exit 0
else