[zypp-devel] (for libzypp-6.9) PoolQuery now allows to inspect the attributes that lead to a match.

Hi! Some enhancement for the zypp::PoolQuery (for libzypp-6.9): Assume a query where multipme attributes are involved: * // Setup query for "libzypp" in name, provides or requires: * PoolQuery q; * q.addString( "libzypp" ); * q.setMatchSubstring(); * q.setCaseSensitive( false ); * q.addAttribute( sat::SolvAttr::name ); * q.addDependency( sat::SolvAttr::provides ); * q.addDependency( sat::SolvAttr::requires ); * // Iterate the result: * for_( solvIter, q.begin(), q.end() ) * { * cout << "Found matches in " << *solvIter << endl; * } * Output: * Found matches in PackageKit-0.3.11-1.12.i586(@System) * Found matches in libqdialogsolver1-1.2.6-1.1.2.i586(@System) * Found matches in libzypp-5.30.3-0.1.1.i586(@System) * Found matches in libzypp-testsuite-tools-4.2.6-8.1.i586(@System) * ... The PoolQuery iterator allowed to visit each matching solvable, but you were not able to tell which of the attributes actually matched. This is now fixed. The iterator now offers to visit all matching attributes within the solvable: * // Iterate the result: * for_( solvIter, q.begin(), q.end() ) * { * cout << "Found matches in " << *solvIter << endl; + if ( verbose ) + for_( attrIter, solvIter.matchesBegin(), solvIter.matchesEnd() ) + { + cout << " " << attrIter->inSolvAttr() + << "\t\"" << attrIter->asString() + << "\"" << endl; + } * } * Output: * Found matches in PackageKit-0.3.11-1.12.i586(@System) * solvable:requires "libzypp.so.523" * Found matches in libqdialogsolver1-1.2.6-1.1.2.i586(@System) * solvable:requires "libzypp.so.523" * solvable:requires "libzypp >= 5.25.3-0.1.2" * Found matches in libzypp-5.30.3-0.1.1.i586(@System) * solvable:name "libzypp" * solvable:provides "libzypp.so.523" * solvable:provides "libzypp = 5.30.3-0.1.1" * Found matches in libzypp-testsuite-tools-4.2.6-8.1.i586(@System) * solvable:name "libzypp-testsuite-tools" * solvable:provides "libzypp-testsuite-tools = 4.2.6-8.1" * solvable:requires "libzypp.so.523" * ... Could be used by zypper/UI to give more feedback when searching. -- cu, Michael Andres +------------------------------------------------------------------+ Key fingerprint = 2DFA 5D73 18B1 E7EF A862 27AC 3FB8 9E3A 27C6 B0E4 +------------------------------------------------------------------+ Michael Andres YaST Development ma@novell.com SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg) Maxfeldstrasse 5, D-90409 Nuernberg, Germany, ++49 (0)911 - 740 53-0 +------------------------------------------------------------------+ -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
participants (1)
-
Michael Andres