aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-09-02 18:36:37 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-09-02 18:36:37 +0100
commitb69a5e695c08e63b78034f38ec1a1f603e2253e2 (patch)
treed9288e787e4daa664ba76d4231af07b8b4c431b4
parentc604d248f866c381661b65154f701a1a2046c058 (diff)
downloadpaludis-b69a5e695c08e63b78034f38ec1a1f603e2253e2.tar.gz
paludis-b69a5e695c08e63b78034f38ec1a1f603e2253e2.tar.xz
Make repo IDs exist even when a repo is configured
-rw-r--r--paludis/repositories/unavailable/unavailable_mask.cc18
-rw-r--r--paludis/repositories/unavailable/unavailable_mask.hh9
-rw-r--r--paludis/repositories/unavailable/unavailable_repository_TEST.cc1
-rw-r--r--paludis/repositories/unavailable/unavailable_repository_store.cc17
4 files changed, 36 insertions, 9 deletions
diff --git a/paludis/repositories/unavailable/unavailable_mask.cc b/paludis/repositories/unavailable/unavailable_mask.cc
index 0f44578..1d09c38 100644
--- a/paludis/repositories/unavailable/unavailable_mask.cc
+++ b/paludis/repositories/unavailable/unavailable_mask.cc
@@ -58,3 +58,21 @@ NoConfigurationInformationMask::explanation() const
return "Not enough information is available to configure this repository automatically";
}
+char
+AlreadyConfiguredMask::key() const
+{
+ return 'A';
+}
+
+const std::string
+AlreadyConfiguredMask::description() const
+{
+ return "already configured";
+}
+
+const std::string
+AlreadyConfiguredMask::explanation() const
+{
+ return "This repository is already configured";
+}
+
diff --git a/paludis/repositories/unavailable/unavailable_mask.hh b/paludis/repositories/unavailable/unavailable_mask.hh
index 30aa3bf..f5cae38 100644
--- a/paludis/repositories/unavailable/unavailable_mask.hh
+++ b/paludis/repositories/unavailable/unavailable_mask.hh
@@ -43,6 +43,15 @@ namespace paludis
virtual char key() const;
virtual const std::string description() const;
};
+
+ class AlreadyConfiguredMask :
+ public UnsupportedMask
+ {
+ public:
+ virtual const std::string explanation() const;
+ virtual char key() const;
+ virtual const std::string description() const;
+ };
}
}
diff --git a/paludis/repositories/unavailable/unavailable_repository_TEST.cc b/paludis/repositories/unavailable/unavailable_repository_TEST.cc
index 968ff6a..9262fca 100644
--- a/paludis/repositories/unavailable/unavailable_repository_TEST.cc
+++ b/paludis/repositories/unavailable/unavailable_repository_TEST.cc
@@ -117,6 +117,7 @@ namespace test_cases
"cat-one/pkg-one-3:0::unavailable (in ::foo) "
"cat-one/pkg-two-1:1::unavailable (in ::foo) "
"cat-one/pkg-two-2:2::unavailable (in ::foo) "
+ "repository/bar-0::unavailable "
"repository/foo-0::unavailable"
);
}
diff --git a/paludis/repositories/unavailable/unavailable_repository_store.cc b/paludis/repositories/unavailable/unavailable_repository_store.cc
index f720789..58792aa 100644
--- a/paludis/repositories/unavailable/unavailable_repository_store.cc
+++ b/paludis/repositories/unavailable/unavailable_repository_store.cc
@@ -107,12 +107,7 @@ UnavailableRepositoryStore::_populate_one(const Environment * const env, const F
UnavailableRepositoryFile file(f);
- if (env->package_database()->has_repository_named(RepositoryName(file.repo_name())))
- {
- Log::get_instance()->message("unavailable_repository.file.present", ll_debug, lc_context)
- << "Skipping file '" << f << "' due to present repo_name '" << file.repo_name() << "'";
- return;
- }
+ bool has_repo(env->package_database()->has_repository_named(RepositoryName(file.repo_name())));
if (! _imp->seen_repo_names.insert(file.repo_name()).second)
{
@@ -136,6 +131,7 @@ UnavailableRepositoryStore::_populate_one(const Environment * const env, const F
repository_sync = std::make_shared<LiteralMetadataValueKey<std::string>>(
"REPOSITORY_SYNC", "Repository sync", mkt_normal, file.sync());
+ if (! has_repo)
{
std::shared_ptr<Mask> mask(std::make_shared<UnavailableMask>());
std::shared_ptr<Set<std::string> > from_repositories_set(std::make_shared<Set<std::string>>());
@@ -190,12 +186,16 @@ UnavailableRepositoryStore::_populate_one(const Environment * const env, const F
if (file.autoconfigurable())
{
- const std::shared_ptr<NoConfigurationInformationMask> no_configuration_mask(std::make_shared<NoConfigurationInformationMask>());
+ std::shared_ptr<Mask> mask;
std::shared_ptr<UnavailableRepositoryDependenciesKey> deps;
if (! file.dependencies().empty())
deps = std::make_shared<UnavailableRepositoryDependenciesKey>(env, "dependencies", "Dependencies", mkt_dependencies,
file.dependencies());
+ if (has_repo)
+ mask = std::make_shared<AlreadyConfiguredMask>();
+ else if (! (repository_sync && repository_format))
+ mask = std::make_shared<NoConfigurationInformationMask>();
const std::shared_ptr<UnavailableRepositoryID> id(std::make_shared<UnavailableRepositoryID>(
make_named_values<UnavailableRepositoryIDParams>(
n::dependencies() = deps,
@@ -203,8 +203,7 @@ UnavailableRepositoryStore::_populate_one(const Environment * const env, const F
n::environment() = env,
n::format() = repository_format,
n::homepage() = repository_homepage,
- n::mask() = repository_sync && repository_format ?
- make_null_shared_ptr() : no_configuration_mask,
+ n::mask() = mask,
n::name() = CategoryNamePart("repository") + PackageNamePart(file.repo_name()),
n::repository() = _imp->repo,
n::sync() = repository_sync