aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Mike Kelly <pioto@pioto.org> 2007-07-23 19:29:22 +0000
committerAvatar Mike Kelly <pioto@pioto.org> 2007-07-23 19:29:22 +0000
commitd47902b6474b2c42ebf6338384cf2ffae3ea69d2 (patch)
tree79431058a9b5a6569e93928b8007c5d8015a5ac3
parentffa0ece20ac179541743ee9a7cf4a54c0733e39f (diff)
downloadpaludis-d47902b6474b2c42ebf6338384cf2ffae3ea69d2.tar.gz
paludis-d47902b6474b2c42ebf6338384cf2ffae3ea69d2.tar.xz
Allow specifying specific repositories for the --regenerate-*-cache actions. Fixes: ticket:251
-rw-r--r--bash-completion/paludis17
-rw-r--r--src/clients/paludis/applets.cc28
-rw-r--r--src/clients/paludis/paludis.cc3
3 files changed, 33 insertions, 15 deletions
diff --git a/bash-completion/paludis b/bash-completion/paludis
index 9e42bdb..8f9bb4e 100644
--- a/bash-completion/paludis
+++ b/bash-completion/paludis
@@ -127,9 +127,10 @@ _paludis() {
--category \
--package \
--set"
- regen_opts=""
+ regen_news_opts=""
+ regen_repos_opts=""
- all_opts="${action_opts} ${general_opts} ${query_opts} ${install_opts} ${uninstall_opts} ${sync_opts} ${report_opts} ${contents_opts} ${owner_opts} ${version_query_opts} ${variable_query_opts} ${list_opts} ${regen_opts}"
+ all_opts="${action_opts} ${general_opts} ${query_opts} ${install_opts} ${uninstall_opts} ${sync_opts} ${report_opts} ${contents_opts} ${owner_opts} ${version_query_opts} ${variable_query_opts} ${list_opts} ${regen_news_opts} ${regen_repos_opts}"
local x
for x in "${COMP_WORDS[@]}" ; do
@@ -186,8 +187,12 @@ _paludis() {
action="list"
break
;;
- --update-news|--regenerate-installed-cache|--regenerate-installable-cache)
- action="regen"
+ --update-news)
+ action="regen_news"
+ break
+ ;;
+ --regenerate-installed-cache|--regenerate-installable-cache)
+ action="regen_repos"
break
;;
esac
@@ -303,11 +308,11 @@ _paludis() {
# ;;
*)
case "${action}" in
- sync)
+ sync|regen_repos)
COMPREPLY=($(compgen -W "$(_paludis_dolist repositories)" -- "${cur}"))
return 0
;;
- report|info|list|regen)
+ report|info|list|regen_news)
return 0
;;
owner)
diff --git a/src/clients/paludis/applets.cc b/src/clients/paludis/applets.cc
index cd07d2b..92d3b1f 100644
--- a/src/clients/paludis/applets.cc
+++ b/src/clients/paludis/applets.cc
@@ -244,14 +244,30 @@ int do_regenerate_cache(tr1::shared_ptr<Environment> env, bool installed)
{
Context context("When performing cache regeneration action from command line:");
- for (PackageDatabase::RepositoryIterator r(env->package_database()->begin_repositories()),
- r_end(env->package_database()->end_repositories()) ; r != r_end ; ++r)
+ if (! CommandLine::get_instance()->empty())
{
- if (installed != (0 != (*r)->installed_interface))
- continue;
+ CommandLine::ParametersIterator q(CommandLine::get_instance()->begin_parameters()),
+ q_end(CommandLine::get_instance()->end_parameters());
+ for ( ; q != q_end ; ++q)
+ {
+ if (! env->package_database()->has_repository_named(RepositoryName(*q)))
+ throw NoSuchRepositoryError(*q);
- std::cout << "Regenerating cache for " << (*r)->name() << "..." << std::endl;
- (*r)->regenerate_cache();
+ std::cout << "Regenerating cache for " << (*q) << "..." << std::endl;
+ env->package_database()->fetch_repository(RepositoryName(*q))->regenerate_cache();
+ }
+ }
+ else
+ {
+ for (PackageDatabase::RepositoryIterator r(env->package_database()->begin_repositories()),
+ r_end(env->package_database()->end_repositories()) ; r != r_end ; ++r)
+ {
+ if (installed != (0 != (*r)->installed_interface))
+ continue;
+
+ std::cout << "Regenerating cache for " << (*r)->name() << "..." << std::endl;
+ (*r)->regenerate_cache();
+ }
}
return 0;
diff --git a/src/clients/paludis/paludis.cc b/src/clients/paludis/paludis.cc
index 33683b8..6e43c19 100644
--- a/src/clients/paludis/paludis.cc
+++ b/src/clients/paludis/paludis.cc
@@ -509,9 +509,6 @@ main(int argc, char *argv[])
if (CommandLine::get_instance()->a_regenerate_installed_cache.specified() ||
CommandLine::get_instance()->a_regenerate_installable_cache.specified())
{
- if (! CommandLine::get_instance()->empty())
- throw args::DoHelp("regenerate cache actions takes no parameters");
-
return do_regenerate_cache(env, CommandLine::get_instance()->a_regenerate_installed_cache.specified());
}