From 289719ddd8d17ba300c27cd1d938559016148e9c Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Fri, 23 May 2008 13:02:52 +0000 Subject: [PATCH] improve serialization of version in PoolQuery. --- tests/zypp/PoolQuery_test.cc | 1 + tests/zypp/data/PoolQuery/savedqueries | 1 + zypp/PoolQuery.cc | 14 ++++++++++---- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/zypp/PoolQuery_test.cc b/tests/zypp/PoolQuery_test.cc index 713f1c5..6948438 100644 --- a/tests/zypp/PoolQuery_test.cc +++ b/tests/zypp/PoolQuery_test.cc @@ -592,6 +592,7 @@ BOOST_AUTO_TEST_CASE(pool_query_recovery) q.setRequireAll(); q.setCaseSensitive(); q.setUninstalledOnly(); + q.setEdition(Edition("0.8.3"),Rel::NE); BOOST_CHECK(q==queries[1]); } diff --git a/tests/zypp/data/PoolQuery/savedqueries b/tests/zypp/data/PoolQuery/savedqueries index a770c55..698efc4 100644 --- a/tests/zypp/data/PoolQuery/savedqueries +++ b/tests/zypp/data/PoolQuery/savedqueries @@ -9,3 +9,4 @@ match_type: regex require_all: on case_sensitive: on install_status: not-installed +version: != 0.8.3 diff --git a/zypp/PoolQuery.cc b/zypp/PoolQuery.cc index 7df1954..51a9fc9 100644 --- a/zypp/PoolQuery.cc +++ b/zypp/PoolQuery.cc @@ -478,6 +478,7 @@ attremptycheckend: o << "* SEARCH_NOCASE: " << ((_cflags & SEARCH_NOCASE) ? "yes" : "no") << endl; o << "* SEARCH_ALL_REPOS: " << ((_cflags & SEARCH_ALL_REPOS) ? "yes" : "no") << endl; o << "status filter flags:" << _status_flags << endl; + o << "version: "<< _op << " " << _edition.asString() << endl; // raw @@ -732,7 +733,7 @@ attremptycheckend: // copy the iterator to forward check for the next attribute *** _tmpit = base_reference(); - _has_next = (*(++_tmpit) != sat::detail::noId); + _has_next = ++_tmpit != LookupAttr::iterator(); if (_has_next) { @@ -1142,12 +1143,12 @@ attremptycheckend: else if ( attribute == PoolQueryAttr::editionAttr) { string::size_type pos; - Rel rel; - if (attrValue.find_first_of("=<>") == 0) + Rel rel("=="); + if (attrValue.find_first_of("=<>!") == 0) { pos = attrValue.find_last_of("=<>"); rel = Rel(attrValue.substr(0, pos+1)); - attrValue = attrValue.substr(pos+1, attrValue.npos); + attrValue = str::trim(attrValue.substr(pos+1, attrValue.npos)); } setEdition(Edition(attrValue), rel); @@ -1329,6 +1330,11 @@ attremptycheckend: return false; if(a._pimpl->_cflags!= _pimpl->_cflags) return false; + if(a.edition()!=edition()) + return false; + if(a.editionRel()!= editionRel()) + return false; + return true; } -- 2.7.4