Imported Upstream version 1.12.3 93/109393/1 upstream/1.12.3
authorDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 10 Jan 2017 05:31:30 +0000 (14:31 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 10 Jan 2017 05:31:32 +0000 (14:31 +0900)
Change-Id: Iebab2f3a8970c9a78d15980727def6fdbea05db8
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
VERSION.cmake
package/zypper.changes
po/zypper-po.tar.bz2
src/bash-completion.sh
src/info.cc
src/repos.cc
src/solve-commit.cc
src/utils/misc.cc
src/utils/misc.h
zypper.spec.cmake

index c6da195..bffb5f0 100644 (file)
@@ -34,7 +34,7 @@
 #
 SET(VERSION_MAJOR "1")
 SET(VERSION_MINOR "12")
-SET(VERSION_PATCH "2")
+SET(VERSION_PATCH "3")
 
-# LAST RELEASED: 1.12.2
+# LAST RELEASED: 1.12.3
 #=======
index 1bf0b44..817849c 100644 (file)
@@ -1,4 +1,24 @@
 -------------------------------------------------------------------
+Wed Jun  3 13:05:29 CEST 2015 - ma@suse.de
+
+- Tab completion for package names in install+remove+update 
+  commands (bnc#928650)
+- Adapt enterprise product detection (bnc#933277)
+- removerepo: Warn user that deleting a service repo is a volatile 
+  change (bnc#929990)
+- version 1.12.3
+
+-------------------------------------------------------------------
+Sun May 31 01:13:12 CEST 2015 - ma@suse.de
+
+- Update zypper-po.tar.bz2
+
+-------------------------------------------------------------------
+Thu May 28 01:14:16 CEST 2015 - ma@suse.de
+
+- Update zypper-po.tar.bz2
+
+-------------------------------------------------------------------
 Sun May 24 18:21:03 CEST 2015 - ma@suse.de
 
 - man: add section about GPG checks
index d54c849..815e692 100644 (file)
Binary files a/po/zypper-po.tar.bz2 and b/po/zypper-po.tar.bz2 differ
index 8744efc..5cc11f9 100644 (file)
@@ -2,10 +2,9 @@
 #
 # A hackweek gift from Marek Stopka <mstopka@opensuse.org>
 # Major rewrite by Josef Reidinger <jreidinger@suse.cz>
-# 2009/02/19 Allow empty spaces in repos names, Werner Fink <werner@suse.de>
+# 2009-02-19 Allow empty spaces in repos names, Werner Fink <werner@suse.de>
+# 2015-04-26 add completion for install+remove+update commands, Bernhard M. Wiedemann <bwiedemann@suse.de>
 #
-# some TODOs:
-# - complete package names for install/remove/update
 
 _strip()
 {
@@ -23,8 +22,28 @@ _strip()
        fi
 }
 
+_installed_packages() {
+       ! [[ $cur =~ / ]] || return
+       grep -s --no-filename "^$cur" "/var/cache/zypp/solv/@System/solv.idx" | cut -f1
+}
+
+_available_solvables2() {
+       local lcur=$1
+       ! [[ $cur =~ / ]] || return # for installing local packages
+       set +o noglob
+       grep -s --no-filename "^$lcur" /var/cache/zypp/solv/*/solv.idx |\
+               cut -f1 | sort --unique
+       set -o noglob
+}
+_available_solvables() {
+       _available_solvables2 "$1:$cur" | sed -e "s/^$1://"
+}
+_available_packages() {
+       [[ $cur ]] || return # this case is too slow with tenthousands of completions
+       _available_solvables2 $cur
+}
+
 _zypper() {
-        ZYPPER_CMDLIST=()
        ZYPPER="$(type -p zypper)"
 
        local noglob=$(shopt -po noglob)
@@ -112,9 +131,12 @@ _zypper() {
        fi
 
        if test -n "$command" ; then
-               opts=$(LC_ALL=POSIX $ZYPPER -q help $command 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//')
+               if ! [[ $cur =~ ^[^-] ]] ; then
+                       opts=$(LC_ALL=POSIX $ZYPPER -q help $command 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//')
+               fi
 
                #handling individual commands if they need more then we can dig from help
+               if ! [[ $cur =~ ^- ]] ; then
                case "$command" in
                        help | \?)
                                opts=(${ZYPPER_CMDLIST[@]})
@@ -146,7 +168,23 @@ _zypper() {
                                                p
                                        }'))
                        ;;
+                       product-info)
+                               opts=(${opts[@]}$(echo; _available_solvables product ))
+                       ;;
+                       pattern-info)
+                               opts=(${opts[@]}$(echo; _available_solvables pattern ))
+                       ;;
+                       patch-info )
+                               opts=(${opts[@]}$(echo; _available_solvables patch ))
+                       ;;
+                       remove | rm | update | up)
+                               opts=(${opts[@]}$(echo; _installed_packages ))
+                       ;;
+                       install | in | source-install | si | download | info | if)
+                               opts=(${opts[@]}$(echo; _available_packages ))
+                       ;;
                esac
+               fi
                IFS=$'\n'
                COMPREPLY=($(compgen -W "${opts[*]}" -- ${cur}))
                _strip
index 03b9159..53ab32c 100644 (file)
@@ -204,8 +204,7 @@ void printPkgInfo(Zypper & zypper, const ui::Selectable & s)
   printNVA(theone.resolvable());
 
   // if running on SUSE Linux Enterprise, report unsupported packages
-  Product::constPtr platform = God->target()->baseProduct();
-  if (platform && platform->name().find("SUSE_SLE") != string::npos)
+  if ( runningOnEnterprise() )
   {
     Package::constPtr pkg = asKind<Package>(theone.resolvable());
     cout << _("Support Level: ") << asUserString(pkg->vendorSupport()) << endl;
index 195a568..b4f9e01 100644 (file)
@@ -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 <typename Target, typename Source>
 void safe_lexical_cast (Source s, Target &tr) {
   try {
@@ -1941,11 +1956,20 @@ ostream& operator << (ostream& s, const vector<T>& 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 ) );
 }
 
 
@@ -2167,8 +2191,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;
 
@@ -2234,10 +2257,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
index 5611510..4f42062 100755 (executable)
@@ -580,8 +580,7 @@ void solve_and_commit (Zypper & zypper)
     }
 
     // if running on SUSE Linux Enterprise, report unsupported packages
-    Product::constPtr platform = God->target()->baseProduct();
-    if (platform && platform->name().find("SUSE_SLE") != string::npos)
+    if ( runningOnEnterprise() )
       summary.setViewOption(Summary::SHOW_UNSUPPORTED);
     else
       summary.unsetViewOption(Summary::SHOW_UNSUPPORTED);
index 84801ed..86131e1 100644 (file)
@@ -17,6 +17,8 @@
 #include <zypp/misc/CheckAccessDeleted.h>
 #include <zypp/ExternalProgram.h>
 
+#include <zypp/ZYpp.h>
+#include <zypp/Target.h>
 #include <zypp/PoolItem.h>
 #include <zypp/Product.h>
 #include <zypp/Pattern.h>
 using namespace std;
 using namespace zypp;
 
+extern ZYpp::Ptr God;
+
+bool runningOnEnterprise()
+{
+  bool ret = false;
+  if ( Target_Ptr target = God->getTarget() )
+    if ( Product::constPtr platform = target->baseProduct() )
+    {
+      static const CpeId enterprise( "cpe:/o:suse:sle%02" );
+      if ( compare( platform->cpeId(), enterprise, SetRelation::subset ) )
+       ret = true;
+    }
+  return ret;
+}
+
 // ----------------------------------------------------------------------------
 
 bool is_changeable_media(const zypp::Url & url)
index faa8672..300b592 100644 (file)
@@ -32,6 +32,11 @@ using namespace zypp;
 
 typedef std::set<zypp::ResKind> ResKindSet;
 
+/** Whether running on SLE.
+ * If so, report e.g. unsupported packages per default.
+ */
+bool runningOnEnterprise();
+
 bool is_changeable_media(const zypp::Url & url);
 
 /** Converts user-supplied kind to zypp::ResKind object.
index a543269..9e3cb49 100644 (file)
@@ -22,7 +22,7 @@ BuildRequires:  boost-devel >= 1.33.1
 BuildRequires:  cmake >= 2.4.6
 BuildRequires:  gcc-c++ >= 4.7
 BuildRequires:  gettext-devel >= 0.15
-BuildRequires:  libzypp-devel >= 15.3.0
+BuildRequires:  libzypp-devel >= 15.3.1
 BuildRequires:  readline-devel >= 5.1
 Requires:       procps
 %if 0%{?suse_version}