Rename sync suffixes to sources
"Suffixes" made sense when they were going to be configured as sync.foo = , sync.bar = , etc, but not anymore.
This commit is contained in:
parent
95c7070526
commit
338d0ebd6a
5
NEWS
5
NEWS
@ -4,6 +4,11 @@ News for Paludis
|
||||
This file lists the major changes between versions. For a more detailed list
|
||||
of every change, see the Git log.
|
||||
|
||||
master:
|
||||
* 'cave sync --suffix' is now known as '--source' (although the old
|
||||
version is still supported for compatibility). The short version is
|
||||
still '-s'.
|
||||
|
||||
0.68.0:
|
||||
* Licence groups are now supported.
|
||||
|
||||
|
||||
@ -76,11 +76,11 @@ 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. Different sync URIs to use when a different suffix is requested may be
|
||||
repository does not need to be synced. Different sync URIs to use when a different source 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. Options for suffixes are specified using the same format as
|
||||
<dd>Any options to be passed to the syncer. Optional. Options for alternative sources are specified using the same format as
|
||||
for <code>sync</code>.</dd>
|
||||
|
||||
<dt><code>builddir</code></dt>
|
||||
|
||||
@ -19,11 +19,11 @@ for <code>unavailable</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. Different sync URIs to use when a different suffix is requested may be
|
||||
repository does not need to be synced. Different sync URIs to use when a different source 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. Options for suffixes are specified using the same format as
|
||||
<dd>Any options to be passed to the syncer. Optional. Options for alternative sources are specified using the same format as
|
||||
for <code>sync</code>.</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
@ -18,11 +18,11 @@ for <code>unwritten</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. Different sync URIs to use when a different suffix is requested may be
|
||||
repository does not need to be synced. Different sync URIs to use when a different source 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. Options for suffixes are specified using the same format as
|
||||
<dd>Any options to be passed to the syncer. Optional. Options for alternative sources are specified using the same format as
|
||||
for <code>sync</code>.</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
@ -725,20 +725,20 @@ ERepository::need_mirrors() const
|
||||
|
||||
bool
|
||||
ERepository::sync(
|
||||
const std::string & suffix,
|
||||
const std::string & source,
|
||||
const std::string & revision,
|
||||
const std::shared_ptr<OutputManager> & output_manager) const
|
||||
{
|
||||
Context context("When syncing repository '" + stringify(name()) + "':");
|
||||
|
||||
std::string sync_uri, sync_options;
|
||||
if (_imp->params.sync()->end() != _imp->params.sync()->find(suffix))
|
||||
sync_uri = _imp->params.sync()->find(suffix)->second;
|
||||
if (_imp->params.sync()->end() != _imp->params.sync()->find(source))
|
||||
sync_uri = _imp->params.sync()->find(source)->second;
|
||||
if (sync_uri.empty())
|
||||
return false;
|
||||
|
||||
if (_imp->params.sync_options()->end() != _imp->params.sync_options()->find(suffix))
|
||||
sync_options = _imp->params.sync_options()->find(suffix)->second;
|
||||
if (_imp->params.sync_options()->end() != _imp->params.sync_options()->find(source))
|
||||
sync_options = _imp->params.sync_options()->find(source)->second;
|
||||
|
||||
std::list<std::string> sync_list;
|
||||
tokenise_whitespace(sync_uri, std::back_inserter(sync_list));
|
||||
@ -1373,35 +1373,35 @@ ERepository::repository_factory_create(
|
||||
auto sync(std::make_shared<Map<std::string, std::string> >());
|
||||
std::vector<std::string> sync_tokens;
|
||||
tokenise_whitespace(f("sync"), std::back_inserter(sync_tokens));
|
||||
std::string suffix;
|
||||
std::string source;
|
||||
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);
|
||||
source = 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);
|
||||
if (sync->end() != sync->find(source))
|
||||
v = sync->find(source)->second + " ";
|
||||
sync->erase(source);
|
||||
sync->insert(source, v + *t);
|
||||
}
|
||||
|
||||
auto sync_options(std::make_shared<Map<std::string, std::string> >());
|
||||
std::vector<std::string> sync_options_tokens;
|
||||
tokenise_whitespace(f("sync_options"), std::back_inserter(sync_options_tokens));
|
||||
suffix = "";
|
||||
source = "";
|
||||
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);
|
||||
source = 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 + *t);
|
||||
if (sync_options->end() != sync_options->find(source))
|
||||
v = sync_options->find(source)->second + " ";
|
||||
sync_options->erase(source);
|
||||
sync_options->insert(source, v + *t);
|
||||
}
|
||||
|
||||
std::string builddir(f("builddir"));
|
||||
|
||||
@ -306,20 +306,20 @@ UnavailableRepository::some_ids_might_not_be_masked() const
|
||||
|
||||
bool
|
||||
UnavailableRepository::sync(
|
||||
const std::string & suffix,
|
||||
const std::string & source,
|
||||
const std::string & revision,
|
||||
const std::shared_ptr<OutputManager> & output_manager) const
|
||||
{
|
||||
Context context("When syncing repository '" + stringify(name()) + "':");
|
||||
|
||||
std::string sync_uri, sync_options;
|
||||
if (_imp->params.sync()->end() != _imp->params.sync()->find(suffix))
|
||||
sync_uri = _imp->params.sync()->find(suffix)->second;
|
||||
if (_imp->params.sync()->end() != _imp->params.sync()->find(source))
|
||||
sync_uri = _imp->params.sync()->find(source)->second;
|
||||
if (sync_uri.empty())
|
||||
return false;
|
||||
|
||||
if (_imp->params.sync_options()->end() != _imp->params.sync_options()->find(suffix))
|
||||
sync_options = _imp->params.sync_options()->find(suffix)->second;
|
||||
if (_imp->params.sync_options()->end() != _imp->params.sync_options()->find(source))
|
||||
sync_options = _imp->params.sync_options()->find(source)->second;
|
||||
|
||||
std::list<std::string> sync_list;
|
||||
tokenise_whitespace(sync_uri, std::back_inserter(sync_list));
|
||||
@ -377,35 +377,35 @@ UnavailableRepository::repository_factory_create(
|
||||
auto sync(std::make_shared<Map<std::string, std::string> >());
|
||||
std::vector<std::string> sync_tokens;
|
||||
tokenise_whitespace(f("sync"), std::back_inserter(sync_tokens));
|
||||
std::string suffix;
|
||||
std::string source;
|
||||
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);
|
||||
source = 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);
|
||||
if (sync->end() != sync->find(source))
|
||||
v = sync->find(source)->second + " ";
|
||||
sync->erase(source);
|
||||
sync->insert(source, v + *t);
|
||||
}
|
||||
|
||||
auto sync_options(std::make_shared<Map<std::string, std::string> >());
|
||||
std::vector<std::string> sync_options_tokens;
|
||||
tokenise_whitespace(f("sync_options"), std::back_inserter(sync_options_tokens));
|
||||
suffix = "";
|
||||
source = "";
|
||||
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);
|
||||
source = 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 + *t);
|
||||
if (sync_options->end() != sync_options->find(source))
|
||||
v = sync_options->find(source)->second + " ";
|
||||
sync_options->erase(source);
|
||||
sync_options->insert(source, v + *t);
|
||||
}
|
||||
|
||||
return std::make_shared<UnavailableRepository>(
|
||||
|
||||
@ -254,20 +254,20 @@ UnwrittenRepository::some_ids_might_not_be_masked() const
|
||||
|
||||
bool
|
||||
UnwrittenRepository::sync(
|
||||
const std::string & suffix,
|
||||
const std::string & source,
|
||||
const std::string & revision,
|
||||
const std::shared_ptr<OutputManager> & output_manager) const
|
||||
{
|
||||
Context context("When syncing repository '" + stringify(name()) + "':");
|
||||
|
||||
std::string sync_uri, sync_options;
|
||||
if (_imp->params.sync()->end() != _imp->params.sync()->find(suffix))
|
||||
sync_uri = _imp->params.sync()->find(suffix)->second;
|
||||
if (_imp->params.sync()->end() != _imp->params.sync()->find(source))
|
||||
sync_uri = _imp->params.sync()->find(source)->second;
|
||||
if (sync_uri.empty())
|
||||
return false;
|
||||
|
||||
if (_imp->params.sync_options()->end() != _imp->params.sync_options()->find(suffix))
|
||||
sync_options = _imp->params.sync_options()->find(suffix)->second;
|
||||
if (_imp->params.sync_options()->end() != _imp->params.sync_options()->find(source))
|
||||
sync_options = _imp->params.sync_options()->find(source)->second;
|
||||
|
||||
std::list<std::string> sync_list;
|
||||
tokenise_whitespace(sync_uri, std::back_inserter(sync_list));
|
||||
@ -333,35 +333,35 @@ UnwrittenRepository::repository_factory_create(
|
||||
auto sync(std::make_shared<Map<std::string, std::string> >());
|
||||
std::vector<std::string> sync_tokens;
|
||||
tokenise_whitespace(f("sync"), std::back_inserter(sync_tokens));
|
||||
std::string suffix;
|
||||
std::string source;
|
||||
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);
|
||||
source = 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);
|
||||
if (sync->end() != sync->find(source))
|
||||
v = sync->find(source)->second + " ";
|
||||
sync->erase(source);
|
||||
sync->insert(source, v + *t);
|
||||
}
|
||||
|
||||
auto sync_options(std::make_shared<Map<std::string, std::string> >());
|
||||
std::vector<std::string> sync_options_tokens;
|
||||
tokenise_whitespace(f("sync_options"), std::back_inserter(sync_options_tokens));
|
||||
suffix = "";
|
||||
source = "";
|
||||
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);
|
||||
source = 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 + *t);
|
||||
if (sync_options->end() != sync_options->find(source))
|
||||
v = sync_options->find(source)->second + " ";
|
||||
sync_options->erase(source);
|
||||
sync_options->insert(source, v + *t);
|
||||
}
|
||||
|
||||
return std::make_shared<UnwrittenRepository>(
|
||||
|
||||
@ -425,11 +425,11 @@ namespace paludis
|
||||
*
|
||||
* \return True if we synced successfully, false if we skipped sync.
|
||||
* \since 0.42 (previously in an interface)
|
||||
* \since 0.55 takes a suffix (may be empty)
|
||||
* \since 0.55 takes a source (may be empty)
|
||||
* \since 0.61 takes a revision (may be empty)
|
||||
*/
|
||||
virtual bool sync(
|
||||
const std::string & suffix,
|
||||
const std::string & source,
|
||||
const std::string & revision,
|
||||
const std::shared_ptr<OutputManager> &) const = 0;
|
||||
|
||||
|
||||
@ -67,7 +67,8 @@ namespace
|
||||
args::SwitchArg a_sequential;
|
||||
|
||||
args::ArgsGroup g_sync_options;
|
||||
args::StringArg a_suffix;
|
||||
args::StringArg a_source;
|
||||
args::AliasArg a_suffix;
|
||||
args::StringArg a_revision;
|
||||
|
||||
virtual std::string app_name() const
|
||||
@ -91,7 +92,8 @@ namespace
|
||||
a_sequential(&g_job_options, "sequential", '\0', "Only perform one sync at a time.", false),
|
||||
|
||||
g_sync_options(main_options_section(), "Sync Options", "Sync options."),
|
||||
a_suffix(&g_sync_options, "suffix", 's', "Use the specified suffix for syncing."),
|
||||
a_source(&g_sync_options, "source", 's', "Use the specified source for syncing."),
|
||||
a_suffix(&a_source, "suffix", true),
|
||||
a_revision(&g_sync_options, "revision", 'r', "Sync to the specified revision. Not supported by all "
|
||||
"syncers. Probably doesn't make sense when not specified with a repository parameter.")
|
||||
{
|
||||
@ -144,8 +146,8 @@ namespace
|
||||
if (r->sync_host_key())
|
||||
{
|
||||
auto sync_host(r->sync_host_key()->parse_value());
|
||||
if (sync_host->end() != sync_host->find(cmdline.a_suffix.argument()))
|
||||
return sync_host->find(cmdline.a_suffix.argument())->second;
|
||||
if (sync_host->end() != sync_host->find(cmdline.a_source.argument()))
|
||||
return sync_host->find(cmdline.a_source.argument())->second;
|
||||
}
|
||||
|
||||
return "";
|
||||
@ -207,7 +209,7 @@ namespace
|
||||
{
|
||||
const std::shared_ptr<Repository> repo(env->fetch_repository(name));
|
||||
|
||||
if (! repo->sync(cmdline.a_suffix.argument(), cmdline.a_revision.argument(), output_manager))
|
||||
if (! repo->sync(cmdline.a_source.argument(), cmdline.a_revision.argument(), output_manager))
|
||||
skipped = true;
|
||||
success = true;
|
||||
}
|
||||
|
||||
@ -833,7 +833,7 @@ _cave_cmd_sync()
|
||||
_arguments -s : \
|
||||
'(--help -h)'{--help,-h}'[Display help messsage]' \
|
||||
'--sequential[Only perform one sync at a time]' \
|
||||
'(--suffix -s)'{--suffix,-s}'[Use the specified suffix for syncing]:Suffix: ' \
|
||||
'(--source -s)'{--source,-s}'[Use the specified source for syncing]:Source: ' \
|
||||
'(--revision -r)'{--revision,-r}'[Sync to the specified revision]:Revision: ' \
|
||||
'*:repository:_cave_repositories' && return 0
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user