{
zypp::PoolItem pi( zypp::ResPool::instance().find( solvable ) );
cout << pi.resolvable() << endl;
+ // name: yast2-sound 2.16.2-9 i586
return true;
}
sat::Pool::instance().addRepoSolv(dir / "factory-nonoss.solv", i2);
RepoInfo i3; i3.setAlias("zypp_svn");
sat::Pool::instance().addRepoSolv(dir / "zypp_svn.solv", i3);
- sat::Pool::instance().addRepoSolv(dir / "@System.solv");
+ RepoInfo i4; i4.setAlias("@System");
+ sat::Pool::instance().addRepoSolv(dir / "@System.solv", i4);
}
BOOST_AUTO_TEST_CASE(pool_query_init)
cout << "****1****" << endl;
PoolQuery q;
cout << q.size() << endl;
- BOOST_CHECK(q.size() == 11449);
+ BOOST_CHECK(q.size() == 11451);
+ //!\todo should be 11453 probably according to:
+ // dumpsolv factory.solv factory-nonoss.solv zypp_svn.solv \@System.solv | \
+ // grep '^name:.*\(noarch\|i386\|i586\|i686\|src\)$' | wc -l
}
// default query + one search string
BOOST_CHECK(q1.empty());
}
+// match by installed status (basically by system vs. repo)
BOOST_AUTO_TEST_CASE(pool_query_8)
{
+ cout << "****8****" << endl;
+ PoolQuery q;
+ q.addString("zypper");
+ q.addAttribute(sat::SolvAttr::name);
+ q.setMatchExact();
+ q.setInstalledOnly();
+
+ std::for_each(q.begin(), q.end(), &result_cb);
+ BOOST_CHECK(q.size() == 1);
+
+ cout << endl;
+
+ PoolQuery q1;
+ q1.addString("zypper");
+ q1.addAttribute(sat::SolvAttr::name);
+ q1.setMatchExact();
+ q1.setUninstalledOnly();
+
+ std::for_each(q1.begin(), q1.end(), &result_cb);
+ BOOST_CHECK(q1.size() == 5);
}
BOOST_AUTO_TEST_CASE(pool_query_save_restore)
o << "compiled: " << _compiled << endl;
- o << "match flags:" << endl;
+ o << "string match flags:" << endl;
o << "* sat: " << (_flags & SEARCH_STRINGMASK) << endl;
o << "* SEARCH_REGEX: " << ((_flags & SEARCH_STRINGMASK) == SEARCH_REGEX ? "yes" : "no") << endl;
+ o << "status filter flags:" << _status_flags << endl;
// raw
{
_sid = _rdit->solvid;
+ bool new_solvable = true;
bool matches = !_do_matching;
bool in_repo;
+ bool drop_by_kind_status;
do
{
//! \todo FIXME Dataiterator returning resolvables belonging to current repo?
- in_repo = _sid >= _rdit->repo->start;
+ in_repo = _sid >= _rdit->repo->start;
- if (_do_matching)
+ if (in_repo && new_solvable)
{
- if ( !matches && in_repo /*_sid >= 2 *//*_rdit->repo->start*/)
+ drop_by_kind_status = false;
+
+ // filter by installed uninstalled
+ if ( (_pqimpl->_status_flags & INSTALLED_ONLY) &&
+ _rdit->repo->name != _pool.systemRepoName() )
+ drop_by_kind_status = true;
+
+ if (!drop_by_kind_status)
+ if ( (_pqimpl->_status_flags & UNINSTALLED_ONLY) &&
+ _rdit->repo->name == _pool.systemRepoName() )
+ drop_by_kind_status = true;
+
+ matches = matches && !drop_by_kind_status;
+ }
+
+ if (_do_matching && !drop_by_kind_status)
+ {
+ if (!matches && in_repo)
{
SolvAttr attr(_rdit->key->name);
if ((_has_next = ::dataiterator_step(_rdit)))
{
- if (!in_repo /*_sid < 2 *//*_rdit->repo->start*/)
+ new_solvable = _rdit->solvid != _sid;
+ if (!in_repo)
{
INT << "repo start: " << _rdit->repo->start << endl;
_sid = _rdit->solvid;
return matches && in_repo;
}
}
- while (_rdit->solvid == _sid || !in_repo /*_sid < 2 *//*_rdit->repo->start*/);
+ while (!new_solvable || !in_repo);
return matches;
}
void PoolQuery::setInstalledOnly()
- { _pimpl->_status_flags |= INSTALLED_ONLY; }
+ { _pimpl->_status_flags = INSTALLED_ONLY; }
void PoolQuery::setUninstalledOnly()
- { _pimpl->_status_flags |= UNINSTALLED_ONLY; }
+ { _pimpl->_status_flags = UNINSTALLED_ONLY; }
void PoolQuery::setStatusFilterFlags( int flags )
- { _pimpl->_status_flags |= flags; }
+ { _pimpl->_status_flags = flags; }
void PoolQuery::requireAll(const bool require_all)