Imported Upstream version 1.12.25 14/109414/1 upstream/1.12.25
authorDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 10 Jan 2017 05:45:41 +0000 (14:45 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 10 Jan 2017 05:45:42 +0000 (14:45 +0900)
Change-Id: Ib1cf6464675b766e0dedbdec163fe8360cd104e6
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
VERSION.cmake
doc/zypper.8
doc/zypper.8.txt
package/zypper.changes
po/sle-zypper-po.tar.bz2
po/zypper-po.tar.bz2
src/Zypper.cc
src/bash-completion.sh
src/repos.cc
src/solve-commit.cc
src/utils/text.h

index b46bd41..f29514e 100644 (file)
@@ -34,7 +34,7 @@
 #
 SET(VERSION_MAJOR "1")
 SET(VERSION_MINOR "12")
-SET(VERSION_PATCH "24")
+SET(VERSION_PATCH "25")
 
-# LAST RELEASED: 1.12.24
+# LAST RELEASED: 1.12.25
 #=======
index 799b85a..2a0cd02 100644 (file)
@@ -2,12 +2,12 @@
 .\"     Title: zypper
 .\"    Author: [see the "AUTHORS" section]
 .\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\"      Date: 10/26/2015
+.\"      Date: 10/29/2015
 .\"    Manual: ZYPPER
 .\"    Source: SUSE Linux
 .\"  Language: English
 .\"
-.TH "ZYPPER" "8" "10/26/2015" "SUSE Linux" "ZYPPER"
+.TH "ZYPPER" "8" "10/29/2015" "SUSE Linux" "ZYPPER"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -1928,16 +1928,25 @@ Add the repository as disabled\&. Repositories are added as enabled by default\&
 Probe given URI\&.
 .RE
 .PP
-\fB\-C\fR, \fB\-\-nocheck\fR
+\fB\-C\fR, \fB\-\-no\-check\fR
 .RS 4
 Don\(cqt probe URI, probe later during refresh\&.
 .RE
 .PP
-\fB\-n\fR, \fB\-\-name\fR
+\fB\-n\fR, \fB\-\-name\fR \fIname\fR
 .RS 4
 Specify descriptive name for the repository\&.
 .RE
 .PP
+\fB\-p\fR, \fB\-\-priority\fR \fIpositive\-integer\fR
+.RS 4
+Set the priority of the repository\&. Priority of
+\fB1\fR
+is the highest, the higher the number the lower the priority\&.
+\fB\-p 0\fR
+will set the priority back to the default (\fB99\fR)\&. Packages from repositories with higher priority will be preferred even in case there is a higher installable version available in the repository with a lower priority\&.
+.RE
+.PP
 \fB\-k\fR, \fB\-\-keep\-packages\fR
 .RS 4
 Enable RPM files caching for the repository\&.
@@ -1948,6 +1957,16 @@ Enable RPM files caching for the repository\&.
 Disable RPM files caching\&.
 .RE
 .PP
+\fB\-g\fR, \fB\-\-gpgcheck\fR
+.RS 4
+Enable GPG check for this repository\&.
+.RE
+.PP
+\fB\-G\fR, \fB\-\-no\-gpgcheck\fR
+.RS 4
+Disable GPG check for this repository\&.
+.RE
+.PP
 \fB\-f\fR, \fB\-\-refresh\fR
 .RS 4
 Enable autorefresh of the repository\&. The autorefresh is disabled by default when adding new repositories\&.
@@ -2140,14 +2159,18 @@ Enable auto\-refresh for the repository\&.
 Disable auto\-refresh for the repository\&.
 .RE
 .PP
-\fB\-p\fR, \fB\-\-priority\fR \fIpositive\-integer\fR
+\fB\-n\fR, \fB\-\-name\fR
 .RS 4
-Set priority of the repository\&. Priority of 1 is the highest, the higher the number the lower the priority\&. Default priority is 99\&. Packages from repositories with higher priority will be preferred even in case there is a higher installable version available in the repository with a lower priority\&.
+Set a descriptive name for the repository\&.
 .RE
 .PP
-\fB\-n\fR, \fB\-\-name\fR
+\fB\-p\fR, \fB\-\-priority\fR \fIpositive\-integer\fR
 .RS 4
-Set a descriptive name for the repository\&.
+Set the priority of the repository\&. Priority of
+\fB1\fR
+is the highest, the higher the number the lower the priority\&.
+\fB\-p 0\fR
+will set the priority back to the default (\fB99\fR)\&. Packages from repositories with higher priority will be preferred even in case there is a higher installable version available in the repository with a lower priority\&.
 .RE
 .PP
 \fB\-k\fR, \fB\-\-keep\-packages\fR
@@ -2160,6 +2183,16 @@ Enable RPM files caching\&.
 Disable RPM files caching\&.
 .RE
 .PP
+\fB\-g\fR, \fB\-\-gpgcheck\fR
+.RS 4
+Enable GPG check for this repository\&.
+.RE
+.PP
+\fB\-G\fR, \fB\-\-no\-gpgcheck\fR
+.RS 4
+Disable GPG check for this repository\&.
+.RE
+.PP
 \fB\-a\fR, \fB\-\-all\fR
 .RS 4
 Apply changes to all repositories\&.
index b4a4eaf..71a558d 100644 (file)
@@ -956,18 +956,27 @@ Supported URI formats:
        *-c*, *--check*::
                Probe given URI.
 
-       *-C*, *--nocheck*::
+       *-C*, *--no-check*::
                Don't probe URI, probe later during refresh.
 
-       *-n*, *--name*::
+       *-n*, *--name* 'name'::
                Specify descriptive name for the repository.
 
+       *-p*, *--priority* 'positive-integer'::
+               Set the priority of the repository. Priority of *1* is the highest, the higher the number the lower the priority. *-p 0* will set the priority back to the default (*99*). Packages from repositories with higher priority will be preferred even in case there is a higher installable version available in the repository with a lower priority.
+
        *-k*, *--keep-packages*::
                Enable RPM files caching for the repository.
 
        *-K*, *--no-keep-packages*::
                Disable RPM files caching.
 
+       *-g*, *--gpgcheck*::
+               Enable GPG check for this repository.
+
+       *-G*, *--no-gpgcheck*::
+               Disable GPG check for this repository.
+
        *-f*, *--refresh*::
                Enable autorefresh of the repository. The autorefresh is disabled by default when adding new repositories.
 
@@ -1075,18 +1084,24 @@ Supported URI formats:
        *-R*, *--no-refresh*::
                Disable auto-refresh for the repository.
 
-       *-p*, *--priority* 'positive-integer'::
-               Set priority of the repository. Priority of 1 is the highest, the higher the number the lower the priority. Default priority is 99. Packages from repositories with higher priority will be preferred even in case there is a higher installable version available in the repository with a lower priority.
-
        *-n*, *--name*::
                Set a descriptive name for the repository.
 
+       *-p*, *--priority* 'positive-integer'::
+               Set the priority of the repository. Priority of *1* is the highest, the higher the number the lower the priority. *-p 0* will set the priority back to the default (*99*). Packages from repositories with higher priority will be preferred even in case there is a higher installable version available in the repository with a lower priority.
+
        *-k*, *--keep-packages*::
                Enable RPM files caching.
 
        *-K*, *--no-keep-packages*::
                Disable RPM files caching.
 
+       *-g*, *--gpgcheck*::
+               Enable GPG check for this repository.
+
+       *-G*, *--no-gpgcheck*::
+               Disable GPG check for this repository.
+
        *-a*, *--all*::
                Apply changes to all repositories.
 
index 3a4a15f..6d91ab7 100644 (file)
@@ -1,4 +1,41 @@
 -------------------------------------------------------------------
+Fri Nov  6 11:03:59 CET 2015 - ma@suse.de
+
+- Fix #83 incomplete bash completion for --type
+- Fix typo (bsc#953214)
+- Fix miss aligned output when LANG=C (bsc#951707)
+- Provide --priority option on addrepo command.
+- add/modifyrepo: Support '--priority 0' to restore the default
+  repo priority.
+- Fixed Japanese translations (bsc#949196)
+- version 1.12.25
+
+-------------------------------------------------------------------
+Fri Nov  6 10:56:52 CET 2015 - ma@suse.de
+
+- Update sle-zypper-po.tar.bz2
+
+-------------------------------------------------------------------
+Thu Nov  5 01:15:23 CET 2015 - ma@suse.de
+
+- Update sle-zypper-po.tar.bz2
+
+-------------------------------------------------------------------
+Thu Nov  5 01:13:38 CET 2015 - ma@suse.de
+
+- Update zypper-po.tar.bz2
+
+-------------------------------------------------------------------
+Tue Nov  3 10:52:08 CET 2015 - ma@suse.de
+
+- Update sle-zypper-po.tar.bz2
+
+-------------------------------------------------------------------
+Tue Nov  3 10:51:52 CET 2015 - ma@suse.de
+
+- Update zypper-po.tar.bz2
+
+-------------------------------------------------------------------
 Mon Oct 26 12:29:07 CET 2015 - ma@suse.de
 
 - Add -x shorthand for --match-exact (fixes #64)
index 604ccae..669e2e4 100644 (file)
Binary files a/po/sle-zypper-po.tar.bz2 and b/po/sle-zypper-po.tar.bz2 differ
index c1e1fe5..b41a429 100644 (file)
Binary files a/po/zypper-po.tar.bz2 and b/po/zypper-po.tar.bz2 differ
index edc1058..93c8fd6 100644 (file)
@@ -1694,6 +1694,7 @@ void Zypper::processCommandOptions()
       {"check", no_argument, 0, 'c'},
       {"no-check", no_argument, 0, 'C'},
       {"name", required_argument, 0, 'n'},
+      {"priority", required_argument, 0, 'p'},
       {"keep-packages", no_argument, 0, 'k'},
       {"no-keep-packages", no_argument, 0, 'K'},
       {"gpgcheck", no_argument, 0, 'g'},
@@ -1711,17 +1712,18 @@ void Zypper::processCommandOptions()
       " or can be read from specified .repo file (even remote).\n"
       "\n"
       "  Command options:\n"
-      "-r, --repo <file.repo>  Just another means to specify a .repo file to read.\n"
-      "-t, --type <type>       Type of repository (%s).\n"
-      "-d, --disable           Add the repository as disabled.\n"
-      "-c, --check             Probe URI.\n"
-      "-C, --no-check          Don't probe URI, probe later during refresh.\n"
-      "-n, --name <name>       Specify descriptive name for the repository.\n"
-      "-k, --keep-packages     Enable RPM files caching.\n"
-      "-K, --no-keep-packages  Disable RPM files caching.\n"
-      "-g, --gpgcheck          Enable GPG check for this repository.\n"
-      "-G, --no-gpgcheck       Disable GPG check for this repository.\n"
-      "-f, --refresh           Enable autorefresh of the repository.\n"
+      "-r, --repo <file.repo>    Just another means to specify a .repo file to read.\n"
+      "-t, --type <type>         Type of repository (%s).\n"
+      "-d, --disable             Add the repository as disabled.\n"
+      "-c, --check               Probe URI.\n"
+      "-C, --no-check            Don't probe URI, probe later during refresh.\n"
+      "-n, --name <name>         Specify descriptive name for the repository.\n"
+      "-p, --priority <integer>  Set priority of the repository.\n"
+      "-k, --keep-packages       Enable RPM files caching.\n"
+      "-K, --no-keep-packages    Disable RPM files caching.\n"
+      "-g, --gpgcheck            Enable GPG check for this repository.\n"
+      "-G, --no-gpgcheck         Disable GPG check for this repository.\n"
+      "-f, --refresh             Enable autorefresh of the repository.\n"
     ), "yast2, rpm-md, plaindir");
     break;
   }
@@ -2766,7 +2768,7 @@ void Zypper::processCommandOptions()
     .option( "-s, --short",    // translators: -s, --short
             _("Create a short table not showing the deleted files. Given twice, show only processes which are associated with a system service. Given three times, list the associated system service names only.") )
     .option( "--print <format>",       // translators: --print <format>
-            _("For each associated system service print <format> on the standard output, followed by a newline. Any '%s' directive in <format> is replaced by the the system service name.") )
+            _("For each associated system service print <format> on the standard output, followed by a newline. Any '%s' directive in <format> is replaced by the system service name.") )
     ;
     break;
   }
index 5bccde5..1a23cd7 100644 (file)
@@ -92,7 +92,7 @@ _zypper() {
 
        case "$prev" in
                "--type" | "-t")
-                       opts=(package patch pattern product)
+                       opts=(package patch pattern product srcpackage application)
                        COMPREPLY=($(compgen -W "${opts[*]}" -- ${cur}))
                        _strip
                        eval $noglob
index c2b1520..5721840 100644 (file)
@@ -70,6 +70,31 @@ void safe_lexical_cast (Source s, Target &tr) {
   }
 }
 
