aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Mike Kelly <pioto@pioto.org> 2007-01-22 03:12:26 +0000
committerAvatar Mike Kelly <pioto@pioto.org> 2007-01-22 03:12:26 +0000
commitb7b35781fc844d89a2f8902a053e6b8b36a9529e (patch)
tree1a67dd90add271f5dfa97c457abb778edb4a9ead
parentef09852dd649784f7b5b13b5ac5f11c44b339a8e (diff)
downloadpaludis-b7b35781fc844d89a2f8902a053e6b8b36a9529e.tar.gz
paludis-b7b35781fc844d89a2f8902a053e6b8b36a9529e.tar.xz
Allow for multiple sync urls. They are tried in the order listed until one succeeds.
-rw-r--r--paludis/syncer.cc16
1 files changed, 14 insertions, 2 deletions
diff --git a/paludis/syncer.cc b/paludis/syncer.cc
index 2e7bbe6..2116515 100644
--- a/paludis/syncer.cc
+++ b/paludis/syncer.cc
@@ -93,8 +93,14 @@ DefaultSyncer::DefaultSyncer(const SyncerParams & params)
void
DefaultSyncer::sync(const SyncOptions & opts) const
{
+ std::list<std::string> remote_list;
+ WhitespaceTokeniser::get_instance()->tokenise(_remote, std::back_inserter(remote_list));
- MakeEnvCommand cmd(make_env_command(stringify(_syncer) + " '" + _local + "' '" + _remote + "'")
+ bool ok(false);
+ for (std::list<std::string>::const_iterator r(remote_list.begin()),
+ r_end(remote_list.end()) ; r != r_end ; ++r)
+ {
+ MakeEnvCommand cmd(make_env_command(stringify(_syncer) + " '" + _local + "' '" + *r + "'")
("PKGMANAGER", PALUDIS_PACKAGE "-" + stringify(PALUDIS_VERSION_MAJOR) + "." +
stringify(PALUDIS_VERSION_MINOR) + "." +
stringify(PALUDIS_VERSION_MICRO) +
@@ -109,8 +115,14 @@ DefaultSyncer::sync(const SyncOptions & opts) const
("PALUDIS_EBUILD_LOG_LEVEL", stringify(Log::get_instance()->log_level()))
("PALUDIS_EBUILD_DIR", getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis"))
("PALUDIS_SYNC_EXCLUDE_FROM", opts.exclude_from));
+ if (! run_command(cmd))
+ {
+ ok = true;
+ break;
+ }
+ }
- if (run_command(cmd))
+ if (! ok)
throw SyncFailedError(_local, _remote);
}