aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-05-12 08:25:52 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-05-12 03:02:28 +0100
commitbb6fdcdda9d450e056daff26df127e4081669090 (patch)
tree6dd1560c909ee276dc48b9906fcf6577ccfc9a4e
parentc2d9c202a7ea9f85875024bde38da7d8d034aef7 (diff)
downloadpaludis-bb6fdcdda9d450e056daff26df127e4081669090.tar.gz
paludis-bb6fdcdda9d450e056daff26df127e4081669090.tar.xz
EAPI 3 has REPLACING vars
-rw-r--r--paludis/repositories/e/e_repository_TEST_replacing.cc46
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_replacing_setup.sh51
-rw-r--r--paludis/repositories/e/eapi.cc2
-rw-r--r--paludis/repositories/e/eapi.hh4
-rw-r--r--paludis/repositories/e/eapis/3.conf2
-rw-r--r--paludis/repositories/e/ebuild.cc22
6 files changed, 111 insertions, 16 deletions
diff --git a/paludis/repositories/e/e_repository_TEST_replacing.cc b/paludis/repositories/e/e_repository_TEST_replacing.cc
index 4755321..b20360b 100644
--- a/paludis/repositories/e/e_repository_TEST_replacing.cc
+++ b/paludis/repositories/e/e_repository_TEST_replacing.cc
@@ -83,13 +83,20 @@ namespace
struct ReplacingTest : TestCase
{
+ const std::string eapi;
+ const std::string repo_path;
const std::string test;
const std::string replacing;
+ const std::string replacing_pkg_name;
- ReplacingTest(const std::string & s, const std::string & r) :
- TestCase(s),
+ ReplacingTest(const std::string & e, const std::string & p, const std::string & s, const std::string & r,
+ const std::string & n) :
+ TestCase(e + " " + s),
+ eapi(e),
+ repo_path(p),
test(s),
- replacing(r)
+ replacing(r),
+ replacing_pkg_name(n)
{
}
@@ -110,12 +117,13 @@ namespace
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_replacing_dir" / "repo1"));
- keys->insert("profiles", stringify(FSEntry::cwd() / "e_repository_TEST_replacing_dir" / "repo1/profiles/profile"));
+ keys->insert("location", stringify(FSEntry::cwd() / "e_repository_TEST_replacing_dir" / repo_path));
+ keys->insert("profiles", stringify(FSEntry::cwd() / "e_repository_TEST_replacing_dir" / repo_path
+ / "profiles/profile"));
keys->insert("layout", "exheres");
- keys->insert("eapi_when_unknown", "exheres-0");
- keys->insert("eapi_when_unspecified", "exheres-0");
- keys->insert("profile_eapi", "exheres-0");
+ keys->insert("eapi_when_unknown", eapi);
+ keys->insert("eapi_when_unspecified", eapi);
+ keys->insert("profile_eapi", eapi);
keys->insert("distdir", stringify(FSEntry::cwd() / "e_repository_TEST_replacing_dir" / "distdir"));
keys->insert("builddir", stringify(FSEntry::cwd() / "e_repository_TEST_replacing_dir" / "build"));
std::tr1::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
@@ -123,14 +131,15 @@ namespace
env.package_database()->add_repository(1, repo);
std::tr1::shared_ptr<FakeInstalledRepository> installed_repo(new FakeInstalledRepository(&env, RepositoryName("installed")));
- installed_repo->add_version("cat", "pkg", "1")->set_slot(SlotName("1"));
- installed_repo->add_version("cat", "pkg", "2")->set_slot(SlotName("2"));
- installed_repo->add_version("cat", "pkg", "3")->set_slot(SlotName("3"));
+ installed_repo->add_version("cat", replacing_pkg_name, "1")->set_slot(SlotName("1"));
+ installed_repo->add_version("cat", replacing_pkg_name, "2")->set_slot(SlotName("2"));
+ installed_repo->add_version("cat", replacing_pkg_name, "3")->set_slot(SlotName("3"));
env.package_database()->add_repository(2, installed_repo);
const std::tr1::shared_ptr<const PackageIDSequence> rlist(env[selection::AllVersionsSorted(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec(replacing, &env, UserPackageDepSpecOptions())),
- MatchPackageOptions()))]);
+ MatchPackageOptions()) |
+ filter::SupportsAction<InstalledAction>())]);
InstallAction action(make_named_values<InstallActionOptions>(
value_for<n::destination>(installed_repo),
@@ -142,7 +151,8 @@ namespace
const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
PackageDepSpec(parse_user_package_dep_spec("cat/" + test,
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
+ &env, UserPackageDepSpecOptions())), MatchPackageOptions()) |
+ filter::SupportsAction<InstallAction>())]->last());
TEST_CHECK(id);
id->perform_action(action);
}
@@ -151,8 +161,12 @@ namespace
namespace test_cases
{
- ReplacingTest test_replace_none("replace-none", "cat/none");
- ReplacingTest test_replace_one("replace-one", "=cat/pkg-1");
- ReplacingTest test_replace_many("replace-many", "cat/pkg");
+ ReplacingTest test_exheres_0_replace_none("exheres-0", "repo1", "replace-none", "cat/none", "pkg");
+ ReplacingTest test_exheres_0_replace_one("exheres-0", "repo1", "replace-one", "=cat/pkg-1", "pkg");
+ ReplacingTest test_exheres_0_replace_many("exheres-0", "repo1", "replace-many", "cat/pkg", "pkg");
+
+ ReplacingTest test_3_replace_none("0", "repo2", "replace-none", "cat/none", "replace-none");
+ ReplacingTest test_3_replace_one("0", "repo2", "replace-one", "=cat/replace-one-1", "replace-one");
+ ReplacingTest test_3_replace_many("0", "repo2", "replace-many", "cat/replace-many", "replace-many");
}
diff --git a/paludis/repositories/e/e_repository_TEST_replacing_setup.sh b/paludis/repositories/e/e_repository_TEST_replacing_setup.sh
index 2bd7f3e..f03b411 100755
--- a/paludis/repositories/e/e_repository_TEST_replacing_setup.sh
+++ b/paludis/repositories/e/e_repository_TEST_replacing_setup.sh
@@ -27,6 +27,7 @@ cat <<'END' > packages/cat/replace-none/replace-none-1.exheres-0 || exit 1
WORK="${WORKBASE}"
PLATFORMS="test"
FOO=true
+SLOT="0"
pkg_setup() {
[[ -z "${REPLACING_IDS}" ]] || die "REPLACING_IDS is ${REPLACING_IDS}"
@@ -37,6 +38,7 @@ cat <<'END' > packages/cat/replace-one/replace-one-1.exheres-0 || exit 1
WORK="${WORKBASE}"
PLATFORMS="test"
FOO=true
+SLOT="0"
pkg_setup() {
[[ "${REPLACING_IDS}" == "cat/pkg-1:1::installed" ]] || die "REPLACING_IDS is ${REPLACING_IDS}"
@@ -47,6 +49,7 @@ cat <<'END' > packages/cat/replace-many/replace-many-1.exheres-0 || exit 1
WORK="${WORKBASE}"
PLATFORMS="test"
FOO=true
+SLOT="0"
pkg_setup() {
[[ "${REPLACING_IDS}" == \
@@ -55,5 +58,53 @@ pkg_setup() {
}
END
cd ..
+
+mkdir -p repo2/{profiles/profile,metadata,eclass} || exit 1
+cd repo2 || exit 1
+echo "test-repo-1" >> profiles/repo_name || exit 1
+echo "cat" >> metadata/categories.conf || exit 1
+cat <<END > profiles/profile/make.defaults
+CHOST="i286-badger-linux-gnu"
+SUBOPTIONS="LINGUAS"
+LINGUAS="en en_GB en_GB@UTF-8"
+USERLAND="GNU"
+OPTIONS="weasel spinach"
+ARCH="dead-badger"
+KERNEL="linux"
+END
+mkdir -p "packages/cat/replace-none"
+cat <<'END' > packages/cat/replace-none/replace-none-1.ebuild || exit 1
+S="${WORKDIR}"
+KEYWORDS="test"
+SLOT="0"
+EAPI="3"
+
+pkg_setup() {
+ [[ -z "${REPLACING_VERSIONS}" ]] || die "REPLACING_VERSIONS is ${REPLACING_VERSIONS}"
+}
+END
+mkdir -p "packages/cat/replace-one"
+cat <<'END' > packages/cat/replace-one/replace-one-1.ebuild || exit 1
+S="${WORKDIR}"
+KEYWORDS="test"
+SLOT="0"
+EAPI="3"
+
+pkg_setup() {
+ [[ "${REPLACING_VERSIONS}" == "1" ]] || die "REPLACING_VERSIONS is ${REPLACING_VERSIONS}"
+}
+END
+mkdir -p "packages/cat/replace-many"
+cat <<'END' > packages/cat/replace-many/replace-many-1.ebuild || exit 1
+S="${WORKDIR}"
+KEYWORDS="test"
+SLOT="0"
+EAPI="3"
+
+pkg_setup() {
+ [[ "${REPLACING_VERSIONS}" == "1 2 3" ]] || die "REPLACING_VERSIONS is ${REPLACING_VERSIONS}"
+}
+END
+cd ..
cd ..
diff --git a/paludis/repositories/e/eapi.cc b/paludis/repositories/e/eapi.cc
index f09c7b6..8a78e8a 100644
--- a/paludis/repositories/e/eapi.cc
+++ b/paludis/repositories/e/eapi.cc
@@ -86,7 +86,9 @@ namespace
value_for<n::env_pf>(check_get(k, "env_pf")),
value_for<n::env_portdir>(check_get(k, "env_portdir")),
value_for<n::env_replaced_by_id>(check_get(k, "env_replaced_by_id")),
+ value_for<n::env_replaced_by_version>(check_get(k, "env_replaced_by_version")),
value_for<n::env_replacing_ids>(check_get(k, "env_replacing_ids")),
+ value_for<n::env_replacing_versions>(check_get(k, "env_replacing_versions")),
value_for<n::env_t>(check_get(k, "env_t")),
value_for<n::env_use>(check_get(k, "env_use")),
value_for<n::env_use_expand>(check_get(k, "env_use_expand")),
diff --git a/paludis/repositories/e/eapi.hh b/paludis/repositories/e/eapi.hh
index 715f345..d26e979 100644
--- a/paludis/repositories/e/eapi.hh
+++ b/paludis/repositories/e/eapi.hh
@@ -91,7 +91,9 @@ namespace paludis
struct env_pf;
struct env_portdir;
struct env_replaced_by_id;
+ struct env_replaced_by_version;
struct env_replacing_ids;
+ struct env_replacing_versions;
struct env_t;
struct env_use;
struct env_use_expand;
@@ -286,7 +288,9 @@ namespace paludis
NamedValue<n::env_pf, std::string> env_pf;
NamedValue<n::env_portdir, std::string> env_portdir;
NamedValue<n::env_replaced_by_id, std::string> env_replaced_by_id;
+ NamedValue<n::env_replaced_by_version, std::string> env_replaced_by_version;
NamedValue<n::env_replacing_ids, std::string> env_replacing_ids;
+ NamedValue<n::env_replacing_versions, std::string> env_replacing_versions;
NamedValue<n::env_t, std::string> env_t;
NamedValue<n::env_use, std::string> env_use;
NamedValue<n::env_use_expand, std::string> env_use_expand;
diff --git a/paludis/repositories/e/eapis/3.conf b/paludis/repositories/e/eapis/3.conf
index c8dacff..21276ff 100644
--- a/paludis/repositories/e/eapis/3.conf
+++ b/paludis/repositories/e/eapis/3.conf
@@ -30,6 +30,8 @@ ebuild_info = \
env_aa =
env_kv =
+env_replacing_versions = REPLACING_VERSIONS
+env_replaced_by_version = REPLACED_BY_VERSION
package_dep_spec_parse_options = ${package_dep_spec_parse_options} \
allow_slot_equal_deps allow_slot_star_deps allow_use_dep_defaults
diff --git a/paludis/repositories/e/ebuild.cc b/paludis/repositories/e/ebuild.cc
index 8e2050e..64103e7 100644
--- a/paludis/repositories/e/ebuild.cc
+++ b/paludis/repositories/e/ebuild.cc
@@ -765,11 +765,28 @@ EbuildInstallCommand::extend_command(const Command & cmd)
if (! params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_use_expand_hidden().empty())
result.with_setenv(params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_use_expand_hidden(),
install_params.use_expand_hidden());
+
if (! params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_replacing_ids().empty())
result.with_setenv(params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_replacing_ids(),
join(indirect_iterator(install_params.replacing_ids()->begin()),
indirect_iterator(install_params.replacing_ids()->end()), " "));
+ if (! params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_replacing_versions().empty())
+ {
+ std::string s;
+ for (PackageIDSequence::ConstIterator i(install_params.replacing_ids()->begin()),
+ i_end(install_params.replacing_ids()->end()) ;
+ i != i_end ; ++i)
+ if ((*i)->name() == params.package_id()->name())
+ {
+ if (! s.empty())
+ s.append(" ");
+ s.append(stringify((*i)->version()));
+ }
+
+ result.with_setenv(params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_replacing_versions(), s);
+ }
+
for (Map<std::string, std::string>::ConstIterator
i(install_params.expand_vars()->begin()),
j(install_params.expand_vars()->end()) ; i != j ; ++i)
@@ -821,6 +838,11 @@ EbuildUninstallCommand::extend_command(const Command & cmd)
result.with_setenv(params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_replaced_by_id(),
stringify(*uninstall_params.replaced_by()));
+ if (! params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_replaced_by_version().empty())
+ if (uninstall_params.replaced_by())
+ result.with_setenv(params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_replaced_by_version(),
+ stringify(uninstall_params.replaced_by()->version()));
+
return result;
}