aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2008-06-10 15:13:58 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2008-06-10 15:13:58 +0000
commitbff468799b90d6e474a61c76f6828aa8c2a47fff (patch)
tree86a18b237c25a1c52ea9bcbea21ea8d53b3885d4
parent8681eb2a437c6fb4ec94299dd4d39faf7b0cbb7a (diff)
downloadpaludis-bff468799b90d6e474a61c76f6828aa8c2a47fff.tar.gz
paludis-bff468799b90d6e474a61c76f6828aa8c2a47fff.tar.xz
Allow specifying an UnavailableRepository's name in its config file.
-rw-r--r--paludis/repositories/unavailable/registration.cc5
-rw-r--r--paludis/repositories/unavailable/unavailable_repository.cc2
-rw-r--r--paludis/repositories/unavailable/unavailable_repository.hh1
-rw-r--r--paludis/repositories/unavailable/unavailable_repository_TEST.cc2
4 files changed, 9 insertions, 1 deletions
diff --git a/paludis/repositories/unavailable/registration.cc b/paludis/repositories/unavailable/registration.cc
index c21b247..0643dff 100644
--- a/paludis/repositories/unavailable/registration.cc
+++ b/paludis/repositories/unavailable/registration.cc
@@ -42,6 +42,10 @@ namespace
Context context("When making unavailable repository from repo_file '" + repo_file + "':");
+ std::string name_str;
+ RepositoryName name(m->end() == m->find("name") || (name_str = m->find("name")->second).empty()
+ ? "unavailable" : name_str);
+
std::string location;
if (m->end() == m->find("location") || ((location = m->find("location")->second)).empty())
throw UnavailableRepositoryConfigurationError("Key 'location' not specified or empty");
@@ -56,6 +60,7 @@ namespace
return std::tr1::shared_ptr<UnavailableRepository>(new UnavailableRepository(
UnavailableRepositoryParams::named_create()
+ (k::name(), name)
(k::location(), location)
(k::sync(), sync)
(k::sync_options(), sync_options)
diff --git a/paludis/repositories/unavailable/unavailable_repository.cc b/paludis/repositories/unavailable/unavailable_repository.cc
index a834f7b..e1ac2c4 100644
--- a/paludis/repositories/unavailable/unavailable_repository.cc
+++ b/paludis/repositories/unavailable/unavailable_repository.cc
@@ -82,7 +82,7 @@ UnavailableRepositoryConfigurationError::UnavailableRepositoryConfigurationError
UnavailableRepository::UnavailableRepository(const UnavailableRepositoryParams & p) :
PrivateImplementationPattern<UnavailableRepository>(new Implementation<UnavailableRepository>(this, p)),
Repository(
- RepositoryName("unavailable"),
+ p[k::name()],
RepositoryCapabilities::named_create()
(k::sets_interface(), static_cast<RepositorySetsInterface *>(0))
(k::syncable_interface(), this)
diff --git a/paludis/repositories/unavailable/unavailable_repository.hh b/paludis/repositories/unavailable/unavailable_repository.hh
index 48d4da8..aac9f91 100644
--- a/paludis/repositories/unavailable/unavailable_repository.hh
+++ b/paludis/repositories/unavailable/unavailable_repository.hh
@@ -38,6 +38,7 @@ namespace paludis
typedef kc::KeyedClass<
kc::Field<k::environment, Environment *>,
+ kc::Field<k::name, RepositoryName>,
kc::Field<k::location, FSEntry>,
kc::Field<k::sync, std::string>,
kc::Field<k::sync_options, std::string>
diff --git a/paludis/repositories/unavailable/unavailable_repository_TEST.cc b/paludis/repositories/unavailable/unavailable_repository_TEST.cc
index 311be29..eca2373 100644
--- a/paludis/repositories/unavailable/unavailable_repository_TEST.cc
+++ b/paludis/repositories/unavailable/unavailable_repository_TEST.cc
@@ -49,6 +49,7 @@ namespace test_cases
TestEnvironment env;
std::tr1::shared_ptr<UnavailableRepository> repo(new UnavailableRepository(
UnavailableRepositoryParams::named_create()
+ (k::name(), RepositoryName("unavailable"))
(k::sync(), "")
(k::sync_options(), "")
(k::location(), FSEntry::cwd() / "unavailable_repository_TEST_dir" / "repo1")
@@ -68,6 +69,7 @@ namespace test_cases
TestEnvironment env;
std::tr1::shared_ptr<UnavailableRepository> repo(new UnavailableRepository(
UnavailableRepositoryParams::named_create()
+ (k::name(), RepositoryName("unavailable"))
(k::sync(), "")
(k::sync_options(), "")
(k::location(), FSEntry::cwd() / "unavailable_repository_TEST_dir" / "repo2")