aboutsummaryrefslogtreecommitdiff
path: root/paludis/repositories/e/exndbam_repository_TEST.cc
diff options
context:
space:
mode:
authorAvatar Saleem Abdulrasool <compnerd@compnerd.org> 2013-05-24 22:12:45 -0700
committerAvatar Saleem Abdulrasool <compnerd@compnerd.org> 2013-05-27 10:20:08 -0700
commitd34636a1dc4f422aeb868e49447a0503c303f0a2 (patch)
tree744eaca3276801c0b22429a46ace39372c74fba0 /paludis/repositories/e/exndbam_repository_TEST.cc
parent450c0331aca4600729216b9bff5d3e1b4e203871 (diff)
downloadpaludis-d34636a1dc4f422aeb868e49447a0503c303f0a2.tar.gz
paludis-d34636a1dc4f422aeb868e49447a0503c303f0a2.tar.xz
e repository: perform additional expart validation
When contents are partitioned, ensure that the partition name supplied has been declared previously. This will help identify packages which do not correctly indicate valid partition names. Signed-off-by: Saleem Abdulrasool <compnerd@compnerd.org>
Diffstat (limited to 'paludis/repositories/e/exndbam_repository_TEST.cc')
-rw-r--r--paludis/repositories/e/exndbam_repository_TEST.cc51
1 files changed, 50 insertions, 1 deletions
diff --git a/paludis/repositories/e/exndbam_repository_TEST.cc b/paludis/repositories/e/exndbam_repository_TEST.cc
index 0809628d8..518978734 100644
--- a/paludis/repositories/e/exndbam_repository_TEST.cc
+++ b/paludis/repositories/e/exndbam_repository_TEST.cc
@@ -44,6 +44,8 @@ namespace
{
const auto exndbam_repository_TEST_dir =
FSPath::cwd() / "exndbam_repository_TEST_dir";
+ const auto exndbam_repository_TEST_root =
+ exndbam_repository_TEST_dir / "root";
void do_uninstall(const std::shared_ptr<const PackageID> & id, const UninstallActionOptions & u)
{
@@ -111,6 +113,31 @@ namespace
std::bind(from_keys,
keys, _1));
}
+
+ std::shared_ptr<Repository>
+ make_exheres_0_repository(Environment & env, const FSPath & root,
+ const std::string & name)
+ {
+ using namespace std::placeholders;
+
+ auto keys = std::make_shared<Map<std::string, std::string>>();
+
+ keys->insert("eapi_when_unknown", "exheres-0");
+ keys->insert("eapi_when_unspecified", "exheres-0");
+ keys->insert("format", "e");
+ keys->insert("layout", "exheres");
+ keys->insert("location", stringify(root / name));
+ keys->insert("names_cache", "/var/empty");
+ keys->insert("profile_eapi", "exheres-0");
+ keys->insert("profiles", stringify(root / name / "profiles" / "profile"));
+ keys->insert("root", stringify(root / "root"));
+
+ keys->insert("builddir", stringify(root / "build"));
+ keys->insert("distdir", stringify(root / "distdir"));
+
+ return ERepository::repository_factory_create(&env, std::bind(from_keys,
+ keys, _1));
+ }
}
TEST(ExndbamRepository, RepoName)
@@ -122,7 +149,7 @@ TEST(ExndbamRepository, RepoName)
TEST(ExndbamRepository, PhaseOrdering)
{
- TestEnvironment env(exndbam_repository_TEST_dir / "root");
+ TestEnvironment env(exndbam_repository_TEST_root);
std::shared_ptr<Map<std::string, std::string> > keys(std::make_shared<Map<std::string, std::string>>());
keys->insert("format", "e");
keys->insert("names_cache", "/var/empty");
@@ -213,3 +240,25 @@ TEST(ExndbamRepository, PhaseOrdering)
}
}
+TEST(ExndbamRepository, UnlistedPartsFails)
+{
+ const auto partitioned(QualifiedPackageName("category/partitioned"));
+
+ TestEnvironment env(exndbam_repository_TEST_root);
+
+ auto parts(make_exheres_0_repository(env, exndbam_repository_TEST_dir,
+ "parts"));
+ auto installed(make_exndbam_repository(env, exndbam_repository_TEST_dir,
+ "installed"));
+ env.add_repository(0, installed);
+ env.add_repository(1, parts);
+
+ EXPECT_TRUE(installed->package_ids(partitioned, { })->empty());
+ EXPECT_TRUE(!parts->package_ids(partitioned, { })->empty());
+
+ ASSERT_THROW(install(env, installed, "=category/partitioned-0::parts", ""),
+ paludis::ActionFailedError);
+
+ EXPECT_TRUE(installed->package_ids(partitioned, { })->empty());
+}
+