aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2012-09-09 19:10:07 +0100
committerAvatar David Leverton <levertond@googlemail.com> 2012-09-09 19:10:07 +0100
commit012179625e140693f4d4b9d600dbac1d97739ed3 (patch)
tree0024bc896fe047c2f986c5d8e60b410580f09f9f
parentff055935bf6917e86b39bd9d547c86c2fd58a0ef (diff)
downloadpaludis-012179625e140693f4d4b9d600dbac1d97739ed3.tar.gz
paludis-012179625e140693f4d4b9d600dbac1d97739ed3.tar.xz
EBUILD_PHASE_FUNC variable in EAPI 5
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_4_setup.sh1
-rw-r--r--paludis/repositories/e/e_repository_TEST_5.cc10
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_5_setup.sh17
-rw-r--r--paludis/repositories/e/eapi.cc1
-rw-r--r--paludis/repositories/e/eapi.hh2
-rw-r--r--paludis/repositories/e/eapis/0.conf1
-rw-r--r--paludis/repositories/e/eapis/5.conf2
-rw-r--r--paludis/repositories/e/eapis/exheres-0.conf1
-rw-r--r--paludis/repositories/e/eapis/paludis-1.conf1
-rw-r--r--paludis/repositories/e/ebuild.cc6
-rwxr-xr-xpaludis/repositories/e/ebuild/ebuild.bash2
11 files changed, 44 insertions, 0 deletions
diff --git a/paludis/repositories/e/e_repository_TEST_4_setup.sh b/paludis/repositories/e/e_repository_TEST_4_setup.sh
index c1f9e09..27b13de 100755
--- a/paludis/repositories/e/e_repository_TEST_4_setup.sh
+++ b/paludis/repositories/e/e_repository_TEST_4_setup.sh
@@ -1155,6 +1155,7 @@ pkg_pretend() {
[[ -z $(type -t usex) ]] || die
[[ -z $(type -t doheader) ]] || die
[[ -z $(type -t newheader) ]] || die
+ [[ -z ${EBUILD_PHASE_FUNC} ]] || die
}
END
mkdir -p "cat/no-new-stdin"
diff --git a/paludis/repositories/e/e_repository_TEST_5.cc b/paludis/repositories/e/e_repository_TEST_5.cc
index 23427b7..f020a4f 100644
--- a/paludis/repositories/e/e_repository_TEST_5.cc
+++ b/paludis/repositories/e/e_repository_TEST_5.cc
@@ -202,6 +202,16 @@ TEST(ERepository, InstallEAPI5)
EXPECT_EQ("5", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value());
id->perform_action(action);
}
+
+ {
+ const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/ebuild-phase-func-5::test-repo",
+ &env, { })), make_null_shared_ptr(), { }))]->last());
+ ASSERT_TRUE(bool(id));
+ EXPECT_EQ("5", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value());
+ id->perform_action(pretend_action);
+ ASSERT_TRUE(! pretend_action.failed());
+ }
}
TEST(ERepository, RequiredUse)
diff --git a/paludis/repositories/e/e_repository_TEST_5_setup.sh b/paludis/repositories/e/e_repository_TEST_5_setup.sh
index b38a5ce..2bbf6c3 100755
--- a/paludis/repositories/e/e_repository_TEST_5_setup.sh
+++ b/paludis/repositories/e/e_repository_TEST_5_setup.sh
@@ -339,5 +339,22 @@ EOF
}
END
+mkdir -p "cat/ebuild-phase-func" || exit 1
+cat << 'END' > cat/ebuild-phase-func/ebuild-phase-func-5.ebuild || exit 1
+EAPI="5"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE=""
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+pkg_pretend() {
+ [[ ${EBUILD_PHASE} == pretend ]] || die
+ [[ ${EBUILD_PHASE_FUNC} == pkg_pretend ]] || die
+}
+END
+
cd ..
cd ..
diff --git a/paludis/repositories/e/eapi.cc b/paludis/repositories/e/eapi.cc
index f149e08..053c9eb 100644
--- a/paludis/repositories/e/eapi.cc
+++ b/paludis/repositories/e/eapi.cc
@@ -81,6 +81,7 @@ namespace
n::env_d() = check_get(k, "env_d"),
n::env_distdir() = check_get(k, "env_distdir"),
n::env_ebuild_phase() = check_get(k, "env_ebuild_phase"),
+ n::env_ebuild_phase_func() = check_get(k, "env_ebuild_phase_func"),
n::env_ed() = check_get(k, "env_ed"),
n::env_eprefix() = check_get(k, "env_eprefix"),
n::env_eroot() = check_get(k, "env_eroot"),
diff --git a/paludis/repositories/e/eapi.hh b/paludis/repositories/e/eapi.hh
index b5aad4f..c575f89 100644
--- a/paludis/repositories/e/eapi.hh
+++ b/paludis/repositories/e/eapi.hh
@@ -98,6 +98,7 @@ namespace paludis
typedef Name<struct name_env_d> env_d;
typedef Name<struct name_env_distdir> env_distdir;
typedef Name<struct name_env_ebuild_phase> env_ebuild_phase;
+ typedef Name<struct name_env_ebuild_phase_func> env_ebuild_phase_func;
typedef Name<struct name_env_ed> env_ed;
typedef Name<struct name_env_eprefix> env_eprefix;
typedef Name<struct name_env_eroot> env_eroot;
@@ -340,6 +341,7 @@ namespace paludis
NamedValue<n::env_d, std::string> env_d;
NamedValue<n::env_distdir, std::string> env_distdir;
NamedValue<n::env_ebuild_phase, std::string> env_ebuild_phase;
+ NamedValue<n::env_ebuild_phase_func, std::string> env_ebuild_phase_func;
NamedValue<n::env_ed, std::string> env_ed;
NamedValue<n::env_eprefix, std::string> env_eprefix;
NamedValue<n::env_eroot, std::string> env_eroot;
diff --git a/paludis/repositories/e/eapis/0.conf b/paludis/repositories/e/eapis/0.conf
index 4d60151..fe1906f 100644
--- a/paludis/repositories/e/eapis/0.conf
+++ b/paludis/repositories/e/eapis/0.conf
@@ -253,6 +253,7 @@ env_pf = PF
env_filesdir = FILESDIR
env_a = A
env_ebuild_phase = EBUILD_PHASE
+env_ebuild_phase_func =
dependency_labels =
diff --git a/paludis/repositories/e/eapis/5.conf b/paludis/repositories/e/eapis/5.conf
index f413c91..3e5fec9 100644
--- a/paludis/repositories/e/eapis/5.conf
+++ b/paludis/repositories/e/eapis/5.conf
@@ -22,6 +22,8 @@ load_modules = ${load_modules} usex
use_stable_mask_force = true
+env_ebuild_phase_func = EBUILD_PHASE_FUNC
+
best_has_version_host_root = true
econf_extra_options_help_dependent = ${econf_extra_options_help_dependent} disable-silent-rules::--disable-silent-rules
new_stdin = true
diff --git a/paludis/repositories/e/eapis/exheres-0.conf b/paludis/repositories/e/eapis/exheres-0.conf
index 2d8d4ce..49c30d0 100644
--- a/paludis/repositories/e/eapis/exheres-0.conf
+++ b/paludis/repositories/e/eapis/exheres-0.conf
@@ -310,6 +310,7 @@ env_a = ARCHIVES
env_replacing_ids = REPLACING_IDS
env_replaced_by_id = REPLACED_BY_ID
env_ebuild_phase = EXHERES_PHASE
+env_ebuild_phase_func =
env_jobs = EXJOBS
uri_labels = \
diff --git a/paludis/repositories/e/eapis/paludis-1.conf b/paludis/repositories/e/eapis/paludis-1.conf
index 0c44f52..61f3396 100644
--- a/paludis/repositories/e/eapis/paludis-1.conf
+++ b/paludis/repositories/e/eapis/paludis-1.conf
@@ -250,6 +250,7 @@ env_pf = PF
env_filesdir = FILESDIR
env_a = A
env_ebuild_phase = EBUILD_PHASE
+env_ebuild_phase_func =
uri_labels = \
default = URIListedThenMirrorsLabel ; \
diff --git a/paludis/repositories/e/ebuild.cc b/paludis/repositories/e/ebuild.cc
index c1651f3..066a315 100644
--- a/paludis/repositories/e/ebuild.cc
+++ b/paludis/repositories/e/ebuild.cc
@@ -267,6 +267,8 @@ EbuildCommand::operator() ()
params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_pf())
.setenv("PALUDIS_EBUILD_PHASE_VAR",
params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_ebuild_phase())
+ .setenv("PALUDIS_EBUILD_PHASE_FUNC_VAR",
+ params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_ebuild_phase_func())
.setenv("PALUDIS_PIPE_COMMANDS_SUPPORTED", "yes")
.setenv("PALUDIS_PIPE_COMMANDS_STATUS_SUPPORTED", "yes")
.setenv("PALUDIS_PIPE_COMMAND_DELIM", "\2")
@@ -1060,6 +1062,8 @@ WriteVDBEntryCommand::operator() ()
params.package_id()->eapi()->supported()->ebuild_options()->ebuild_module_suffixes())
.setenv("PALUDIS_EBUILD_PHASE_VAR",
params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_ebuild_phase())
+ .setenv("PALUDIS_EBUILD_PHASE_FUNC_VAR",
+ params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_ebuild_phase_func())
.setenv("PALUDIS_PIPE_COMMANDS_SUPPORTED", "yes")
.setenv("PALUDIS_PIPE_COMMANDS_STATUS_SUPPORTED", "yes")
.pipe_command_handler("PALUDIS_PIPE_COMMAND", std::bind(&pipe_command_handler, params.environment(),
@@ -1317,6 +1321,8 @@ WriteBinaryEbuildCommand::operator() ()
params.package_id()->eapi()->supported()->ebuild_options()->ebuild_module_suffixes())
.setenv("PALUDIS_EBUILD_PHASE_VAR",
params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_ebuild_phase())
+ .setenv("PALUDIS_EBUILD_PHASE_FUNC_VAR",
+ params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_ebuild_phase_func())
.setenv("PALUDIS_PIPE_COMMANDS_SUPPORTED", "yes")
.setenv("PALUDIS_PIPE_COMMANDS_STATUS_SUPPORTED", "yes")
.pipe_command_handler("PALUDIS_PIPE_COMMAND", std::bind(&pipe_command_handler, params.environment(),
diff --git a/paludis/repositories/e/ebuild/ebuild.bash b/paludis/repositories/e/ebuild/ebuild.bash
index c0e6a48..6a893bc 100755
--- a/paludis/repositories/e/ebuild/ebuild.bash
+++ b/paludis/repositories/e/ebuild/ebuild.bash
@@ -628,6 +628,8 @@ ebuild_main()
for action in $@ ; do
export ${PALUDIS_EBUILD_PHASE_VAR}="${action}"
+ [[ -n ${PALUDIS_EBUILD_PHASE_FUNC_VAR} ]] && export ${PALUDIS_EBUILD_PHASE_FUNC_VAR}="$(paludis_phase_to_function_name "${action}")"
+
perform_hook ebuild_${action}_pre
if [[ ${action} == metadata ]]; then