+unsigned parse_priority(Zypper & zypper)
+{
+  //! \todo use some preset priorities (high, medium, low, ...)
+  unsigned ret = 0U;
+  parsed_opts::const_iterator cArg = zypper.cOpts().find("priority");
+  if ( cArg == zypper.cOpts().end() )
+    return ret;     // 0: no --priority arg
+
+  int prio = -1;
+  std::string prio_str = *cArg->second.begin();
+  safe_lexical_cast(prio_str, prio); // try to make an int out of the string
+
+  if ( prio < 0 )
+  {
+    zypper.out().error(boost::str(format(
+      _("Invalid priority '%s'. Use a positive integer number. The greater the number, the lower the priority."))
+      % prio_str));
+    zypper.setExitCode(ZYPPER_EXIT_ERR_INVALID_ARGS);
+    ZYPP_THROW(ExitRequestException("Invalid priority."));
+  }
+
+  ret = ( prio ? unsigned(prio) : RepoInfo::defaultPriority() );
+  return ret;
+}
+
 // | Enabled | GPG Check |  Colored strings for enabled and GPG Check status
 // +---------+-----------+
 // | Yes     | (  ) No   |
@@ -1726,6 +1751,8 @@ void add_repo(Zypper & zypper, RepoInfo & repo)
     // translators: property name; short; used like "Name: value"
     p.add( _("GPG Check"),     repo.gpgCheck() ).paint( ColorContext::MSG_WARNING, repo.gpgCheck() == false );
     // translators: property name; short; used like "Name: value"
