Hello community, here is the log from the commit of package libzypp for openSUSE:Factory checked in at 2017-05-04 08:51:35 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libzypp (Old) and /work/SRC/openSUSE:Factory/.libzypp.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "libzypp" Thu May 4 08:51:35 2017 rev:379 rq:491631 version:16.9.0 Changes: -------- --- /work/SRC/openSUSE:Factory/libzypp/libzypp.changes 2017-04-25 08:56:48.742762203 +0200 +++ /work/SRC/openSUSE:Factory/.libzypp.new/libzypp.changes 2017-05-04 08:51:37.492488080 +0200 @@ -1,0 +2,7 @@ +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) + +------------------------------------------------------------------- Old: ---- libzypp-16.8.0.tar.bz2 New: ---- libzypp-16.9.0.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libzypp.spec ++++++ --- /var/tmp/diff_new_pack.cOcGYn/_old 2017-05-04 08:51:38.524342560 +0200 +++ /var/tmp/diff_new_pack.cOcGYn/_new 2017-05-04 08:51:38.528341996 +0200 @@ -19,7 +19,7 @@ %define force_gcc_46 0 Name: libzypp -Version: 16.8.0 +Version: 16.9.0 Release: 0 Url: git://gitorious.org/opensuse/libzypp.git Summary: Package, Patch, Pattern, and Product Management ++++++ libzypp-16.8.0.tar.bz2 -> libzypp-16.9.0.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-16.8.0/VERSION.cmake new/libzypp-16.9.0/VERSION.cmake --- old/libzypp-16.8.0/VERSION.cmake 2017-04-21 16:39:00.000000000 +0200 +++ new/libzypp-16.9.0/VERSION.cmake 2017-04-27 16:06:07.000000000 +0200 @@ -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) #======= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-16.8.0/package/libzypp.changes new/libzypp-16.9.0/package/libzypp.changes --- old/libzypp-16.8.0/package/libzypp.changes 2017-04-21 16:39:00.000000000 +0200 +++ new/libzypp-16.9.0/package/libzypp.changes 2017-04-27 16:06:07.000000000 +0200 @@ -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) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-16.8.0/zypp/PoolQuery.cc new/libzypp-16.9.0/zypp/PoolQuery.cc --- old/libzypp-16.8.0/zypp/PoolQuery.cc 2016-11-29 11:31:52.000000000 +0100 +++ new/libzypp-16.9.0/zypp/PoolQuery.cc 2017-04-27 16:06:07.000000000 +0200 @@ -179,6 +179,13 @@ * 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 @@ 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 @@ } 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 @@ 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 @@ 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 @@ // 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 @@ } ///////////////////////////////////////////////////////////////////// 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 @@ { // 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 ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-16.8.0/zypp/base/StrMatcher.cc new/libzypp-16.9.0/zypp/base/StrMatcher.cc --- old/libzypp-16.8.0/zypp/base/StrMatcher.cc 2017-01-10 15:57:07.000000000 +0100 +++ new/libzypp-16.9.0/zypp/base/StrMatcher.cc 2017-04-27 16:06:07.000000000 +0200 @@ -170,8 +170,8 @@ 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 @@ { 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 @@ 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 @@ 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(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libzypp-16.8.0/zypp/base/StrMatcher.h new/libzypp-16.9.0/zypp/base/StrMatcher.h --- old/libzypp-16.8.0/zypp/base/StrMatcher.h 2016-11-29 11:31:52.000000000 +0100 +++ new/libzypp-16.9.0/zypp/base/StrMatcher.h 2017-04-27 16:06:07.000000000 +0200 @@ -311,18 +311,26 @@ /** 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 @@ /** 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;