Imported Upstream version 16.9.0 upstream/16.9.0
authorDongHun Kwak <dh0128.kwak@samsung.com>
Mon, 2 Sep 2019 07:13:02 +0000 (16:13 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Mon, 2 Sep 2019 07:13:02 +0000 (16:13 +0900)
VERSION.cmake
package/libzypp.changes
po/hu.po
zypp/PoolQuery.cc
zypp/base/StrMatcher.cc
zypp/base/StrMatcher.h

index 7dcc9ce..32d8eff 100644 (file)
@@ -60,9 +60,9 @@
 #
 SET(LIBZYPP_MAJOR "16")
 SET(LIBZYPP_COMPATMINOR "0")
-SET(LIBZYPP_MINOR "8")
+SET(LIBZYPP_MINOR "9")
 SET(LIBZYPP_PATCH "0")
 #
-# LAST RELEASED: 16.8.0 (0)
+# LAST RELEASED: 16.9.0 (0)
 # (The number in parenthesis is LIBZYPP_COMPATMINOR)
 #=======
index 52a25ab..0b3f172 100644 (file)
@@ -1,4 +1,11 @@
 -------------------------------------------------------------------
+Thu Apr 27 16:03:32 CEST 2017 - ma@suse.de
+
+- PoolQuery: Treat explicit queries for 'kind:name' correctly
+  (bsc#1035729)
+- version 16.9.0 (0)
+
+-------------------------------------------------------------------
 Fri Apr 21 16:23:51 CEST 2017 - ma@suse.de
 
 - Add API to control resolver job to update all packages (FATE#320653)
index 13482ef..b30f8dc 100644 (file)
--- a/po/hu.po
+++ b/po/hu.po
@@ -19,8 +19,8 @@ msgstr ""
 "Project-Id-Version: zypp.hu\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2016-11-21 15:07+0100\n"
-"PO-Revision-Date: 2017-04-20 15:38+0000\n"
-"Last-Translator: Robert Taisz <robert.taisz@emerald.hu>\n"
+"PO-Revision-Date: 2017-04-21 14:59+0000\n"
+"Last-Translator: Janos Stampf <jstampf@consell.hu>\n"
 "Language-Team: Hungarian "
 "<https://l10n.opensuse.org/projects/libzypp/master/hu/>\n"
 "Language: hu\n"
@@ -66,7 +66,7 @@ msgstr "Rekurzív mutex attribútum nem állítható be"
 
 #: zypp/thread/Mutex.cc:47
 msgid "Can't initialize recursive mutex"
-msgstr "A rekurzív mutex attribútum nem inicializálható"
+msgstr "A rekurzív mutex attribútum inicializációja sikertelen"
 
 #: zypp/thread/Mutex.cc:77
 msgid "Can't acquire the mutex lock"
@@ -132,7 +132,7 @@ msgstr " végrehajtás sikertelen"
 #: zypp/target/TargetImpl.cc:449
 #, c-format, boost-format
 msgid "%s already executed as %s)"
-msgstr "%s már futtatva volt: %s)"
+msgstr "%s már futtatva volt mint %s)"
 
 #: zypp/target/TargetImpl.cc:459
 msgid " execution skipped while aborting"
index 5fe838e..1e5c6ab 100644 (file)
@@ -179,6 +179,13 @@ namespace zypp
      * match, it's also suitable for sub-structure (flexarray) inspection
      * (\see \ref sat::LookupAttr::iterator::solvAttrSubEntry).
      *
+     * (bsc#1035729) If SolvAttr::name searches for an explicit \c kind:name,
+     * this \c kind is stored in \ref kindPredicate and will overwrite any
+     * 'global' kind restriction applied via \ref PoolQuery::addKind. This
+     * task can't be passed off to a predicate, as \ref PoolQueryMatcher::isAMatch
+     * must accept only explicit-kind-checking predicate matches, in case the
+     * 'global' kind restriction woudl otherwise discard the match.
+     *
      * \note: \see \ref addPredicate for further constraints.
      */
     struct AttrMatchData
@@ -191,6 +198,10 @@ namespace zypp
       AttrMatchData()
       {}
 
+      AttrMatchData( sat::SolvAttr attr_r )
+        : attr( attr_r )
+      {}
+
       AttrMatchData( sat::SolvAttr attr_r, const StrMatcher & strMatcher_r )
         : attr( attr_r )
         , strMatcher( strMatcher_r )
@@ -301,15 +312,18 @@ namespace zypp
      }
 
       sat::SolvAttr    attr;
-      StrMatcher strMatcher;
+      StrMatcher       strMatcher;
       Predicate        predicate;
       std::string      predicateStr;
+      ResKind          kindPredicate = ResKind::nokind;        // holds the 'kind' part if SolvAttr:name looks for an explicit 'kind:name'
     };
 
     /** \relates AttrMatchData */
     inline std::ostream & operator<<( std::ostream & str, const AttrMatchData & obj )
     {
       str << obj.attr << ": " << obj.strMatcher;
+      if ( obj.kindPredicate )
+        str << " +(" << obj.kindPredicate << ")";
       if ( obj.predicate )
         str << " +(" << obj.predicateStr << ")";
       return str;
@@ -620,9 +634,10 @@ attremptycheckend:
           if ( joined.size() > 1 ) // switch to regex for multiple strings
             cflags.setModeRegex();
 
-          _attrMatchList.push_back( AttrMatchData( it->attr,
-                                    StrMatcher( rcstrings, cflags ),
-                                                      it->predicate, it->predicateStr ) );
+         // copy and exchange the StrMatcher
+         AttrMatchData nattr( *it );
+         nattr.strMatcher = StrMatcher( rcstrings, cflags ),
+          _attrMatchList.push_back( std::move(nattr) );
         }
         else
         {
@@ -859,10 +874,14 @@ attremptycheckend:
 
   void PoolQuery::addDependency( const sat::SolvAttr & attr, const std::string & name, const Rel & op, const Edition & edition, const Arch & arch )
   {
+    // SolvAttr::name with explicit 'kind:name' will overwrite the default _kinds
+    ResKind explicitKind;
+    if ( attr == sat::SolvAttr::name ) explicitKind = ResKind::explicitBuiltin( name );
+
     switch ( op.inSwitch() )
     {
       case Rel::ANY_e: // no additional constraint on edition.
-        if ( arch.empty() )    // no additional constraint on arch.
+        if ( arch.empty() && !explicitKind )   // no additional constraint on arch/kind
        {
          addAttribute( attr, name );
          return;
@@ -878,7 +897,15 @@ attremptycheckend:
 
     // Match::OTHER indicates need to compile
     // (merge global search strings into name).
-    AttrMatchData attrMatchData( attr, StrMatcher( name, Match::OTHER ) );
+    AttrMatchData attrMatchData( attr );
+    if ( !explicitKind )
+      attrMatchData.strMatcher = StrMatcher( name, Match::OTHER );
+    else
+    {
+      // ResKind::explicitBuiltin call above asserts the presence of the ':' in name
+      attrMatchData.strMatcher = StrMatcher( strchr( name.c_str(), ':')+1, Match::OTHER );
+      attrMatchData.kindPredicate = explicitKind;
+    }
 
     if ( isDependencyAttribute( attr ) )
       attrMatchData.addPredicate( EditionRangePredicate( op, edition, arch ) );
@@ -1614,19 +1641,18 @@ attremptycheckend:
          }
          /////////////////////////////////////////////////////////////////////
          sat::Solvable inSolvable( base_r.inSolvable() );
-         // Kind restriction:
-         if ( ! _kinds.empty() && ! inSolvable.isKind( _kinds.begin(), _kinds.end() ) )
-         {
-            base_r.nextSkipSolvable();
-            return false;
-         }
-
          // Edition restriction:
          if ( _op != Rel::ANY && !compareByRel( _op, inSolvable.edition(), _edition, Edition::Match() ) )
          {
            base_r.nextSkipSolvable();
            return false;
          }
+
+         // Kind restriction:
+         // Delay the decision to nextSkipSolvable and return false, as there may be
+         // some explicit kind:name predicate which overrules the global kinds.
+         bool globalKindOk =( _kinds.empty() || inSolvable.isKind( _kinds.begin(), _kinds.end() ) );
+
          /////////////////////////////////////////////////////////////////////
          // string and predicate matching:
 
@@ -1634,17 +1660,38 @@ attremptycheckend:
           {
             // String matching was done by the base iterator.
             // Now check any predicate:
-            const AttrMatchData::Predicate & predicate( _attrMatchList.front().predicate );
-            if ( ! predicate || predicate( base_r ) )
+           const AttrMatchData & matchData( _attrMatchList.front() );
+
+           if ( matchData.kindPredicate )
+           {
+             if ( matchData.kindPredicate != inSolvable.kind() )
+             {
+               base_r.nextSkipSolvable();      // this matchData will never match in this solvable
+               return false;
+             }
+           }
+           else if ( !globalKindOk )
+             return false;                     // only matching kindPredicate could overwrite this
+
+            if ( !matchData.predicate || matchData.predicate( base_r ) )
               return true;
 
-            return false; // no skip as there may be more occurrences od this attr.
+            return false; // no skip as there may be more occurrences in this solvable of this attr.
           }
 
           // Here: search all attributes ;(
           for_( mi, _attrMatchList.begin(), _attrMatchList.end() )
           {
             const AttrMatchData & matchData( *mi );
+
+           if ( matchData.kindPredicate )
+           {
+             if ( matchData.kindPredicate != inSolvable.kind() )
+               continue;                       // this matchData does not apply
+           }
+           else if ( !globalKindOk )
+             continue;                         // only matching kindPredicate could overwrite this
+
             sat::LookupAttr q( matchData.attr, inSolvable );
             if ( matchData.strMatcher ) // an empty searchstring matches always
               q.setStrMatcher( matchData.strMatcher );
index 6042324..277cb2c 100644 (file)
@@ -170,8 +170,8 @@ namespace zypp
     Impl()
     {}
 
-    Impl( const std::string & search_r, const Match & flags_r )
-    : _search( search_r )
+    Impl( std::string search_r, const Match & flags_r )
+    : _search( std::move(search_r) )
     , _flags( flags_r )
     {}
 
@@ -215,8 +215,8 @@ namespace zypp
     { return _search; }
 
     /** Set a new searchstring. */
-    void setSearchstring( const std::string & string_r )
-    { invalidate(); _search = string_r; }
+    void setSearchstring( std::string string_r )
+    { invalidate(); _search = std::move(string_r); }
 
     /** The current search flags. */
     const Match & flags() const
@@ -264,18 +264,30 @@ namespace zypp
   StrMatcher::StrMatcher( const std::string & search_r )
   : _pimpl( new Impl( search_r, Match::STRING ) )
   {}
+  StrMatcher::StrMatcher( std::string && search_r )
+  : _pimpl( new Impl( std::move(search_r), Match::STRING ) )
+  {}
 
   StrMatcher::StrMatcher( const std::string & search_r, const Match & flags_r )
   : _pimpl( new Impl( search_r, flags_r ) )
   {}
+  StrMatcher::StrMatcher( std::string && search_r, const Match & flags_r )
+  : _pimpl( new Impl( std::move(search_r), flags_r ) )
+  {}
 
   StrMatcher::StrMatcher( const std::string & search_r, const Match::Mode & flags_r )
   : _pimpl( new Impl( search_r, flags_r ) )
   {}
+  StrMatcher::StrMatcher( std::string && search_r, const Match::Mode & flags_r )
+  : _pimpl( new Impl( std::move(search_r), flags_r ) )
+  {}
 
   StrMatcher::StrMatcher( const std::string & search_r, int flags_r )
   : _pimpl( new Impl( search_r, Match(flags_r) ) )
   {}
+  StrMatcher::StrMatcher( std::string && search_r, int flags_r )
+  : _pimpl( new Impl( std::move(search_r), Match(flags_r) ) )
+  {}
 
   void StrMatcher::compile() const
   { return _pimpl->compile(); }
@@ -291,12 +303,19 @@ namespace zypp
 
   void StrMatcher::setSearchstring( const std::string & string_r )
   { _pimpl->setSearchstring( string_r ); }
+  void StrMatcher::setSearchstring( std::string && string_r )
+  { _pimpl->setSearchstring( std::move(string_r) ); }
 
   void StrMatcher::setSearchstring( const std::string & string_r, const Match & flags_r )
   {
     _pimpl->setSearchstring( string_r );
     _pimpl->setFlags( flags_r );
   }
+  void StrMatcher::setSearchstring( std::string && string_r, const Match & flags_r )
+  {
+    _pimpl->setSearchstring( std::move(string_r) );
+    _pimpl->setFlags( flags_r );
+  }
 
   const Match & StrMatcher::flags() const
   { return _pimpl->flags(); }
index 7265efb..8e28ca6 100644 (file)
@@ -311,18 +311,26 @@ namespace zypp
 
     /** Ctor from string matches in \ref Match::STRING mode per default. */
     StrMatcher( const std::string & search_r );
+    /** \overload for rvalues */
+    StrMatcher( std::string && search_r );
 
     /** Ctor taking string and \ref Match flags. */
     StrMatcher( const std::string & search_r, const Match & flags_r );
+    /** \overload for rvalues */
+    StrMatcher( std::string && search_r, const Match & flags_r );
 
     /** Ctor taking string and \ref Match::Mode.
      * Needed because we want them to be treated as \ref Match,
      * and not as \ref int as the compiler woud do.
      */
     StrMatcher( const std::string & search_r, const Match::Mode & flags_r );
+    /** \overload for rvalues */
+    StrMatcher( std::string && search_r, const Match::Mode & flags_r );
 
     /** Low level interface wraps \a flags into \ref Match. */
     StrMatcher( const std::string & search_r, int flags_r );
+    /** \overload for rvalues */
+    StrMatcher( std::string && search_r, int flags_r );
 
     /** Evaluate in a boolean context <tt>( ! searchstring().empty() )</tt>. */
     explicit operator bool() const
@@ -347,9 +355,13 @@ namespace zypp
 
     /** Set a new searchstring. */
     void setSearchstring( const std::string & string_r );
+    /** \overload for rvalues */
+    void setSearchstring( std::string && string_r );
 
     /** Set a new searchstring and flags. */
     void setSearchstring( const std::string & string_r, const Match & flags_r );
+    /** \overload for rvalues */
+    void setSearchstring( std::string && string_r, const Match & flags_r );
 
     /** The current search flags. */
     const Match & flags() const;