aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Bo ├śrsted Andresen <bo.andresen@zlin.dk> 2009-10-05 06:10:43 +0000
committerAvatar Bo ├śrsted Andresen <bo.andresen@zlin.dk> 2009-10-05 18:59:20 +0000
commit61d5d9da7cdeba7120ec3b333e15e5ccec96a912 (patch)
tree50f697f635ebc4938f9e64ec1293e1e678b0ff90
parentcbfa5a1f18259de94ca6a44b25caa58e8679fc21 (diff)
downloadpaludis-61d5d9da7cdeba7120ec3b333e15e5ccec96a912.tar.gz
paludis-61d5d9da7cdeba7120ec3b333e15e5ccec96a912.tar.xz
Enforce cross-phase function call ban for exlib phase functions too #755.
-rw-r--r--paludis/repositories/e/e_repository_TEST_exlibs.cc2
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_exlibs_setup.sh40
-rw-r--r--paludis/repositories/e/ebuild/exheres-0/exlib_functions.bash8
3 files changed, 50 insertions, 0 deletions
diff --git a/paludis/repositories/e/e_repository_TEST_exlibs.cc b/paludis/repositories/e/e_repository_TEST_exlibs.cc
index 8f4a1ee..1caa4db 100644
--- a/paludis/repositories/e/e_repository_TEST_exlibs.cc
+++ b/paludis/repositories/e/e_repository_TEST_exlibs.cc
@@ -198,6 +198,8 @@ namespace test_cases
ExlibsTest test_called_cross_phase("called-cross-phase", throws_InstallActionError);
ExlibsTest test_called_cross_phase_default("called-cross-phase-default", throws_InstallActionError);
ExlibsTest test_called_cross_phase_user_overridden("called-cross-phase-user-overridden", throws_InstallActionError);
+ ExlibsTest test_called_cross_phase_exlib("called-cross-phase-exlib", throws_InstallActionError);
+ ExlibsTest test_called_cross_phase_exlib_exported("called-cross-phase-exlib-exported", throws_InstallActionError);
ExlibsTest test_boolean("boolean", success);
ExlibsTest test_boolean_badvalue("boolean-badvalue", throws_UnsupportedActionError);
ExlibsTest test_boolean_blankvalue("boolean-blankvalue", throws_UnsupportedActionError);
diff --git a/paludis/repositories/e/e_repository_TEST_exlibs_setup.sh b/paludis/repositories/e/e_repository_TEST_exlibs_setup.sh
index a4d236b..042c2d1 100755
--- a/paludis/repositories/e/e_repository_TEST_exlibs_setup.sh
+++ b/paludis/repositories/e/e_repository_TEST_exlibs_setup.sh
@@ -576,6 +576,46 @@ src_unpack() {
pkg_setup
}
END
+mkdir -p "packages/cat/called-cross-phase-exlib"
+cat <<'END' > packages/cat/called-cross-phase-exlib/verify.exlib || exit 1
+verify_pkg_setup() {
+ :
+}
+END
+cat <<'END' > packages/cat/called-cross-phase-exlib/called-cross-phase-exlib-1.ebuild || exit 1
+require verify
+
+DESCRIPTION="The Long Description"
+SUMMARY="The Short Description"
+HOMEPAGE="http://example.com/"
+SLOT="0"
+LICENCES="GPL-2"
+
+src_unpack() {
+ verify_pkg_setup
+}
+END
+mkdir -p "packages/cat/called-cross-phase-exlib-exported"
+cat <<'END' > packages/cat/called-cross-phase-exlib-exported/verify.exlib || exit 1
+export_exlib_phases pkg_setup
+
+verify_pkg_setup() {
+ :
+}
+END
+cat <<'END' > packages/cat/called-cross-phase-exlib-exported/called-cross-phase-exlib-exported-1.ebuild || exit 1
+require verify
+
+DESCRIPTION="The Long Description"
+SUMMARY="The Short Description"
+HOMEPAGE="http://example.com/"
+SLOT="0"
+LICENCES="GPL-2"
+
+src_unpack() {
+ pkg_setup
+}
+END
cd ..
cd ..
diff --git a/paludis/repositories/e/ebuild/exheres-0/exlib_functions.bash b/paludis/repositories/e/ebuild/exheres-0/exlib_functions.bash
index 5db1546..e6f3eb2 100644
--- a/paludis/repositories/e/ebuild/exheres-0/exlib_functions.bash
+++ b/paludis/repositories/e/ebuild/exheres-0/exlib_functions.bash
@@ -193,6 +193,14 @@ require()
source "${location}" || die "Error sourcing exlib ${e}"
hasq "${CURRENT_EXLIB}" ${INHERITED} || export INHERITED="${INHERITED} ${CURRENT_EXLIB}"
+ local f e_f
+ for f in ${PALUDIS_EBUILD_FUNCTIONS} ; do
+ [[ ${f} == builtin_* ]] && continue
+ [[ $(type -t ${CURRENT_EXLIB}_${f}) == function ]] || continue
+ e_f=$(declare -f ${CURRENT_EXLIB}_${f})
+ eval "${e_f/{/{ verify_not_called_cross_phase ${f}}"
+ done
+
for v in ${PALUDIS_SOURCE_MERGED_VARIABLES} ; do
local e_v="E_${v}"
export -n ${e_v}="${!e_v} ${!v}"