aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2008-08-10 16:17:29 +0100
committerAvatar David Leverton <levertond@googlemail.com> 2008-08-10 16:17:29 +0100
commit50eefb0b6b3cefe9b9c6ed1f90d355c6440a4802 (patch)
tree28020f3e171122ab9261fd6c8cfe0d6b1388a7e8
parent301564093f2dd20128be8f2033ec517412738b02 (diff)
downloadpaludis-50eefb0b6b3cefe9b9c6ed1f90d355c6440a4802.tar.gz
paludis-50eefb0b6b3cefe9b9c6ed1f90d355c6440a4802.tar.xz
Keep a list of phase functions for each EAPI, instead of hard-coding it in various places.
-rw-r--r--paludis/repositories/e/eapi.cc1
-rw-r--r--paludis/repositories/e/eapi.hh2
-rw-r--r--paludis/repositories/e/eapis/0.conf9
-rw-r--r--paludis/repositories/e/eapis/exheres-0.conf9
-rw-r--r--paludis/repositories/e/eapis/paludis-1.conf9
-rw-r--r--paludis/repositories/e/ebuild.cc2
-rw-r--r--paludis/repositories/e/ebuild/0/eclass_functions.bash18
-rwxr-xr-xpaludis/repositories/e/ebuild/ebuild.bash37
-rw-r--r--paludis/repositories/e/ebuild/exheres-0/exlib_functions.bash17
9 files changed, 57 insertions, 47 deletions
diff --git a/paludis/repositories/e/eapi.cc b/paludis/repositories/e/eapi.cc
index 70ef841..44103df 100644
--- a/paludis/repositories/e/eapi.cc
+++ b/paludis/repositories/e/eapi.cc
@@ -136,6 +136,7 @@ namespace
value_for<n::bracket_merged_variables>(check_get(k, "bracket_merged_variables")),
value_for<n::directory_if_exists_variables>(check_get(k, "directory_if_exists_variables")),
value_for<n::directory_variables>(check_get(k, "directory_variables")),
+ value_for<n::ebuild_functions>(check_get(k, "ebuild_functions")),
value_for<n::ebuild_module_suffixes>(check_get(k, "ebuild_module_suffixes")),
value_for<n::ebuild_must_not_set_variables>(check_get(k, "ebuild_must_not_set_variables")),
value_for<n::eclass_must_not_set_variables>(check_get(k, "eclass_must_not_set_variables")),
diff --git a/paludis/repositories/e/eapi.hh b/paludis/repositories/e/eapi.hh
index ed11863..e40382b 100644
--- a/paludis/repositories/e/eapi.hh
+++ b/paludis/repositories/e/eapi.hh
@@ -55,6 +55,7 @@ namespace paludis
struct eapi;
struct ebuild_config;
struct ebuild_environment_variables;
+ struct ebuild_functions;
struct ebuild_info;
struct ebuild_install;
struct ebuild_metadata;
@@ -273,6 +274,7 @@ namespace paludis
NamedValue<n::bracket_merged_variables, std::string> bracket_merged_variables;
NamedValue<n::directory_if_exists_variables, std::string> directory_if_exists_variables;
NamedValue<n::directory_variables, std::string> directory_variables;
+ NamedValue<n::ebuild_functions, std::string> ebuild_functions;
NamedValue<n::ebuild_module_suffixes, std::string> ebuild_module_suffixes;
NamedValue<n::ebuild_must_not_set_variables, std::string> ebuild_must_not_set_variables;
NamedValue<n::eclass_must_not_set_variables, std::string> eclass_must_not_set_variables;
diff --git a/paludis/repositories/e/eapis/0.conf b/paludis/repositories/e/eapis/0.conf
index 32d2471..97d3898 100644
--- a/paludis/repositories/e/eapis/0.conf
+++ b/paludis/repositories/e/eapis/0.conf
@@ -86,6 +86,15 @@ load_modules = \
conditional_functions kernel_functions sandbox portage_stubs \
multilib_functions install_functions build_functions eclass_functions
+ebuild_functions = \
+ builtin_infovars builtin_init builtin_initrm builtin_initmisc \
+ builtin_loadenv builtin_metadata builtin_killold builtin_killoldrm \
+ builtin_killoldmisc builtin_saveenv builtin_tidyup builtin_tidyuprm \
+ builtin_tidyupmisc builtin_variable \
+ pkg_config pkg_info pkg_nofetch pkg_postinst pkg_postrm \
+ pkg_preinst pkg_prerm pkg_setup \
+ src_compile src_install src_test src_unpack
+
ebuild_install = \
: killold ; \
userpriv sandbox : init saveenv ; \
diff --git a/paludis/repositories/e/eapis/exheres-0.conf b/paludis/repositories/e/eapis/exheres-0.conf
index c709d6b..fb3feab 100644
--- a/paludis/repositories/e/eapis/exheres-0.conf
+++ b/paludis/repositories/e/eapis/exheres-0.conf
@@ -92,6 +92,15 @@ load_modules = \
conditional_functions kernel_functions sandbox portage_stubs ever_functions \
multilib_functions install_functions build_functions exlib_functions
+ebuild_functions = \
+ builtin_infovars builtin_init builtin_initrm builtin_initmisc \
+ builtin_loadenv builtin_metadata builtin_killold builtin_killoldrm \
+ builtin_killoldmisc builtin_saveenv builtin_tidyup builtin_tidyuprm \
+ builtin_tidyupmisc builtin_variable \
+ pkg_config pkg_info pkg_nofetch pkg_postinst pkg_postrm \
+ pkg_preinst pkg_prerm pkg_pretend pkg_setup \
+ src_compile src_configure src_install src_prepare src_test src_unpack
+
ebuild_install = \
: killold ; \
userpriv sandbox : init saveenv ; \
diff --git a/paludis/repositories/e/eapis/paludis-1.conf b/paludis/repositories/e/eapis/paludis-1.conf
index 82c3666..799d2bc 100644
--- a/paludis/repositories/e/eapis/paludis-1.conf
+++ b/paludis/repositories/e/eapis/paludis-1.conf
@@ -90,6 +90,15 @@ load_modules = \
conditional_functions kernel_functions sandbox portage_stubs \
multilib_functions install_functions build_functions eclass_functions
+ebuild_functions = \
+ builtin_infovars builtin_init builtin_initrm builtin_initmisc \
+ builtin_loadenv builtin_metadata builtin_killold builtin_killoldrm \
+ builtin_killoldmisc builtin_saveenv builtin_tidyup builtin_tidyuprm \
+ builtin_tidyupmisc builtin_variable \
+ pkg_config pkg_info pkg_nofetch pkg_postinst pkg_postrm \
+ pkg_preinst pkg_prerm pkg_pretend pkg_setup \
+ src_compile src_install src_test src_unpack
+
ebuild_install = \
: killold ; \
userpriv sandbox : init saveenv ; \
diff --git a/paludis/repositories/e/ebuild.cc b/paludis/repositories/e/ebuild.cc
index 020ce8f..1870c4b 100644
--- a/paludis/repositories/e/ebuild.cc
+++ b/paludis/repositories/e/ebuild.cc
@@ -174,6 +174,8 @@ EbuildCommand::operator() ()
params.package_id()->eapi()->supported()->ebuild_options()->ignore_pivot_env_variables())
.with_setenv("PALUDIS_LOAD_MODULES",
params.package_id()->eapi()->supported()->ebuild_options()->load_modules())
+ .with_setenv("PALUDIS_EBUILD_FUNCTIONS",
+ params.package_id()->eapi()->supported()->ebuild_options()->ebuild_functions())
.with_setenv("PALUDIS_BINARY_DISTDIR_VARIABLE",
params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_distdir())
.with_setenv("PALUDIS_UNPACK_UNRECOGNISED_IS_FATAL",
diff --git a/paludis/repositories/e/ebuild/0/eclass_functions.bash b/paludis/repositories/e/ebuild/0/eclass_functions.bash
index 62f1e67..86a303d 100644
--- a/paludis/repositories/e/ebuild/0/eclass_functions.bash
+++ b/paludis/repositories/e/ebuild/0/eclass_functions.bash
@@ -26,20 +26,10 @@ EXPORT_FUNCTIONS()
local e
for e in "$@" ; do
- case "$e" in
- pkg_nofetch|pkg_setup|pkg_prerm|pkg_postrm|pkg_preinst|pkg_postinst|pkg_config)
- eval "${e}() { ${ECLASS}_${e} \"\$@\" ; }"
- ;;
-
- src_unpack|src_compile|src_install|src_test)
- eval "${e}() { ${ECLASS}_${e} \"\$@\" ; }"
- ;;
-
- *)
- eval "${e}() { ${ECLASS}_${e} \"\$@\" ; }"
- ebuild_notice "qa" "$e should not be in EXPORT_FUNCTIONS for ${ECLASS}"
- ;;
- esac
+ if [[ "${e}" == builtin_* ]] || ! has "${e}" ${PALUDIS_EBUILD_FUNCTIONS}; then
+ ebuild_notice "qa" "$e should not be in EXPORT_FUNCTIONS for ${ECLASS}"
+ fi
+ eval "${e}() { ${ECLASS}_${e} \"\$@\" ; }"
done
}
diff --git a/paludis/repositories/e/ebuild/ebuild.bash b/paludis/repositories/e/ebuild/ebuild.bash
index d48d261..e2ba10e 100755
--- a/paludis/repositories/e/ebuild/ebuild.bash
+++ b/paludis/repositories/e/ebuild/ebuild.bash
@@ -135,6 +135,15 @@ for m in ${PALUDIS_LOAD_MODULES}; do
ebuild_load_module ${m}
done
+[[ -z ${PALUDIS_EBUILD_FUNCTIONS} ]] && PALUDIS_EBUILD_FUNCTIONS="
+ builtin_infovars builtin_init builtin_initrm builtin_initmisc
+ builtin_loadenv builtin_metadata builtin_killold builtin_killoldrm
+ builtin_killoldmisc builtin_saveenv builtin_tidyup builtin_tidyuprm
+ builtin_tidyupmisc builtin_variable
+ pkg_config pkg_info pkg_nofetch pkg_postinst pkg_postrm
+ pkg_preinst pkg_prerm pkg_pretend pkg_setup
+ src_compile src_configure src_install src_prepare src_test src_unpack"
+
check_paludis_pipe_command()
{
[[ -n "${PALUDIS_SKIP_PIPE_COMMAND_CHECK}" ]] && return
@@ -402,26 +411,14 @@ perform_hook()
}
paludis_phase_to_function_name() {
- case "${1}" in
- metadata|variable|init|initmisc|initrm|killold|killoldmisc|killoldrm|merge|\
- unmerge|tidyup|tidyupmisc|tidyuprm|loadenv|saveenv|initbin|\
- unpackbin|infovars|pivotbin|installbin)
- echo builtin_${1}
- ;;
-
- unpack|prepare|configure|compile|install|test)
- echo src_${1}
- ;;
-
- setup|config|nofetch|preinst|postinst|prerm|postrm|pretend|info)
- echo pkg_${1}
- ;;
-
- *)
- die "Usage error: Unknown phase '${1}'"
- exit 1
- ;;
- esac
+ local p
+ for p in builtin src pkg; do
+ if has ${p}_${1} ${PALUDIS_EBUILD_FUNCTIONS}; then
+ echo ${p}_${1}
+ return
+ fi
+ done
+ die "Usage error: Unknown phase '${1}'"
}
ebuild_main()
diff --git a/paludis/repositories/e/ebuild/exheres-0/exlib_functions.bash b/paludis/repositories/e/ebuild/exheres-0/exlib_functions.bash
index d78de73..034ea8f 100644
--- a/paludis/repositories/e/ebuild/exheres-0/exlib_functions.bash
+++ b/paludis/repositories/e/ebuild/exheres-0/exlib_functions.bash
@@ -22,19 +22,10 @@ export_exlib_phases()
local e
for e in "$@" ; do
- case "$e" in
- pkg_nofetch|pkg_setup|pkg_prerm|pkg_postrm|pkg_preinst|pkg_postinst|pkg_config|pkg_pretend|pkg_info)
- eval "${e}() { ${CURRENT_EXLIB}_${e} \"\$@\" ; }"
- ;;
-
- src_unpack|src_prepare|src_configure|src_compile|src_install|src_test)
- eval "${e}() { ${CURRENT_EXLIB}_${e} \"\$@\" ; }"
- ;;
-
- *)
- die "$e should not be in export_exlib_phases for ${CURRENT_EXLIB}"
- ;;
- esac
+ if [[ "${e}" == builtin_* ]] || ! has "${e}" ${PALUDIS_EBUILD_FUNCTIONS}; then
+ die "$e should not be in export_exlib_phases for ${CURRENT_EXLIB}"
+ fi
+ eval "${e}() { ${CURRENT_EXLIB}_${e} \"\$@\" ; }"
done
}