aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/builtins/inherit_builtin.cpp19
-rwxr-xr-xutils/isolated-functions.sh2
2 files changed, 17 insertions, 4 deletions
diff --git a/src/builtins/inherit_builtin.cpp b/src/builtins/inherit_builtin.cpp
index 1490e5b..96dab9b 100644
--- a/src/builtins/inherit_builtin.cpp
+++ b/src/builtins/inherit_builtin.cpp
@@ -83,8 +83,8 @@ int inherit_builtin::exec(const std::vector<std::string>& bash_args)
{
location = eclassdir + *iter + ".eclass";
_walker.set_value("ECLASS", *iter);
- export_funcs_var = "__export_functions_" + _walker.resolve<std::string>("ECLASS_DEPTH");
- _walker.unset(export_funcs_var);
+ _walker.define("__export_funcs_var", "__export_functions_" + _walker.resolve<std::string>("ECLASS_DEPTH"));
+ _walker.unset(_walker.resolve<std::string>("__export_funcs_var"));
// Portage implementation performs actions for overlays here but we don't do it for now
@@ -108,7 +108,20 @@ int inherit_builtin::exec(const std::vector<std::string>& bash_args)
restore_global("RDEPEND", B_RDEPEND);
restore_global("PDEPEND", B_PDEPEND);
- // Portage implementation exports functions here but we don't do it for now
+ if(!_walker.is_unset(_walker.resolve<std::string>("__export_funcs_var")))
+ {
+ std::stringstream func_names(_walker.resolve<std::string>(_walker.resolve<std::string>("__export_funcs_var")));
+ std::string func_name;
+
+ while(func_names >> func_name)
+ {
+ std::stringstream func;
+ func << func_name << "() { " << _walker.resolve<std::string>("ECLASS") << "_" << func_name
+ << " \"$@\" ; }";
+ _walker.execute_builtin("eval", {func.str()});
+ }
+ }
+ _walker.unset(_walker.resolve<std::string>("__export_funcs_var"));
if(!hasq(*iter, "INHERITED"))
_walker.set_value("INHERITED", _walker.resolve<std::string>("INHERITED") + " " + *iter);
diff --git a/utils/isolated-functions.sh b/utils/isolated-functions.sh
index 9d189ed..150fe4b 100755
--- a/utils/isolated-functions.sh
+++ b/utils/isolated-functions.sh
@@ -19,7 +19,7 @@ EXPORT_FUNCTIONS() {
die "EXPORT_FUNCTIONS without a defined ECLASS"
return 1
fi
- __export_funcs_var="$__export_funcs_var $*"
+ eval $__export_funcs_var+=\" $*\"
}
use() {