aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-12-04 14:20:19 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-12-04 20:51:26 +0000
commit821693b16c1f997ff5567c1bbf3966244bb835fa (patch)
treee65f37866579032e9c5489aeed7a9a93fe831ca1
parentc8840c14f37099fb74cc68684a260eff7641a7ce (diff)
downloadpaludis-821693b16c1f997ff5567c1bbf3966244bb835fa.tar.gz
paludis-821693b16c1f997ff5567c1bbf3966244bb835fa.tar.xz
EAPI 4 has MERGE_TYPE
-rw-r--r--paludis/repositories/e/e_repository.cc20
-rw-r--r--paludis/repositories/e/e_repository_TEST_4.cc173
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_4_setup.sh46
-rw-r--r--paludis/repositories/e/eapi.cc1
-rw-r--r--paludis/repositories/e/eapi.hh2
-rw-r--r--paludis/repositories/e/eapis/4.conf1
-rw-r--r--paludis/repositories/e/eapis/pbin-1+4.conf1
-rw-r--r--paludis/repositories/e/ebuild.cc20
-rw-r--r--paludis/repositories/e/ebuild.hh6
9 files changed, 262 insertions, 8 deletions
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index 29c9be8..ac37961 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -2608,7 +2608,9 @@ ERepository::install(const std::shared_ptr<const ERepositoryID> & id,
n::accept_license() = accept_license,
n::config_protect() = environment_updated_profile_variable("CONFIG_PROTECT"),
n::config_protect_mask() = environment_updated_profile_variable("CONFIG_PROTECT_MASK"),
+ n::destination() = install_action.options.destination(),
n::expand_vars() = expand_vars,
+ n::is_from_pbin() = id->eapi()->supported()->is_pbin(),
n::loadsaveenv_dir() = package_builddir / "temp",
n::profiles() = _imp->params.profiles(),
n::profiles_with_parents() = profile()->profiles_with_parents(),
@@ -3094,14 +3096,16 @@ ERepository::pretend(
EbuildPretendCommand pretend_cmd(command_params,
make_named_values<EbuildPretendCommandParams>(
- n::expand_vars() = expand_vars,
- n::profiles() = _imp->params.profiles(),
- n::profiles_with_parents() = profile()->profiles_with_parents(),
- n::replacing_ids() = a.options.replacing(),
- n::use() = use,
- n::use_expand() = join(profile()->use_expand()->begin(), profile()->use_expand()->end(), " "),
- n::use_expand_hidden() = join(profile()->use_expand_hidden()->begin(), profile()->use_expand_hidden()->end(), " ")
- ));
+ n::destination() = a.options.destination(),
+ n::expand_vars() = expand_vars,
+ n::is_from_pbin() = id->eapi()->supported()->is_pbin(),
+ n::profiles() = _imp->params.profiles(),
+ n::profiles_with_parents() = profile()->profiles_with_parents(),
+ n::replacing_ids() = a.options.replacing(),
+ n::use() = use,
+ n::use_expand() = join(profile()->use_expand()->begin(), profile()->use_expand()->end(), " "),
+ n::use_expand_hidden() = join(profile()->use_expand_hidden()->begin(), profile()->use_expand_hidden()->end(), " ")
+ ));
if (! pretend_cmd())
return false;
diff --git a/paludis/repositories/e/e_repository_TEST_4.cc b/paludis/repositories/e/e_repository_TEST_4.cc
index b137b60..aec0405 100644
--- a/paludis/repositories/e/e_repository_TEST_4.cc
+++ b/paludis/repositories/e/e_repository_TEST_4.cc
@@ -235,5 +235,178 @@ namespace test_cases
}
}
} test_e_repository_install_eapi_4;
+
+ struct ERepositoryEAPI4MergeTypeTest : TestCase
+ {
+ ERepositoryEAPI4MergeTypeTest() : TestCase("eapi 4 merge type") { }
+
+ unsigned max_run_time() const
+ {
+ return 3000;
+ }
+
+ bool repeatable() const
+ {
+ return false;
+ }
+
+ void run()
+ {
+ FSPath root(FSPath::cwd() / "e_repository_TEST_4_dir" / "root");
+
+ TestEnvironment env;
+ env.set_paludis_command("/bin/false");
+ std::shared_ptr<Map<std::string, std::string> > keys(std::make_shared<Map<std::string, std::string>>());
+ keys->insert("format", "e");
+ keys->insert("names_cache", "/var/empty");
+ keys->insert("location", stringify(FSPath::cwd() / "e_repository_TEST_4_dir" / "repo"));
+ keys->insert("profiles", stringify(FSPath::cwd() / "e_repository_TEST_4_dir" / "repo/profiles/profile"));
+ keys->insert("layout", "traditional");
+ keys->insert("eapi_when_unknown", "0");
+ keys->insert("eapi_when_unspecified", "0");
+ keys->insert("profile_eapi", "0");
+ keys->insert("distdir", stringify(FSPath::cwd() / "e_repository_TEST_4_dir" / "distdir"));
+ keys->insert("builddir", stringify(FSPath::cwd() / "e_repository_TEST_4_dir" / "build"));
+ std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
+ std::bind(from_keys, keys, std::placeholders::_1)));
+ env.package_database()->add_repository(1, repo);
+
+ std::shared_ptr<Map<std::string, std::string> > v_keys(std::make_shared<Map<std::string, std::string>>());
+ v_keys->insert("format", "vdb");
+ v_keys->insert("names_cache", "/var/empty");
+ v_keys->insert("provides_cache", "/var/empty");
+ v_keys->insert("location", stringify(FSPath::cwd() / "e_repository_TEST_4_dir" / "vdb"));
+ v_keys->insert("root", stringify(root));
+ std::shared_ptr<Repository> v_repo(VDBRepository::repository_factory_create(&env,
+ std::bind(from_keys, keys, std::placeholders::_1)));
+ env.package_database()->add_repository(1, v_repo);
+
+ {
+ InstallAction action(make_named_values<InstallActionOptions>(
+ n::destination() = v_repo,
+ n::make_output_manager() = &make_standard_output_manager,
+ n::perform_uninstall() = &cannot_uninstall,
+ n::replacing() = std::make_shared<PackageIDSequence>(),
+ n::want_phase() = &want_all_phases
+ ));
+ ::setenv("EXPECTED_MERGE_TYPE", "source", 1);
+
+ TestMessageSuffix suffix("merge type source", true);
+ const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/merge-type-4::test-repo",
+ &env, { })), { }))]->last());
+ TEST_CHECK(bool(id));
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "4");
+ id->perform_action(action);
+ }
+ }
+ } test_e_repository_eapi_4_merge_type;
+
+#ifdef ENABLE_PBINS
+ struct ERepositoryEAPI4MergeTypeBinTest : TestCase
+ {
+ ERepositoryEAPI4MergeTypeBinTest() : TestCase("eapi 4 merge type bin") { }
+
+ unsigned max_run_time() const
+ {
+ return 3000;
+ }
+
+ bool repeatable() const
+ {
+ return false;
+ }
+
+ void run()
+ {
+ FSPath root(FSPath::cwd() / "e_repository_TEST_4_dir" / "root");
+
+ TestEnvironment env;
+ env.set_paludis_command("/bin/false");
+ std::shared_ptr<Map<std::string, std::string> > keys(std::make_shared<Map<std::string, std::string>>());
+ keys->insert("format", "e");
+ keys->insert("names_cache", "/var/empty");
+ keys->insert("location", stringify(FSPath::cwd() / "e_repository_TEST_4_dir" / "repo"));
+ keys->insert("profiles", stringify(FSPath::cwd() / "e_repository_TEST_4_dir" / "repo/profiles/profile"));
+ keys->insert("layout", "traditional");
+ keys->insert("eapi_when_unknown", "0");
+ keys->insert("eapi_when_unspecified", "0");
+ keys->insert("profile_eapi", "0");
+ keys->insert("distdir", stringify(FSPath::cwd() / "e_repository_TEST_4_dir" / "distdir"));
+ keys->insert("builddir", stringify(FSPath::cwd() / "e_repository_TEST_4_dir" / "build"));
+ std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
+ std::bind(from_keys, keys, std::placeholders::_1)));
+ env.package_database()->add_repository(1, repo);
+
+ std::shared_ptr<Map<std::string, std::string> > b_keys(std::make_shared<Map<std::string, std::string>>());
+ b_keys->insert("format", "e");
+ b_keys->insert("names_cache", "/var/empty");
+ b_keys->insert("location", stringify(FSPath::cwd() / "e_repository_TEST_4_dir" / ("binrepo")));
+ b_keys->insert("profiles", stringify(FSPath::cwd() / "e_repository_TEST_4_dir" / "repo/profiles/profile"));
+ b_keys->insert("layout", "traditional");
+ b_keys->insert("eapi_when_unknown", "0");
+ b_keys->insert("eapi_when_unspecified", "0");
+ b_keys->insert("profile_eapi", "0");
+ b_keys->insert("distdir", stringify(FSPath::cwd() / "e_repository_TEST_4_dir" / "distdir"));
+ b_keys->insert("binary_distdir", stringify(FSPath::cwd() / "e_repository_TEST_4_dir" / "distdir"));
+ b_keys->insert("binary_keywords_filter", "test");
+ b_keys->insert("binary_destination", "true");
+ b_keys->insert("master_repository", "test-repo");
+ b_keys->insert("builddir", stringify(FSPath::cwd() / "e_repository_TEST_4_dir" / "build"));
+ b_keys->insert("root", stringify(root));
+ std::shared_ptr<Repository> b_repo(ERepository::repository_factory_create(&env,
+ std::bind(from_keys, b_keys, std::placeholders::_1)));
+ env.package_database()->add_repository(2, b_repo);
+
+ std::shared_ptr<Map<std::string, std::string> > v_keys(std::make_shared<Map<std::string, std::string>>());
+ v_keys->insert("format", "vdb");
+ v_keys->insert("names_cache", "/var/empty");
+ v_keys->insert("provides_cache", "/var/empty");
+ v_keys->insert("location", stringify(FSPath::cwd() / "e_repository_TEST_4_dir" / "vdb"));
+ v_keys->insert("root", stringify(root));
+ std::shared_ptr<Repository> v_repo(VDBRepository::repository_factory_create(&env,
+ std::bind(from_keys, keys, std::placeholders::_1)));
+ env.package_database()->add_repository(1, v_repo);
+
+ {
+ InstallAction action(make_named_values<InstallActionOptions>(
+ n::destination() = b_repo,
+ n::make_output_manager() = &make_standard_output_manager,
+ n::perform_uninstall() = &cannot_uninstall,
+ n::replacing() = std::make_shared<PackageIDSequence>(),
+ n::want_phase() = &want_all_phases
+ ));
+ ::setenv("EXPECTED_MERGE_TYPE", "buildonly", 1);
+
+ TestMessageSuffix suffix("merge type buildonly", true);
+ const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/merge-type-bin-4::test-repo",
+ &env, { })), { }))]->last());
+ TEST_CHECK(bool(id));
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "4");
+ id->perform_action(action);
+ }
+
+ {
+ InstallAction action(make_named_values<InstallActionOptions>(
+ n::destination() = v_repo,
+ n::make_output_manager() = &make_standard_output_manager,
+ n::perform_uninstall() = &cannot_uninstall,
+ n::replacing() = std::make_shared<PackageIDSequence>(),
+ n::want_phase() = &want_all_phases
+ ));
+ ::setenv("EXPECTED_MERGE_TYPE", "binary", 1);
+
+ TestMessageSuffix suffix("merge type binary", true);
+ const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/merge-type-bin-4::binrepo",
+ &env, { })), { }))]->last());
+ TEST_CHECK(bool(id));
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "pbin-1+4");
+ id->perform_action(action);
+ }
+ }
+ } test_e_repository_eapi_4_merge_type_bin;
+#endif
}
diff --git a/paludis/repositories/e/e_repository_TEST_4_setup.sh b/paludis/repositories/e/e_repository_TEST_4_setup.sh
index 61420a2..04f4f44 100755
--- a/paludis/repositories/e/e_repository_TEST_4_setup.sh
+++ b/paludis/repositories/e/e_repository_TEST_4_setup.sh
@@ -9,6 +9,12 @@ mkdir -p root/etc
mkdir -p vdb
touch vdb/THISISTHEVDB
+mkdir -p binrepo/{profiles/profile,metadata,eclass} || exit 1
+cd binrepo || exit 1
+echo "binrepo" >> profiles/repo_name || exit 1
+echo > profiles/categories || exit 1
+cd ..
+
mkdir -p build
ln -s build symlinked_build
@@ -1005,6 +1011,46 @@ EAPI="4"
S="${WORKDIR}"
END
+mkdir -p "cat/merge-type" || exit 1
+cat << 'END' > cat/merge-type/merge-type-4.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork enabled"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="4"
+
+S="${WORKDIR}"
+
+pkg_setup() {
+ if [[ ${EXPECTED_MERGE_TYPE} != ${MERGE_TYPE} ]] ; then
+ die ${EXPECTED_MERGE_TYPE} is not ${MERGE_TYPE}
+ fi
+}
+END
+mkdir -p "cat/merge-type-bin" || exit 1
+cat << 'END' > cat/merge-type-bin/merge-type-bin-4.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork enabled"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="4"
+
+S="${WORKDIR}"
+
+pkg_setup() {
+ if [[ ${EXPECTED_MERGE_TYPE} != ${MERGE_TYPE} ]] ; then
+ die ${EXPECTED_MERGE_TYPE} is not ${MERGE_TYPE}
+ fi
+}
+END
cd ..
cd ..
diff --git a/paludis/repositories/e/eapi.cc b/paludis/repositories/e/eapi.cc
index 7aa2beb..07c2146 100644
--- a/paludis/repositories/e/eapi.cc
+++ b/paludis/repositories/e/eapi.cc
@@ -87,6 +87,7 @@ namespace
n::env_iuse_implicit() = check_get(k, "env_iuse_implicit"),
n::env_jobs() = check_get(k, "env_jobs"),
n::env_kv() = check_get(k, "env_kv"),
+ n::env_merge_type() = check_get(k, "env_merge_type"),
n::env_p() = check_get(k, "env_p"),
n::env_pf() = check_get(k, "env_pf"),
n::env_portdir() = check_get(k, "env_portdir"),
diff --git a/paludis/repositories/e/eapi.hh b/paludis/repositories/e/eapi.hh
index 6faa046..bc28929 100644
--- a/paludis/repositories/e/eapi.hh
+++ b/paludis/repositories/e/eapi.hh
@@ -101,6 +101,7 @@ namespace paludis
typedef Name<struct env_iuse_implicit_name> env_iuse_implicit;
typedef Name<struct env_jobs_name> env_jobs;
typedef Name<struct env_kv_name> env_kv;
+ typedef Name<struct env_merge_type_name> env_merge_type;
typedef Name<struct env_p_name> env_p;
typedef Name<struct env_pf_name> env_pf;
typedef Name<struct env_portdir_name> env_portdir;
@@ -318,6 +319,7 @@ namespace paludis
NamedValue<n::env_iuse_implicit, std::string> env_iuse_implicit;
NamedValue<n::env_jobs, std::string> env_jobs;
NamedValue<n::env_kv, std::string> env_kv;
+ NamedValue<n::env_merge_type, std::string> env_merge_type;
NamedValue<n::env_p, std::string> env_p;
NamedValue<n::env_pf, std::string> env_pf;
NamedValue<n::env_portdir, std::string> env_portdir;
diff --git a/paludis/repositories/e/eapis/4.conf b/paludis/repositories/e/eapis/4.conf
index c21a5b7..960391f 100644
--- a/paludis/repositories/e/eapis/4.conf
+++ b/paludis/repositories/e/eapis/4.conf
@@ -33,6 +33,7 @@ env_aa =
env_kv =
env_replacing_versions = REPLACING_VERSIONS
env_replaced_by_version = REPLACED_BY_VERSION
+env_merge_type = MERGE_TYPE
vdb_from_env_variables = ${vdb_from_env_variables}
diff --git a/paludis/repositories/e/eapis/pbin-1+4.conf b/paludis/repositories/e/eapis/pbin-1+4.conf
index 20edcc7..3965443 100644
--- a/paludis/repositories/e/eapis/pbin-1+4.conf
+++ b/paludis/repositories/e/eapis/pbin-1+4.conf
@@ -30,6 +30,7 @@ ebuild_functions = ${ebuild_functions} builtin_pivotbin builtin_installbin
ebuild_install = \
skipname=killold : killold ; \
skipname=init userpriv sandbox : init saveenv ; \
+ skipname=pretend sandbox userpriv : loadenv pivotbin pretend ; \
skipname=setup clearenv : loadenv pivotbin setup saveenv ; \
skipname=installbin sandbox clearenv : loadenv installbin saveenv ; \
skipname=strip strip : ; \
diff --git a/paludis/repositories/e/ebuild.cc b/paludis/repositories/e/ebuild.cc
index 04b5015..0faed29 100644
--- a/paludis/repositories/e/ebuild.cc
+++ b/paludis/repositories/e/ebuild.cc
@@ -878,6 +878,26 @@ EbuildInstallCommand::extend_command(Process & process)
process.setenv(params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_replacing_versions(), s);
}
+ if (! params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_merge_type().empty())
+ {
+ std::string s;
+
+ if (install_params.destination())
+ {
+ if (install_params.destination()->installed_root_key())
+ {
+ if (install_params.is_from_pbin())
+ s = "binary";
+ else
+ s = "source";
+ }
+ else
+ s = "buildonly";
+ }
+
+ process.setenv(params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_merge_type(), s);
+ }
+
for (Map<std::string, std::string>::ConstIterator
i(install_params.expand_vars()->begin()),
j(install_params.expand_vars()->end()) ; i != j ; ++i)
diff --git a/paludis/repositories/e/ebuild.hh b/paludis/repositories/e/ebuild.hh
index 8e1cc3b..9aa6a16 100644
--- a/paludis/repositories/e/ebuild.hh
+++ b/paludis/repositories/e/ebuild.hh
@@ -54,6 +54,7 @@ namespace paludis
typedef Name<struct commands_name> commands;
typedef Name<struct config_protect_name> config_protect;
typedef Name<struct config_protect_mask_name> config_protect_mask;
+ typedef Name<struct destination_name> destination;
typedef Name<struct destination_repository_name> destination_repository;
typedef Name<struct distdir_name> distdir;
typedef Name<struct ebuild_dir_name> ebuild_dir;
@@ -66,6 +67,7 @@ namespace paludis
typedef Name<struct files_dir_name> files_dir;
typedef Name<struct image_name> image;
typedef Name<struct info_vars_name> info_vars;
+ typedef Name<struct is_from_pbin_name> is_from_pbin;
typedef Name<struct load_environment_name> load_environment;
typedef Name<struct loadsaveenv_dir_name> loadsaveenv_dir;
typedef Name<struct maybe_output_manager_name> maybe_output_manager;
@@ -179,7 +181,9 @@ namespace paludis
NamedValue<n::accept_license, std::string> accept_license;
NamedValue<n::config_protect, std::string> config_protect;
NamedValue<n::config_protect_mask, std::string> config_protect_mask;
+ NamedValue<n::destination, std::shared_ptr<Repository> > destination;
NamedValue<n::expand_vars, std::shared_ptr<const Map<std::string, std::string> > > expand_vars;
+ NamedValue<n::is_from_pbin, bool> is_from_pbin;
NamedValue<n::loadsaveenv_dir, FSPath> loadsaveenv_dir;
NamedValue<n::profiles, std::shared_ptr<const FSPathSequence> > profiles;
NamedValue<n::profiles_with_parents, std::shared_ptr<const FSPathSequence> > profiles_with_parents;
@@ -199,7 +203,9 @@ namespace paludis
*/
struct EbuildPretendCommandParams
{
+ NamedValue<n::destination, std::shared_ptr<Repository> > destination;
NamedValue<n::expand_vars, std::shared_ptr<const Map<std::string, std::string> > > expand_vars;
+ NamedValue<n::is_from_pbin, bool> is_from_pbin;
NamedValue<n::profiles, std::shared_ptr<const FSPathSequence> > profiles;
NamedValue<n::profiles_with_parents, std::shared_ptr<const FSPathSequence> > profiles_with_parents;
NamedValue<n::replacing_ids, std::shared_ptr<const PackageIDSequence> > replacing_ids;