aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-11-08 15:57:30 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-11-08 15:58:17 +0000
commitaaefa5c1fb5f1e0bdc9390028509fa2be1d1f6fe (patch)
tree4eb82f7f213e56576b87358e3098fb64e379ac3c
parent71037b419832743996620c47fb91bb87206b61c9 (diff)
downloadpaludis-aaefa5c1fb5f1e0bdc9390028509fa2be1d1f6fe.tar.gz
paludis-aaefa5c1fb5f1e0bdc9390028509fa2be1d1f6fe.tar.xz
Allow sync suffixes
Fixes: ticket:1033
-rw-r--r--doc/configuration/repositories/e.html.part6
-rw-r--r--doc/configuration/repositories/unavailable.html.part7
-rw-r--r--doc/configuration/repositories/unwritten.html.part7
-rw-r--r--paludis/repositories/e/e_repository.cc31
-rw-r--r--paludis/repositories/unavailable/unavailable_repository.cc32
-rw-r--r--paludis/repositories/unwritten/unwritten_repository.cc32
6 files changed, 103 insertions, 12 deletions
diff --git a/doc/configuration/repositories/e.html.part b/doc/configuration/repositories/e.html.part
index e1e0038..7ef01fd 100644
--- a/doc/configuration/repositories/e.html.part
+++ b/doc/configuration/repositories/e.html.part
@@ -76,10 +76,12 @@ for <code>e</code> format repositories:</p>
<dt><code>sync</code></dt>
<dd>How to sync the repository. See <a href="../syncers.html">Syncers</a> for supported formats. Optional if the
- repository does not need to be synced.</dd>
+ repository does not need to be synced. Different sync URIs to use when a different suffix is requested may be
+ specified, e.g. <code>sync = git+http://host/path local: git+file:///path</code>.</dd>
<dt><code>sync_options</code></dt>
- <dd>Any options to be passed to the syncer. Optional.</dd>
+ <dd>Any options to be passed to the syncer. Optional. Options for suffixes are specified using the same format as
+ for <code>sync</code>.</dd>
<dt><code>builddir</code></dt>
<dd>The temporary directory to use when building packages. Optional.</dd>
diff --git a/doc/configuration/repositories/unavailable.html.part b/doc/configuration/repositories/unavailable.html.part
index 781da09..187e7e3 100644
--- a/doc/configuration/repositories/unavailable.html.part
+++ b/doc/configuration/repositories/unavailable.html.part
@@ -18,10 +18,13 @@ for <code>unavailable</code> format repositories:</p>
<dd>The name of the repository. Defaults to <code>unavailable</code>.</dd>
<dt><code>sync</code></dt>
- <dd>How to sync the repository. See <a href="../syncers.html">Syncers</a> for supported formats.</dd>
+ <dd>How to sync the repository. See <a href="../syncers.html">Syncers</a> for supported formats. Optional if the
+ repository does not need to be synced. Different sync URIs to use when a different suffix is requested may be
+ specified, e.g. <code>sync = git+http://host/path local: git+file:///path</code>.</dd>
<dt><code>sync_options</code></dt>
- <dd>Any options to be passed to the syncer. Optional.</dd>
+ <dd>Any options to be passed to the syncer. Optional. Options for suffixes are specified using the same format as
+ for <code>sync</code>.</dd>
</dl>
<p>When used in conjunction with <a href="repository.html">repository format repositories</a>, the
diff --git a/doc/configuration/repositories/unwritten.html.part b/doc/configuration/repositories/unwritten.html.part
index f16a961..e7edcf3 100644
--- a/doc/configuration/repositories/unwritten.html.part
+++ b/doc/configuration/repositories/unwritten.html.part
@@ -16,10 +16,13 @@ for <code>unwritten</code> format repositories:</p>
<dd>The name of the repository. Defaults to <code>unwritten</code>.</dd>
<dt><code>sync</code></dt>
- <dd>How to sync the repository. See <a href="../syncers.html">Syncers</a> for supported formats.</dd>
+ <dd>How to sync the repository. See <a href="../syncers.html">Syncers</a> for supported formats. Optional if the
+ repository does not need to be synced. Different sync URIs to use when a different suffix is requested may be
+ specified, e.g. <code>sync = git+http://host/path local: git+file:///path</code>.</dd>
<dt><code>sync_options</code></dt>
- <dd>Any options to be passed to the syncer. Optional.</dd>
+ <dd>Any options to be passed to the syncer. Optional. Options for suffixes are specified using the same format as
+ for <code>sync</code>.</dd>
</dl>
<h2>Reference Configurations</h2>
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index 5ddd4c8..3083961 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -1452,10 +1452,37 @@ ERepository::repository_factory_create(
}
auto sync(std::make_shared<Map<std::string, std::string> >());
- sync->insert("", f("sync"));
+ std::vector<std::string> sync_tokens;
+ tokenise_whitespace(f("sync"), std::back_inserter(sync_tokens));
+ std::string suffix;
+ for (auto t(sync_tokens.begin()), t_end(sync_tokens.end()) ;
+ t != t_end ; ++t)
+ if ((! t->empty()) && (':' == t->at(t->length() - 1)))
+ suffix = t->substr(0, t->length() - 1);
+ else
+ {
+ std::string v;
+ if (sync->end() != sync->find(suffix))
+ v = sync->find(suffix)->second + " ";
+ sync->erase(suffix);
+ sync->insert(suffix, v + *t);
+ }
auto sync_options(std::make_shared<Map<std::string, std::string> >());
- sync_options->insert("", f("sync_options"));
+ std::vector<std::string> sync_options_tokens;
+ tokenise_whitespace(f("sync_options"), std::back_inserter(sync_options_tokens));
+ for (auto t(sync_options_tokens.begin()), t_end(sync_options_tokens.end()) ;
+ t != t_end ; ++t)
+ if ((! t->empty()) && (':' == t->at(t->length() - 1)))
+ suffix = t->substr(0, t->length() - 1);
+ else
+ {
+ std::string v;
+ if (sync_options->end() != sync_options->find(suffix))
+ v = sync_options->find(suffix)->second + " ";
+ sync_options->erase(suffix);
+ sync_options->insert(suffix, v);
+ }
std::string builddir(f("builddir"));
if (builddir.empty())
diff --git a/paludis/repositories/unavailable/unavailable_repository.cc b/paludis/repositories/unavailable/unavailable_repository.cc
index bf80521..4a9d660 100644
--- a/paludis/repositories/unavailable/unavailable_repository.cc
+++ b/paludis/repositories/unavailable/unavailable_repository.cc
@@ -31,6 +31,7 @@
#include <paludis/action.hh>
#include <paludis/syncer.hh>
#include <paludis/hook.hh>
+#include <vector>
#include <list>
using namespace paludis;
@@ -330,10 +331,37 @@ UnavailableRepository::repository_factory_create(
throw UnavailableRepositoryConfigurationError("Key 'location' not specified or empty");
auto sync(std::make_shared<Map<std::string, std::string> >());
- sync->insert("", f("sync"));
+ std::vector<std::string> sync_tokens;
+ tokenise_whitespace(f("sync"), std::back_inserter(sync_tokens));
+ std::string suffix;
+ for (auto t(sync_tokens.begin()), t_end(sync_tokens.end()) ;
+ t != t_end ; ++t)
+ if ((! t->empty()) && (':' == t->at(t->length() - 1)))
+ suffix = t->substr(0, t->length() - 1);
+ else
+ {
+ std::string v;
+ if (sync->end() != sync->find(suffix))
+ v = sync->find(suffix)->second + " ";
+ sync->erase(suffix);
+ sync->insert(suffix, v + *t);
+ }
auto sync_options(std::make_shared<Map<std::string, std::string> >());
- sync_options->insert("", f("sync_options"));
+ std::vector<std::string> sync_options_tokens;
+ tokenise_whitespace(f("sync_options"), std::back_inserter(sync_options_tokens));
+ for (auto t(sync_options_tokens.begin()), t_end(sync_options_tokens.end()) ;
+ t != t_end ; ++t)
+ if ((! t->empty()) && (':' == t->at(t->length() - 1)))
+ suffix = t->substr(0, t->length() - 1);
+ else
+ {
+ std::string v;
+ if (sync_options->end() != sync_options->find(suffix))
+ v = sync_options->find(suffix)->second + " ";
+ sync_options->erase(suffix);
+ sync_options->insert(suffix, v);
+ }
return std::make_shared<UnavailableRepository>(
make_named_values<UnavailableRepositoryParams>(
diff --git a/paludis/repositories/unwritten/unwritten_repository.cc b/paludis/repositories/unwritten/unwritten_repository.cc
index 666b163..bd910d1 100644
--- a/paludis/repositories/unwritten/unwritten_repository.cc
+++ b/paludis/repositories/unwritten/unwritten_repository.cc
@@ -31,6 +31,7 @@
#include <paludis/action.hh>
#include <paludis/syncer.hh>
#include <paludis/hook.hh>
+#include <vector>
#include <list>
using namespace paludis;
@@ -333,10 +334,37 @@ UnwrittenRepository::repository_factory_create(
throw UnwrittenRepositoryConfigurationError("Key 'location' not specified or empty");
auto sync(std::make_shared<Map<std::string, std::string> >());
- sync->insert("", f("sync"));
+ std::vector<std::string> sync_tokens;
+ tokenise_whitespace(f("sync"), std::back_inserter(sync_tokens));
+ std::string suffix;
+ for (auto t(sync_tokens.begin()), t_end(sync_tokens.end()) ;
+ t != t_end ; ++t)
+ if ((! t->empty()) && (':' == t->at(t->length() - 1)))
+ suffix = t->substr(0, t->length() - 1);
+ else
+ {
+ std::string v;
+ if (sync->end() != sync->find(suffix))
+ v = sync->find(suffix)->second + " ";
+ sync->erase(suffix);
+ sync->insert(suffix, v + *t);
+ }
auto sync_options(std::make_shared<Map<std::string, std::string> >());
- sync_options->insert("", f("sync_options"));
+ std::vector<std::string> sync_options_tokens;
+ tokenise_whitespace(f("sync_options"), std::back_inserter(sync_options_tokens));
+ for (auto t(sync_options_tokens.begin()), t_end(sync_options_tokens.end()) ;
+ t != t_end ; ++t)
+ if ((! t->empty()) && (':' == t->at(t->length() - 1)))
+ suffix = t->substr(0, t->length() - 1);
+ else
+ {
+ std::string v;
+ if (sync_options->end() != sync_options->find(suffix))
+ v = sync_options->find(suffix)->second + " ";
+ sync_options->erase(suffix);
+ sync_options->insert(suffix, v);
+ }
return std::make_shared<UnwrittenRepository>(
make_named_values<UnwrittenRepositoryParams>(