+    p.add( _("Priority"),      repo.priority() );
+    // translators: property name; short; used like "Name: value"
     p.add( _("URI"),           repo.baseUrlsBegin(), repo.baseUrlsEnd() );
     s << p;
   }
@@ -1771,6 +1798,8 @@ void add_repo_by_url( Zypper & zypper,
   MIL << "going to add repository by url (alias=" << alias << ", url=" << url
       << ")" << endl;
 
+  unsigned prio = parse_priority(zypper);
+
   RepoInfo repo;
 
   if ( ! type.empty() )
@@ -1782,6 +1811,9 @@ void add_repo_by_url( Zypper & zypper,
     repo.setName(it->second.front());
   repo.addBaseUrl(url);
 
+  if (prio >= 1)
+    repo.setPriority(prio);
+
   // enable the repo by default
   if ( indeterminate(enabled) )
     enabled = true;
@@ -1814,6 +1846,8 @@ void add_repo_from_file( Zypper & zypper,
     return;
   }
 
+  unsigned prio = parse_priority(zypper);
+
   list<RepoInfo> repos;
 
   // read the repo file
@@ -1883,6 +1917,9 @@ void add_repo_from_file( Zypper & zypper,
     if ( !indeterminate(gpgCheck) )
       repo.setGpgCheck(gpgCheck);
 
+    if (prio >= 1)
+      repo.setPriority(prio);
+
     MIL << "to-be-added: enabled: " << repo.enabled() << " autorefresh: " << repo.autorefresh() << endl;
 
     add_repo(zypper, repo);
@@ -2058,6 +2095,8 @@ void modify_repo(Zypper & zypper, const string & alias)
       zypper, "gpgcheck", "no-gpgcheck");
   DBG << "gpgCheck = " << gpgCheck << endl;
 
+  unsigned prio = parse_priority(zypper);
+
   try
   {
     RepoManager & manager = zypper.repoManager();
@@ -2096,24 +2135,9 @@ void modify_repo(Zypper & zypper, const string & alias)
       repo.setGpgCheck(gpgCheck);
     }
 
-    long long prio = 0;
-    parsed_opts::const_iterator tmp1;
-    if ((tmp1 = zypper.cOpts().find("priority")) != zypper.cOpts().end())
+    if (prio >= 1)
     {
-      //! \todo use some preset priorities (high, medium, low, ...)
-
-      string prio_str = *tmp1->second.begin();
-      safe_lexical_cast(prio_str, prio); // try to make an int out of the string
-      if (prio < 1)
-      {
-        zypper.out().error(boost::str(format(
-          _("Invalid priority '%s'. Use a positive integer number. The greater the number, the lower the priority."))
-          % prio_str));
-        zypper.setExitCode(ZYPPER_EXIT_ERR_INVALID_ARGS);
-        return;
-      }
-
-      if (prio == (int) repo.priority())
+      if (prio == repo.priority())
         zypper.out().info(boost::str(format(
           _("Repository '%s' priority has been left unchanged (%d)"))
           % alias % prio));
@@ -2125,6 +2149,7 @@ void modify_repo(Zypper & zypper, const string & alias)
     }
 
     string name;
+    parsed_opts::const_iterator tmp1;
     if ((tmp1 = zypper.cOpts().find("name")) != zypper.cOpts().end())
     {
       name = *tmp1->second.begin();
index 22c9023..7e8e9a1 100755 (executable)
@@ -805,7 +805,6 @@ void solve_and_commit (Zypper & zypper)
           gData.show_media_progress_hack = false;
          gData.entered_commit = false;
 
-         USR << dump(result.transaction()) << endl;
          if ( !result.allDone() && !( copts.count("dry-run") && result.noError() ) )
          { zypper.setExitCode( result.attemptToModify() ? ZYPPER_EXIT_ERR_COMMIT : ZYPPER_EXIT_ERR_ZYPP ); }   // error message comes later....
 
index b60578b..70791af 100644 (file)
@@ -22,6 +22,50 @@ using std::endl;
 namespace mbs
 {
 #define ZYPPER_TRACE_MBS 0
+
+  struct MbToWc
+  {
+    static const char _oooooooo = 0000;
+    static const char _Xooooooo = 0200;
+    static const char _XXoooooo = 0300;
+    static const char _XXXooooo = 0340;
+    static const char _XXXXoooo = 0360;
+    static const char _XXXXXooo = 0370;
+    static const char _ooXXXXXX = 0077;
+
+    MbToWc( char ch )
+    : _wc( ch )
+    , _cont( -1 )
+    {
+      if      ( (_wc & _XXXooooo) == _XXoooooo )       // '110xxxxx'
+      { _wc &= ~_XXXooooo; _cont = 1; }
+      else if ( (_wc & _XXXXoooo) == _XXXooooo )       // '1110xxxx'
+      { _wc &= ~_XXXXoooo; _cont = 2; }
+      else if ( (_wc & _XXXXXooo) == _XXXXoooo )       // '11110xxx'
+      { _wc &= ~_XXXXXooo; _cont = 3; }
+      else if ( (_wc & _Xooooooo) == _oooooooo )       // '0xxxxxxx'
+      { _cont = 0; }
+      else                                             // something broken
+      { _wc = L'?'; }
+    }
+
+    bool add( char ch ) // return whether ch is a continuation char
+    {
+      if ( (ch & _XXoooooo) == _Xooooooo )     // '10xxxxxx'
+      {
+       if ( _cont > 0 )
+       { _wc = (_wc<<6)+(ch & _ooXXXXXX); --_cont; }
+       return true;
+      }
+      if ( _cont > 0 )                         // error, else ignore excess chars
+      { _wc = L'?'; _cont = -1; }
+      return false;
+    }
+
+    wchar_t _wc;
+    char _cont;
+  };
+
   ///////////////////////////////////////////////////////////////////
   /// \class MbsIterator
   /// \brief Iterate chars and ANSI SGR in a multi-byte character string
@@ -40,6 +84,7 @@ namespace mbs
     , _tpos( _text.data() )
     , _trest( _text.size() )
     , _tread( 0 )
+    , _cols( size_t(-1) )
     , _wc( L'\0' )
     { memset( &_mbstate, 0, sizeof(_mbstate) ); operator++(); }
 
@@ -49,7 +94,21 @@ namespace mbs
 
     const char * pos() const           { return _tpos; }
     size_t       size() const          { return _tread; }
-    size_t       columns() const       { size_t ret = ::wcwidth(_wc); if ( ret == size_t(-1) ) ret = 0; return ret; }
+    size_t       columns() const
+    {
+      if ( _cols == size_t(-1) )
+      {
+       if ( _wc < L' ' )
+         _cols = 0;    // CTRLs
+       else
+       {
+         _cols = ::wcwidth( _wc );
+         if ( _cols == size_t(-1) )
+           _cols = 1;  // -1 due to LC_CTYPE?
+       }
+      }
+      return _cols;
+    }
 
     boost::string_ref ref() const      { return boost::string_ref( _tpos, _tread ); }
 
@@ -65,13 +124,26 @@ namespace mbs
        _tpos += _tread;
        _trest -= _tread;
        _tread = ::mbrtowc( &_wc, _tpos, _trest, &_mbstate );
+       _cols = size_t(-1);
+
+       if ( _tread >= (size_t)-2 )
+       {
+         // common case is -1 due to LC_CTYPE
+         // skip this and continue with next mb
+         memset( &_mbstate, 0, sizeof(_mbstate) );
+         _tread = 1;
+         MbToWc c( *_tpos );
+         while ( c.add( *(_tpos+_tread) ) )
+           _tread += 1;
+         _wc = c._wc;
+       }
 
        switch ( _tread )
        {
-         case (size_t)-2:
-         case (size_t)-1:
-           _tread = 0;
-           // fall through
+//       case (size_t)-2:
+//       case (size_t)-1:
+//         _tread = 0;
+//         // fall through
          case 0:
            _trest = 0; // atEnd
            _wc = L'\0';
@@ -120,6 +192,7 @@ namespace mbs
     const char *       _tpos;  // start of last ::mbrtowc
     size_t             _trest; // _tpos to end of string
     size_t             _tread; // consumed in last ::mbrtowc
+    mutable size_t     _cols;  // number of columns occupied on screen
 
     wchar_t            _wc;    // result of last ::mbrtowc
     mbstate_t          _mbstate;