aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Mike Kelly <pioto@pioto.org> 2007-01-23 02:26:53 +0000
committerAvatar Mike Kelly <pioto@pioto.org> 2007-01-23 02:26:53 +0000
commitb0b93868cbbc1a484c130c9e4a91ac250f2832bd (patch)
tree36ce7dd11eec87eee1d144c4de9513afe29737fc
parent8e54a6a3df94b40e17f33aea997e30ee70d26d78 (diff)
downloadpaludis-b0b93868cbbc1a484c130c9e4a91ac250f2832bd.tar.gz
paludis-b0b93868cbbc1a484c130c9e4a91ac250f2832bd.tar.xz
Move sync= line splitting code into portage_repository instead of in syncer.cc. Should now work right if different repo types are in one sync= line.
-rw-r--r--paludis/repositories/portage/portage_repository.cc33
-rw-r--r--paludis/syncer.cc16
2 files changed, 29 insertions, 20 deletions
diff --git a/paludis/repositories/portage/portage_repository.cc b/paludis/repositories/portage/portage_repository.cc
index 3c8da57..c870b54 100644
--- a/paludis/repositories/portage/portage_repository.cc
+++ b/paludis/repositories/portage/portage_repository.cc
@@ -782,12 +782,33 @@ PortageRepository::do_sync() const
if (_imp->params.sync.empty())
return false;
- DefaultSyncer syncer(SyncerParams::create()
- .environment(_imp->params.environment)
- .local(stringify(_imp->params.location))
- .remote(_imp->params.sync));
- SyncOptions opts(_imp->params.sync_exclude);
- syncer.sync(opts);
+ std::list<std::string> sync_list;
+ WhitespaceTokeniser::get_instance()->tokenise(_imp->params.sync, std::back_inserter(sync_list));
+
+ bool ok(false);
+ for (std::list<std::string>::const_iterator s(sync_list.begin()),
+ s_end(sync_list.end()) ; s != s_end ; ++s)
+ {
+ DefaultSyncer syncer(SyncerParams::create()
+ .environment(_imp->params.environment)
+ .local(stringify(_imp->params.location))
+ .remote(*s));
+ SyncOptions opts(_imp->params.sync_exclude);
+ try
+ {
+ syncer.sync(opts);
+ }
+ catch (const SyncFailedError & e)
+ {
+ continue;
+ }
+
+ ok=true;
+ break;
+ }
+
+ if (! ok)
+ throw SyncFailedError(stringify(_imp->params.location), _imp->params.sync);
return true;
}
diff --git a/paludis/syncer.cc b/paludis/syncer.cc
index 2116515..2e7bbe6 100644
--- a/paludis/syncer.cc
+++ b/paludis/syncer.cc
@@ -93,14 +93,8 @@ 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));
- 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 + "'")
+ MakeEnvCommand cmd(make_env_command(stringify(_syncer) + " '" + _local + "' '" + _remote + "'")
("PKGMANAGER", PALUDIS_PACKAGE "-" + stringify(PALUDIS_VERSION_MAJOR) + "." +
stringify(PALUDIS_VERSION_MINOR) + "." +
stringify(PALUDIS_VERSION_MICRO) +
@@ -115,14 +109,8 @@ 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 (! ok)
+ if (run_command(cmd))
throw SyncFailedError(_local, _remote);
}