From af8563b06af2eb03e180b79fea0443908984a319 Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Tue, 10 Jan 2017 14:25:34 +0900 Subject: [PATCH] Imported Upstream version 1.11.30 Change-Id: I87c2959a3fa33b5fcc020d202c6a46efc197e6f3 Signed-off-by: DongHun Kwak --- VERSION.cmake | 4 ++-- package/zypper.changes | 6 ++++++ src/repos.cc | 36 ++++++++++++++++++++++++++++-------- 3 files changed, 36 insertions(+), 10 deletions(-) diff --git a/VERSION.cmake b/VERSION.cmake index 3d2b205..a5b215c 100644 --- a/VERSION.cmake +++ b/VERSION.cmake @@ -34,7 +34,7 @@ # SET(VERSION_MAJOR "1") SET(VERSION_MINOR "11") -SET(VERSION_PATCH "29") +SET(VERSION_PATCH "30") -# LAST RELEASED: 1.11.29 +# LAST RELEASED: 1.11.30 #======= diff --git a/package/zypper.changes b/package/zypper.changes index 67eacae..df68cce 100644 --- a/package/zypper.changes +++ b/package/zypper.changes @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Mon Jun 1 16:17:02 CEST 2015 - ma@suse.de + +- removerepo: Warn user that deleting a service repo is a volatile change (bnc#929990) +- version 1.11.30 + +------------------------------------------------------------------- Wed May 6 12:44:02 CEST 2015 - ma@suse.de - Clarify 'zypper lp --date' description (bnc#929593) diff --git a/src/repos.cc b/src/repos.cc index 1493212..fe8a04d 100644 --- a/src/repos.cc +++ b/src/repos.cc @@ -46,6 +46,21 @@ static bool refresh_service(Zypper & zypper, const ServiceInfo & service); // ---------------------------------------------------------------------------- +inline std::string volatileTag() +{ + // translators: used as 'XYZ changed to SOMETHING [volatile]' to tag specific property changes. + return std::string( " [" + ColorString( ColorContext::MSG_WARNING, _("volatile") ).str() + "]" ); +} + +inline std::string volatileServiceRepoChange( const RepoInfo & repo_r ) +{ + return boost::str(format( + // translators: 'Volatile' refers to changes we previously tagged as 'XYZ changed to SOMETHING [volatile]' + _("Repo '%1%' is managed by service '%2%'. Volatile changes are reset by the next service refresh!") + ) % repo_r.alias() % repo_r.service() ); +} + + template void safe_lexical_cast (Source s, Target &tr) { try { @@ -1885,11 +1900,20 @@ ostream& operator << (ostream& s, const vector& v) { void remove_repo(Zypper & zypper, const RepoInfo & repoinfo) { + bool isServiceRepo = !repoinfo.service().empty(); + RepoManager & manager = zypper.repoManager(); manager.removeRepository(repoinfo); - zypper.out().info(boost::str( - format(_("Repository '%s' has been removed.")) % repoinfo.asUserString())); + + std::string msg(boost::str(format(_("Repository '%s' has been removed.")) % repoinfo.asUserString())); + if ( isServiceRepo ) + msg += volatileTag(); // '[volatile]' + + zypper.out().info( msg ); MIL << format("Repository '%s' has been removed.") % repoinfo.alias() << endl; + + if ( isServiceRepo ) + zypper.out().warning( volatileServiceRepoChange( repoinfo ) ); } @@ -2111,8 +2135,7 @@ void modify_repo(Zypper & zypper, const string & alias) std::string volatileNote; // service repos changes may be volatile if ( ! repo.service().empty() ) { - // translators: used as 'XYZ changed to SOMETHING [volatile]' to tag specific property changes. - volatileNote = std::string( " [" + ColorString( ColorContext::MSG_WARNING, _("volatile") ).str() + "]" ); + volatileNote = volatileTag(); // '[volatile]' } bool didVolatileChanges = false; @@ -2178,10 +2201,7 @@ void modify_repo(Zypper & zypper, const string & alias) if ( didVolatileChanges ) { - zypper.out().warning(boost::str(format( - // translators: 'Volatile' refers to changes we previously tagged as 'XYZ changed to SOMETHING [volatile]' - _("Repo '%1%' is managed by service '%2%'. Volatile changes are reset by the next service refresh!") - ) % alias % repo.service() )); + zypper.out().warning( volatileServiceRepoChange( repo ) ); } } else -- 2.7.4