summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorBrian Harring <ferringb@gentoo.org>2005-11-09 20:06:11 +0000
committerBrian Harring <ferringb@gentoo.org>2005-11-09 20:06:11 +0000
commit38c408b674a1f61db1991091724dd2ff0b21a9dd (patch)
treed5be377e5ecaf7ba2832818e27dcf7bbe6695298 /bin
parent2a3b095d1b920210e6925de721268117311bde3c (diff)
downloadportage-38c408b674a1f61db1991091724dd2ff0b21a9dd.tar.gz
portage-38c408b674a1f61db1991091724dd2ff0b21a9dd.tar.bz2
portage-38c408b674a1f61db1991091724dd2ff0b21a9dd.zip
pre/post hooks originally from 2.1, quick rewrite by axxo for 2.0
Not to be used by ebuilds/eclasses (with the sole exception of java eclass var reset till ebd is stabled), this is user hooks. svn path=/main/trunk/; revision=2267
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ebuild.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 4ba25ee12..be4486182 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -634,11 +634,14 @@ END
dyn_setup()
{
+ [ "$(type -t pre_pkg_setup)" == "function" ] && pre_pkg_setup
pkg_setup
+ [ "$(type -t post_pkg_setup)" == "function" ] && post_pkg_setup
}
dyn_unpack() {
trap "abort_unpack" SIGINT SIGQUIT
+ [ "$(type -t pre_src_unpack)" == "function" ] && pre_src_unpack
local newstuff="no"
if [ -e "${WORKDIR}" ]; then
local x
@@ -665,6 +668,7 @@ dyn_unpack() {
if [ -e "${WORKDIR}" ]; then
if [ "$newstuff" == "no" ]; then
echo ">>> WORKDIR is up-to-date, keeping..."
+ [ "$(type -t post_src_unpack)" == "function" ] && post_src_unpack
return 0
fi
fi
@@ -676,6 +680,9 @@ dyn_unpack() {
touch "${BUILDDIR}/.unpacked" || die "IO Failure -- Failed 'touch .unpacked' in BUILDIR"
echo ">>> Source unpacked."
cd "$BUILDDIR"
+
+ [ "$(type -t post_src_unpack)" == "function" ] && post_src_unpack
+
trap SIGINT SIGQUIT
}
@@ -857,6 +864,9 @@ abort_install() {
dyn_compile() {
trap "abort_compile" SIGINT SIGQUIT
+
+ [ "$(type -t pre_src_compile)" == "function" ] && pre_src_compile
+
[ "${CFLAGS-unset}" != "unset" ] && export CFLAGS
[ "${CXXFLAGS-unset}" != "unset" ] && export CXXFLAGS
[ "${LIBCFLAGS-unset}" != "unset" ] && export LIBCFLAGS
@@ -895,6 +905,7 @@ dyn_compile() {
echo ">>> It appears that ${PN} is already compiled; skipping."
echo ">>> (clean to force compilation)"
trap SIGINT SIGQUIT
+ [ "$(type -t post_src_compile)" == "function" ] && post_src_compile
return
fi
if [ -d "${S}" ]; then
@@ -951,6 +962,9 @@ dyn_compile() {
if hasq nostrip $FEATURES $RESTRICT; then
touch DEBUGBUILD
fi
+
+ [ "$(type -t post_src_compile)" == "function" ] && post_src_compile
+
trap SIGINT SIGQUIT
}
@@ -975,8 +989,10 @@ dyn_package() {
dyn_test() {
+ [ "$(type -t pre_src_test)" == "function" ] && pre_src_test
if [ ${BUILDDIR}/.tested -nt "${WORKDIR}" ]; then
echo ">>> It appears that ${PN} has already been tested; skipping."
+ [ "$(type -t post_src_test)" == "function" ] && post_src_test
return
fi
trap "abort_test" SIGINT SIGQUIT
@@ -995,6 +1011,7 @@ dyn_test() {
cd "${BUILDDIR}"
touch .tested || die "Failed to 'touch .tested' in ${BUILDDIR}"
+ [ "$(type -t post_src_test)" == "function" ] && post_src_test
trap SIGINT SIGQUIT
}
@@ -1004,6 +1021,7 @@ PORTAGE_INST_GID="0"
dyn_install() {
trap "abort_install" SIGINT SIGQUIT
+ [ "$(type -t pre_src_install)" == "function" ] && pre_src_install
rm -rf "${BUILDDIR}/image"
mkdir "${BUILDDIR}/image"
if [ -d "${S}" ]; then
@@ -1207,6 +1225,7 @@ dyn_install() {
echo ">>> Completed installing ${PF} into ${D}"
echo
cd ${BUILDDIR}
+ [ "$(type -t post_src_install)" == "function" ] && post_src_install
trap SIGINT SIGQUIT
}
@@ -1214,6 +1233,8 @@ dyn_preinst() {
# set IMAGE depending if this is a binary or compile merge
[ "${EMERGE_FROM}" == "binary" ] && IMAGE=${PKG_TMPDIR}/${PF}/bin \
|| IMAGE=${D}
+
+ [ "$(type -t pre_pkg_preinst)" == "function" ] && pre_pkg_preinst
D=${IMAGE} pkg_preinst
@@ -1322,6 +1343,9 @@ dyn_preinst() {
echo "!!! Unable to set SELinux security labels"
fi
fi
+
+ [ "$(type -t post_pkg_preinst)" == "function" ] && post_pkg_preinst
+
trap SIGINT SIGQUIT
}
@@ -1848,11 +1872,15 @@ for myarg in $*; do
prerm|postrm|postinst|config)
export SANDBOX_ON="0"
if [ "$PORTAGE_DEBUG" != "1" ]; then
+ [ "$(type -t pre_pkg_${myarg})" == "function" ] && pre_pkg_${myarg}
pkg_${myarg}
+ [ "$(type -t post_pkg_${myarg})" == "function" ] && post_pkg_${myarg}
#Allow non-zero return codes since they can be caused by &&
else
set -x
+ [ "$(type -t pre_pkg_${myarg})" == "function" ] && pre_pkg_${myarg}
pkg_${myarg}
+ [ "$(type -t post_pkg_${myarg})" == "function" ] && post_pkg_${myarg}
#Allow non-zero return codes since they can be caused by &&
set +x
fi