aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-11-04 18:33:53 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-11-04 18:33:53 +0000
commita5fcbaf27a510880bce5df74d352bdac2c0de43e (patch)
treec2e11a6151a4985056682e5584e9241c870f5b77
parentc424dabb0d0a7c92bee82a1e62c07c8cef5d5f08 (diff)
downloadpaludis-a5fcbaf27a510880bce5df74d352bdac2c0de43e.tar.gz
paludis-a5fcbaf27a510880bce5df74d352bdac2c0de43e.tar.xz
split up more
-rw-r--r--.gitignore4
-rw-r--r--paludis/repositories/e/Makefile.am66
-rw-r--r--paludis/repositories/e/e_repository_TEST.cc706
-rw-r--r--paludis/repositories/e/e_repository_TEST_0.cc384
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_0_cleanup.sh9
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_0_setup.sh1007
-rw-r--r--paludis/repositories/e/e_repository_TEST_1.cc192
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_1_cleanup.sh9
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_1_setup.sh1007
-rw-r--r--paludis/repositories/e/e_repository_TEST_2.cc222
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_2_cleanup.sh9
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_2_setup.sh1006
-rw-r--r--paludis/repositories/e/e_repository_TEST_3.cc268
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_3_cleanup.sh9
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_3_setup.sh1010
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_setup.sh980
16 files changed, 5201 insertions, 1687 deletions
diff --git a/.gitignore b/.gitignore
index 3395973..651122f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -222,6 +222,10 @@ paludis-*.*.*.tar.bz2
/paludis/repositories/e/dep_spec_pretty_printer_TEST
/paludis/repositories/e/depend_rdepend_TEST
/paludis/repositories/e/e_repository_TEST
+/paludis/repositories/e/e_repository_TEST_0
+/paludis/repositories/e/e_repository_TEST_1
+/paludis/repositories/e/e_repository_TEST_2
+/paludis/repositories/e/e_repository_TEST_3
/paludis/repositories/e/e_repository_TEST_dependencies_rewriter
/paludis/repositories/e/e_repository_TEST_ever
/paludis/repositories/e/e_repository_TEST_exheres_0
diff --git a/paludis/repositories/e/Makefile.am b/paludis/repositories/e/Makefile.am
index 80c6281..93b3f3e 100644
--- a/paludis/repositories/e/Makefile.am
+++ b/paludis/repositories/e/Makefile.am
@@ -207,6 +207,50 @@ e_repository_TEST_kdebuild_1_LDADD = \
e_repository_TEST_kdebuild_1_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir) @PALUDIS_CXXFLAGS_NO_DEBUGGING@
+e_repository_TEST_3_SOURCES = e_repository_TEST_3.cc
+
+e_repository_TEST_3_LDADD = \
+ $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \
+ $(top_builddir)/paludis/util/test_extras.o \
+ $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \
+ $(top_builddir)/test/libtest.a \
+ $(DYNAMIC_LD_LIBS)
+
+e_repository_TEST_3_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir) @PALUDIS_CXXFLAGS_NO_DEBUGGING@
+
+e_repository_TEST_2_SOURCES = e_repository_TEST_2.cc
+
+e_repository_TEST_2_LDADD = \
+ $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \
+ $(top_builddir)/paludis/util/test_extras.o \
+ $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \
+ $(top_builddir)/test/libtest.a \
+ $(DYNAMIC_LD_LIBS)
+
+e_repository_TEST_2_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir) @PALUDIS_CXXFLAGS_NO_DEBUGGING@
+
+e_repository_TEST_1_SOURCES = e_repository_TEST_1.cc
+
+e_repository_TEST_1_LDADD = \
+ $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \
+ $(top_builddir)/paludis/util/test_extras.o \
+ $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \
+ $(top_builddir)/test/libtest.a \
+ $(DYNAMIC_LD_LIBS)
+
+e_repository_TEST_1_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir) @PALUDIS_CXXFLAGS_NO_DEBUGGING@
+
+e_repository_TEST_0_SOURCES = e_repository_TEST_0.cc
+
+e_repository_TEST_0_LDADD = \
+ $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \
+ $(top_builddir)/paludis/util/test_extras.o \
+ $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \
+ $(top_builddir)/test/libtest.a \
+ $(DYNAMIC_LD_LIBS)
+
+e_repository_TEST_0_CXXFLAGS = $(AM_CXXFLAGS) -I$(top_srcdir) @PALUDIS_CXXFLAGS_NO_DEBUGGING@
+
e_repository_TEST_phases_SOURCES = e_repository_TEST_phases.cc
e_repository_TEST_phases_LDADD = \
@@ -408,6 +452,18 @@ EXTRA_DIST = \
e_repository_TEST_kdebuild_1.cc \
e_repository_TEST_kdebuild_1_setup.sh \
e_repository_TEST_kdebuild_1_cleanup.sh \
+ e_repository_TEST_0.cc \
+ e_repository_TEST_0_setup.sh \
+ e_repository_TEST_0_cleanup.sh \
+ e_repository_TEST_1.cc \
+ e_repository_TEST_1_setup.sh \
+ e_repository_TEST_1_cleanup.sh \
+ e_repository_TEST_2.cc \
+ e_repository_TEST_2_setup.sh \
+ e_repository_TEST_2_cleanup.sh \
+ e_repository_TEST_3.cc \
+ e_repository_TEST_3_setup.sh \
+ e_repository_TEST_3_cleanup.sh \
e_repository_TEST_phases.cc \
e_repository_TEST_phases_setup.sh \
e_repository_TEST_phases_cleanup.sh \
@@ -468,6 +524,10 @@ check_SCRIPTS = \
e_repository_TEST_ever_setup.sh e_repository_TEST_ever_cleanup.sh \
e_repository_TEST_exheres_0_setup.sh e_repository_TEST_exheres_0_cleanup.sh \
e_repository_TEST_kdebuild_1_setup.sh e_repository_TEST_kdebuild_1_cleanup.sh \
+ e_repository_TEST_0_setup.sh e_repository_TEST_0_cleanup.sh \
+ e_repository_TEST_1_setup.sh e_repository_TEST_1_cleanup.sh \
+ e_repository_TEST_2_setup.sh e_repository_TEST_2_cleanup.sh \
+ e_repository_TEST_3_setup.sh e_repository_TEST_3_cleanup.sh \
e_repository_TEST_phases_setup.sh e_repository_TEST_phases_cleanup.sh \
e_repository_TEST_exlibs_setup.sh e_repository_TEST_exlibs_cleanup.sh \
e_repository_TEST_replacing_setup.sh e_repository_TEST_replacing_cleanup.sh \
@@ -532,12 +592,16 @@ TESTS = \
dep_spec_pretty_printer_TEST \
depend_rdepend_TEST \
e_repository_TEST \
+ e_repository_TEST_0 \
+ e_repository_TEST_1 \
+ e_repository_TEST_2 \
+ e_repository_TEST_3 \
e_repository_TEST_dependencies_rewriter \
e_repository_TEST_ever \
e_repository_TEST_exheres_0 \
+ e_repository_TEST_exlibs \
e_repository_TEST_kdebuild_1 \
e_repository_TEST_phases \
- e_repository_TEST_exlibs \
e_repository_TEST_replacing \
e_repository_TEST_symlink_rewriting \
e_repository_sets_TEST \
diff --git a/paludis/repositories/e/e_repository_TEST.cc b/paludis/repositories/e/e_repository_TEST.cc
index 6d954d8..3a1c797 100644
--- a/paludis/repositories/e/e_repository_TEST.cc
+++ b/paludis/repositories/e/e_repository_TEST.cc
@@ -1071,711 +1071,5 @@ namespace test_cases
id->perform_action(action);
}
} test_e_repository_manifest_check;
-
- struct ERepositoryInstallEAPI0Test : TestCase
- {
- ERepositoryInstallEAPI0Test() : TestCase("install_eapi_0") { }
-
- unsigned max_run_time() const
- {
- return 3000;
- }
-
- bool repeatable() const
- {
- return false;
- }
-
- void run()
- {
-#ifdef ENABLE_VIRTUALS_REPOSITORY
- ::setenv("PALUDIS_ENABLE_VIRTUALS_REPOSITORY", "yes", 1);
-#else
- ::setenv("PALUDIS_ENABLE_VIRTUALS_REPOSITORY", "", 1);
-#endif
-
- TestEnvironment env;
- env.set_paludis_command("/bin/false");
-
- std::tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>);
- keys->insert("format", "ebuild");
- keys->insert("names_cache", "/var/empty");
- keys->insert("location", stringify(FSEntry::cwd() / "e_repository_TEST_dir" / "repo13"));
- keys->insert("profiles", stringify(FSEntry::cwd() / "e_repository_TEST_dir" / "repo13/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(FSEntry::cwd() / "e_repository_TEST_dir" / "distdir"));
- keys->insert("builddir", stringify(FSEntry::cwd() / "e_repository_TEST_dir" / "build"));
- std::tr1::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
- std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
-
- std::tr1::shared_ptr<FakeInstalledRepository> installed_repo(new FakeInstalledRepository(
- make_named_values<FakeInstalledRepositoryParams>(
- value_for<n::environment>(&env),
- value_for<n::name>(RepositoryName("installed")),
- value_for<n::suitable_destination>(true),
- value_for<n::supports_uninstall>(true)
- )));
- installed_repo->add_version("cat", "pretend-installed", "0")->provide_key()->set_from_string("virtual/virtual-pretend-installed");
- installed_repo->add_version("cat", "pretend-installed", "1")->provide_key()->set_from_string("virtual/virtual-pretend-installed");
- env.package_database()->add_repository(2, installed_repo);
-
-#ifdef ENABLE_VIRTUALS_REPOSITORY
- std::tr1::shared_ptr<Map<std::string, std::string> > iv_keys(new Map<std::string, std::string>);
- iv_keys->insert("root", "/");
- iv_keys->insert("format", "installed_virtuals");
- env.package_database()->add_repository(-2, RepositoryFactory::get_instance()->create(&env,
- std::tr1::bind(from_keys, iv_keys, std::tr1::placeholders::_1)));
- std::tr1::shared_ptr<Map<std::string, std::string> > v_keys(new Map<std::string, std::string>);
- v_keys->insert("format", "virtuals");
- env.package_database()->add_repository(-2, RepositoryFactory::get_instance()->create(&env,
- std::tr1::bind(from_keys, v_keys, std::tr1::placeholders::_1)));
-#endif
-
- InstallAction action(make_named_values<InstallActionOptions>(
- value_for<n::destination>(installed_repo),
- value_for<n::make_output_manager>(&make_standard_output_manager),
- value_for<n::perform_uninstall>(&cannot_uninstall),
- value_for<n::replacing>(make_shared_ptr(new PackageIDSequence)),
- value_for<n::want_phase>(&want_all_phases)
- ));
-
-#ifdef ENABLE_VIRTUALS_REPOSITORY
- {
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=virtual/virtual-pretend-installed-0",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- }
-#endif
-
- {
- TestMessageSuffix suffix("in-ebuild die", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("cat/in-ebuild-die",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError);
- }
-
- {
- TestMessageSuffix suffix("in-subshell die", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("cat/in-subshell-die",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError);
- }
-
- {
- TestMessageSuffix suffix("success", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("cat/success",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- id->perform_action(action);
- }
-
- {
- TestMessageSuffix suffix("unpack die", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("cat/unpack-die",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError);
- }
-
- {
- TestMessageSuffix suffix("econf die", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("cat/econf-die",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError);
- }
-
- {
- TestMessageSuffix suffix("emake fail", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("cat/emake-fail",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- id->perform_action(action);
- }
-
- {
- TestMessageSuffix suffix("emake die", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("cat/emake-die",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError);
- }
-
- {
- TestMessageSuffix suffix("einstall die", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("cat/einstall-die",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError);
- }
-
- {
- TestMessageSuffix suffix("keepdir die", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("cat/keepdir-die",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError);
- }
-
- {
- TestMessageSuffix suffix("dobin fail", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("cat/dobin-fail",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- id->perform_action(action);
- }
-
- {
- TestMessageSuffix suffix("dobin die", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("cat/dobin-die",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError);
- }
-
- {
- TestMessageSuffix suffix("fperms fail", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("cat/fperms-fail",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- id->perform_action(action);
- }
-
- {
- TestMessageSuffix suffix("fperms die", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("cat/fperms-die",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError);
- }
-
- {
- TestMessageSuffix suffix("econf source 0", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/econf-source-0",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "0");
- TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError);
- }
-
- {
- TestMessageSuffix suffix("doman 0", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/doman-0",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "0");
- id->perform_action(action);
- }
-
- {
- TestMessageSuffix suffix("no src_prepare 0", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/src_prepare-0",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "0");
- id->perform_action(action);
- }
-
- {
- TestMessageSuffix suffix("no src_configure 0", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/src_configure-0",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "0");
- id->perform_action(action);
- }
-
- {
- TestMessageSuffix suffix("best version", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/best-version-0",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- id->perform_action(action);
- }
-
- {
- TestMessageSuffix suffix("has version", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/has-version-0",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- id->perform_action(action);
- }
-
- {
- TestMessageSuffix suffix("match", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/match-0",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- id->perform_action(action);
- }
-
- {
- TestMessageSuffix suffix("vars", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/vars-0",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- id->perform_action(action);
- }
-
- {
- TestMessageSuffix suffix("expand vars", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/expand-vars-0",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- id->perform_action(action);
- }
-
- {
- TestMessageSuffix suffix("econf disable dependency tracking", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/econf-disable-dependency-tracking-0",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "0");
- id->perform_action(action);
- }
- }
- } test_e_repository_install_eapi_0;
-
- struct ERepositoryInstallEAPI1Test : TestCase
- {
- ERepositoryInstallEAPI1Test() : TestCase("install_eapi_1") { }
-
- unsigned max_run_time() const
- {
- return 3000;
- }
-
- bool repeatable() const
- {
- return false;
- }
-
- void run()
- {
- TestEnvironment env;
- env.set_paludis_command("/bin/false");
- std::tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>);
- keys->insert("format", "ebuild");
- keys->insert("names_cache", "/var/empty");
- keys->insert("location", stringify(FSEntry::cwd() / "e_repository_TEST_dir" / "repo13"));
- keys->insert("profiles", stringify(FSEntry::cwd() / "e_repository_TEST_dir" / "repo13/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(FSEntry::cwd() / "e_repository_TEST_dir" / "distdir"));
- keys->insert("builddir", stringify(FSEntry::cwd() / "e_repository_TEST_dir" / "build"));
- std::tr1::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
- std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
-
- std::tr1::shared_ptr<FakeInstalledRepository> installed_repo(new FakeInstalledRepository(
- make_named_values<FakeInstalledRepositoryParams>(
- value_for<n::environment>(&env),
- value_for<n::name>(RepositoryName("installed")),
- value_for<n::suitable_destination>(true),
- value_for<n::supports_uninstall>(true)
- )));
- env.package_database()->add_repository(2, installed_repo);
-
- InstallAction action(make_named_values<InstallActionOptions>(
- value_for<n::destination>(installed_repo),
- value_for<n::make_output_manager>(&make_standard_output_manager),
- value_for<n::perform_uninstall>(&cannot_uninstall),
- value_for<n::replacing>(make_shared_ptr(new PackageIDSequence)),
- value_for<n::want_phase>(&want_all_phases)
- ));
-
- {
- TestMessageSuffix suffix("econf source 1", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/econf-source-1",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "1");
- id->perform_action(action);
- }
-
- {
- TestMessageSuffix suffix("dosym success 1", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/dosym-success-1",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "1");
- id->perform_action(action);
- }
-
- {
- TestMessageSuffix suffix("doman 1", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/doman-1",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "1");
- id->perform_action(action);
- }
-
- {
- TestMessageSuffix suffix("no src_prepare 1", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/src_prepare-1",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "1");
- id->perform_action(action);
- }
-
- {
- TestMessageSuffix suffix("no src_configure 1", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/src_configure-1",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "1");
- id->perform_action(action);
- }
- }
- } test_e_repository_install_eapi_1;
-
- struct ERepositoryInstallEAPI2Test : TestCase
- {
- ERepositoryInstallEAPI2Test() : TestCase("install_eapi_2") { }
-
- unsigned max_run_time() const
- {
- return 3000;
- }
-
- bool repeatable() const
- {
- return false;
- }
-
- void run()
- {
- TestEnvironment env;
- env.set_paludis_command("/bin/false");
- std::tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>);
- keys->insert("format", "ebuild");
- keys->insert("names_cache", "/var/empty");
- keys->insert("location", stringify(FSEntry::cwd() / "e_repository_TEST_dir" / "repo13"));
- keys->insert("profiles", stringify(FSEntry::cwd() / "e_repository_TEST_dir" / "repo13/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(FSEntry::cwd() / "e_repository_TEST_dir" / "distdir"));
- keys->insert("builddir", stringify(FSEntry::cwd() / "e_repository_TEST_dir" / "build"));
- std::tr1::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
- std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
-
- std::tr1::shared_ptr<FakeInstalledRepository> installed_repo(new FakeInstalledRepository(
- make_named_values<FakeInstalledRepositoryParams>(
- value_for<n::environment>(&env),
- value_for<n::name>(RepositoryName("installed")),
- value_for<n::suitable_destination>(true),
- value_for<n::supports_uninstall>(true)
- )));
- env.package_database()->add_repository(2, installed_repo);
-
- InstallAction action(make_named_values<InstallActionOptions>(
- value_for<n::destination>(installed_repo),
- value_for<n::make_output_manager>(&make_standard_output_manager),
- value_for<n::perform_uninstall>(&cannot_uninstall),
- value_for<n::replacing>(make_shared_ptr(new PackageIDSequence)),
- value_for<n::want_phase>(&want_all_phases)
- ));
-
- {
- TestMessageSuffix suffix("econf source 2", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/econf-source-2",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2");
- id->perform_action(action);
- }
-
- {
- TestMessageSuffix suffix("doman 2", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/doman-2",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2");
- id->perform_action(action);
- }
-
- {
- TestMessageSuffix suffix("src_prepare 2", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/src_prepare-2",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2");
- TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError);
- }
-
- {
- TestMessageSuffix suffix("src_configure 2", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/src_configure-2",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2");
- TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError);
- }
-
- {
- TestMessageSuffix suffix("default src_configure 2", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/default-src_configure-2",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2");
- id->perform_action(action);
- }
-
- {
- TestMessageSuffix suffix("default src_compile 2", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/default-src_compile-2",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2");
- id->perform_action(action);
- }
-
- {
- TestMessageSuffix suffix("default_src_compile 2", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/default_src_compile-2",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2");
- id->perform_action(action);
- }
-
- {
- TestMessageSuffix suffix("src_compile via default function 2", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/src_compile-via-default-func-2",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2");
- id->perform_action(action);
- }
- }
- } test_e_repository_install_eapi_2;
-
- struct ERepositoryInstallEAPI3Test : TestCase
- {
- ERepositoryInstallEAPI3Test() : TestCase("install_eapi_3") { }
-
- unsigned max_run_time() const
- {
- return 3000;
- }
-
- bool repeatable() const
- {
- return false;
- }
-
- void run()
- {
- TestEnvironment env;
- env.set_paludis_command("/bin/false");
- std::tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>);
- keys->insert("format", "ebuild");
- keys->insert("names_cache", "/var/empty");
- keys->insert("location", stringify(FSEntry::cwd() / "e_repository_TEST_dir" / "repo13"));
- keys->insert("profiles", stringify(FSEntry::cwd() / "e_repository_TEST_dir" / "repo13/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(FSEntry::cwd() / "e_repository_TEST_dir" / "distdir"));
- keys->insert("builddir", stringify(FSEntry::cwd() / "e_repository_TEST_dir" / "build"));
- std::tr1::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
- std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
-
- std::tr1::shared_ptr<FakeInstalledRepository> installed_repo(new FakeInstalledRepository(
- make_named_values<FakeInstalledRepositoryParams>(
- value_for<n::environment>(&env),
- value_for<n::name>(RepositoryName("installed")),
- value_for<n::suitable_destination>(true),
- value_for<n::supports_uninstall>(true)
- )));
- env.package_database()->add_repository(2, installed_repo);
-
- InstallAction action(make_named_values<InstallActionOptions>(
- value_for<n::destination>(installed_repo),
- value_for<n::make_output_manager>(&make_standard_output_manager),
- value_for<n::perform_uninstall>(&cannot_uninstall),
- value_for<n::replacing>(make_shared_ptr(new PackageIDSequence)),
- value_for<n::want_phase>(&want_all_phases)
- ));
-
- PretendAction pretend_action(make_named_values<PretendActionOptions>(
- value_for<n::make_output_manager>(&make_standard_output_manager)
- ));
-
- {
- TestMessageSuffix suffix("pkg_pretend", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/pkg_pretend-3",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
- id->perform_action(pretend_action);
- TEST_CHECK(! pretend_action.failed());
- }
-
- {
- TestMessageSuffix suffix("pkg_pretend-failure", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/pkg_pretend-failure-3",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
- id->perform_action(pretend_action);
- TEST_CHECK(pretend_action.failed());
- }
-
- {
- TestMessageSuffix suffix("default_src_install 3", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/default_src_install-3",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
- id->perform_action(action);
- }
-
- {
- TestMessageSuffix suffix("docompress 3", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/docompress-3",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
- id->perform_action(action);
- }
-
- {
- TestMessageSuffix suffix("dodoc -r", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/dodoc-r-3",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
- id->perform_action(action);
- }
-
- {
- TestMessageSuffix suffix("doins symlink", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/doins-symlink-3",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
- id->perform_action(action);
- }
-
- {
- TestMessageSuffix suffix("banned functions 3", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/banned-functions-3",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
- TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError);
- }
-
- {
- TestMessageSuffix suffix("econf disable dependency tracking", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/econf-disable-dependency-tracking-3",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
- id->perform_action(action);
- }
-
- {
- TestMessageSuffix suffix("strict use", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/strict-use-3",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
- id->perform_action(action);
- }
-
- {
- TestMessageSuffix suffix("strict use fail", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/strict-use-fail-3",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
- TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError);
- }
-
- {
- TestMessageSuffix suffix("strict use injection", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/strict-use-injection-3",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
- id->perform_action(action);
- }
-
- {
- TestMessageSuffix suffix("global scope use", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/global-scope-use-3",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
- id->perform_action(action);
- }
- }
- } test_e_repository_install_eapi_3;
}
diff --git a/paludis/repositories/e/e_repository_TEST_0.cc b/paludis/repositories/e/e_repository_TEST_0.cc
new file mode 100644
index 0000000..1d2dcca
--- /dev/null
+++ b/paludis/repositories/e/e_repository_TEST_0.cc
@@ -0,0 +1,384 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006, 2007, 2008, 2009 Ciaran McCreesh
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/repositories/e/e_repository.hh>
+#include <paludis/repositories/e/e_repository_exceptions.hh>
+#include <paludis/repositories/e/e_repository_id.hh>
+#include <paludis/repositories/e/vdb_repository.hh>
+#include <paludis/repositories/e/eapi.hh>
+#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
+#include <paludis/repositories/fake/fake_installed_repository.hh>
+#include <paludis/repositories/fake/fake_package_id.hh>
+#include <paludis/environments/test/test_environment.hh>
+#include <paludis/util/system.hh>
+#include <paludis/util/simple_visitor_cast.hh>
+#include <paludis/util/map.hh>
+#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/make_named_values.hh>
+#include <paludis/util/set.hh>
+#include <paludis/standard_output_manager.hh>
+#include <paludis/util/safe_ifstream.hh>
+#include <paludis/package_id.hh>
+#include <paludis/metadata_key.hh>
+#include <paludis/action.hh>
+#include <paludis/stringify_formatter.hh>
+#include <paludis/user_dep_spec.hh>
+#include <paludis/generator.hh>
+#include <paludis/filter.hh>
+#include <paludis/filtered_generator.hh>
+#include <paludis/selection.hh>
+#include <paludis/repository_factory.hh>
+#include <paludis/choice.hh>
+#include <test/test_framework.hh>
+#include <test/test_runner.hh>
+#include <tr1/functional>
+#include <set>
+#include <string>
+
+#include "config.h"
+
+using namespace test;
+using namespace paludis;
+
+namespace
+{
+ void cannot_uninstall(const std::tr1::shared_ptr<const PackageID> & id, const UninstallActionOptions &)
+ {
+ if (id)
+ throw InternalError(PALUDIS_HERE, "cannot uninstall");
+ }
+
+ std::tr1::shared_ptr<OutputManager> make_standard_output_manager(const Action &)
+ {
+ return make_shared_ptr(new StandardOutputManager);
+ }
+
+ std::string from_keys(const std::tr1::shared_ptr<const Map<std::string, std::string> > & m,
+ const std::string & k)
+ {
+ Map<std::string, std::string>::ConstIterator mm(m->find(k));
+ if (m->end() == mm)
+ return "";
+ else
+ return mm->second;
+ }
+
+ WantPhase want_all_phases(const std::string &)
+ {
+ return wp_yes;
+ }
+}
+
+namespace test_cases
+{
+ struct ERepositoryInstallEAPI0Test : TestCase
+ {
+ ERepositoryInstallEAPI0Test() : TestCase("install_eapi_0") { }
+
+ unsigned max_run_time() const
+ {
+ return 3000;
+ }
+
+ bool repeatable() const
+ {
+ return false;
+ }
+
+ void run()
+ {
+#ifdef ENABLE_VIRTUALS_REPOSITORY
+ ::setenv("PALUDIS_ENABLE_VIRTUALS_REPOSITORY", "yes", 1);
+#else
+ ::setenv("PALUDIS_ENABLE_VIRTUALS_REPOSITORY", "", 1);
+#endif
+
+ TestEnvironment env;
+ env.set_paludis_command("/bin/false");
+
+ std::tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>);
+ keys->insert("format", "ebuild");
+ keys->insert("names_cache", "/var/empty");
+ keys->insert("location", stringify(FSEntry::cwd() / "e_repository_TEST_0_dir" / "repo"));
+ keys->insert("profiles", stringify(FSEntry::cwd() / "e_repository_TEST_0_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(FSEntry::cwd() / "e_repository_TEST_0_dir" / "distdir"));
+ keys->insert("builddir", stringify(FSEntry::cwd() / "e_repository_TEST_0_dir" / "build"));
+ std::tr1::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
+ std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)));
+ env.package_database()->add_repository(1, repo);
+
+ std::tr1::shared_ptr<FakeInstalledRepository> installed_repo(new FakeInstalledRepository(
+ make_named_values<FakeInstalledRepositoryParams>(
+ value_for<n::environment>(&env),
+ value_for<n::name>(RepositoryName("installed")),
+ value_for<n::suitable_destination>(true),
+ value_for<n::supports_uninstall>(true)
+ )));
+ installed_repo->add_version("cat", "pretend-installed", "0")->provide_key()->set_from_string("virtual/virtual-pretend-installed");
+ installed_repo->add_version("cat", "pretend-installed", "1")->provide_key()->set_from_string("virtual/virtual-pretend-installed");
+ env.package_database()->add_repository(2, installed_repo);
+
+#ifdef ENABLE_VIRTUALS_REPOSITORY
+ std::tr1::shared_ptr<Map<std::string, std::string> > iv_keys(new Map<std::string, std::string>);
+ iv_keys->insert("root", "/");
+ iv_keys->insert("format", "installed_virtuals");
+ env.package_database()->add_repository(-2, RepositoryFactory::get_instance()->create(&env,
+ std::tr1::bind(from_keys, iv_keys, std::tr1::placeholders::_1)));
+ std::tr1::shared_ptr<Map<std::string, std::string> > v_keys(new Map<std::string, std::string>);
+ v_keys->insert("format", "virtuals");
+ env.package_database()->add_repository(-2, RepositoryFactory::get_instance()->create(&env,
+ std::tr1::bind(from_keys, v_keys, std::tr1::placeholders::_1)));
+#endif
+
+ InstallAction action(make_named_values<InstallActionOptions>(
+ value_for<n::destination>(installed_repo),
+ value_for<n::make_output_manager>(&make_standard_output_manager),
+ value_for<n::perform_uninstall>(&cannot_uninstall),
+ value_for<n::replacing>(make_shared_ptr(new PackageIDSequence)),
+ value_for<n::want_phase>(&want_all_phases)
+ ));
+
+#ifdef ENABLE_VIRTUALS_REPOSITORY
+ {
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=virtual/virtual-pretend-installed-0",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ }
+#endif
+
+ {
+ TestMessageSuffix suffix("in-ebuild die", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("cat/in-ebuild-die",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError);
+ }
+
+ {
+ TestMessageSuffix suffix("in-subshell die", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("cat/in-subshell-die",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError);
+ }
+
+ {
+ TestMessageSuffix suffix("success", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("cat/success",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ id->perform_action(action);
+ }
+
+ {
+ TestMessageSuffix suffix("unpack die", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("cat/unpack-die",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError);
+ }
+
+ {
+ TestMessageSuffix suffix("econf die", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("cat/econf-die",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError);
+ }
+
+ {
+ TestMessageSuffix suffix("emake fail", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("cat/emake-fail",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ id->perform_action(action);
+ }
+
+ {
+ TestMessageSuffix suffix("emake die", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("cat/emake-die",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError);
+ }
+
+ {
+ TestMessageSuffix suffix("einstall die", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("cat/einstall-die",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError);
+ }
+
+ {
+ TestMessageSuffix suffix("keepdir die", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("cat/keepdir-die",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError);
+ }
+
+ {
+ TestMessageSuffix suffix("dobin fail", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("cat/dobin-fail",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ id->perform_action(action);
+ }
+
+ {
+ TestMessageSuffix suffix("dobin die", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("cat/dobin-die",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError);
+ }
+
+ {
+ TestMessageSuffix suffix("fperms fail", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("cat/fperms-fail",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ id->perform_action(action);
+ }
+
+ {
+ TestMessageSuffix suffix("fperms die", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("cat/fperms-die",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError);
+ }
+
+ {
+ TestMessageSuffix suffix("econf source 0", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/econf-source-0",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "0");
+ TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError);
+ }
+
+ {
+ TestMessageSuffix suffix("doman 0", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/doman-0",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "0");
+ id->perform_action(action);
+ }
+
+ {
+ TestMessageSuffix suffix("no src_prepare 0", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/src_prepare-0",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "0");
+ id->perform_action(action);
+ }
+
+ {
+ TestMessageSuffix suffix("no src_configure 0", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/src_configure-0",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "0");
+ id->perform_action(action);
+ }
+
+ {
+ TestMessageSuffix suffix("best version", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/best-version-0",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ id->perform_action(action);
+ }
+
+ {
+ TestMessageSuffix suffix("has version", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/has-version-0",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ id->perform_action(action);
+ }
+
+ {
+ TestMessageSuffix suffix("match", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/match-0",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ id->perform_action(action);
+ }
+
+ {
+ TestMessageSuffix suffix("vars", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/vars-0",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ id->perform_action(action);
+ }
+
+ {
+ TestMessageSuffix suffix("expand vars", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/expand-vars-0",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ id->perform_action(action);
+ }
+
+ {
+ TestMessageSuffix suffix("econf disable dependency tracking", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/econf-disable-dependency-tracking-0",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "0");
+ id->perform_action(action);
+ }
+ }
+ } test_e_repository_install_eapi_0;
+}
+
diff --git a/paludis/repositories/e/e_repository_TEST_0_cleanup.sh b/paludis/repositories/e/e_repository_TEST_0_cleanup.sh
new file mode 100755
index 0000000..16e6ec1
--- /dev/null
+++ b/paludis/repositories/e/e_repository_TEST_0_cleanup.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+if [ -d e_repository_TEST_0_dir ] ; then
+ rm -fr e_repository_TEST_0_dir
+else
+ true
+fi
+
diff --git a/paludis/repositories/e/e_repository_TEST_0_setup.sh b/paludis/repositories/e/e_repository_TEST_0_setup.sh
new file mode 100755
index 0000000..df0383e
--- /dev/null
+++ b/paludis/repositories/e/e_repository_TEST_0_setup.sh
@@ -0,0 +1,1007 @@
+#!/usr/bin/env bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+mkdir e_repository_TEST_0_dir || exit 1
+cd e_repository_TEST_0_dir || exit 1
+
+mkdir -p root/etc
+
+mkdir -p vdb
+touch vdb/THISISTHEVDB
+
+mkdir -p build
+ln -s build symlinked_build
+
+mkdir -p distdir
+echo "already fetched" > distdir/already-fetched.txt || exit 1
+cat <<END > distdir/expatch-success-1.patch || exit 1
+--- a/bar
++++ b/bar
+@@ -1 +1,3 @@
+ foo
++bar
++baz
+END
+
+mkdir -p repo/{profiles/profile,metadata,eclass} || exit 1
+cd repo || exit 1
+echo "test-repo" >> profiles/repo_name || exit 1
+echo "cat" >> profiles/categories || exit 1
+cat <<END > profiles/profile/virtuals
+virtual/virtual-pretend-installed cat/pretend-installed
+virtual/virtual-doesnotexist cat/doesnotexist
+END
+cat <<END > profiles/profile/make.defaults
+ARCH="cheese"
+USERLAND="GNU"
+KERNEL="linux"
+LIBC="glibc"
+CHOST="i286-badger-linux-gnu"
+LINGUAS="enabled_en enabled_en_GB enabled_en_GB@UTF-8"
+USE_EXPAND="LINGUAS USERLAND"
+USE_EXPAND_UNPREFIXED="ARCH"
+USE_EXPAND_IMPLICIT="USERLAND ARCH"
+USE_EXPAND_VALUES_USERLAND="GNU"
+USE_EXPAND_VALUES_ARCH="cheese otherarch"
+IUSE_IMPLICIT="build"
+END
+mkdir -p "cat/in-ebuild-die"
+cat <<END > cat/in-ebuild-die/in-ebuild-die-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE=""
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+pkg_setup() {
+ die "boom"
+}
+END
+mkdir -p "cat/in-subshell-die"
+cat <<'END' > cat/in-subshell-die/in-subshell-die-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE=""
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+pkg_setup() {
+ ( hasq test $KEYWORDS && die "boom" )
+}
+END
+mkdir -p "cat/success"
+cat <<END > cat/success/success-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+pkg_setup() {
+ useq spork && die "boom"
+}
+END
+mkdir -p "cat/unpack-die"
+cat <<END > cat/unpack-die/unpack-die-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_unpack() {
+ echo "123" > f.bz2
+ unpack ./f.bz2
+}
+END
+mkdir -p "cat/econf-die"
+cat <<END > cat/econf-die/econf-die-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_compile() {
+ econf
+}
+END
+mkdir -p "cat/emake-fail"
+cat <<END > cat/emake-fail/emake-fail-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_compile() {
+ emake monkey
+}
+END
+mkdir -p "cat/emake-die"
+cat <<END > cat/emake-die/emake-die-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_compile() {
+ emake monkey || die
+}
+END
+mkdir -p "cat/einstall-die"
+cat <<END > cat/einstall-die/einstall-die-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_install() {
+ einstall
+}
+END
+mkdir -p "cat/keepdir-die"
+cat <<"END" > cat/keepdir-die/keepdir-die-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_install() {
+ dodir /usr/share
+ touch "${D}"/usr/share/monkey
+ keepdir /usr/share/monkey
+}
+END
+mkdir -p "cat/dobin-fail"
+cat <<END > cat/dobin-fail/dobin-fail-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_install() {
+ dobin monkey
+}
+END
+mkdir -p "cat/dobin-die"
+cat <<END > cat/dobin-die/dobin-die-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_install() {
+ dobin monkey || die
+}
+END
+mkdir -p "cat/fperms-fail"
+cat <<END > cat/fperms-fail/fperms-fail-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_install() {
+ fperms 755 monkey
+}
+END
+mkdir -p "cat/fperms-die"
+cat <<END > cat/fperms-die/fperms-die-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_install() {
+ fperms 755 monkey || die
+}
+END
+mkdir -p "cat/pretend-installed"
+cat <<END > cat/pretend-installed/pretend-installed-2.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_compile() {
+ die "not supposed to install this"
+}
+END
+mkdir -p "cat/econf-source"
+cat <<END > cat/econf-source/econf-source-0.ebuild || exit 1
+EAPI="\${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_unpack() {
+ ECONF_SOURCE=subdir
+ mkdir \${S}
+ cd \${S}
+ mkdir subdir
+ echo 'touch monkey' > subdir/configure
+ chmod +x subdir/configure
+}
+
+src_install() {
+ insinto /usr/bin
+ doins monkey || die "no monkey"
+}
+END
+cp cat/econf-source/econf-source-{0,1}.ebuild || exit 1
+cp cat/econf-source/econf-source-{0,2}.ebuild || exit 1
+mkdir -p "cat/doman"
+cat <<END > cat/doman/doman-0.ebuild || exit 1
+EAPI="\${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_compile() {
+ echo \${PF} >foo.1
+ mkdir dir
+ echo \${PF} >dir/foo.2
+ echo \${PF} >foo.2
+ echo \${PF} >foo.3x
+ echo \${PF} >foo.4.gz
+ echo \${PF} >foo.5f.bz2
+ echo \${PF} >foo.6.Z
+ echo \${PF} >foo.en.7
+ echo \${PF} >foo.en_GB.8
+ echo \${PF} >foo.e.9
+ echo \${PF} >foo.enn.n
+ echo \${PF} >foo.EN.1
+ echo \${PF} >foo.en-GB.2
+ echo \${PF} >foo.en_gb.3
+ echo \${PF} >foo.en_G.4
+ echo \${PF} >foo.en_GBB.5
+ echo \${PF} >foo.nonkey
+ touch foo.1x
+ echo \${PF} >bar.m
+ echo \${PF} >bar.monkey
+ echo \${PF} >baz.6
+ echo \${PF} >baz.en_US.7
+}
+
+src_install() {
+ doman foo.* dir/foo.* || die
+ doman bar.m && die
+ doman bar.monkey && die
+ doman bar.1 && die
+ doman -i18n=en_GB baz.* || die
+ keepdir /meh || die
+ cd "\${D}"/meh || die
+ doman .keep* || die
+ rm "\${D}"/usr/share/man/{man1/foo.1,man2/foo.2,man3/foo.3x,man4/foo.4.gz,man5/foo.5f.bz2} || die
+ rm "\${D}"/usr/share/man/{man6/foo.6.Z,man7/foo.en.7,man8/foo.en_GB.8,man9/foo.e.9,mann/foo.enn.n} || die
+ rm "\${D}"/usr/share/man/{man1/foo.EN.1,man2/foo.en-GB.2,man3/foo.en_gb.3,man4/foo.en_G.4} || die
+ rm "\${D}"/usr/share/man/{man5/foo.en_GBB.5,mann/foo.nonkey,en_GB/man6/baz.6,en_GB/man7/baz.en_US.7} || die
+ rmdir "\${D}"/usr/share/man/{man1,man2,man3,man4,man5,man6,man7,man8,man9,mann,en_GB/man6,en_GB/man7,en_GB,} || die
+}
+END
+cp cat/doman/doman-{0,1}.ebuild || exit 1
+cat <<END > cat/doman/doman-2.ebuild || exit 1
+EAPI="\${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_compile() {
+ echo \${PF} >foo.1
+ mkdir dir
+ echo \${PF} >dir/foo.2
+ echo \${PF} >foo.3x
+ echo \${PF} >foo.4.gz
+ echo \${PF} >foo.5f.bz2
+ echo \${PF} >foo.6.Z
+ echo \${PF} >foo.en.7
+ echo \${PF} >foo.en_GB.8
+ echo \${PF} >foo.e.9
+ echo \${PF} >foo.enn.n
+ echo \${PF} >foo.EN.1
+ echo \${PF} >foo.en-GB.2
+ echo \${PF} >foo.en_gb.3
+ echo \${PF} >foo.en_G.4
+ echo \${PF} >foo.en_GBB.5
+ echo \${PF} >foo.nonkey
+ touch foo.1x
+ echo \${PF} >bar.m
+ echo \${PF} >bar.monkey
+ echo \${PF} >baz.6
+ echo \${PF} >baz.en_US.7
+}
+
+src_install() {
+ doman foo.* dir/foo.* || die
+ doman bar.m && die
+ doman bar.monkey && die
+ doman bar.1 && die
+ doman -i18n=en_GB baz.* || die
+ keepdir /meh || die
+ cd "\${D}"/meh || die
+ doman .keep* || die
+ rm "\${D}"/usr/share/man/{man1/foo.1,man2/foo.2,man3/foo.3x,man4/foo.4.gz,man5/foo.5f.bz2} || die
+ rm "\${D}"/usr/share/man/{man6/foo.6.Z,en/man7/foo.7,en_GB/man8/foo.8,man9/foo.e.9,mann/foo.enn.n} || die
+ rm "\${D}"/usr/share/man/{man1/foo.EN.1,man2/foo.en-GB.2,man3/foo.en_gb.3,man4/foo.en_G.4} || die
+ rm "\${D}"/usr/share/man/{man5/foo.en_GBB.5,mann/foo.nonkey,en_GB/man6/baz.6,en_US/man7/baz.7} || die
+ rmdir "\${D}"/usr/share/man/{man1,man2,man3,man4,man5,man6,man9,mann,en/man7,en_GB/man6,en_GB/man8,en_US/man7,en,en_GB,en_US,} || die
+}
+END
+mkdir -p "cat/dosym-success"
+cat <<'END' > cat/dosym-success/dosym-success-1.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_install() {
+ dosym foo /usr/bin/bar
+ [[ "$(readlink ${D}/usr/bin/bar )" == "foo" ]] || die
+}
+END
+mkdir -p "cat/best-version"
+cat <<'END' > cat/best-version/best-version-0.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+pkg_setup() {
+ if ! best_version cat/pretend-installed >/dev/null ; then
+ die "failed cat/pretend-installed"
+ fi
+
+ BV1=$(best_version cat/pretend-installed )
+ [[ "$BV1" == "cat/pretend-installed-1" ]] || die "BV1 is $BV1"
+
+ if best_version cat/doesnotexist >/dev/null ; then
+ die "not failed cat/doesnotexist"
+ fi
+
+ BV2=$(best_version cat/doesnotexist )
+ [[ "$BV2" == "" ]] || die "BV2 is $BV2"
+
+ if [[ -n "$PALUDIS_ENABLE_VIRTUALS_REPOSITORY" ]] ; then
+ if ! best_version virtual/virtual-pretend-installed >/dev/null ; then
+ die "failed virtual/virtual-pretend-installed"
+ fi
+
+ BV3=$(best_version virtual/virtual-pretend-installed )
+ [[ "$BV3" == "cat/pretend-installed-1" ]] || die "BV3 is $BV3"
+
+ if best_version virtual/virtual-doesnotexist >/dev/null ; then
+ die "not failed virtual/virtual-doesnotexist"
+ fi
+
+ BV2=$(best_version virtual/virtual-doesnotexist )
+ [[ "$BV4" == "" ]] || die "BV4 is $BV4"
+ fi
+}
+END
+mkdir -p "cat/has-version"
+cat <<'END' > cat/has-version/has-version-0.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+pkg_setup() {
+ if ! has_version cat/pretend-installed ; then
+ die "failed cat/pretend-installed"
+ fi
+
+ if has_version cat/doesnotexist >/dev/null ; then
+ die "not failed cat/doesnotexist"
+ fi
+}
+END
+mkdir -p "cat/match"
+cat <<'END' > cat/match/match-0.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+pkg_setup() {
+ if ! portageq match "${ROOT}" cat/pretend-installed >/dev/null ; then
+ die "failed cat/pretend-installed"
+ fi
+
+ cat <<'DONE' > ${T}/expected
+cat/pretend-installed-0
+cat/pretend-installed-1
+DONE
+ portageq match "${ROOT}" cat/pretend-installed > ${T}/got
+ cmp ${T}/expected ${T}/got || die "oops"
+
+ if portageq match "${ROOT}" cat/doesnotexist >/dev/null ; then
+ die "not failed cat/doesnotexist"
+ fi
+
+ BV2=$(portageq match "${ROOT}" cat/doesnotexist )
+ [[ "$BV2" == "" ]] || die "BV2 is $BV2"
+}
+END
+mkdir -p "cat/vars"
+cat <<'END' > cat/vars/vars-0.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+pkg_setup() {
+ [[ -d "${T}" ]] || die "T not a dir"
+}
+
+src_compile() {
+ [[ -d "${T}" ]] || die "T not a dir"
+}
+
+pkg_preinst() {
+ [[ -d "${T}" ]] || die "T not a dir"
+}
+END
+mkdir -p "cat/src_prepare"
+cat <<END > cat/src_prepare/src_prepare-0.ebuild || exit 1
+EAPI="\${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_prepare() {
+ die src_prepare
+}
+END
+cp cat/src_prepare/src_prepare-{0,1}.ebuild || exit 1
+cp cat/src_prepare/src_prepare-{0,2}.ebuild || exit 1
+mkdir -p "cat/src_configure"
+cat <<END > cat/src_configure/src_configure-0.ebuild || exit 1
+EAPI="\${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_configure() {
+ die src_configure
+}
+END
+cp cat/src_configure/src_configure-{0,1}.ebuild || exit 1
+cp cat/src_configure/src_configure-{0,2}.ebuild || exit 1
+mkdir -p "cat/default-src_configure" || exit 1
+cat << END > cat/default-src_configure/default-src_configure-2.ebuild || exit 1
+EAPI="\${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_unpack() {
+ cat <<EOF >configure
+#! /bin/sh
+touch foo
+EOF
+ chmod +x configure
+ echo 'all: ; rm foo' >Makefile
+}
+
+src_compile() {
+ [[ -e foo ]] || die
+}
+END
+mkdir -p "cat/default-src_compile" || exit 1
+cat << END > cat/default-src_compile/default-src_compile-2.ebuild || exit 1
+EAPI="\${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_unpack() {
+ cat <<EOF >configure
+#! /bin/sh
+rm Makefile
+EOF
+ chmod +x configure
+ echo 'all: ; touch foo' >Makefile
+}
+
+src_configure() {
+ :
+}
+
+src_install() {
+ [[ -e foo ]] || die
+}
+END
+mkdir -p "cat/default_src_compile" || exit 1
+cat << END > cat/default_src_compile/default_src_compile-2.ebuild || exit 1
+EAPI="\${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_unpack() {
+ cat <<EOF >configure
+#! /bin/sh
+rm Makefile
+EOF
+ chmod +x configure
+ echo 'all: ; touch foo' >Makefile
+}
+
+src_configure() {
+ :
+}
+
+src_compile() {
+ default_src_compile
+ [[ -e foo ]] || die
+}
+END
+mkdir -p "cat/src_compile-via-default-func" || exit 1
+cat << END > cat/src_compile-via-default-func/src_compile-via-default-func-2.ebuild || exit 1
+EAPI="\${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_unpack() {
+ cat <<EOF >configure
+#! /bin/sh
+rm Makefile
+EOF
+ chmod +x configure
+ echo 'all: ; touch foo' >Makefile
+}
+
+src_configure() {
+ :
+}
+
+src_compile() {
+ default
+ [[ -e foo ]] || die
+}
+END
+mkdir -p "cat/expand-vars"
+cat <<"END" > cat/expand-vars/expand-vars-0.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="enabled-weasel broccoli"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+pkg_setup() {
+ [[ $USE == "enabled-weasel linguas_enabled_en linguas_enabled_en_GB linguas_enabled_en_GB@UTF-8 userland_GNU cheese " ]] \
+ || die "USE=$USE is wrong"
+ [[ $USERLAND == "GNU" ]] || die "USERLAND=$USERLAND is wrong"
+ [[ $LINGUAS == "enabled_en enabled_en_GB enabled_en_GB@UTF-8" ]] || die "LINGUAS=$LINGUAS is wrong"
+}
+END
+mkdir -p "cat/pkg_pretend"
+cat <<"END" > cat/pkg_pretend/pkg_pretend-3.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="enabled-weasel broccoli"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+pkg_pretend() {
+ einfo "This is my pkg_pretend. There are many like it, but this one is mine."
+}
+END
+mkdir -p "cat/pkg_pretend-failure"
+cat <<"END" > cat/pkg_pretend-failure/pkg_pretend-failure-3.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="enabled-weasel broccoli"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+pkg_pretend() {
+ die "This is my pkg_pretend. There are many like it, but this one is mine."
+}
+END
+mkdir -p "cat/default_src_install" || exit 1
+cat << 'END' > cat/default_src_install/default_src_install-3.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+S="${WORKDIR}"
+
+src_unpack() {
+ mkdir -p ${WORKDIR}
+ cat <<'EOF' >${WORKDIR}/Makefile
+all :
+ echo spork > README
+ echo monkey > README.txt
+ touch README.foo
+ echo gerbil > GERBIL
+
+install :
+ echo spork > $(DESTDIR)/EATME
+EOF
+}
+
+pkg_preinst() {
+ [[ -e ${D}/usr/share/doc/${PF}/README ]] || die README
+ [[ -e ${D}/usr/share/doc/${PF}/README.txt ]] || die README.txt
+ [[ -e ${D}/usr/share/doc/${PF}/README.foo ]] && die README.foo
+ [[ -e ${D}/usr/share/doc/${PF}/GERBIL ]] && die GERBIL
+ [[ -e ${D}/EATME ]] || die EATME
+}
+END
+mkdir -p "cat/docompress" || exit 1
+cat << 'END' > cat/docompress/docompress-3.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+S="${WORKDIR}"
+
+src_install() {
+ docompress foo || die
+ docompress bar || die
+}
+END
+mkdir -p "cat/dodoc-r" || exit 1
+cat << 'END' > cat/dodoc-r/dodoc-r-3.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+S="${WORKDIR}"
+
+src_unpack() {
+ mkdir -p ${WORKDIR}
+ cd "${WORKDIR}"
+
+ mkdir one two three
+ echo foo > one/first
+ echo foo > two/second
+ echo foo > four
+ mkdir dot
+ mkdir dot/five
+ echo foo > dot/five/fifth
+}
+
+src_install() {
+ dodoc -r one two three four
+ cd dot
+ dodoc -r .
+}
+
+pkg_preinst() {
+ [[ -e ${D}/usr/share/doc/${PF}/one/first ]] || die one/first
+ [[ -e ${D}/usr/share/doc/${PF}/two/second ]] || die two/second
+ [[ -e ${D}/usr/share/doc/${PF}/four ]] || die four
+ [[ -e ${D}/usr/share/doc/${PF}/five/fifth ]] || die five/fifth
+}
+END
+mkdir -p "cat/doins-symlink" || exit 1
+cat << 'END' > cat/doins-symlink/doins-symlink-3.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+S="${WORKDIR}"
+
+src_unpack() {
+ mkdir -p ${WORKDIR}
+ cd "${WORKDIR}"
+
+ mkdir a
+ cd a
+ echo qwerty > qwerty
+ ln -s qwerty uiop
+ ln -s qwerty adfs
+
+ cd ..
+
+ mkdir b
+ cd b
+ echo foo > foo
+ ln -s foo bar
+
+}
+
+src_install() {
+ insinto /foo
+ doins a/qwerty
+ doins a/uiop
+ newins a/adfs asdf
+ cd b
+ doins -r .
+}
+
+pkg_preinst() {
+ [[ -f ${D}/foo/qwerty ]] || die qwerty
+ [[ -L ${D}/foo/uiop ]] || die uiop
+ [[ $(readlink ${D}/foo/uiop ) == qwerty ]] || die sym
+ [[ -L ${D}/foo/asdf ]] || die asdf
+ [[ $(readlink ${D}/foo/asdf ) == qwerty ]] || die sym
+ [[ -f ${D}/foo/foo ]] || die foo
+ [[ -L ${D}/foo/bar ]] || die bar
+ [[ $(readlink ${D}/foo/bar ) == foo ]] || die sym
+}
+END
+mkdir -p "cat/banned-functions"
+cat <<END > cat/banned-functions/banned-functions-3.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+S="\${WORKDIR}"
+
+src_install() {
+ touch foo
+ dohard foo bar
+}
+END
+mkdir -p "cat/econf-disable-dependency-tracking" || exit 1
+cat << 'END' > cat/econf-disable-dependency-tracking/econf-disable-dependency-tracking-0.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="0"
+
+S="${WORKDIR}"
+
+src_unpack() {
+ mkdir -p ${WORKDIR}
+ cd "${WORKDIR}"
+
+ cat <<'EOF' > configure
+#!/bin/sh
+
+if echo "$@" | grep -q 'disable-dependency-tracking' ; then
+ exit 1
+fi
+
+exit 0
+EOF
+
+ chmod +x configure
+}
+END
+cat << 'END' > cat/econf-disable-dependency-tracking/econf-disable-dependency-tracking-3.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+S="${WORKDIR}"
+
+src_unpack() {
+ mkdir -p ${WORKDIR}
+ cd "${WORKDIR}"
+
+ cat <<'EOF' > configure
+#!/bin/sh
+
+if ! echo "$@" | grep -q 'disable-dependency-tracking' ; then
+ exit 1
+fi
+
+exit 0
+EOF
+
+ chmod +x configure
+}
+END
+mkdir -p "cat/strict-use" || exit 1
+cat << 'END' > cat/strict-use/strict-use-3.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="3"
+
+S="${WORKDIR}"
+
+pkg_setup() {
+ use enabled || die "enabled not enabled"
+ use spork && die "sporks are bad"
+}
+END
+mkdir -p "cat/strict-use-fail" || exit 1
+cat << 'END' > cat/strict-use-fail/strict-use-fail-3.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="3"
+
+S="${WORKDIR}"
+
+pkg_setup() {
+ use pony
+}
+END
+mkdir -p "cat/strict-use-injection" || exit 1
+cat << 'END' > cat/strict-use-injection/strict-use-injection-3.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="3"
+
+S="${WORKDIR}"
+
+pkg_setup() {
+ use build && die "build set"
+ use userland_GNU || die "userland_GNU not set"
+ use cheese || die "cheese not set"
+ use otherarch && die "otherarch set"
+}
+END
+mkdir -p "cat/global-scope-use" || exit 1
+cat << 'END' > cat/global-scope-use/global-scope-use-3.ebuild || exit 1
+use spork
+
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork enabled"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+S="${WORKDIR}"
+END
+cd ..
+
+cd ..
+
diff --git a/paludis/repositories/e/e_repository_TEST_1.cc b/paludis/repositories/e/e_repository_TEST_1.cc
new file mode 100644
index 0000000..e0cfe54
--- /dev/null
+++ b/paludis/repositories/e/e_repository_TEST_1.cc
@@ -0,0 +1,192 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006, 2007, 2008, 2009 Ciaran McCreesh
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/repositories/e/e_repository.hh>
+#include <paludis/repositories/e/e_repository_exceptions.hh>
+#include <paludis/repositories/e/e_repository_id.hh>
+#include <paludis/repositories/e/vdb_repository.hh>
+#include <paludis/repositories/e/eapi.hh>
+#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
+#include <paludis/repositories/fake/fake_installed_repository.hh>
+#include <paludis/repositories/fake/fake_package_id.hh>
+#include <paludis/environments/test/test_environment.hh>
+#include <paludis/util/system.hh>
+#include <paludis/util/simple_visitor_cast.hh>
+#include <paludis/util/map.hh>
+#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/make_named_values.hh>
+#include <paludis/util/set.hh>
+#include <paludis/standard_output_manager.hh>
+#include <paludis/util/safe_ifstream.hh>
+#include <paludis/package_id.hh>
+#include <paludis/metadata_key.hh>
+#include <paludis/action.hh>
+#include <paludis/stringify_formatter.hh>
+#include <paludis/user_dep_spec.hh>
+#include <paludis/generator.hh>
+#include <paludis/filter.hh>
+#include <paludis/filtered_generator.hh>
+#include <paludis/selection.hh>
+#include <paludis/repository_factory.hh>
+#include <paludis/choice.hh>
+#include <test/test_framework.hh>
+#include <test/test_runner.hh>
+#include <tr1/functional>
+#include <set>
+#include <string>
+
+#include "config.h"
+
+using namespace test;
+using namespace paludis;
+
+namespace
+{
+ void cannot_uninstall(const std::tr1::shared_ptr<const PackageID> & id, const UninstallActionOptions &)
+ {
+ if (id)
+ throw InternalError(PALUDIS_HERE, "cannot uninstall");
+ }
+
+ std::tr1::shared_ptr<OutputManager> make_standard_output_manager(const Action &)
+ {
+ return make_shared_ptr(new StandardOutputManager);
+ }
+
+ std::string from_keys(const std::tr1::shared_ptr<const Map<std::string, std::string> > & m,
+ const std::string & k)
+ {
+ Map<std::string, std::string>::ConstIterator mm(m->find(k));
+ if (m->end() == mm)
+ return "";
+ else
+ return mm->second;
+ }
+
+ WantPhase want_all_phases(const std::string &)
+ {
+ return wp_yes;
+ }
+}
+
+namespace test_cases
+{
+ struct ERepositoryInstallEAPI1Test : TestCase
+ {
+ ERepositoryInstallEAPI1Test() : TestCase("install_eapi_1") { }
+
+ unsigned max_run_time() const
+ {
+ return 3000;
+ }
+
+ bool repeatable() const
+ {
+ return false;
+ }
+
+ void run()
+ {
+ TestEnvironment env;
+ env.set_paludis_command("/bin/false");
+ std::tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>);
+ keys->insert("format", "ebuild");
+ keys->insert("names_cache", "/var/empty");
+ keys->insert("location", stringify(FSEntry::cwd() / "e_repository_TEST_1_dir" / "repo"));
+ keys->insert("profiles", stringify(FSEntry::cwd() / "e_repository_TEST_1_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(FSEntry::cwd() / "e_repository_TEST_1_dir" / "distdir"));
+ keys->insert("builddir", stringify(FSEntry::cwd() / "e_repository_TEST_1_dir" / "build"));
+ std::tr1::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
+ std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)));
+ env.package_database()->add_repository(1, repo);
+
+ std::tr1::shared_ptr<FakeInstalledRepository> installed_repo(new FakeInstalledRepository(
+ make_named_values<FakeInstalledRepositoryParams>(
+ value_for<n::environment>(&env),
+ value_for<n::name>(RepositoryName("installed")),
+ value_for<n::suitable_destination>(true),
+ value_for<n::supports_uninstall>(true)
+ )));
+ env.package_database()->add_repository(2, installed_repo);
+
+ InstallAction action(make_named_values<InstallActionOptions>(
+ value_for<n::destination>(installed_repo),
+ value_for<n::make_output_manager>(&make_standard_output_manager),
+ value_for<n::perform_uninstall>(&cannot_uninstall),
+ value_for<n::replacing>(make_shared_ptr(new PackageIDSequence)),
+ value_for<n::want_phase>(&want_all_phases)
+ ));
+
+ {
+ TestMessageSuffix suffix("econf source 1", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/econf-source-1",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "1");
+ id->perform_action(action);
+ }
+
+ {
+ TestMessageSuffix suffix("dosym success 1", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/dosym-success-1",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "1");
+ id->perform_action(action);
+ }
+
+ {
+ TestMessageSuffix suffix("doman 1", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/doman-1",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "1");
+ id->perform_action(action);
+ }
+
+ {
+ TestMessageSuffix suffix("no src_prepare 1", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/src_prepare-1",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "1");
+ id->perform_action(action);
+ }
+
+ {
+ TestMessageSuffix suffix("no src_configure 1", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/src_configure-1",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "1");
+ id->perform_action(action);
+ }
+ }
+ } test_e_repository_install_eapi_1;
+}
+
diff --git a/paludis/repositories/e/e_repository_TEST_1_cleanup.sh b/paludis/repositories/e/e_repository_TEST_1_cleanup.sh
new file mode 100755
index 0000000..836377b
--- /dev/null
+++ b/paludis/repositories/e/e_repository_TEST_1_cleanup.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+if [ -d e_repository_TEST_1_dir ] ; then
+ rm -fr e_repository_TEST_1_dir
+else
+ true
+fi
+
diff --git a/paludis/repositories/e/e_repository_TEST_1_setup.sh b/paludis/repositories/e/e_repository_TEST_1_setup.sh
new file mode 100755
index 0000000..bdde541
--- /dev/null
+++ b/paludis/repositories/e/e_repository_TEST_1_setup.sh
@@ -0,0 +1,1007 @@
+#!/usr/bin/env bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+mkdir e_repository_TEST_1_dir || exit 1
+cd e_repository_TEST_1_dir || exit 1
+
+mkdir -p root/etc
+
+mkdir -p vdb
+touch vdb/THISISTHEVDB
+
+mkdir -p build
+ln -s build symlinked_build
+
+mkdir -p distdir
+echo "already fetched" > distdir/already-fetched.txt || exit 1
+cat <<END > distdir/expatch-success-1.patch || exit 1
+--- a/bar
++++ b/bar
+@@ -1 +1,3 @@
+ foo
++bar
++baz
+END
+
+mkdir -p repo/{profiles/profile,metadata,eclass} || exit 1
+cd repo || exit 1
+echo "test-repo" >> profiles/repo_name || exit 1
+echo "cat" >> profiles/categories || exit 1
+cat <<END > profiles/profile/virtuals
+virtual/virtual-pretend-installed cat/pretend-installed
+virtual/virtual-doesnotexist cat/doesnotexist
+END
+cat <<END > profiles/profile/make.defaults
+ARCH="cheese"
+USERLAND="GNU"
+KERNEL="linux"
+LIBC="glibc"
+CHOST="i286-badger-linux-gnu"
+LINGUAS="enabled_en enabled_en_GB enabled_en_GB@UTF-8"
+USE_EXPAND="LINGUAS USERLAND"
+USE_EXPAND_UNPREFIXED="ARCH"
+USE_EXPAND_IMPLICIT="USERLAND ARCH"
+USE_EXPAND_VALUES_USERLAND="GNU"
+USE_EXPAND_VALUES_ARCH="cheese otherarch"
+IUSE_IMPLICIT="build"
+END
+mkdir -p "cat/in-ebuild-die"
+cat <<END > cat/in-ebuild-die/in-ebuild-die-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE=""
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+pkg_setup() {
+ die "boom"
+}
+END
+mkdir -p "cat/in-subshell-die"
+cat <<'END' > cat/in-subshell-die/in-subshell-die-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE=""
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+pkg_setup() {
+ ( hasq test $KEYWORDS && die "boom" )
+}
+END
+mkdir -p "cat/success"
+cat <<END > cat/success/success-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+pkg_setup() {
+ useq spork && die "boom"
+}
+END
+mkdir -p "cat/unpack-die"
+cat <<END > cat/unpack-die/unpack-die-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_unpack() {
+ echo "123" > f.bz2
+ unpack ./f.bz2
+}
+END
+mkdir -p "cat/econf-die"
+cat <<END > cat/econf-die/econf-die-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_compile() {
+ econf
+}
+END
+mkdir -p "cat/emake-fail"
+cat <<END > cat/emake-fail/emake-fail-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_compile() {
+ emake monkey
+}
+END
+mkdir -p "cat/emake-die"
+cat <<END > cat/emake-die/emake-die-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_compile() {
+ emake monkey || die
+}
+END
+mkdir -p "cat/einstall-die"
+cat <<END > cat/einstall-die/einstall-die-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_install() {
+ einstall
+}
+END
+mkdir -p "cat/keepdir-die"
+cat <<"END" > cat/keepdir-die/keepdir-die-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_install() {
+ dodir /usr/share
+ touch "${D}"/usr/share/monkey
+ keepdir /usr/share/monkey
+}
+END
+mkdir -p "cat/dobin-fail"
+cat <<END > cat/dobin-fail/dobin-fail-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_install() {
+ dobin monkey
+}
+END
+mkdir -p "cat/dobin-die"
+cat <<END > cat/dobin-die/dobin-die-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_install() {
+ dobin monkey || die
+}
+END
+mkdir -p "cat/fperms-fail"
+cat <<END > cat/fperms-fail/fperms-fail-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_install() {
+ fperms 755 monkey
+}
+END
+mkdir -p "cat/fperms-die"
+cat <<END > cat/fperms-die/fperms-die-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_install() {
+ fperms 755 monkey || die
+}
+END
+mkdir -p "cat/pretend-installed"
+cat <<END > cat/pretend-installed/pretend-installed-2.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_compile() {
+ die "not supposed to install this"
+}
+END
+mkdir -p "cat/econf-source"
+cat <<END > cat/econf-source/econf-source-0.ebuild || exit 1
+EAPI="\${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_unpack() {
+ ECONF_SOURCE=subdir
+ mkdir \${S}
+ cd \${S}
+ mkdir subdir
+ echo 'touch monkey' > subdir/configure
+ chmod +x subdir/configure
+}
+
+src_install() {
+ insinto /usr/bin
+ doins monkey || die "no monkey"
+}
+END
+cp cat/econf-source/econf-source-{0,1}.ebuild || exit 1
+cp cat/econf-source/econf-source-{0,2}.ebuild || exit 1
+mkdir -p "cat/doman"
+cat <<END > cat/doman/doman-0.ebuild || exit 1
+EAPI="\${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_compile() {
+ echo \${PF} >foo.1
+ mkdir dir
+ echo \${PF} >dir/foo.2
+ echo \${PF} >foo.2
+ echo \${PF} >foo.3x
+ echo \${PF} >foo.4.gz
+ echo \${PF} >foo.5f.bz2
+ echo \${PF} >foo.6.Z
+ echo \${PF} >foo.en.7
+ echo \${PF} >foo.en_GB.8
+ echo \${PF} >foo.e.9
+ echo \${PF} >foo.enn.n
+ echo \${PF} >foo.EN.1
+ echo \${PF} >foo.en-GB.2
+ echo \${PF} >foo.en_gb.3
+ echo \${PF} >foo.en_G.4
+ echo \${PF} >foo.en_GBB.5
+ echo \${PF} >foo.nonkey
+ touch foo.1x
+ echo \${PF} >bar.m
+ echo \${PF} >bar.monkey
+ echo \${PF} >baz.6
+ echo \${PF} >baz.en_US.7
+}
+
+src_install() {
+ doman foo.* dir/foo.* || die
+ doman bar.m && die
+ doman bar.monkey && die
+ doman bar.1 && die
+ doman -i18n=en_GB baz.* || die
+ keepdir /meh || die
+ cd "\${D}"/meh || die
+ doman .keep* || die
+ rm "\${D}"/usr/share/man/{man1/foo.1,man2/foo.2,man3/foo.3x,man4/foo.4.gz,man5/foo.5f.bz2} || die
+ rm "\${D}"/usr/share/man/{man6/foo.6.Z,man7/foo.en.7,man8/foo.en_GB.8,man9/foo.e.9,mann/foo.enn.n} || die
+ rm "\${D}"/usr/share/man/{man1/foo.EN.1,man2/foo.en-GB.2,man3/foo.en_gb.3,man4/foo.en_G.4} || die
+ rm "\${D}"/usr/share/man/{man5/foo.en_GBB.5,mann/foo.nonkey,en_GB/man6/baz.6,en_GB/man7/baz.en_US.7} || die
+ rmdir "\${D}"/usr/share/man/{man1,man2,man3,man4,man5,man6,man7,man8,man9,mann,en_GB/man6,en_GB/man7,en_GB,} || die
+}
+END
+cp cat/doman/doman-{0,1}.ebuild || exit 1
+cat <<END > cat/doman/doman-2.ebuild || exit 1
+EAPI="\${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_compile() {
+ echo \${PF} >foo.1
+ mkdir dir
+ echo \${PF} >dir/foo.2
+ echo \${PF} >foo.3x
+ echo \${PF} >foo.4.gz
+ echo \${PF} >foo.5f.bz2
+ echo \${PF} >foo.6.Z
+ echo \${PF} >foo.en.7
+ echo \${PF} >foo.en_GB.8
+ echo \${PF} >foo.e.9
+ echo \${PF} >foo.enn.n
+ echo \${PF} >foo.EN.1
+ echo \${PF} >foo.en-GB.2
+ echo \${PF} >foo.en_gb.3
+ echo \${PF} >foo.en_G.4
+ echo \${PF} >foo.en_GBB.5
+ echo \${PF} >foo.nonkey
+ touch foo.1x
+ echo \${PF} >bar.m
+ echo \${PF} >bar.monkey
+ echo \${PF} >baz.6
+ echo \${PF} >baz.en_US.7
+}
+
+src_install() {
+ doman foo.* dir/foo.* || die
+ doman bar.m && die
+ doman bar.monkey && die
+ doman bar.1 && die
+ doman -i18n=en_GB baz.* || die
+ keepdir /meh || die
+ cd "\${D}"/meh || die
+ doman .keep* || die
+ rm "\${D}"/usr/share/man/{man1/foo.1,man2/foo.2,man3/foo.3x,man4/foo.4.gz,man5/foo.5f.bz2} || die
+ rm "\${D}"/usr/share/man/{man6/foo.6.Z,en/man7/foo.7,en_GB/man8/foo.8,man9/foo.e.9,mann/foo.enn.n} || die
+ rm "\${D}"/usr/share/man/{man1/foo.EN.1,man2/foo.en-GB.2,man3/foo.en_gb.3,man4/foo.en_G.4} || die
+ rm "\${D}"/usr/share/man/{man5/foo.en_GBB.5,mann/foo.nonkey,en_GB/man6/baz.6,en_US/man7/baz.7} || die
+ rmdir "\${D}"/usr/share/man/{man1,man2,man3,man4,man5,man6,man9,mann,en/man7,en_GB/man6,en_GB/man8,en_US/man7,en,en_GB,en_US,} || die
+}
+END
+mkdir -p "cat/dosym-success"
+cat <<'END' > cat/dosym-success/dosym-success-1.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_install() {
+ dosym foo /usr/bin/bar
+ [[ "$(readlink ${D}/usr/bin/bar )" == "foo" ]] || die
+}
+END
+mkdir -p "cat/best-version"
+cat <<'END' > cat/best-version/best-version-0.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+pkg_setup() {
+ if ! best_version cat/pretend-installed >/dev/null ; then
+ die "failed cat/pretend-installed"
+ fi
+
+ BV1=$(best_version cat/pretend-installed )
+ [[ "$BV1" == "cat/pretend-installed-1" ]] || die "BV1 is $BV1"
+
+ if best_version cat/doesnotexist >/dev/null ; then
+ die "not failed cat/doesnotexist"
+ fi
+
+ BV2=$(best_version cat/doesnotexist )
+ [[ "$BV2" == "" ]] || die "BV2 is $BV2"
+
+ if [[ -n "$PALUDIS_ENABLE_VIRTUALS_REPOSITORY" ]] ; then
+ if ! best_version virtual/virtual-pretend-installed >/dev/null ; then
+ die "failed virtual/virtual-pretend-installed"
+ fi
+
+ BV3=$(best_version virtual/virtual-pretend-installed )
+ [[ "$BV3" == "cat/pretend-installed-1" ]] || die "BV3 is $BV3"
+
+ if best_version virtual/virtual-doesnotexist >/dev/null ; then
+ die "not failed virtual/virtual-doesnotexist"
+ fi
+
+ BV2=$(best_version virtual/virtual-doesnotexist )
+ [[ "$BV4" == "" ]] || die "BV4 is $BV4"
+ fi
+}
+END
+mkdir -p "cat/has-version"
+cat <<'END' > cat/has-version/has-version-0.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+pkg_setup() {
+ if ! has_version cat/pretend-installed ; then
+ die "failed cat/pretend-installed"
+ fi
+
+ if has_version cat/doesnotexist >/dev/null ; then
+ die "not failed cat/doesnotexist"
+ fi
+}
+END
+mkdir -p "cat/match"
+cat <<'END' > cat/match/match-0.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+pkg_setup() {
+ if ! portageq match "${ROOT}" cat/pretend-installed >/dev/null ; then
+ die "failed cat/pretend-installed"
+ fi
+
+ cat <<'DONE' > ${T}/expected
+cat/pretend-installed-0
+cat/pretend-installed-1
+DONE
+ portageq match "${ROOT}" cat/pretend-installed > ${T}/got
+ cmp ${T}/expected ${T}/got || die "oops"
+
+ if portageq match "${ROOT}" cat/doesnotexist >/dev/null ; then
+ die "not failed cat/doesnotexist"
+ fi
+
+ BV2=$(portageq match "${ROOT}" cat/doesnotexist )
+ [[ "$BV2" == "" ]] || die "BV2 is $BV2"
+}
+END
+mkdir -p "cat/vars"
+cat <<'END' > cat/vars/vars-0.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+pkg_setup() {
+ [[ -d "${T}" ]] || die "T not a dir"
+}
+
+src_compile() {
+ [[ -d "${T}" ]] || die "T not a dir"
+}
+
+pkg_preinst() {
+ [[ -d "${T}" ]] || die "T not a dir"
+}
+END
+mkdir -p "cat/src_prepare"
+cat <<END > cat/src_prepare/src_prepare-0.ebuild || exit 1
+EAPI="\${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_prepare() {
+ die src_prepare
+}
+END
+cp cat/src_prepare/src_prepare-{0,1}.ebuild || exit 1
+cp cat/src_prepare/src_prepare-{0,2}.ebuild || exit 1
+mkdir -p "cat/src_configure"
+cat <<END > cat/src_configure/src_configure-0.ebuild || exit 1
+EAPI="\${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_configure() {
+ die src_configure
+}
+END
+cp cat/src_configure/src_configure-{0,1}.ebuild || exit 1
+cp cat/src_configure/src_configure-{0,2}.ebuild || exit 1
+mkdir -p "cat/default-src_configure" || exit 1
+cat << END > cat/default-src_configure/default-src_configure-2.ebuild || exit 1
+EAPI="\${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_unpack() {
+ cat <<EOF >configure
+#! /bin/sh
+touch foo
+EOF
+ chmod +x configure
+ echo 'all: ; rm foo' >Makefile
+}
+
+src_compile() {
+ [[ -e foo ]] || die
+}
+END
+mkdir -p "cat/default-src_compile" || exit 1
+cat << END > cat/default-src_compile/default-src_compile-2.ebuild || exit 1
+EAPI="\${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_unpack() {
+ cat <<EOF >configure
+#! /bin/sh
+rm Makefile
+EOF
+ chmod +x configure
+ echo 'all: ; touch foo' >Makefile
+}
+
+src_configure() {
+ :
+}
+
+src_install() {
+ [[ -e foo ]] || die
+}
+END
+mkdir -p "cat/default_src_compile" || exit 1
+cat << END > cat/default_src_compile/default_src_compile-2.ebuild || exit 1
+EAPI="\${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_unpack() {
+ cat <<EOF >configure
+#! /bin/sh
+rm Makefile
+EOF
+ chmod +x configure
+ echo 'all: ; touch foo' >Makefile
+}
+
+src_configure() {
+ :
+}
+
+src_compile() {
+ default_src_compile
+ [[ -e foo ]] || die
+}
+END
+mkdir -p "cat/src_compile-via-default-func" || exit 1
+cat << END > cat/src_compile-via-default-func/src_compile-via-default-func-2.ebuild || exit 1
+EAPI="\${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_unpack() {
+ cat <<EOF >configure
+#! /bin/sh
+rm Makefile
+EOF
+ chmod +x configure
+ echo 'all: ; touch foo' >Makefile
+}
+
+src_configure() {
+ :
+}
+
+src_compile() {
+ default
+ [[ -e foo ]] || die
+}
+END
+mkdir -p "cat/expand-vars"
+cat <<"END" > cat/expand-vars/expand-vars-0.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="enabled-weasel broccoli"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+pkg_setup() {
+ [[ $USE == "enabled-weasel linguas_enabled_en linguas_enabled_en_GB linguas_enabled_en_GB@UTF-8 userland_GNU cheese " ]] \
+ || die "USE=$USE is wrong"
+ [[ $USERLAND == "GNU" ]] || die "USERLAND=$USERLAND is wrong"
+ [[ $LINGUAS == "enabled_en enabled_en_GB enabled_en_GB@UTF-8" ]] || die "LINGUAS=$LINGUAS is wrong"
+}
+END
+mkdir -p "cat/pkg_pretend"
+cat <<"END" > cat/pkg_pretend/pkg_pretend-3.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="enabled-weasel broccoli"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+pkg_pretend() {
+ einfo "This is my pkg_pretend. There are many like it, but this one is mine."
+}
+END
+mkdir -p "cat/pkg_pretend-failure"
+cat <<"END" > cat/pkg_pretend-failure/pkg_pretend-failure-3.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="enabled-weasel broccoli"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+pkg_pretend() {
+ die "This is my pkg_pretend. There are many like it, but this one is mine."
+}
+END
+mkdir -p "cat/default_src_install" || exit 1
+cat << 'END' > cat/default_src_install/default_src_install-3.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+S="${WORKDIR}"
+
+src_unpack() {
+ mkdir -p ${WORKDIR}
+ cat <<'EOF' >${WORKDIR}/Makefile
+all :
+ echo spork > README
+ echo monkey > README.txt
+ touch README.foo
+ echo gerbil > GERBIL
+
+install :
+ echo spork > $(DESTDIR)/EATME
+EOF
+}
+
+pkg_preinst() {
+ [[ -e ${D}/usr/share/doc/${PF}/README ]] || die README
+ [[ -e ${D}/usr/share/doc/${PF}/README.txt ]] || die README.txt
+ [[ -e ${D}/usr/share/doc/${PF}/README.foo ]] && die README.foo
+ [[ -e ${D}/usr/share/doc/${PF}/GERBIL ]] && die GERBIL
+ [[ -e ${D}/EATME ]] || die EATME
+}
+END
+mkdir -p "cat/docompress" || exit 1
+cat << 'END' > cat/docompress/docompress-3.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+S="${WORKDIR}"
+
+src_install() {
+ docompress foo || die
+ docompress bar || die
+}
+END
+mkdir -p "cat/dodoc-r" || exit 1
+cat << 'END' > cat/dodoc-r/dodoc-r-3.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+S="${WORKDIR}"
+
+src_unpack() {
+ mkdir -p ${WORKDIR}
+ cd "${WORKDIR}"
+
+ mkdir one two three
+ echo foo > one/first
+ echo foo > two/second
+ echo foo > four
+ mkdir dot
+ mkdir dot/five
+ echo foo > dot/five/fifth
+}
+
+src_install() {
+ dodoc -r one two three four
+ cd dot
+ dodoc -r .
+}
+
+pkg_preinst() {
+ [[ -e ${D}/usr/share/doc/${PF}/one/first ]] || die one/first
+ [[ -e ${D}/usr/share/doc/${PF}/two/second ]] || die two/second
+ [[ -e ${D}/usr/share/doc/${PF}/four ]] || die four
+ [[ -e ${D}/usr/share/doc/${PF}/five/fifth ]] || die five/fifth
+}
+END
+mkdir -p "cat/doins-symlink" || exit 1
+cat << 'END' > cat/doins-symlink/doins-symlink-3.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+S="${WORKDIR}"
+
+src_unpack() {
+ mkdir -p ${WORKDIR}
+ cd "${WORKDIR}"
+
+ mkdir a
+ cd a
+ echo qwerty > qwerty
+ ln -s qwerty uiop
+ ln -s qwerty adfs
+
+ cd ..
+
+ mkdir b
+ cd b
+ echo foo > foo
+ ln -s foo bar
+
+}
+
+src_install() {
+ insinto /foo
+ doins a/qwerty
+ doins a/uiop
+ newins a/adfs asdf
+ cd b
+ doins -r .
+}
+
+pkg_preinst() {
+ [[ -f ${D}/foo/qwerty ]] || die qwerty
+ [[ -L ${D}/foo/uiop ]] || die uiop
+ [[ $(readlink ${D}/foo/uiop ) == qwerty ]] || die sym
+ [[ -L ${D}/foo/asdf ]] || die asdf
+ [[ $(readlink ${D}/foo/asdf ) == qwerty ]] || die sym
+ [[ -f ${D}/foo/foo ]] || die foo
+ [[ -L ${D}/foo/bar ]] || die bar
+ [[ $(readlink ${D}/foo/bar ) == foo ]] || die sym
+}
+END
+mkdir -p "cat/banned-functions"
+cat <<END > cat/banned-functions/banned-functions-3.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+S="\${WORKDIR}"
+
+src_install() {
+ touch foo
+ dohard foo bar
+}
+END
+mkdir -p "cat/econf-disable-dependency-tracking" || exit 1
+cat << 'END' > cat/econf-disable-dependency-tracking/econf-disable-dependency-tracking-0.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="0"
+
+S="${WORKDIR}"
+
+src_unpack() {
+ mkdir -p ${WORKDIR}
+ cd "${WORKDIR}"
+
+ cat <<'EOF' > configure
+#!/bin/sh
+
+if echo "$@" | grep -q 'disable-dependency-tracking' ; then
+ exit 1
+fi
+
+exit 0
+EOF
+
+ chmod +x configure
+}
+END
+cat << 'END' > cat/econf-disable-dependency-tracking/econf-disable-dependency-tracking-3.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+S="${WORKDIR}"
+
+src_unpack() {
+ mkdir -p ${WORKDIR}
+ cd "${WORKDIR}"
+
+ cat <<'EOF' > configure
+#!/bin/sh
+
+if ! echo "$@" | grep -q 'disable-dependency-tracking' ; then
+ exit 1
+fi
+
+exit 0
+EOF
+
+ chmod +x configure
+}
+END
+mkdir -p "cat/strict-use" || exit 1
+cat << 'END' > cat/strict-use/strict-use-3.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="3"
+
+S="${WORKDIR}"
+
+pkg_setup() {
+ use enabled || die "enabled not enabled"
+ use spork && die "sporks are bad"
+}
+END
+mkdir -p "cat/strict-use-fail" || exit 1
+cat << 'END' > cat/strict-use-fail/strict-use-fail-3.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="3"
+
+S="${WORKDIR}"
+
+pkg_setup() {
+ use pony
+}
+END
+mkdir -p "cat/strict-use-injection" || exit 1
+cat << 'END' > cat/strict-use-injection/strict-use-injection-3.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="3"
+
+S="${WORKDIR}"
+
+pkg_setup() {
+ use build && die "build set"
+ use userland_GNU || die "userland_GNU not set"
+ use cheese || die "cheese not set"
+ use otherarch && die "otherarch set"
+}
+END
+mkdir -p "cat/global-scope-use" || exit 1
+cat << 'END' > cat/global-scope-use/global-scope-use-3.ebuild || exit 1
+use spork
+
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork enabled"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+S="${WORKDIR}"
+END
+cd ..
+
+cd ..
+
diff --git a/paludis/repositories/e/e_repository_TEST_2.cc b/paludis/repositories/e/e_repository_TEST_2.cc
new file mode 100644
index 0000000..d3c1cfc
--- /dev/null
+++ b/paludis/repositories/e/e_repository_TEST_2.cc
@@ -0,0 +1,222 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006, 2007, 2008, 2009 Ciaran McCreesh
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/repositories/e/e_repository.hh>
+#include <paludis/repositories/e/e_repository_exceptions.hh>
+#include <paludis/repositories/e/e_repository_id.hh>
+#include <paludis/repositories/e/vdb_repository.hh>
+#include <paludis/repositories/e/eapi.hh>
+#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
+#include <paludis/repositories/fake/fake_installed_repository.hh>
+#include <paludis/repositories/fake/fake_package_id.hh>
+#include <paludis/environments/test/test_environment.hh>
+#include <paludis/util/system.hh>
+#include <paludis/util/simple_visitor_cast.hh>
+#include <paludis/util/map.hh>
+#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/make_named_values.hh>
+#include <paludis/util/set.hh>
+#include <paludis/standard_output_manager.hh>
+#include <paludis/util/safe_ifstream.hh>
+#include <paludis/package_id.hh>
+#include <paludis/metadata_key.hh>
+#include <paludis/action.hh>
+#include <paludis/stringify_formatter.hh>
+#include <paludis/user_dep_spec.hh>
+#include <paludis/generator.hh>
+#include <paludis/filter.hh>
+#include <paludis/filtered_generator.hh>
+#include <paludis/selection.hh>
+#include <paludis/repository_factory.hh>
+#include <paludis/choice.hh>
+#include <test/test_framework.hh>
+#include <test/test_runner.hh>
+#include <tr1/functional>
+#include <set>
+#include <string>
+
+#include "config.h"
+
+using namespace test;
+using namespace paludis;
+
+namespace
+{
+ void cannot_uninstall(const std::tr1::shared_ptr<const PackageID> & id, const UninstallActionOptions &)
+ {
+ if (id)
+ throw InternalError(PALUDIS_HERE, "cannot uninstall");
+ }
+
+ std::tr1::shared_ptr<OutputManager> make_standard_output_manager(const Action &)
+ {
+ return make_shared_ptr(new StandardOutputManager);
+ }
+
+ std::string from_keys(const std::tr1::shared_ptr<const Map<std::string, std::string> > & m,
+ const std::string & k)
+ {
+ Map<std::string, std::string>::ConstIterator mm(m->find(k));
+ if (m->end() == mm)
+ return "";
+ else
+ return mm->second;
+ }
+
+ WantPhase want_all_phases(const std::string &)
+ {
+ return wp_yes;
+ }
+}
+
+namespace test_cases
+{
+ struct ERepositoryInstallEAPI2Test : TestCase
+ {
+ ERepositoryInstallEAPI2Test() : TestCase("install_eapi_2") { }
+
+ unsigned max_run_time() const
+ {
+ return 3000;
+ }
+
+ bool repeatable() const
+ {
+ return false;
+ }
+
+ void run()
+ {
+ TestEnvironment env;
+ env.set_paludis_command("/bin/false");
+ std::tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>);
+ keys->insert("format", "ebuild");
+ keys->insert("names_cache", "/var/empty");
+ keys->insert("location", stringify(FSEntry::cwd() / "e_repository_TEST_2_dir" / "repo"));
+ keys->insert("profiles", stringify(FSEntry::cwd() / "e_repository_TEST_2_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(FSEntry::cwd() / "e_repository_TEST_2_dir" / "distdir"));
+ keys->insert("builddir", stringify(FSEntry::cwd() / "e_repository_TEST_2_dir" / "build"));
+ std::tr1::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
+ std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)));
+ env.package_database()->add_repository(1, repo);
+
+ std::tr1::shared_ptr<FakeInstalledRepository> installed_repo(new FakeInstalledRepository(
+ make_named_values<FakeInstalledRepositoryParams>(
+ value_for<n::environment>(&env),
+ value_for<n::name>(RepositoryName("installed")),
+ value_for<n::suitable_destination>(true),
+ value_for<n::supports_uninstall>(true)
+ )));
+ env.package_database()->add_repository(2, installed_repo);
+
+ InstallAction action(make_named_values<InstallActionOptions>(
+ value_for<n::destination>(installed_repo),
+ value_for<n::make_output_manager>(&make_standard_output_manager),
+ value_for<n::perform_uninstall>(&cannot_uninstall),
+ value_for<n::replacing>(make_shared_ptr(new PackageIDSequence)),
+ value_for<n::want_phase>(&want_all_phases)
+ ));
+
+ {
+ TestMessageSuffix suffix("econf source 2", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/econf-source-2",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2");
+ id->perform_action(action);
+ }
+
+ {
+ TestMessageSuffix suffix("doman 2", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/doman-2",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2");
+ id->perform_action(action);
+ }
+
+ {
+ TestMessageSuffix suffix("src_prepare 2", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/src_prepare-2",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2");
+ TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError);
+ }
+
+ {
+ TestMessageSuffix suffix("src_configure 2", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/src_configure-2",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2");
+ TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError);
+ }
+
+ {
+ TestMessageSuffix suffix("default src_configure 2", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/default-src_configure-2",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2");
+ id->perform_action(action);
+ }
+
+ {
+ TestMessageSuffix suffix("default src_compile 2", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/default-src_compile-2",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2");
+ id->perform_action(action);
+ }
+
+ {
+ TestMessageSuffix suffix("default_src_compile 2", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/default_src_compile-2",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2");
+ id->perform_action(action);
+ }
+
+ {
+ TestMessageSuffix suffix("src_compile via default function 2", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/src_compile-via-default-func-2",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "2");
+ id->perform_action(action);
+ }
+ }
+ } test_e_repository_install_eapi_2;
+}
+
diff --git a/paludis/repositories/e/e_repository_TEST_2_cleanup.sh b/paludis/repositories/e/e_repository_TEST_2_cleanup.sh
new file mode 100755
index 0000000..2bc0e01
--- /dev/null
+++ b/paludis/repositories/e/e_repository_TEST_2_cleanup.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+if [ -d e_repository_TEST_2_dir ] ; then
+ rm -fr e_repository_TEST_2_dir
+else
+ true
+fi
+
diff --git a/paludis/repositories/e/e_repository_TEST_2_setup.sh b/paludis/repositories/e/e_repository_TEST_2_setup.sh
new file mode 100755
index 0000000..32af663
--- /dev/null
+++ b/paludis/repositories/e/e_repository_TEST_2_setup.sh
@@ -0,0 +1,1006 @@
+#!/usr/bin/env bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+mkdir e_repository_TEST_2_dir || exit 1
+cd e_repository_TEST_2_dir || exit 1
+
+mkdir -p root/etc
+
+mkdir -p vdb
+touch vdb/THISISTHEVDB
+
+mkdir -p build
+ln -s build symlinked_build
+
+mkdir -p distdir
+echo "already fetched" > distdir/already-fetched.txt || exit 1
+cat <<END > distdir/expatch-success-1.patch || exit 1
+--- a/bar
++++ b/bar
+@@ -1 +1,3 @@
+ foo
++bar
++baz
+END
+
+mkdir -p repo/{profiles/profile,metadata,eclass} || exit 1
+cd repo || exit 1
+echo "test-repo" >> profiles/repo_name || exit 1
+echo "cat" >> profiles/categories || exit 1
+cat <<END > profiles/profile/virtuals
+virtual/virtual-pretend-installed cat/pretend-installed
+virtual/virtual-doesnotexist cat/doesnotexist
+END
+cat <<END > profiles/profile/make.defaults
+ARCH="cheese"
+USERLAND="GNU"
+KERNEL="linux"
+LIBC="glibc"
+CHOST="i286-badger-linux-gnu"
+LINGUAS="enabled_en enabled_en_GB enabled_en_GB@UTF-8"
+USE_EXPAND="LINGUAS USERLAND"
+USE_EXPAND_UNPREFIXED="ARCH"
+USE_EXPAND_IMPLICIT="USERLAND ARCH"
+USE_EXPAND_VALUES_USERLAND="GNU"
+USE_EXPAND_VALUES_ARCH="cheese otherarch"
+IUSE_IMPLICIT="build"
+END
+mkdir -p "cat/in-ebuild-die"
+cat <<END > cat/in-ebuild-die/in-ebuild-die-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE=""
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+pkg_setup() {
+ die "boom"
+}
+END
+mkdir -p "cat/in-subshell-die"
+cat <<'END' > cat/in-subshell-die/in-subshell-die-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE=""
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+pkg_setup() {
+ ( hasq test $KEYWORDS && die "boom" )
+}
+END
+mkdir -p "cat/success"
+cat <<END > cat/success/success-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+pkg_setup() {
+ useq spork && die "boom"
+}
+END
+mkdir -p "cat/unpack-die"
+cat <<END > cat/unpack-die/unpack-die-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_unpack() {
+ echo "123" > f.bz2
+ unpack ./f.bz2
+}
+END
+mkdir -p "cat/econf-die"
+cat <<END > cat/econf-die/econf-die-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_compile() {
+ econf
+}
+END
+mkdir -p "cat/emake-fail"
+cat <<END > cat/emake-fail/emake-fail-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_compile() {
+ emake monkey
+}
+END
+mkdir -p "cat/emake-die"
+cat <<END > cat/emake-die/emake-die-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_compile() {
+ emake monkey || die
+}
+END
+mkdir -p "cat/einstall-die"
+cat <<END > cat/einstall-die/einstall-die-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_install() {
+ einstall
+}
+END
+mkdir -p "cat/keepdir-die"
+cat <<"END" > cat/keepdir-die/keepdir-die-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_install() {
+ dodir /usr/share
+ touch "${D}"/usr/share/monkey
+ keepdir /usr/share/monkey
+}
+END
+mkdir -p "cat/dobin-fail"
+cat <<END > cat/dobin-fail/dobin-fail-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_install() {
+ dobin monkey
+}
+END
+mkdir -p "cat/dobin-die"
+cat <<END > cat/dobin-die/dobin-die-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_install() {
+ dobin monkey || die
+}
+END
+mkdir -p "cat/fperms-fail"
+cat <<END > cat/fperms-fail/fperms-fail-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_install() {
+ fperms 755 monkey
+}
+END
+mkdir -p "cat/fperms-die"
+cat <<END > cat/fperms-die/fperms-die-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_install() {
+ fperms 755 monkey || die
+}
+END
+mkdir -p "cat/pretend-installed"
+cat <<END > cat/pretend-installed/pretend-installed-2.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_compile() {
+ die "not supposed to install this"
+}
+END
+mkdir -p "cat/econf-source"
+cat <<END > cat/econf-source/econf-source-0.ebuild || exit 1
+EAPI="\${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_unpack() {
+ ECONF_SOURCE=subdir
+ mkdir \${S}
+ cd \${S}
+ mkdir subdir
+ echo 'touch monkey' > subdir/configure
+ chmod +x subdir/configure
+}
+
+src_install() {
+ insinto /usr/bin
+ doins monkey || die "no monkey"
+}
+END
+cp cat/econf-source/econf-source-{0,1}.ebuild || exit 1
+cp cat/econf-source/econf-source-{0,2}.ebuild || exit 1
+mkdir -p "cat/doman"
+cat <<END > cat/doman/doman-0.ebuild || exit 1
+EAPI="\${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_compile() {
+ echo \${PF} >foo.1
+ mkdir dir
+ echo \${PF} >dir/foo.2
+ echo \${PF} >foo.2
+ echo \${PF} >foo.3x
+ echo \${PF} >foo.4.gz
+ echo \${PF} >foo.5f.bz2
+ echo \${PF} >foo.6.Z
+ echo \${PF} >foo.en.7
+ echo \${PF} >foo.en_GB.8
+ echo \${PF} >foo.e.9
+ echo \${PF} >foo.enn.n
+ echo \${PF} >foo.EN.1
+ echo \${PF} >foo.en-GB.2
+ echo \${PF} >foo.en_gb.3
+ echo \${PF} >foo.en_G.4
+ echo \${PF} >foo.en_GBB.5
+ echo \${PF} >foo.nonkey
+ touch foo.1x
+ echo \${PF} >bar.m
+ echo \${PF} >bar.monkey
+ echo \${PF} >baz.6
+ echo \${PF} >baz.en_US.7
+}
+
+src_install() {
+ doman foo.* dir/foo.* || die
+ doman bar.m && die
+ doman bar.monkey && die
+ doman bar.1 && die
+ doman -i18n=en_GB baz.* || die
+ keepdir /meh || die
+ cd "\${D}"/meh || die
+ doman .keep* || die
+ rm "\${D}"/usr/share/man/{man1/foo.1,man2/foo.2,man3/foo.3x,man4/foo.4.gz,man5/foo.5f.bz2} || die
+ rm "\${D}"/usr/share/man/{man6/foo.6.Z,man7/foo.en.7,man8/foo.en_GB.8,man9/foo.e.9,mann/foo.enn.n} || die
+ rm "\${D}"/usr/share/man/{man1/foo.EN.1,man2/foo.en-GB.2,man3/foo.en_gb.3,man4/foo.en_G.4} || die
+ rm "\${D}"/usr/share/man/{man5/foo.en_GBB.5,mann/foo.nonkey,en_GB/man6/baz.6,en_GB/man7/baz.en_US.7} || die
+ rmdir "\${D}"/usr/share/man/{man1,man2,man3,man4,man5,man6,man7,man8,man9,mann,en_GB/man6,en_GB/man7,en_GB,} || die
+}
+END
+cp cat/doman/doman-{0,1}.ebuild || exit 1
+cat <<END > cat/doman/doman-2.ebuild || exit 1
+EAPI="\${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_compile() {
+ echo \${PF} >foo.1
+ mkdir dir
+ echo \${PF} >dir/foo.2
+ echo \${PF} >foo.3x
+ echo \${PF} >foo.4.gz
+ echo \${PF} >foo.5f.bz2
+ echo \${PF} >foo.6.Z
+ echo \${PF} >foo.en.7
+ echo \${PF} >foo.en_GB.8
+ echo \${PF} >foo.e.9
+ echo \${PF} >foo.enn.n
+ echo \${PF} >foo.EN.1
+ echo \${PF} >foo.en-GB.2
+ echo \${PF} >foo.en_gb.3
+ echo \${PF} >foo.en_G.4
+ echo \${PF} >foo.en_GBB.5
+ echo \${PF} >foo.nonkey
+ touch foo.1x
+ echo \${PF} >bar.m
+ echo \${PF} >bar.monkey
+ echo \${PF} >baz.6
+ echo \${PF} >baz.en_US.7
+}
+
+src_install() {
+ doman foo.* dir/foo.* || die
+ doman bar.m && die
+ doman bar.monkey && die
+ doman bar.1 && die
+ doman -i18n=en_GB baz.* || die
+ keepdir /meh || die
+ cd "\${D}"/meh || die
+ doman .keep* || die
+ rm "\${D}"/usr/share/man/{man1/foo.1,man2/foo.2,man3/foo.3x,man4/foo.4.gz,man5/foo.5f.bz2} || die
+ rm "\${D}"/usr/share/man/{man6/foo.6.Z,en/man7/foo.7,en_GB/man8/foo.8,man9/foo.e.9,mann/foo.enn.n} || die
+ rm "\${D}"/usr/share/man/{man1/foo.EN.1,man2/foo.en-GB.2,man3/foo.en_gb.3,man4/foo.en_G.4} || die
+ rm "\${D}"/usr/share/man/{man5/foo.en_GBB.5,mann/foo.nonkey,en_GB/man6/baz.6,en_US/man7/baz.7} || die
+ rmdir "\${D}"/usr/share/man/{man1,man2,man3,man4,man5,man6,man9,mann,en/man7,en_GB/man6,en_GB/man8,en_US/man7,en,en_GB,en_US,} || die
+}
+END
+mkdir -p "cat/dosym-success"
+cat <<'END' > cat/dosym-success/dosym-success-1.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_install() {
+ dosym foo /usr/bin/bar
+ [[ "$(readlink ${D}/usr/bin/bar )" == "foo" ]] || die
+}
+END
+mkdir -p "cat/best-version"
+cat <<'END' > cat/best-version/best-version-0.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+pkg_setup() {
+ if ! best_version cat/pretend-installed >/dev/null ; then
+ die "failed cat/pretend-installed"
+ fi
+
+ BV1=$(best_version cat/pretend-installed )
+ [[ "$BV1" == "cat/pretend-installed-1" ]] || die "BV1 is $BV1"
+
+ if best_version cat/doesnotexist >/dev/null ; then
+ die "not failed cat/doesnotexist"
+ fi
+
+ BV2=$(best_version cat/doesnotexist )
+ [[ "$BV2" == "" ]] || die "BV2 is $BV2"
+
+ if [[ -n "$PALUDIS_ENABLE_VIRTUALS_REPOSITORY" ]] ; then
+ if ! best_version virtual/virtual-pretend-installed >/dev/null ; then
+ die "failed virtual/virtual-pretend-installed"
+ fi
+
+ BV3=$(best_version virtual/virtual-pretend-installed )
+ [[ "$BV3" == "cat/pretend-installed-1" ]] || die "BV3 is $BV3"
+
+ if best_version virtual/virtual-doesnotexist >/dev/null ; then
+ die "not failed virtual/virtual-doesnotexist"
+ fi
+
+ BV2=$(best_version virtual/virtual-doesnotexist )
+ [[ "$BV4" == "" ]] || die "BV4 is $BV4"
+ fi
+}
+END
+mkdir -p "cat/has-version"
+cat <<'END' > cat/has-version/has-version-0.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+pkg_setup() {
+ if ! has_version cat/pretend-installed ; then
+ die "failed cat/pretend-installed"
+ fi
+
+ if has_version cat/doesnotexist >/dev/null ; then
+ die "not failed cat/doesnotexist"
+ fi
+}
+END
+mkdir -p "cat/match"
+cat <<'END' > cat/match/match-0.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+pkg_setup() {
+ if ! portageq match "${ROOT}" cat/pretend-installed >/dev/null ; then
+ die "failed cat/pretend-installed"
+ fi
+
+ cat <<'DONE' > ${T}/expected
+cat/pretend-installed-0
+cat/pretend-installed-1
+DONE
+ portageq match "${ROOT}" cat/pretend-installed > ${T}/got
+ cmp ${T}/expected ${T}/got || die "oops"
+
+ if portageq match "${ROOT}" cat/doesnotexist >/dev/null ; then
+ die "not failed cat/doesnotexist"
+ fi
+
+ BV2=$(portageq match "${ROOT}" cat/doesnotexist )
+ [[ "$BV2" == "" ]] || die "BV2 is $BV2"
+}
+END
+mkdir -p "cat/vars"
+cat <<'END' > cat/vars/vars-0.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+pkg_setup() {
+ [[ -d "${T}" ]] || die "T not a dir"
+}
+
+src_compile() {
+ [[ -d "${T}" ]] || die "T not a dir"
+}
+
+pkg_preinst() {
+ [[ -d "${T}" ]] || die "T not a dir"
+}
+END
+mkdir -p "cat/src_prepare"
+cat <<END > cat/src_prepare/src_prepare-0.ebuild || exit 1
+EAPI="\${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_prepare() {
+ die src_prepare
+}
+END
+cp cat/src_prepare/src_prepare-{0,1}.ebuild || exit 1
+cp cat/src_prepare/src_prepare-{0,2}.ebuild || exit 1
+mkdir -p "cat/src_configure"
+cat <<END > cat/src_configure/src_configure-0.ebuild || exit 1
+EAPI="\${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_configure() {
+ die src_configure
+}
+END
+cp cat/src_configure/src_configure-{0,1}.ebuild || exit 1
+cp cat/src_configure/src_configure-{0,2}.ebuild || exit 1
+mkdir -p "cat/default-src_configure" || exit 1
+cat << END > cat/default-src_configure/default-src_configure-2.ebuild || exit 1
+EAPI="\${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_unpack() {
+ cat <<EOF >configure
+#! /bin/sh
+touch foo
+EOF
+ chmod +x configure
+ echo 'all: ; rm foo' >Makefile
+}
+
+src_compile() {
+ [[ -e foo ]] || die
+}
+END
+mkdir -p "cat/default-src_compile" || exit 1
+cat << END > cat/default-src_compile/default-src_compile-2.ebuild || exit 1
+EAPI="\${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_unpack() {
+ cat <<EOF >configure
+#! /bin/sh
+rm Makefile
+EOF
+ chmod +x configure
+ echo 'all: ; touch foo' >Makefile
+}
+
+src_configure() {
+ :
+}
+
+src_install() {
+ [[ -e foo ]] || die
+}
+END
+mkdir -p "cat/default_src_compile" || exit 1
+cat << END > cat/default_src_compile/default_src_compile-2.ebuild || exit 1
+EAPI="\${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_unpack() {
+ cat <<EOF >configure
+#! /bin/sh
+rm Makefile
+EOF
+ chmod +x configure
+ echo 'all: ; touch foo' >Makefile
+}
+
+src_configure() {
+ :
+}
+
+src_compile() {
+ default_src_compile
+ [[ -e foo ]] || die
+}
+END
+mkdir -p "cat/src_compile-via-default-func" || exit 1
+cat << END > cat/src_compile-via-default-func/src_compile-via-default-func-2.ebuild || exit 1
+EAPI="\${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_unpack() {
+ cat <<EOF >configure
+#! /bin/sh
+rm Makefile
+EOF
+ chmod +x configure
+ echo 'all: ; touch foo' >Makefile
+}
+
+src_configure() {
+ :
+}
+
+src_compile() {
+ default
+ [[ -e foo ]] || die
+}
+END
+mkdir -p "cat/expand-vars"
+cat <<"END" > cat/expand-vars/expand-vars-0.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="enabled-weasel broccoli"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+pkg_setup() {
+ [[ $USE == "enabled-weasel linguas_enabled_en linguas_enabled_en_GB linguas_enabled_en_GB@UTF-8 userland_GNU cheese " ]] \
+ || die "USE=$USE is wrong"
+ [[ $USERLAND == "GNU" ]] || die "USERLAND=$USERLAND is wrong"
+ [[ $LINGUAS == "enabled_en enabled_en_GB enabled_en_GB@UTF-8" ]] || die "LINGUAS=$LINGUAS is wrong"
+}
+END
+mkdir -p "cat/pkg_pretend"
+cat <<"END" > cat/pkg_pretend/pkg_pretend-3.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="enabled-weasel broccoli"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+pkg_pretend() {
+ einfo "This is my pkg_pretend. There are many like it, but this one is mine."
+}
+END
+mkdir -p "cat/pkg_pretend-failure"
+cat <<"END" > cat/pkg_pretend-failure/pkg_pretend-failure-3.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="enabled-weasel broccoli"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+pkg_pretend() {
+ die "This is my pkg_pretend. There are many like it, but this one is mine."
+}
+END
+mkdir -p "cat/default_src_install" || exit 1
+cat << 'END' > cat/default_src_install/default_src_install-3.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+S="${WORKDIR}"
+
+src_unpack() {
+ mkdir -p ${WORKDIR}
+ cat <<'EOF' >${WORKDIR}/Makefile
+all :
+ echo spork > README
+ echo monkey > README.txt
+ touch README.foo
+ echo gerbil > GERBIL
+
+install :
+ echo spork > $(DESTDIR)/EATME
+EOF
+}
+
+pkg_preinst() {
+ [[ -e ${D}/usr/share/doc/${PF}/README ]] || die README
+ [[ -e ${D}/usr/share/doc/${PF}/README.txt ]] || die README.txt
+ [[ -e ${D}/usr/share/doc/${PF}/README.foo ]] && die README.foo
+ [[ -e ${D}/usr/share/doc/${PF}/GERBIL ]] && die GERBIL
+ [[ -e ${D}/EATME ]] || die EATME
+}
+END
+mkdir -p "cat/docompress" || exit 1
+cat << 'END' > cat/docompress/docompress-3.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+S="${WORKDIR}"
+
+src_install() {
+ docompress foo || die
+ docompress bar || die
+}
+END
+mkdir -p "cat/dodoc-r" || exit 1
+cat << 'END' > cat/dodoc-r/dodoc-r-3.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+S="${WORKDIR}"
+
+src_unpack() {
+ mkdir -p ${WORKDIR}
+ cd "${WORKDIR}"
+
+ mkdir one two three
+ echo foo > one/first
+ echo foo > two/second
+ echo foo > four
+ mkdir dot
+ mkdir dot/five
+ echo foo > dot/five/fifth
+}
+
+src_install() {
+ dodoc -r one two three four
+ cd dot
+ dodoc -r .
+}
+
+pkg_preinst() {
+ [[ -e ${D}/usr/share/doc/${PF}/one/first ]] || die one/first
+ [[ -e ${D}/usr/share/doc/${PF}/two/second ]] || die two/second
+ [[ -e ${D}/usr/share/doc/${PF}/four ]] || die four
+ [[ -e ${D}/usr/share/doc/${PF}/five/fifth ]] || die five/fifth
+}
+END
+mkdir -p "cat/doins-symlink" || exit 1
+cat << 'END' > cat/doins-symlink/doins-symlink-3.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+S="${WORKDIR}"
+
+src_unpack() {
+ mkdir -p ${WORKDIR}
+ cd "${WORKDIR}"
+
+ mkdir a
+ cd a
+ echo qwerty > qwerty
+ ln -s qwerty uiop
+ ln -s qwerty adfs
+
+ cd ..
+
+ mkdir b
+ cd b
+ echo foo > foo
+ ln -s foo bar
+
+}
+
+src_install() {
+ insinto /foo
+ doins a/qwerty
+ doins a/uiop
+ newins a/adfs asdf
+ cd b
+ doins -r .
+}
+
+pkg_preinst() {
+ [[ -f ${D}/foo/qwerty ]] || die qwerty
+ [[ -L ${D}/foo/uiop ]] || die uiop
+ [[ $(readlink ${D}/foo/uiop ) == qwerty ]] || die sym
+ [[ -L ${D}/foo/asdf ]] || die asdf
+ [[ $(readlink ${D}/foo/asdf ) == qwerty ]] || die sym
+ [[ -f ${D}/foo/foo ]] || die foo
+ [[ -L ${D}/foo/bar ]] || die bar
+ [[ $(readlink ${D}/foo/bar ) == foo ]] || die sym
+}
+END
+mkdir -p "cat/banned-functions"
+cat <<END > cat/banned-functions/banned-functions-3.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+S="\${WORKDIR}"
+
+src_install() {
+ touch foo
+ dohard foo bar
+}
+END
+mkdir -p "cat/econf-disable-dependency-tracking" || exit 1
+cat << 'END' > cat/econf-disable-dependency-tracking/econf-disable-dependency-tracking-0.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="0"
+
+S="${WORKDIR}"
+
+src_unpack() {
+ mkdir -p ${WORKDIR}
+ cd "${WORKDIR}"
+
+ cat <<'EOF' > configure
+#!/bin/sh
+
+if echo "$@" | grep -q 'disable-dependency-tracking' ; then
+ exit 1
+fi
+
+exit 0
+EOF
+
+ chmod +x configure
+}
+END
+cat << 'END' > cat/econf-disable-dependency-tracking/econf-disable-dependency-tracking-3.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+S="${WORKDIR}"
+
+src_unpack() {
+ mkdir -p ${WORKDIR}
+ cd "${WORKDIR}"
+
+ cat <<'EOF' > configure
+#!/bin/sh
+
+if ! echo "$@" | grep -q 'disable-dependency-tracking' ; then
+ exit 1
+fi
+
+exit 0
+EOF
+
+ chmod +x configure
+}
+END
+mkdir -p "cat/strict-use" || exit 1
+cat << 'END' > cat/strict-use/strict-use-3.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="3"
+
+S="${WORKDIR}"
+
+pkg_setup() {
+ use enabled || die "enabled not enabled"
+ use spork && die "sporks are bad"
+}
+END
+mkdir -p "cat/strict-use-fail" || exit 1
+cat << 'END' > cat/strict-use-fail/strict-use-fail-3.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="3"
+
+S="${WORKDIR}"
+
+pkg_setup() {
+ use pony
+}
+END
+mkdir -p "cat/strict-use-injection" || exit 1
+cat << 'END' > cat/strict-use-injection/strict-use-injection-3.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="3"
+
+S="${WORKDIR}"
+
+pkg_setup() {
+ use build && die "build set"
+ use userland_GNU || die "userland_GNU not set"
+ use cheese || die "cheese not set"
+ use otherarch && die "otherarch set"
+}
+END
+mkdir -p "cat/global-scope-use" || exit 1
+cat << 'END' > cat/global-scope-use/global-scope-use-3.ebuild || exit 1
+use spork
+
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork enabled"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+S="${WORKDIR}"
+END
+cd ..
+
+cd ..
diff --git a/paludis/repositories/e/e_repository_TEST_3.cc b/paludis/repositories/e/e_repository_TEST_3.cc
new file mode 100644
index 0000000..d57ee76
--- /dev/null
+++ b/paludis/repositories/e/e_repository_TEST_3.cc
@@ -0,0 +1,268 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006, 2007, 2008, 2009 Ciaran McCreesh
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/repositories/e/e_repository.hh>
+#include <paludis/repositories/e/e_repository_exceptions.hh>
+#include <paludis/repositories/e/e_repository_id.hh>
+#include <paludis/repositories/e/vdb_repository.hh>
+#include <paludis/repositories/e/eapi.hh>
+#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
+#include <paludis/repositories/fake/fake_installed_repository.hh>
+#include <paludis/repositories/fake/fake_package_id.hh>
+#include <paludis/environments/test/test_environment.hh>
+#include <paludis/util/system.hh>
+#include <paludis/util/simple_visitor_cast.hh>
+#include <paludis/util/map.hh>
+#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/make_named_values.hh>
+#include <paludis/util/set.hh>
+#include <paludis/standard_output_manager.hh>
+#include <paludis/util/safe_ifstream.hh>
+#include <paludis/package_id.hh>
+#include <paludis/metadata_key.hh>
+#include <paludis/action.hh>
+#include <paludis/stringify_formatter.hh>
+#include <paludis/user_dep_spec.hh>
+#include <paludis/generator.hh>
+#include <paludis/filter.hh>
+#include <paludis/filtered_generator.hh>
+#include <paludis/selection.hh>
+#include <paludis/repository_factory.hh>
+#include <paludis/choice.hh>
+#include <test/test_framework.hh>
+#include <test/test_runner.hh>
+#include <tr1/functional>
+#include <set>
+#include <string>
+
+#include "config.h"
+
+using namespace test;
+using namespace paludis;
+
+namespace
+{
+ void cannot_uninstall(const std::tr1::shared_ptr<const PackageID> & id, const UninstallActionOptions &)
+ {
+ if (id)
+ throw InternalError(PALUDIS_HERE, "cannot uninstall");
+ }
+
+ std::tr1::shared_ptr<OutputManager> make_standard_output_manager(const Action &)
+ {
+ return make_shared_ptr(new StandardOutputManager);
+ }
+
+ std::string from_keys(const std::tr1::shared_ptr<const Map<std::string, std::string> > & m,
+ const std::string & k)
+ {
+ Map<std::string, std::string>::ConstIterator mm(m->find(k));
+ if (m->end() == mm)
+ return "";
+ else
+ return mm->second;
+ }
+
+ WantPhase want_all_phases(const std::string &)
+ {
+ return wp_yes;
+ }
+}
+
+namespace test_cases
+{
+ struct ERepositoryInstallEAPI3Test : TestCase
+ {
+ ERepositoryInstallEAPI3Test() : TestCase("install_eapi_3") { }
+
+ unsigned max_run_time() const
+ {
+ return 3000;
+ }
+
+ bool repeatable() const
+ {
+ return false;
+ }
+
+ void run()
+ {
+ TestEnvironment env;
+ env.set_paludis_command("/bin/false");
+ std::tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>);
+ keys->insert("format", "ebuild");
+ keys->insert("names_cache", "/var/empty");
+ keys->insert("location", stringify(FSEntry::cwd() / "e_repository_TEST_3_dir" / "repo"));
+ keys->insert("profiles", stringify(FSEntry::cwd() / "e_repository_TEST_3_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(FSEntry::cwd() / "e_repository_TEST_3_dir" / "distdir"));
+ keys->insert("builddir", stringify(FSEntry::cwd() / "e_repository_TEST_3_dir" / "build"));
+ std::tr1::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
+ std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)));
+ env.package_database()->add_repository(1, repo);
+
+ std::tr1::shared_ptr<FakeInstalledRepository> installed_repo(new FakeInstalledRepository(
+ make_named_values<FakeInstalledRepositoryParams>(
+ value_for<n::environment>(&env),
+ value_for<n::name>(RepositoryName("installed")),
+ value_for<n::suitable_destination>(true),
+ value_for<n::supports_uninstall>(true)
+ )));
+ env.package_database()->add_repository(2, installed_repo);
+
+ InstallAction action(make_named_values<InstallActionOptions>(
+ value_for<n::destination>(installed_repo),
+ value_for<n::make_output_manager>(&make_standard_output_manager),
+ value_for<n::perform_uninstall>(&cannot_uninstall),
+ value_for<n::replacing>(make_shared_ptr(new PackageIDSequence)),
+ value_for<n::want_phase>(&want_all_phases)
+ ));
+
+ PretendAction pretend_action(make_named_values<PretendActionOptions>(
+ value_for<n::make_output_manager>(&make_standard_output_manager)
+ ));
+
+ {
+ TestMessageSuffix suffix("pkg_pretend", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/pkg_pretend-3",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
+ id->perform_action(pretend_action);
+ TEST_CHECK(! pretend_action.failed());
+ }
+
+ {
+ TestMessageSuffix suffix("pkg_pretend-failure", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/pkg_pretend-failure-3",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
+ id->perform_action(pretend_action);
+ TEST_CHECK(pretend_action.failed());
+ }
+
+ {
+ TestMessageSuffix suffix("default_src_install 3", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/default_src_install-3",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
+ id->perform_action(action);
+ }
+
+ {
+ TestMessageSuffix suffix("docompress 3", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/docompress-3",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
+ id->perform_action(action);
+ }
+
+ {
+ TestMessageSuffix suffix("dodoc -r", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/dodoc-r-3",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
+ id->perform_action(action);
+ }
+
+ {
+ TestMessageSuffix suffix("doins symlink", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/doins-symlink-3",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
+ id->perform_action(action);
+ }
+
+ {
+ TestMessageSuffix suffix("banned functions 3", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/banned-functions-3",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
+ TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError);
+ }
+
+ {
+ TestMessageSuffix suffix("econf disable dependency tracking", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/econf-disable-dependency-tracking-3",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
+ id->perform_action(action);
+ }
+
+ {
+ TestMessageSuffix suffix("strict use", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/strict-use-3",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
+ id->perform_action(action);
+ }
+
+ {
+ TestMessageSuffix suffix("strict use fail", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/strict-use-fail-3",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
+ TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError);
+ }
+
+ {
+ TestMessageSuffix suffix("strict use injection", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/strict-use-injection-3",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
+ id->perform_action(action);
+ }
+
+ {
+ TestMessageSuffix suffix("global scope use", true);
+ const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/global-scope-use-3",
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ TEST_CHECK(id);
+ TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
+ id->perform_action(action);
+ }
+ }
+ } test_e_repository_install_eapi_3;
+}
+
diff --git a/paludis/repositories/e/e_repository_TEST_3_cleanup.sh b/paludis/repositories/e/e_repository_TEST_3_cleanup.sh
new file mode 100755
index 0000000..26e3e59
--- /dev/null
+++ b/paludis/repositories/e/e_repository_TEST_3_cleanup.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+if [ -d e_repository_TEST_3_dir ] ; then
+ rm -fr e_repository_TEST_3_dir
+else
+ true
+fi
+
diff --git a/paludis/repositories/e/e_repository_TEST_3_setup.sh b/paludis/repositories/e/e_repository_TEST_3_setup.sh
new file mode 100755
index 0000000..14e049d
--- /dev/null
+++ b/paludis/repositories/e/e_repository_TEST_3_setup.sh
@@ -0,0 +1,1010 @@
+#!/usr/bin/env bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+mkdir e_repository_TEST_3_dir || exit 1
+cd e_repository_TEST_3_dir || exit 1
+
+mkdir -p root/etc
+
+mkdir -p vdb
+touch vdb/THISISTHEVDB
+
+mkdir -p build
+ln -s build symlinked_build
+
+mkdir -p distdir
+echo "already fetched" > distdir/already-fetched.txt || exit 1
+cat <<END > distdir/expatch-success-1.patch || exit 1
+--- a/bar
++++ b/bar
+@@ -1 +1,3 @@
+ foo
++bar
++baz
+END
+
+mkdir -p fetchable
+echo "one" > fetchable/fetchable-1.txt || exit 1
+echo "two" > fetchable/fetchable-2.txt || exit 1
+
+mkdir -p repo/{profiles/profile,metadata,eclass} || exit 1
+cd repo || exit 1
+echo "test-repo" >> profiles/repo_name || exit 1
+echo "cat" >> profiles/categories || exit 1
+cat <<END > profiles/profile/virtuals
+virtual/virtual-pretend-installed cat/pretend-installed
+virtual/virtual-doesnotexist cat/doesnotexist
+END
+cat <<END > profiles/profile/make.defaults
+ARCH="cheese"
+USERLAND="GNU"
+KERNEL="linux"
+LIBC="glibc"
+CHOST="i286-badger-linux-gnu"
+LINGUAS="enabled_en enabled_en_GB enabled_en_GB@UTF-8"
+USE_EXPAND="LINGUAS USERLAND"
+USE_EXPAND_UNPREFIXED="ARCH"
+USE_EXPAND_IMPLICIT="USERLAND ARCH"
+USE_EXPAND_VALUES_USERLAND="GNU"
+USE_EXPAND_VALUES_ARCH="cheese otherarch"
+IUSE_IMPLICIT="build"
+END
+mkdir -p "cat/in-ebuild-die"
+cat <<END > cat/in-ebuild-die/in-ebuild-die-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE=""
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+pkg_setup() {
+ die "boom"
+}
+END
+mkdir -p "cat/in-subshell-die"
+cat <<'END' > cat/in-subshell-die/in-subshell-die-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE=""
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+pkg_setup() {
+ ( hasq test $KEYWORDS && die "boom" )
+}
+END
+mkdir -p "cat/success"
+cat <<END > cat/success/success-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+pkg_setup() {
+ useq spork && die "boom"
+}
+END
+mkdir -p "cat/unpack-die"
+cat <<END > cat/unpack-die/unpack-die-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_unpack() {
+ echo "123" > f.bz2
+ unpack ./f.bz2
+}
+END
+mkdir -p "cat/econf-die"
+cat <<END > cat/econf-die/econf-die-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_compile() {
+ econf
+}
+END
+mkdir -p "cat/emake-fail"
+cat <<END > cat/emake-fail/emake-fail-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_compile() {
+ emake monkey
+}
+END
+mkdir -p "cat/emake-die"
+cat <<END > cat/emake-die/emake-die-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_compile() {
+ emake monkey || die
+}
+END
+mkdir -p "cat/einstall-die"
+cat <<END > cat/einstall-die/einstall-die-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_install() {
+ einstall
+}
+END
+mkdir -p "cat/keepdir-die"
+cat <<"END" > cat/keepdir-die/keepdir-die-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_install() {
+ dodir /usr/share
+ touch "${D}"/usr/share/monkey
+ keepdir /usr/share/monkey
+}
+END
+mkdir -p "cat/dobin-fail"
+cat <<END > cat/dobin-fail/dobin-fail-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_install() {
+ dobin monkey
+}
+END
+mkdir -p "cat/dobin-die"
+cat <<END > cat/dobin-die/dobin-die-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_install() {
+ dobin monkey || die
+}
+END
+mkdir -p "cat/fperms-fail"
+cat <<END > cat/fperms-fail/fperms-fail-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_install() {
+ fperms 755 monkey
+}
+END
+mkdir -p "cat/fperms-die"
+cat <<END > cat/fperms-die/fperms-die-1.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_install() {
+ fperms 755 monkey || die
+}
+END
+mkdir -p "cat/pretend-installed"
+cat <<END > cat/pretend-installed/pretend-installed-2.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_compile() {
+ die "not supposed to install this"
+}
+END
+mkdir -p "cat/econf-source"
+cat <<END > cat/econf-source/econf-source-0.ebuild || exit 1
+EAPI="\${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_unpack() {
+ ECONF_SOURCE=subdir
+ mkdir \${S}
+ cd \${S}
+ mkdir subdir
+ echo 'touch monkey' > subdir/configure
+ chmod +x subdir/configure
+}
+
+src_install() {
+ insinto /usr/bin
+ doins monkey || die "no monkey"
+}
+END
+cp cat/econf-source/econf-source-{0,1}.ebuild || exit 1
+cp cat/econf-source/econf-source-{0,2}.ebuild || exit 1
+mkdir -p "cat/doman"
+cat <<END > cat/doman/doman-0.ebuild || exit 1
+EAPI="\${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_compile() {
+ echo \${PF} >foo.1
+ mkdir dir
+ echo \${PF} >dir/foo.2
+ echo \${PF} >foo.2
+ echo \${PF} >foo.3x
+ echo \${PF} >foo.4.gz
+ echo \${PF} >foo.5f.bz2
+ echo \${PF} >foo.6.Z
+ echo \${PF} >foo.en.7
+ echo \${PF} >foo.en_GB.8
+ echo \${PF} >foo.e.9
+ echo \${PF} >foo.enn.n
+ echo \${PF} >foo.EN.1
+ echo \${PF} >foo.en-GB.2
+ echo \${PF} >foo.en_gb.3
+ echo \${PF} >foo.en_G.4
+ echo \${PF} >foo.en_GBB.5
+ echo \${PF} >foo.nonkey
+ touch foo.1x
+ echo \${PF} >bar.m
+ echo \${PF} >bar.monkey
+ echo \${PF} >baz.6
+ echo \${PF} >baz.en_US.7
+}
+
+src_install() {
+ doman foo.* dir/foo.* || die
+ doman bar.m && die
+ doman bar.monkey && die
+ doman bar.1 && die
+ doman -i18n=en_GB baz.* || die
+ keepdir /meh || die
+ cd "\${D}"/meh || die
+ doman .keep* || die
+ rm "\${D}"/usr/share/man/{man1/foo.1,man2/foo.2,man3/foo.3x,man4/foo.4.gz,man5/foo.5f.bz2} || die
+ rm "\${D}"/usr/share/man/{man6/foo.6.Z,man7/foo.en.7,man8/foo.en_GB.8,man9/foo.e.9,mann/foo.enn.n} || die
+ rm "\${D}"/usr/share/man/{man1/foo.EN.1,man2/foo.en-GB.2,man3/foo.en_gb.3,man4/foo.en_G.4} || die
+ rm "\${D}"/usr/share/man/{man5/foo.en_GBB.5,mann/foo.nonkey,en_GB/man6/baz.6,en_GB/man7/baz.en_US.7} || die
+ rmdir "\${D}"/usr/share/man/{man1,man2,man3,man4,man5,man6,man7,man8,man9,mann,en_GB/man6,en_GB/man7,en_GB,} || die
+}
+END
+cp cat/doman/doman-{0,1}.ebuild || exit 1
+cat <<END > cat/doman/doman-2.ebuild || exit 1
+EAPI="\${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_compile() {
+ echo \${PF} >foo.1
+ mkdir dir
+ echo \${PF} >dir/foo.2
+ echo \${PF} >foo.3x
+ echo \${PF} >foo.4.gz
+ echo \${PF} >foo.5f.bz2
+ echo \${PF} >foo.6.Z
+ echo \${PF} >foo.en.7
+ echo \${PF} >foo.en_GB.8
+ echo \${PF} >foo.e.9
+ echo \${PF} >foo.enn.n
+ echo \${PF} >foo.EN.1
+ echo \${PF} >foo.en-GB.2
+ echo \${PF} >foo.en_gb.3
+ echo \${PF} >foo.en_G.4
+ echo \${PF} >foo.en_GBB.5
+ echo \${PF} >foo.nonkey
+ touch foo.1x
+ echo \${PF} >bar.m
+ echo \${PF} >bar.monkey
+ echo \${PF} >baz.6
+ echo \${PF} >baz.en_US.7
+}
+
+src_install() {
+ doman foo.* dir/foo.* || die
+ doman bar.m && die
+ doman bar.monkey && die
+ doman bar.1 && die
+ doman -i18n=en_GB baz.* || die
+ keepdir /meh || die
+ cd "\${D}"/meh || die
+ doman .keep* || die
+ rm "\${D}"/usr/share/man/{man1/foo.1,man2/foo.2,man3/foo.3x,man4/foo.4.gz,man5/foo.5f.bz2} || die
+ rm "\${D}"/usr/share/man/{man6/foo.6.Z,en/man7/foo.7,en_GB/man8/foo.8,man9/foo.e.9,mann/foo.enn.n} || die
+ rm "\${D}"/usr/share/man/{man1/foo.EN.1,man2/foo.en-GB.2,man3/foo.en_gb.3,man4/foo.en_G.4} || die
+ rm "\${D}"/usr/share/man/{man5/foo.en_GBB.5,mann/foo.nonkey,en_GB/man6/baz.6,en_US/man7/baz.7} || die
+ rmdir "\${D}"/usr/share/man/{man1,man2,man3,man4,man5,man6,man9,mann,en/man7,en_GB/man6,en_GB/man8,en_US/man7,en,en_GB,en_US,} || die
+}
+END
+mkdir -p "cat/dosym-success"
+cat <<'END' > cat/dosym-success/dosym-success-1.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_install() {
+ dosym foo /usr/bin/bar
+ [[ "$(readlink ${D}/usr/bin/bar )" == "foo" ]] || die
+}
+END
+mkdir -p "cat/best-version"
+cat <<'END' > cat/best-version/best-version-0.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+pkg_setup() {
+ if ! best_version cat/pretend-installed >/dev/null ; then
+ die "failed cat/pretend-installed"
+ fi
+
+ BV1=$(best_version cat/pretend-installed )
+ [[ "$BV1" == "cat/pretend-installed-1" ]] || die "BV1 is $BV1"
+
+ if best_version cat/doesnotexist >/dev/null ; then
+ die "not failed cat/doesnotexist"
+ fi
+
+ BV2=$(best_version cat/doesnotexist )
+ [[ "$BV2" == "" ]] || die "BV2 is $BV2"
+
+ if [[ -n "$PALUDIS_ENABLE_VIRTUALS_REPOSITORY" ]] ; then
+ if ! best_version virtual/virtual-pretend-installed >/dev/null ; then
+ die "failed virtual/virtual-pretend-installed"
+ fi
+
+ BV3=$(best_version virtual/virtual-pretend-installed )
+ [[ "$BV3" == "cat/pretend-installed-1" ]] || die "BV3 is $BV3"
+
+ if best_version virtual/virtual-doesnotexist >/dev/null ; then
+ die "not failed virtual/virtual-doesnotexist"
+ fi
+
+ BV2=$(best_version virtual/virtual-doesnotexist )
+ [[ "$BV4" == "" ]] || die "BV4 is $BV4"
+ fi
+}
+END
+mkdir -p "cat/has-version"
+cat <<'END' > cat/has-version/has-version-0.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+pkg_setup() {
+ if ! has_version cat/pretend-installed ; then
+ die "failed cat/pretend-installed"
+ fi
+
+ if has_version cat/doesnotexist >/dev/null ; then
+ die "not failed cat/doesnotexist"
+ fi
+}
+END
+mkdir -p "cat/match"
+cat <<'END' > cat/match/match-0.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+pkg_setup() {
+ if ! portageq match "${ROOT}" cat/pretend-installed >/dev/null ; then
+ die "failed cat/pretend-installed"
+ fi
+
+ cat <<'DONE' > ${T}/expected
+cat/pretend-installed-0
+cat/pretend-installed-1
+DONE
+ portageq match "${ROOT}" cat/pretend-installed > ${T}/got
+ cmp ${T}/expected ${T}/got || die "oops"
+
+ if portageq match "${ROOT}" cat/doesnotexist >/dev/null ; then
+ die "not failed cat/doesnotexist"
+ fi
+
+ BV2=$(portageq match "${ROOT}" cat/doesnotexist )
+ [[ "$BV2" == "" ]] || die "BV2 is $BV2"
+}
+END
+mkdir -p "cat/vars"
+cat <<'END' > cat/vars/vars-0.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+pkg_setup() {
+ [[ -d "${T}" ]] || die "T not a dir"
+}
+
+src_compile() {
+ [[ -d "${T}" ]] || die "T not a dir"
+}
+
+pkg_preinst() {
+ [[ -d "${T}" ]] || die "T not a dir"
+}
+END
+mkdir -p "cat/src_prepare"
+cat <<END > cat/src_prepare/src_prepare-0.ebuild || exit 1
+EAPI="\${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_prepare() {
+ die src_prepare
+}
+END
+cp cat/src_prepare/src_prepare-{0,1}.ebuild || exit 1
+cp cat/src_prepare/src_prepare-{0,2}.ebuild || exit 1
+mkdir -p "cat/src_configure"
+cat <<END > cat/src_configure/src_configure-0.ebuild || exit 1
+EAPI="\${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_configure() {
+ die src_configure
+}
+END
+cp cat/src_configure/src_configure-{0,1}.ebuild || exit 1
+cp cat/src_configure/src_configure-{0,2}.ebuild || exit 1
+mkdir -p "cat/default-src_configure" || exit 1
+cat << END > cat/default-src_configure/default-src_configure-2.ebuild || exit 1
+EAPI="\${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_unpack() {
+ cat <<EOF >configure
+#! /bin/sh
+touch foo
+EOF
+ chmod +x configure
+ echo 'all: ; rm foo' >Makefile
+}
+
+src_compile() {
+ [[ -e foo ]] || die
+}
+END
+mkdir -p "cat/default-src_compile" || exit 1
+cat << END > cat/default-src_compile/default-src_compile-2.ebuild || exit 1
+EAPI="\${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_unpack() {
+ cat <<EOF >configure
+#! /bin/sh
+rm Makefile
+EOF
+ chmod +x configure
+ echo 'all: ; touch foo' >Makefile
+}
+
+src_configure() {
+ :
+}
+
+src_install() {
+ [[ -e foo ]] || die
+}
+END
+mkdir -p "cat/default_src_compile" || exit 1
+cat << END > cat/default_src_compile/default_src_compile-2.ebuild || exit 1
+EAPI="\${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_unpack() {
+ cat <<EOF >configure
+#! /bin/sh
+rm Makefile
+EOF
+ chmod +x configure
+ echo 'all: ; touch foo' >Makefile
+}
+
+src_configure() {
+ :
+}
+
+src_compile() {
+ default_src_compile
+ [[ -e foo ]] || die
+}
+END
+mkdir -p "cat/src_compile-via-default-func" || exit 1
+cat << END > cat/src_compile-via-default-func/src_compile-via-default-func-2.ebuild || exit 1
+EAPI="\${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+src_unpack() {
+ cat <<EOF >configure
+#! /bin/sh
+rm Makefile
+EOF
+ chmod +x configure
+ echo 'all: ; touch foo' >Makefile
+}
+
+src_configure() {
+ :
+}
+
+src_compile() {
+ default
+ [[ -e foo ]] || die
+}
+END
+mkdir -p "cat/expand-vars"
+cat <<"END" > cat/expand-vars/expand-vars-0.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="enabled-weasel broccoli"
+LICENSE="GPL-2"
+KEYWORDS="test"
+
+pkg_setup() {
+ [[ $USE == "enabled-weasel linguas_enabled_en linguas_enabled_en_GB linguas_enabled_en_GB@UTF-8 userland_GNU cheese " ]] \
+ || die "USE=$USE is wrong"
+ [[ $USERLAND == "GNU" ]] || die "USERLAND=$USERLAND is wrong"
+ [[ $LINGUAS == "enabled_en enabled_en_GB enabled_en_GB@UTF-8" ]] || die "LINGUAS=$LINGUAS is wrong"
+}
+END
+mkdir -p "cat/pkg_pretend"
+cat <<"END" > cat/pkg_pretend/pkg_pretend-3.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="enabled-weasel broccoli"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+pkg_pretend() {
+ einfo "This is my pkg_pretend. There are many like it, but this one is mine."
+}
+END
+mkdir -p "cat/pkg_pretend-failure"
+cat <<"END" > cat/pkg_pretend-failure/pkg_pretend-failure-3.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="enabled-weasel broccoli"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+pkg_pretend() {
+ die "This is my pkg_pretend. There are many like it, but this one is mine."
+}
+END
+mkdir -p "cat/default_src_install" || exit 1
+cat << 'END' > cat/default_src_install/default_src_install-3.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+S="${WORKDIR}"
+
+src_unpack() {
+ mkdir -p ${WORKDIR}
+ cat <<'EOF' >${WORKDIR}/Makefile
+all :
+ echo spork > README
+ echo monkey > README.txt
+ touch README.foo
+ echo gerbil > GERBIL
+
+install :
+ echo spork > $(DESTDIR)/EATME
+EOF
+}
+
+pkg_preinst() {
+ [[ -e ${D}/usr/share/doc/${PF}/README ]] || die README
+ [[ -e ${D}/usr/share/doc/${PF}/README.txt ]] || die README.txt
+ [[ -e ${D}/usr/share/doc/${PF}/README.foo ]] && die README.foo
+ [[ -e ${D}/usr/share/doc/${PF}/GERBIL ]] && die GERBIL
+ [[ -e ${D}/EATME ]] || die EATME
+}
+END
+mkdir -p "cat/docompress" || exit 1
+cat << 'END' > cat/docompress/docompress-3.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+S="${WORKDIR}"
+
+src_install() {
+ docompress foo || die
+ docompress bar || die
+}
+END
+mkdir -p "cat/dodoc-r" || exit 1
+cat << 'END' > cat/dodoc-r/dodoc-r-3.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+S="${WORKDIR}"
+
+src_unpack() {
+ mkdir -p ${WORKDIR}
+ cd "${WORKDIR}"
+
+ mkdir one two three
+ echo foo > one/first
+ echo foo > two/second
+ echo foo > four
+ mkdir dot
+ mkdir dot/five
+ echo foo > dot/five/fifth
+}
+
+src_install() {
+ dodoc -r one two three four
+ cd dot
+ dodoc -r .
+}
+
+pkg_preinst() {
+ [[ -e ${D}/usr/share/doc/${PF}/one/first ]] || die one/first
+ [[ -e ${D}/usr/share/doc/${PF}/two/second ]] || die two/second
+ [[ -e ${D}/usr/share/doc/${PF}/four ]] || die four
+ [[ -e ${D}/usr/share/doc/${PF}/five/fifth ]] || die five/fifth
+}
+END
+mkdir -p "cat/doins-symlink" || exit 1
+cat << 'END' > cat/doins-symlink/doins-symlink-3.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+S="${WORKDIR}"
+
+src_unpack() {
+ mkdir -p ${WORKDIR}
+ cd "${WORKDIR}"
+
+ mkdir a
+ cd a
+ echo qwerty > qwerty
+ ln -s qwerty uiop
+ ln -s qwerty adfs
+
+ cd ..
+
+ mkdir b
+ cd b
+ echo foo > foo
+ ln -s foo bar
+
+}
+
+src_install() {
+ insinto /foo
+ doins a/qwerty
+ doins a/uiop
+ newins a/adfs asdf
+ cd b
+ doins -r .
+}
+
+pkg_preinst() {
+ [[ -f ${D}/foo/qwerty ]] || die qwerty
+ [[ -L ${D}/foo/uiop ]] || die uiop
+ [[ $(readlink ${D}/foo/uiop ) == qwerty ]] || die sym
+ [[ -L ${D}/foo/asdf ]] || die asdf
+ [[ $(readlink ${D}/foo/asdf ) == qwerty ]] || die sym
+ [[ -f ${D}/foo/foo ]] || die foo
+ [[ -L ${D}/foo/bar ]] || die bar
+ [[ $(readlink ${D}/foo/bar ) == foo ]] || die sym
+}
+END
+mkdir -p "cat/banned-functions"
+cat <<END > cat/banned-functions/banned-functions-3.ebuild || exit 1
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+S="\${WORKDIR}"
+
+src_install() {
+ touch foo
+ dohard foo bar
+}
+END
+mkdir -p "cat/econf-disable-dependency-tracking" || exit 1
+cat << 'END' > cat/econf-disable-dependency-tracking/econf-disable-dependency-tracking-0.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="0"
+
+S="${WORKDIR}"
+
+src_unpack() {
+ mkdir -p ${WORKDIR}
+ cd "${WORKDIR}"
+
+ cat <<'EOF' > configure
+#!/bin/sh
+
+if echo "$@" | grep -q 'disable-dependency-tracking' ; then
+ exit 1
+fi
+
+exit 0
+EOF
+
+ chmod +x configure
+}
+END
+cat << 'END' > cat/econf-disable-dependency-tracking/econf-disable-dependency-tracking-3.ebuild || exit 1
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+S="${WORKDIR}"
+
+src_unpack() {
+ mkdir -p ${WORKDIR}
+ cd "${WORKDIR}"
+
+ cat <<'EOF' > configure
+#!/bin/sh
+
+if ! echo "$@" | grep -q 'disable-dependency-tracking' ; then
+ exit 1
+fi
+
+exit 0
+EOF
+
+ chmod +x configure
+}
+END
+mkdir -p "cat/strict-use" || exit 1
+cat << 'END' > cat/strict-use/strict-use-3.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="3"
+
+S="${WORKDIR}"
+
+pkg_setup() {
+ use enabled || die "enabled not enabled"
+ use spork && die "sporks are bad"
+}
+END
+mkdir -p "cat/strict-use-fail" || exit 1
+cat << 'END' > cat/strict-use-fail/strict-use-fail-3.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="3"
+
+S="${WORKDIR}"
+
+pkg_setup() {
+ use pony
+}
+END
+mkdir -p "cat/strict-use-injection" || exit 1
+cat << 'END' > cat/strict-use-injection/strict-use-injection-3.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="3"
+
+S="${WORKDIR}"
+
+pkg_setup() {
+ use build && die "build set"
+ use userland_GNU || die "userland_GNU not set"
+ use cheese || die "cheese not set"
+ use otherarch && die "otherarch set"
+}
+END
+mkdir -p "cat/global-scope-use" || exit 1
+cat << 'END' > cat/global-scope-use/global-scope-use-3.ebuild || exit 1
+use spork
+
+EAPI="${PV}"
+DESCRIPTION="The Description"
+HOMEPAGE="http://example.com/"
+SRC_URI=""
+SLOT="0"
+IUSE="spork enabled"
+LICENSE="GPL-2"
+KEYWORDS="test"
+EAPI="3"
+
+S="${WORKDIR}"
+END
+cd ..
+
+cd ..
diff --git a/paludis/repositories/e/e_repository_TEST_setup.sh b/paludis/repositories/e/e_repository_TEST_setup.sh
index 600ae5f..1227fe7 100755
--- a/paludis/repositories/e/e_repository_TEST_setup.sh
+++ b/paludis/repositories/e/e_repository_TEST_setup.sh
@@ -458,986 +458,6 @@ DEPENDENCIES=""
END
cd ..
-mkdir -p repo13/{profiles/profile,metadata,eclass} || exit 1
-cd repo13 || exit 1
-echo "test-repo-13" >> profiles/repo_name || exit 1
-echo "cat" >> profiles/categories || exit 1
-cat <<END > profiles/profile/virtuals
-virtual/virtual-pretend-installed cat/pretend-installed
-virtual/virtual-doesnotexist cat/doesnotexist
-END
-cat <<END > profiles/profile/make.defaults
-ARCH="cheese"
-USERLAND="GNU"
-KERNEL="linux"
-LIBC="glibc"
-CHOST="i286-badger-linux-gnu"
-LINGUAS="enabled_en enabled_en_GB enabled_en_GB@UTF-8"
-USE_EXPAND="LINGUAS USERLAND"
-USE_EXPAND_UNPREFIXED="ARCH"
-USE_EXPAND_IMPLICIT="USERLAND ARCH"
-USE_EXPAND_VALUES_USERLAND="GNU"
-USE_EXPAND_VALUES_ARCH="cheese otherarch"
-IUSE_IMPLICIT="build"
-END
-mkdir -p "cat/in-ebuild-die"
-cat <<END > cat/in-ebuild-die/in-ebuild-die-1.ebuild || exit 1
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE=""
-LICENSE="GPL-2"
-KEYWORDS="test"
-
-pkg_setup() {
- die "boom"
-}
-END
-mkdir -p "cat/in-subshell-die"
-cat <<'END' > cat/in-subshell-die/in-subshell-die-1.ebuild || exit 1
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE=""
-LICENSE="GPL-2"
-KEYWORDS="test"
-
-pkg_setup() {
- ( hasq test $KEYWORDS && die "boom" )
-}
-END
-mkdir -p "cat/success"
-cat <<END > cat/success/success-1.ebuild || exit 1
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE="spork"
-LICENSE="GPL-2"
-KEYWORDS="test"
-
-pkg_setup() {
- useq spork && die "boom"
-}
-END
-mkdir -p "cat/unpack-die"
-cat <<END > cat/unpack-die/unpack-die-1.ebuild || exit 1
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE="spork"
-LICENSE="GPL-2"
-KEYWORDS="test"
-
-src_unpack() {
- echo "123" > f.bz2
- unpack ./f.bz2
-}
-END
-mkdir -p "cat/econf-die"
-cat <<END > cat/econf-die/econf-die-1.ebuild || exit 1
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE="spork"
-LICENSE="GPL-2"
-KEYWORDS="test"
-
-src_compile() {
- econf
-}
-END
-mkdir -p "cat/emake-fail"
-cat <<END > cat/emake-fail/emake-fail-1.ebuild || exit 1
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE="spork"
-LICENSE="GPL-2"
-KEYWORDS="test"
-
-src_compile() {
- emake monkey
-}
-END
-mkdir -p "cat/emake-die"
-cat <<END > cat/emake-die/emake-die-1.ebuild || exit 1
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE="spork"
-LICENSE="GPL-2"
-KEYWORDS="test"
-
-src_compile() {
- emake monkey || die
-}
-END
-mkdir -p "cat/einstall-die"
-cat <<END > cat/einstall-die/einstall-die-1.ebuild || exit 1
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE="spork"
-LICENSE="GPL-2"
-KEYWORDS="test"
-
-src_install() {
- einstall
-}
-END
-mkdir -p "cat/keepdir-die"
-cat <<"END" > cat/keepdir-die/keepdir-die-1.ebuild || exit 1
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE="spork"
-LICENSE="GPL-2"
-KEYWORDS="test"
-
-src_install() {
- dodir /usr/share
- touch "${D}"/usr/share/monkey
- keepdir /usr/share/monkey
-}
-END
-mkdir -p "cat/dobin-fail"
-cat <<END > cat/dobin-fail/dobin-fail-1.ebuild || exit 1
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE="spork"
-LICENSE="GPL-2"
-KEYWORDS="test"
-
-src_install() {
- dobin monkey
-}
-END
-mkdir -p "cat/dobin-die"
-cat <<END > cat/dobin-die/dobin-die-1.ebuild || exit 1
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE="spork"
-LICENSE="GPL-2"
-KEYWORDS="test"
-
-src_install() {
- dobin monkey || die
-}
-END
-mkdir -p "cat/fperms-fail"
-cat <<END > cat/fperms-fail/fperms-fail-1.ebuild || exit 1
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE="spork"
-LICENSE="GPL-2"
-KEYWORDS="test"
-
-src_install() {
- fperms 755 monkey
-}
-END
-mkdir -p "cat/fperms-die"
-cat <<END > cat/fperms-die/fperms-die-1.ebuild || exit 1
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE="spork"
-LICENSE="GPL-2"
-KEYWORDS="test"
-
-src_install() {
- fperms 755 monkey || die
-}
-END
-mkdir -p "cat/pretend-installed"
-cat <<END > cat/pretend-installed/pretend-installed-2.ebuild || exit 1
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE="spork"
-LICENSE="GPL-2"
-KEYWORDS="test"
-
-src_compile() {
- die "not supposed to install this"
-}
-END
-mkdir -p "cat/econf-source"
-cat <<END > cat/econf-source/econf-source-0.ebuild || exit 1
-EAPI="\${PV}"
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE="spork"
-LICENSE="GPL-2"
-KEYWORDS="test"
-
-src_unpack() {
- ECONF_SOURCE=subdir
- mkdir \${S}
- cd \${S}
- mkdir subdir
- echo 'touch monkey' > subdir/configure
- chmod +x subdir/configure
-}
-
-src_install() {
- insinto /usr/bin
- doins monkey || die "no monkey"
-}
-END
-cp cat/econf-source/econf-source-{0,1}.ebuild || exit 1
-cp cat/econf-source/econf-source-{0,2}.ebuild || exit 1
-mkdir -p "cat/doman"
-cat <<END > cat/doman/doman-0.ebuild || exit 1
-EAPI="\${PV}"
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE="spork"
-LICENSE="GPL-2"
-KEYWORDS="test"
-
-src_compile() {
- echo \${PF} >foo.1
- mkdir dir
- echo \${PF} >dir/foo.2
- echo \${PF} >foo.2
- echo \${PF} >foo.3x
- echo \${PF} >foo.4.gz
- echo \${PF} >foo.5f.bz2
- echo \${PF} >foo.6.Z
- echo \${PF} >foo.en.7
- echo \${PF} >foo.en_GB.8
- echo \${PF} >foo.e.9
- echo \${PF} >foo.enn.n
- echo \${PF} >foo.EN.1
- echo \${PF} >foo.en-GB.2
- echo \${PF} >foo.en_gb.3
- echo \${PF} >foo.en_G.4
- echo \${PF} >foo.en_GBB.5
- echo \${PF} >foo.nonkey
- touch foo.1x
- echo \${PF} >bar.m
- echo \${PF} >bar.monkey
- echo \${PF} >baz.6
- echo \${PF} >baz.en_US.7
-}
-
-src_install() {
- doman foo.* dir/foo.* || die
- doman bar.m && die
- doman bar.monkey && die
- doman bar.1 && die
- doman -i18n=en_GB baz.* || die
- keepdir /meh || die
- cd "\${D}"/meh || die
- doman .keep* || die
- rm "\${D}"/usr/share/man/{man1/foo.1,man2/foo.2,man3/foo.3x,man4/foo.4.gz,man5/foo.5f.bz2} || die
- rm "\${D}"/usr/share/man/{man6/foo.6.Z,man7/foo.en.7,man8/foo.en_GB.8,man9/foo.e.9,mann/foo.enn.n} || die
- rm "\${D}"/usr/share/man/{man1/foo.EN.1,man2/foo.en-GB.2,man3/foo.en_gb.3,man4/foo.en_G.4} || die
- rm "\${D}"/usr/share/man/{man5/foo.en_GBB.5,mann/foo.nonkey,en_GB/man6/baz.6,en_GB/man7/baz.en_US.7} || die
- rmdir "\${D}"/usr/share/man/{man1,man2,man3,man4,man5,man6,man7,man8,man9,mann,en_GB/man6,en_GB/man7,en_GB,} || die
-}
-END
-cp cat/doman/doman-{0,1}.ebuild || exit 1
-cat <<END > cat/doman/doman-2.ebuild || exit 1
-EAPI="\${PV}"
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE="spork"
-LICENSE="GPL-2"
-KEYWORDS="test"
-
-src_compile() {
- echo \${PF} >foo.1
- mkdir dir
- echo \${PF} >dir/foo.2
- echo \${PF} >foo.3x
- echo \${PF} >foo.4.gz
- echo \${PF} >foo.5f.bz2
- echo \${PF} >foo.6.Z
- echo \${PF} >foo.en.7
- echo \${PF} >foo.en_GB.8
- echo \${PF} >foo.e.9
- echo \${PF} >foo.enn.n
- echo \${PF} >foo.EN.1
- echo \${PF} >foo.en-GB.2
- echo \${PF} >foo.en_gb.3
- echo \${PF} >foo.en_G.4
- echo \${PF} >foo.en_GBB.5
- echo \${PF} >foo.nonkey
- touch foo.1x
- echo \${PF} >bar.m
- echo \${PF} >bar.monkey
- echo \${PF} >baz.6
- echo \${PF} >baz.en_US.7
-}
-
-src_install() {
- doman foo.* dir/foo.* || die
- doman bar.m && die
- doman bar.monkey && die
- doman bar.1 && die
- doman -i18n=en_GB baz.* || die
- keepdir /meh || die
- cd "\${D}"/meh || die
- doman .keep* || die
- rm "\${D}"/usr/share/man/{man1/foo.1,man2/foo.2,man3/foo.3x,man4/foo.4.gz,man5/foo.5f.bz2} || die
- rm "\${D}"/usr/share/man/{man6/foo.6.Z,en/man7/foo.7,en_GB/man8/foo.8,man9/foo.e.9,mann/foo.enn.n} || die
- rm "\${D}"/usr/share/man/{man1/foo.EN.1,man2/foo.en-GB.2,man3/foo.en_gb.3,man4/foo.en_G.4} || die
- rm "\${D}"/usr/share/man/{man5/foo.en_GBB.5,mann/foo.nonkey,en_GB/man6/baz.6,en_US/man7/baz.7} || die
- rmdir "\${D}"/usr/share/man/{man1,man2,man3,man4,man5,man6,man9,mann,en/man7,en_GB/man6,en_GB/man8,en_US/man7,en,en_GB,en_US,} || die
-}
-END
-mkdir -p "cat/dosym-success"
-cat <<'END' > cat/dosym-success/dosym-success-1.ebuild || exit 1
-EAPI="${PV}"
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE="spork"
-LICENSE="GPL-2"
-KEYWORDS="test"
-
-src_install() {
- dosym foo /usr/bin/bar
- [[ "$(readlink ${D}/usr/bin/bar )" == "foo" ]] || die
-}
-END
-mkdir -p "cat/best-version"
-cat <<'END' > cat/best-version/best-version-0.ebuild || exit 1
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE="spork"
-LICENSE="GPL-2"
-KEYWORDS="test"
-
-pkg_setup() {
- if ! best_version cat/pretend-installed >/dev/null ; then
- die "failed cat/pretend-installed"
- fi
-
- BV1=$(best_version cat/pretend-installed )
- [[ "$BV1" == "cat/pretend-installed-1" ]] || die "BV1 is $BV1"
-
- if best_version cat/doesnotexist >/dev/null ; then
- die "not failed cat/doesnotexist"
- fi
-
- BV2=$(best_version cat/doesnotexist )
- [[ "$BV2" == "" ]] || die "BV2 is $BV2"
-
- if [[ -n "$PALUDIS_ENABLE_VIRTUALS_REPOSITORY" ]] ; then
- if ! best_version virtual/virtual-pretend-installed >/dev/null ; then
- die "failed virtual/virtual-pretend-installed"
- fi
-
- BV3=$(best_version virtual/virtual-pretend-installed )
- [[ "$BV3" == "cat/pretend-installed-1" ]] || die "BV3 is $BV3"
-
- if best_version virtual/virtual-doesnotexist >/dev/null ; then
- die "not failed virtual/virtual-doesnotexist"
- fi
-
- BV2=$(best_version virtual/virtual-doesnotexist )
- [[ "$BV4" == "" ]] || die "BV4 is $BV4"
- fi
-}
-END
-mkdir -p "cat/has-version"
-cat <<'END' > cat/has-version/has-version-0.ebuild || exit 1
-EAPI="${PV}"
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE="spork"
-LICENSE="GPL-2"
-KEYWORDS="test"
-
-pkg_setup() {
- if ! has_version cat/pretend-installed ; then
- die "failed cat/pretend-installed"
- fi
-
- if has_version cat/doesnotexist >/dev/null ; then
- die "not failed cat/doesnotexist"
- fi
-}
-END
-mkdir -p "cat/match"
-cat <<'END' > cat/match/match-0.ebuild || exit 1
-EAPI="${PV}"
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE="spork"
-LICENSE="GPL-2"
-KEYWORDS="test"
-
-pkg_setup() {
- if ! portageq match "${ROOT}" cat/pretend-installed >/dev/null ; then
- die "failed cat/pretend-installed"
- fi
-
- cat <<'DONE' > ${T}/expected
-cat/pretend-installed-0
-cat/pretend-installed-1
-DONE
- portageq match "${ROOT}" cat/pretend-installed > ${T}/got
- cmp ${T}/expected ${T}/got || die "oops"
-
- if portageq match "${ROOT}" cat/doesnotexist >/dev/null ; then
- die "not failed cat/doesnotexist"
- fi
-
- BV2=$(portageq match "${ROOT}" cat/doesnotexist )
- [[ "$BV2" == "" ]] || die "BV2 is $BV2"
-}
-END
-mkdir -p "cat/vars"
-cat <<'END' > cat/vars/vars-0.ebuild || exit 1
-EAPI="${PV}"
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE="spork"
-LICENSE="GPL-2"
-KEYWORDS="test"
-
-pkg_setup() {
- [[ -d "${T}" ]] || die "T not a dir"
-}
-
-src_compile() {
- [[ -d "${T}" ]] || die "T not a dir"
-}
-
-pkg_preinst() {
- [[ -d "${T}" ]] || die "T not a dir"
-}
-END
-mkdir -p "cat/src_prepare"
-cat <<END > cat/src_prepare/src_prepare-0.ebuild || exit 1
-EAPI="\${PV}"
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE="spork"
-LICENSE="GPL-2"
-KEYWORDS="test"
-
-src_prepare() {
- die src_prepare
-}
-END
-cp cat/src_prepare/src_prepare-{0,1}.ebuild || exit 1
-cp cat/src_prepare/src_prepare-{0,2}.ebuild || exit 1
-mkdir -p "cat/src_configure"
-cat <<END > cat/src_configure/src_configure-0.ebuild || exit 1
-EAPI="\${PV}"
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE="spork"
-LICENSE="GPL-2"
-KEYWORDS="test"
-
-src_configure() {
- die src_configure
-}
-END
-cp cat/src_configure/src_configure-{0,1}.ebuild || exit 1
-cp cat/src_configure/src_configure-{0,2}.ebuild || exit 1
-mkdir -p "cat/default-src_configure" || exit 1
-cat << END > cat/default-src_configure/default-src_configure-2.ebuild || exit 1
-EAPI="\${PV}"
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE="spork"
-LICENSE="GPL-2"
-KEYWORDS="test"
-
-src_unpack() {
- cat <<EOF >configure
-#! /bin/sh
-touch foo
-EOF
- chmod +x configure
- echo 'all: ; rm foo' >Makefile
-}
-
-src_compile() {
- [[ -e foo ]] || die
-}
-END
-mkdir -p "cat/default-src_compile" || exit 1
-cat << END > cat/default-src_compile/default-src_compile-2.ebuild || exit 1
-EAPI="\${PV}"
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE="spork"
-LICENSE="GPL-2"
-KEYWORDS="test"
-
-src_unpack() {
- cat <<EOF >configure
-#! /bin/sh
-rm Makefile
-EOF
- chmod +x configure
- echo 'all: ; touch foo' >Makefile
-}
-
-src_configure() {
- :
-}
-
-src_install() {
- [[ -e foo ]] || die
-}
-END
-mkdir -p "cat/default_src_compile" || exit 1
-cat << END > cat/default_src_compile/default_src_compile-2.ebuild || exit 1
-EAPI="\${PV}"
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE="spork"
-LICENSE="GPL-2"
-KEYWORDS="test"
-
-src_unpack() {
- cat <<EOF >configure
-#! /bin/sh
-rm Makefile
-EOF
- chmod +x configure
- echo 'all: ; touch foo' >Makefile
-}
-
-src_configure() {
- :
-}
-
-src_compile() {
- default_src_compile
- [[ -e foo ]] || die
-}
-END
-mkdir -p "cat/src_compile-via-default-func" || exit 1
-cat << END > cat/src_compile-via-default-func/src_compile-via-default-func-2.ebuild || exit 1
-EAPI="\${PV}"
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE="spork"
-LICENSE="GPL-2"
-KEYWORDS="test"
-
-src_unpack() {
- cat <<EOF >configure
-#! /bin/sh
-rm Makefile
-EOF
- chmod +x configure
- echo 'all: ; touch foo' >Makefile
-}
-
-src_configure() {
- :
-}
-
-src_compile() {
- default
- [[ -e foo ]] || die
-}
-END
-mkdir -p "cat/expand-vars"
-cat <<"END" > cat/expand-vars/expand-vars-0.ebuild || exit 1
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE="enabled-weasel broccoli"
-LICENSE="GPL-2"
-KEYWORDS="test"
-
-pkg_setup() {
- [[ $USE == "enabled-weasel linguas_enabled_en linguas_enabled_en_GB linguas_enabled_en_GB@UTF-8 userland_GNU cheese " ]] \
- || die "USE=$USE is wrong"
- [[ $USERLAND == "GNU" ]] || die "USERLAND=$USERLAND is wrong"
- [[ $LINGUAS == "enabled_en enabled_en_GB enabled_en_GB@UTF-8" ]] || die "LINGUAS=$LINGUAS is wrong"
-}
-END
-mkdir -p "cat/pkg_pretend"
-cat <<"END" > cat/pkg_pretend/pkg_pretend-3.ebuild || exit 1
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE="enabled-weasel broccoli"
-LICENSE="GPL-2"
-KEYWORDS="test"
-EAPI="3"
-
-pkg_pretend() {
- einfo "This is my pkg_pretend. There are many like it, but this one is mine."
-}
-END
-mkdir -p "cat/pkg_pretend-failure"
-cat <<"END" > cat/pkg_pretend-failure/pkg_pretend-failure-3.ebuild || exit 1
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE="enabled-weasel broccoli"
-LICENSE="GPL-2"
-KEYWORDS="test"
-EAPI="3"
-
-pkg_pretend() {
- die "This is my pkg_pretend. There are many like it, but this one is mine."
-}
-END
-mkdir -p "cat/default_src_install" || exit 1
-cat << 'END' > cat/default_src_install/default_src_install-3.ebuild || exit 1
-EAPI="${PV}"
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE="spork"
-LICENSE="GPL-2"
-KEYWORDS="test"
-EAPI="3"
-
-S="${WORKDIR}"
-
-src_unpack() {
- mkdir -p ${WORKDIR}
- cat <<'EOF' >${WORKDIR}/Makefile
-all :
- echo spork > README
- echo monkey > README.txt
- touch README.foo
- echo gerbil > GERBIL
-
-install :
- echo spork > $(DESTDIR)/EATME
-EOF
-}
-
-pkg_preinst() {
- [[ -e ${D}/usr/share/doc/${PF}/README ]] || die README
- [[ -e ${D}/usr/share/doc/${PF}/README.txt ]] || die README.txt
- [[ -e ${D}/usr/share/doc/${PF}/README.foo ]] && die README.foo
- [[ -e ${D}/usr/share/doc/${PF}/GERBIL ]] && die GERBIL
- [[ -e ${D}/EATME ]] || die EATME
-}
-END
-mkdir -p "cat/docompress" || exit 1
-cat << 'END' > cat/docompress/docompress-3.ebuild || exit 1
-EAPI="${PV}"
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE="spork"
-LICENSE="GPL-2"
-KEYWORDS="test"
-EAPI="3"
-
-S="${WORKDIR}"
-
-src_install() {
- docompress foo || die
- docompress bar || die
-}
-END
-mkdir -p "cat/dodoc-r" || exit 1
-cat << 'END' > cat/dodoc-r/dodoc-r-3.ebuild || exit 1
-EAPI="${PV}"
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE="spork"
-LICENSE="GPL-2"
-KEYWORDS="test"
-EAPI="3"
-
-S="${WORKDIR}"
-
-src_unpack() {
- mkdir -p ${WORKDIR}
- cd "${WORKDIR}"
-
- mkdir one two three
- echo foo > one/first
- echo foo > two/second
- echo foo > four
- mkdir dot
- mkdir dot/five
- echo foo > dot/five/fifth
-}
-
-src_install() {
- dodoc -r one two three four
- cd dot
- dodoc -r .
-}
-
-pkg_preinst() {
- [[ -e ${D}/usr/share/doc/${PF}/one/first ]] || die one/first
- [[ -e ${D}/usr/share/doc/${PF}/two/second ]] || die two/second
- [[ -e ${D}/usr/share/doc/${PF}/four ]] || die four
- [[ -e ${D}/usr/share/doc/${PF}/five/fifth ]] || die five/fifth
-}
-END
-mkdir -p "cat/doins-symlink" || exit 1
-cat << 'END' > cat/doins-symlink/doins-symlink-3.ebuild || exit 1
-EAPI="${PV}"
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE="spork"
-LICENSE="GPL-2"
-KEYWORDS="test"
-EAPI="3"
-
-S="${WORKDIR}"
-
-src_unpack() {
- mkdir -p ${WORKDIR}
- cd "${WORKDIR}"
-
- mkdir a
- cd a
- echo qwerty > qwerty
- ln -s qwerty uiop
- ln -s qwerty adfs
-
- cd ..
-
- mkdir b
- cd b
- echo foo > foo
- ln -s foo bar
-
-}
-
-src_install() {
- insinto /foo
- doins a/qwerty
- doins a/uiop
- newins a/adfs asdf
- cd b
- doins -r .
-}
-
-pkg_preinst() {
- [[ -f ${D}/foo/qwerty ]] || die qwerty
- [[ -L ${D}/foo/uiop ]] || die uiop
- [[ $(readlink ${D}/foo/uiop ) == qwerty ]] || die sym
- [[ -L ${D}/foo/asdf ]] || die asdf
- [[ $(readlink ${D}/foo/asdf ) == qwerty ]] || die sym
- [[ -f ${D}/foo/foo ]] || die foo
- [[ -L ${D}/foo/bar ]] || die bar
- [[ $(readlink ${D}/foo/bar ) == foo ]] || die sym
-}
-END
-mkdir -p "cat/banned-functions"
-cat <<END > cat/banned-functions/banned-functions-3.ebuild || exit 1
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE="spork"
-LICENSE="GPL-2"
-KEYWORDS="test"
-EAPI="3"
-
-S="\${WORKDIR}"
-
-src_install() {
- touch foo
- dohard foo bar
-}
-END
-mkdir -p "cat/econf-disable-dependency-tracking" || exit 1
-cat << 'END' > cat/econf-disable-dependency-tracking/econf-disable-dependency-tracking-0.ebuild || exit 1
-EAPI="${PV}"
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE="spork"
-LICENSE="GPL-2"
-KEYWORDS="test"
-EAPI="0"
-
-S="${WORKDIR}"
-
-src_unpack() {
- mkdir -p ${WORKDIR}
- cd "${WORKDIR}"
-
- cat <<'EOF' > configure
-#!/bin/sh
-
-if echo "$@" | grep -q 'disable-dependency-tracking' ; then
- exit 1
-fi
-
-exit 0
-EOF
-
- chmod +x configure
-}
-END
-cat << 'END' > cat/econf-disable-dependency-tracking/econf-disable-dependency-tracking-3.ebuild || exit 1
-EAPI="${PV}"
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE="spork"
-LICENSE="GPL-2"
-KEYWORDS="test"
-EAPI="3"
-
-S="${WORKDIR}"
-
-src_unpack() {
- mkdir -p ${WORKDIR}
- cd "${WORKDIR}"
-
- cat <<'EOF' > configure
-#!/bin/sh
-
-if ! echo "$@" | grep -q 'disable-dependency-tracking' ; then
- exit 1
-fi
-
-exit 0
-EOF
-
- chmod +x configure
-}
-END
-mkdir -p "cat/strict-use" || exit 1
-cat << 'END' > cat/strict-use/strict-use-3.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="3"
-
-S="${WORKDIR}"
-
-pkg_setup() {
- use enabled || die "enabled not enabled"
- use spork && die "sporks are bad"
-}
-END
-mkdir -p "cat/strict-use-fail" || exit 1
-cat << 'END' > cat/strict-use-fail/strict-use-fail-3.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="3"
-
-S="${WORKDIR}"
-
-pkg_setup() {
- use pony
-}
-END
-mkdir -p "cat/strict-use-injection" || exit 1
-cat << 'END' > cat/strict-use-injection/strict-use-injection-3.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="3"
-
-S="${WORKDIR}"
-
-pkg_setup() {
- use build && die "build set"
- use userland_GNU || die "userland_GNU not set"
- use cheese || die "cheese not set"
- use otherarch && die "otherarch set"
-}
-END
-mkdir -p "cat/global-scope-use" || exit 1
-cat << 'END' > cat/global-scope-use/global-scope-use-3.ebuild || exit 1
-use spork
-
-EAPI="${PV}"
-DESCRIPTION="The Description"
-HOMEPAGE="http://example.com/"
-SRC_URI=""
-SLOT="0"
-IUSE="spork enabled"
-LICENSE="GPL-2"
-KEYWORDS="test"
-EAPI="3"
-
-S="${WORKDIR}"
-END
-cd ..
-
mkdir -p repo15/{eclass,distfiles,profiles/profile/subprofile} || exit 1
cd repo15 || exit 1
echo "test-repo-15" >> profiles/repo_name || exit 1