From 87d5ba5dcb59c7947616937f48e9d862d0d6f934 Mon Sep 17 00:00:00 2001 From: Michael Andres Date: Mon, 14 Jul 2014 17:49:27 +0200 Subject: [PATCH] refresh-services: add option --restore-status to undo user modifications --- doc/zypper.8 | 20 +++++++++++++------- src/Zypper.cc | 8 +++++--- src/repos.cc | 9 +++++++-- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/doc/zypper.8 b/doc/zypper.8 index eb38e6d..f7c6860 100644 --- a/doc/zypper.8 +++ b/doc/zypper.8 @@ -1537,18 +1537,24 @@ Sort the list by name. .TP .B refresh-services (refs) [options] ... -Refreshing a service mean executing the service's special task. +Refreshing a service means executing the service's special task. RIS services add, remove, or modify repositories on your system based on -current content of the repository index. Services only manage defined -repositories, they do not refresh them. To refresh also repositories, -use \fI\-\-with\-repos\fR option or the \fBrefresh\fR command. +current content of the repository index. A differing enabled/disabled +state caused by manually calling \fBmodify-repo\fR on a service repository +however will not be reverted unless the \fI\-\-restore\-status\fR option is used, +or the repository index explicitly requests the change. + +Services only manage defined repositories, they do not refresh them. To refresh also +repositories, use \fI\-\-with\-repos\fR option or the \fBrefresh\fR command. .TP .I \-r, \-\-with\-repos -Refresh also repositories. - -TODO more info +Refresh also the service repositories. +.TP +.I \-R, \-\-restore\-status +Also restore service repositories enabled/disabled state to the repository index default. +Useful after you manually changed some service repositories enabled state. .SS Package Locks Management diff --git a/src/Zypper.cc b/src/Zypper.cc index 0548a72..88f1917 100644 --- a/src/Zypper.cc +++ b/src/Zypper.cc @@ -1456,8 +1456,9 @@ void Zypper::processCommandOptions() case ZypperCommand::REFRESH_SERVICES_e: { static struct option options[] = { - {"help", no_argument, 0, 'h'}, - {"with-repos", no_argument, 0, 'r'}, + {"help", no_argument, 0, 'h'}, + {"with-repos", no_argument, 0, 'r'}, + {"restore-status", no_argument, 0, 'R'}, {0, 0, 0, 0} }; specific_options = options; @@ -1467,7 +1468,8 @@ void Zypper::processCommandOptions() "Refresh defined repository index services.\n" "\n" " Command options:\n" - "-r, --with-repos Refresh also repositories.\n" + "-r, --with-repos Refresh also the service repositories.\n" + "-R, --restore-status Also restore service repositories enabled/disabled state.\n" ); break; } diff --git a/src/repos.cc b/src/repos.cc index 065fd3f..db59ce1 100644 --- a/src/repos.cc +++ b/src/repos.cc @@ -662,7 +662,7 @@ void do_init_repos(Zypper & zypper, const Container & container) // disabled repos may get temp. enabled to check for --plus-content bool contentcheck = false; - if ( ! ( gData.additional_content_repos.empty() + if ( ! ( gData.additional_content_repos.empty() || repo.url().schemeIsVolatile() || repo.enabled() ) ) { @@ -2741,7 +2741,12 @@ static bool refresh_service(Zypper & zypper, const ServiceInfo & service) { zypper.out().info( str::form(_("Refreshing service '%s'."), service.asUserString().c_str())); - manager.refreshService(service); + + RepoManager::RefreshServiceOptions opts; + if ( zypper.cOpts().count("restore-status") ) + opts |= RepoManager::RefreshService_restoreStatus; + + manager.refreshService( service, opts ); error = false; } catch ( const repo::ServicePluginInformalException & e ) -- 2.7.4