Author: mlandres
Date: Fri Aug 8 13:34:40 2008
New Revision: 10797
URL: http://svn.opensuse.org/viewcvs/zypp?rev=10797&view=rev
Log:
- Adapt to new product handling. Products are no longer pseudo
installed objects verified by the solver, but actually installed.
Thus removed satisfiedProduct iterator, fixed Selctables.
- Removed class ProductInfo as we keep Product.
Removed:
trunk/libzypp/zypp/ProductInfo.cc
trunk/libzypp/zypp/ProductInfo.h
Modified:
trunk/libzypp/devel/devel.ma/NewPool.cc
trunk/libzypp/package/libzypp.changes
trunk/libzypp/zypp/CMakeLists.txt
trunk/libzypp/zypp/Filter.h
trunk/libzypp/zypp/ResObject.cc
trunk/libzypp/zypp/ResObject.h
trunk/libzypp/zypp/ResPool.h
trunk/libzypp/zypp/base/PtrTypes.h
trunk/libzypp/zypp/solver/detail/Testcase.cc
trunk/libzypp/zypp/ui/Selectable.cc
trunk/libzypp/zypp/ui/Selectable.h
trunk/libzypp/zypp/ui/SelectableImpl.cc
trunk/libzypp/zypp/ui/SelectableImpl.h
trunk/libzypp/zypp/ui/SelectableTraits.h
Modified: trunk/libzypp/devel/devel.ma/NewPool.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.ma/NewPool.cc?rev=10797&r1=10796&r2=10797&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.ma/NewPool.cc (original)
+++ trunk/libzypp/devel/devel.ma/NewPool.cc Fri Aug 8 13:34:40 2008
@@ -441,6 +441,28 @@
if ( 1 )
{
+ Measure x( "INIT TARGET" );
+ {
+ {
+ zypp::base::LogControl::TmpLineWriter shutUp;
+ getZYpp()->initializeTarget( sysRoot );
+ }
+ getZYpp()->target()->load();
+ }
+ }
+
+ dumpRange( USR, satpool.reposBegin(), satpool.reposEnd() );
+ USR << "pool: " << pool << endl;
+ ui::Selectable::Ptr t( getSel<Package>( "test" ) );
+ MIL << dump(t) << endl;
+
+ ///////////////////////////////////////////////////////////////////
+ INT << "===[END]============================================" << endl << endl;
+ zypp::base::LogControl::instance().logNothing();
+ return 0;
+
+ if ( 0 )
+ {
RepoManager repoManager( makeRepoManager( sysRoot ) );
RepoInfoList repos = repoManager.knownRepositories();
@@ -497,18 +519,6 @@
}
}
- if ( 0 )
- {
- Measure x( "INIT TARGET" );
- {
- {
- zypp::base::LogControl::TmpLineWriter shutUp;
- getZYpp()->initializeTarget( sysRoot );
- }
- getZYpp()->target()->load();
- }
- }
-
dumpRange( USR, satpool.reposBegin(), satpool.reposEnd() );
USR << "pool: " << pool << endl;
Modified: trunk/libzypp/package/libzypp.changes
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/package/libzypp.changes?rev=10797&r1=10796&r2=10797&view=diff
==============================================================================
--- trunk/libzypp/package/libzypp.changes (original)
+++ trunk/libzypp/package/libzypp.changes Fri Aug 8 13:34:40 2008
@@ -1,4 +1,13 @@
-------------------------------------------------------------------
+Fri Aug 8 13:27:42 CEST 2008 - ma@suse.de
+
+- Adapt to new product handling. Products are no longer pseudo
+ installed objects verified by the solver, but actually installed.
+ Thus removed satisfiedProduct iterator, fixed Selctables.
+- Removed class ProductInfo as we keep Product.
+- revision 10797
+
+-------------------------------------------------------------------
Thu Aug 7 22:00:55 CEST 2008 - dmacvicar@suse.de
- implement relogin suggested support (fate#304889)
Modified: trunk/libzypp/zypp/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/CMakeLists.txt?rev=10797&r1=10796&r2=10797&view=diff
==============================================================================
--- trunk/libzypp/zypp/CMakeLists.txt (original)
+++ trunk/libzypp/zypp/CMakeLists.txt Fri Aug 8 13:34:40 2008
@@ -41,7 +41,6 @@
PoolQueryResult.cc
ProblemSolution.cc
Product.cc
- ProductInfo.cc
ProgressData.cc
ProvideFilePolicy.cc
PublicKey.cc
@@ -128,7 +127,6 @@
ProblemSolution.h
ProblemTypes.h
Product.h
- ProductInfo.h
ProgressData.h
ProvideFilePolicy.h
PublicKey.h
Modified: trunk/libzypp/zypp/Filter.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Filter.h?rev=10797&r1=10796&r2=10797&view=diff
==============================================================================
--- trunk/libzypp/zypp/Filter.h (original)
+++ trunk/libzypp/zypp/Filter.h Fri Aug 8 13:34:40 2008
@@ -130,26 +130,6 @@
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : SatisfiedProducts
- //
- /** Filter returning the satisfied products.
- */
- class SatisfiedProducts
- {
- public:
- /** Filter on \ref PoolItem. */
- bool operator()( const PoolItem & pi_r ) const
- { return pi_r.satSolvable().isKind( ResKind::product ) && pi_r.isSatisfied(); }
-
- /** Filter on satSolvabe/ResObject. */
- template<class _Solv>
- bool operator()( const _Solv & solv_r ) const
- { return operator()( PoolItem( solv_r ) ); }
- };
- ///////////////////////////////////////////////////////////////////
-
- ///////////////////////////////////////////////////////////////////
//@}
/////////////////////////////////////////////////////////////////
} // namespace filter
Modified: trunk/libzypp/zypp/ResObject.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ResObject.cc?rev=10797&r1=10796&r2=10797&view=diff
==============================================================================
--- trunk/libzypp/zypp/ResObject.cc (original)
+++ trunk/libzypp/zypp/ResObject.cc Fri Aug 8 13:34:40 2008
@@ -10,13 +10,11 @@
*
*/
-#include
#include "zypp/ResObject.h"
#include "zypp/sat/SolvAttr.h"
#include "zypp/sat/Solvable.h"
#include "zypp/Repository.h"
#include "zypp/RepoInfo.h"
-#include "zypp/ProductInfo.h"
#include "zypp/IdString.h"
using namespace zypp;
@@ -57,14 +55,6 @@
///////////////////////////////////////////////////////////////////
- bool ResObject::hasProductInfo() const
- { return ProductInfo( *this ); } // this is basically one lookupIdAttribute call
-
- ProductInfo ResObject::productInfo() const
- { return ProductInfo( *this ); }
-
- ///////////////////////////////////////////////////////////////////
-
std::string ResObject::summary( const Locale & lang_r ) const
{ return lookupStrAttribute( sat::SolvAttr::summary, lang_r ); }
Modified: trunk/libzypp/zypp/ResObject.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ResObject.h?rev=10797&r1=10796&r2=10797&view=diff
==============================================================================
--- trunk/libzypp/zypp/ResObject.h (original)
+++ trunk/libzypp/zypp/ResObject.h Fri Aug 8 13:34:40 2008
@@ -30,8 +30,6 @@
namespace zypp
{ /////////////////////////////////////////////////////////////////
- class ProductInfo;
-
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : ResObject
@@ -67,19 +65,6 @@
//@}
public:
- /** \name Associated product metadata.
- * Some \ref Packages may provide additional product metadata.
- * \see \ref ProductInfo.
- */
- //@{
- /** Whether there is associated \ref ProductInfo available. */
- bool hasProductInfo() const;
- /** Return associated \ref ProductInfo or \ref ProductInfo::noProductInfo. */
- ProductInfo productInfo() const;
- //@}
-
- public:
-
/**
* \short Short text describing the resolvable.
* This attribute is usually displayed in columns.
Modified: trunk/libzypp/zypp/ResPool.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ResPool.h?rev=10797&r1=10796&r2=10797&view=diff
==============================================================================
--- trunk/libzypp/zypp/ResPool.h (original)
+++ trunk/libzypp/zypp/ResPool.h Fri Aug 8 13:34:40 2008
@@ -214,20 +214,6 @@
/** \name Special iterators. */
//@{
- /** \name Iterate over all satisfied products.
- * \note Is satisfied status is computed and updated on each solver
- * run. So it does not reflect any changes made since the last solver run.
- */
- //@{
- typedef filter_iteratorfilter::SatisfiedProducts,const_iterator satisfiedProducts_iterator;
-
- satisfiedProducts_iterator satisfiedProductsBegin() const
- { return filterBegin( filter::SatisfiedProducts() ); }
-
- satisfiedProducts_iterator satisfiedProductsEnd() const
- { return filterEnd( filter::SatisfiedProducts() ); }
- //@}
-
//@}
public:
/** \name Iterate over all Repositories that contribute ResObjects.
Modified: trunk/libzypp/zypp/base/PtrTypes.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/base/PtrTypes.h?rev=10797&r1=10796&r2=10797&view=diff
==============================================================================
--- trunk/libzypp/zypp/base/PtrTypes.h (original)
+++ trunk/libzypp/zypp/base/PtrTypes.h Fri Aug 8 13:34:40 2008
@@ -122,6 +122,14 @@
return str << *obj;
return str << std::string("NULL");
}
+ /** \relates zypp::shared_ptr Stream output. */
+ template<class _D>
+ inline std::ostream & dumpOn( std::ostream & str, const zypp::shared_ptr<_D> & obj )
+ {
+ if ( obj )
+ return dumpOn( str, *obj );
+ return str << std::string("NULL");
+ }
/** \relates zypp::intrusive_ptr Stream output. */
template<class _D>
@@ -131,6 +139,14 @@
return str << *obj;
return str << std::string("NULL");
}
+ /** \relates zypp::intrusive_ptr Stream output. */
+ template<class _D>
+ inline std::ostream & dumpOn( std::ostream & str, const zypp::intrusive_ptr<_D> & obj )
+ {
+ if ( obj )
+ return dumpOn( str, *obj );
+ return str << std::string("NULL");
+ }
/////////////////////////////////////////////////////////////////
} // namespace std
///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/solver/detail/Testcase.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/solver/detail/Testcase.cc?rev=10797&r1=10796&r2=10797&view=diff
==============================================================================
--- trunk/libzypp/zypp/solver/detail/Testcase.cc (original)
+++ trunk/libzypp/zypp/solver/detail/Testcase.cc Fri Aug 8 13:34:40 2008
@@ -22,7 +22,7 @@
#include "zypp/Product.h"
#include "zypp/Package.h"
#include "zypp/Edition.h"
-#include "zypp/parser/xml_escape_parser.hpp"
+#include "zypp/parser/xml/XmlEscape.h"
#include "zypp/base/String.h"
#include "zypp/base/PtrTypes.h"
#include "zypp/Capabilities.h"
@@ -49,13 +49,12 @@
IMPL_PTR_TYPE(HelixResolvable);
-static std::string xml_escape( const std::string &text )
+inline std::string xml_escape( const std::string &text )
{
- iobind::parser::xml_escape_parser parser;
- return parser.escape(text);
+ return zypp::xml::escape(text);
}
-static std::string xml_tag_enclose( const std::string &text, const std::string &tag, bool escape = false )
+inline std::string xml_tag_enclose( const std::string &text, const std::string &tag, bool escape = false )
{
string result;
result += "<" + tag + ">";
@@ -106,8 +105,8 @@
if (!detail.ed().release().empty())
str << " release='" << xml_escape(detail.ed().release()) << "'";
if (detail.ed().epoch() != Edition::noepoch)
- str << " epoch='" << xml_escape(numstring(detail.ed().epoch())) << "'";
- str << " />" << endl;
+ str << " epoch='" << xml_escape(numstring(detail.ed().epoch())) << "'";
+ str << " />" << endl;
} else {
str << "<dep name='" << xml_escape(cap.asString()) << "' />" << endl;
}
@@ -117,7 +116,7 @@
&& detail.rhs().detail().isNamed()) {
// packageand dependency
str << "<dep name='packageand("
- << IdString(detail.lhs().id()) << ","
+ << IdString(detail.lhs().id()) << ","
<< IdString(detail.rhs().id()) << ")' />" << endl;
} else {
// modalias ?
@@ -133,11 +132,11 @@
str << packageName << ":";
str << IdString(detail.rhs().id()) << ")' />" << endl;
} else {
- str << "<!--- ignoring '" << xml_escape(cap.asString()) << "' -->" << endl;
+ str << "<!--- ignoring '" << xml_escape(cap.asString()) << "' -->" << endl;
}
}
} else {
- str << "<!--- ignoring '" << xml_escape(cap.asString()) << "' -->" << endl;
+ str << "<!--- ignoring '" << xml_escape(cap.asString()) << "' -->" << endl;
}
return str.str();
@@ -187,7 +186,7 @@
str << "<" << toLower (resolvable->kind().asString()) << ">" << endl;
str << TAB << xml_tag_enclose (resolvable->name(), "name", true) << endl;
str << TAB << xml_tag_enclose (item->vendor(), "vendor", true) << endl;
- str << TAB << xml_tag_enclose (item->buildtime().asSeconds(), "buildtime", true) << endl;
+ str << TAB << xml_tag_enclose (item->buildtime().asSeconds(), "buildtime", true) << endl;
if ( isKind<Package>(resolvable) ) {
str << TAB << "<history>" << endl << TAB << "<update>" << endl;
str << TAB2 << helixXML (resolvable->arch()) << endl;
@@ -246,9 +245,9 @@
// remove old stuff
zypp::filesystem::clean_dir (dumpPath);
}
-
+
RepositoryTable repoTable;
- HelixResolvable system (dumpPath + "/solver-system.xml.gz");
+ HelixResolvable system (dumpPath + "/solver-system.xml.gz");
for ( ResPool::const_iterator it = pool.begin(); it != pool.end(); ++it )
{
@@ -265,7 +264,7 @@
}
repoTable[repo]->addResolvable (*it);
}
- }
+ }
return true;
}
@@ -374,7 +373,7 @@
control.addDependencies (resolver.extraRequires(), resolver.extraConflicts());
control.addDependencies (SystemCheck::instance().requiredSystemCap(),
- SystemCheck::instance().conflictSystemCap());
+ SystemCheck::instance().conflictSystemCap());
return true;
}
@@ -448,12 +447,12 @@
*file << TAB << "code()
<< "\" />" << endl;
}
-
+
if (forceResolve)
*file << TAB << "<forceResolve/>" << endl;
if (onlyRequires)
*file << TAB << "<onlyRequires/>" << endl;
-
+
*file << "</setup>" << endl
<< "<trial>" << endl
<< "" << endl;
@@ -469,7 +468,7 @@
{
*file << "</trial>" << endl
<< "</test>" << endl;
- delete(file);
+ delete(file);
}
void HelixControl::installResolvable(const ResObject::constPtr &resObject,
Modified: trunk/libzypp/zypp/ui/Selectable.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ui/Selectable.cc?rev=10797&r1=10796&r2=10797&view=diff
==============================================================================
--- trunk/libzypp/zypp/ui/Selectable.cc (original)
+++ trunk/libzypp/zypp/ui/Selectable.cc Fri Aug 8 13:34:40 2008
@@ -167,9 +167,10 @@
** FUNCTION TYPE : std::ostream &
*/
std::ostream & operator<<( std::ostream & str, const Selectable & obj )
- {
- return str << *obj._pimpl;
- }
+ { return str << *(obj._pimpl); }
+
+ std::ostream & dumpOn( std::ostream & str, const Selectable & obj )
+ { return dumpOn( str, *(obj._pimpl) ); }
/////////////////////////////////////////////////////////////////
} // namespace ui
Modified: trunk/libzypp/zypp/ui/Selectable.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ui/Selectable.h?rev=10797&r1=10796&r2=10797&view=diff
==============================================================================
--- trunk/libzypp/zypp/ui/Selectable.h (original)
+++ trunk/libzypp/zypp/ui/Selectable.h Fri Aug 8 13:34:40 2008
@@ -48,6 +48,7 @@
class Selectable : public base::ReferenceCounted, private base::NonCopyable
{
friend std::ostream & operator<<( std::ostream & str, const Selectable & obj );
+ friend std::ostream & dumpOn( std::ostream & str, const Selectable & obj );
public:
typedef intrusive_ptr<Selectable> Ptr;
@@ -74,28 +75,14 @@
/** The ResObjects name. */
const std::string & name() const;
- /**
- * return the first Installed object
- * of available
- */
+ /** The last Installed object. */
PoolItem installedObj() const;
- /**
- * \deprecated use installedObj
- * PoolItem corresponding to the installed object.
- */
- ZYPP_DEPRECATED PoolItem installedPoolItem() const
- { return installedObj(); }
-
/** Best among available objects.
- + The user selected candiate, or a default.
- */
+ * The user selected candiate, or a default.
+ */
PoolItem candidateObj() const;
- /** PoolItem corresponding to the candidate object. */
- ZYPP_DEPRECATED PoolItem candidatePoolItem() const
- { return candidateObj(); }
-
/** Set a candidate (out of available objects).
* \return The new candidate, or NULL if choice was invalid
* (NULL or not among availableObjs). An invalid choice
@@ -108,50 +95,27 @@
////////////////////////////////////////////////////////////////////////
- /**
- * Are there available objects?
- */
+ /** \name Available objects iterators.
+ * Oredered according to solver policy. 'Best' first.
+ */
+ //@{
bool availableEmpty() const;
-
- /**
- * Number of available objects.
- */
available_size_type availableSize() const;
-
- /**
- * Number of available objects.
- * \deprecated Use availableSize
- */
- ZYPP_DEPRECATED available_size_type availableObjs() const
- { return availableSize(); }
-
- /** */
available_iterator availableBegin() const;
-
- /** */
available_iterator availableEnd() const;
+ //@}
////////////////////////////////////////////////////////////////////////
- /**
- * Installed object iterators
- */
-
- /**
- * Are there installed objects?
- */
+ /** \name Insatlled objects iterators.
+ * Ordered by install time. Latest first.
+ */
+ //@{
bool installedEmpty() const;
-
- /**
- * Number of available objects.
- */
installed_size_type installedSize() const;
-
- /** */
installed_iterator installedBegin() const;
-
- /** */
installed_iterator installedEnd() const;
+ //}
////////////////////////////////////////////////////////////////////////
@@ -190,11 +154,11 @@
*/
bool isUnmaintained() const;
- /** \name Classification of available patches (patterns, products).
+ /** \name Classification of available patches (patterns).
* A patch is either \c not \c relevant, \c satisfied or \c broken.
- */
+ */
//@{
- /** Returns true for packages, because packages are not
+ /** Returns true for packages, because packages are not
* classified by the solver.
*/
bool isUndetermined() const;
@@ -265,12 +229,6 @@
*/
bool setStatus( const Status state_r );
- /** Try to set a new Status.
- * Returns \c false if the transitions is not allowed.
- */
- ZYPP_DEPRECATED bool set_status( const Status state_r )
- { return setStatus( state_r ); }
-
/** Return who caused the modification. */
ResStatus::TransactByValue modifiedBy() const;
@@ -299,6 +257,9 @@
/** \relates Selectable Stream output */
std::ostream & operator<<( std::ostream & str, const Selectable & obj );
+ /** \relates Selectable More verbose stream output */
+ std::ostream & dumpOn( std::ostream & str, const Selectable & obj );
+
/** Solvable to Selectable transform functor.
* \relates Selectable
* \relates sat::SolvIterMixin
Modified: trunk/libzypp/zypp/ui/SelectableImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ui/SelectableImpl.cc?rev=10797&r1=10796&r2=10797&view=diff
==============================================================================
--- trunk/libzypp/zypp/ui/SelectableImpl.cc (original)
+++ trunk/libzypp/zypp/ui/SelectableImpl.cc Fri Aug 8 13:34:40 2008
@@ -185,13 +185,15 @@
if ( !installedObj() && allCandidatesLocked() )
return S_Taboo;
- // KEEP state: non packages count as installed if they are satisfied.
+ // KEEP state:
+ // Report not installable items as installed, if they are satisfied.
if ( installedObj() )
- return S_KeepInstalled;
+ return S_KeepInstalled;
- if ( kind() != ResKind::package
+ if ( ( kind() == ResKind::patch
+ || kind() == ResKind::pattern )
&& cand.status().isSatisfied() ) // no installed, so we must have candidate
- return S_KeepInstalled;
+ return S_KeepInstalled;
return S_NoInst;
}
Modified: trunk/libzypp/zypp/ui/SelectableImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ui/SelectableImpl.h?rev=10797&r1=10796&r2=10797&view=diff
==============================================================================
--- trunk/libzypp/zypp/ui/SelectableImpl.h (original)
+++ trunk/libzypp/zypp/ui/SelectableImpl.h Fri Aug 8 13:34:40 2008
@@ -12,13 +12,16 @@
#ifndef ZYPP_UI_SELECTABLEIMPL_H
#define ZYPP_UI_SELECTABLEIMPL_H
-#include <iosfwd>
+#include <iostream>
+#include "zypp/base/LogTools.h"
#include "zypp/base/PtrTypes.h"
#include "zypp/ui/Selectable.h"
#include "zypp/ui/SelectableTraits.h"
+using std::endl;
+
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
@@ -36,8 +39,6 @@
*/
struct Selectable::Impl
{
- friend std::ostream & operator<<( std::ostream & str, const Selectable::Impl & obj );
-
public:
typedef SelectableTraits::AvailableItemSet AvailableItemSet;
@@ -258,11 +259,21 @@
inline std::ostream & operator<<( std::ostream & str, const Selectable::Impl & obj )
{
return str << '[' << obj.kind() << ']' << obj.name() << ": " << obj.status()
- << " (I " << obj._installedItems.size() << ")"
- << " (A " << obj._availableItems.size() << ")"
+ << " (I " << obj.installedSize() << ")"
+ << " (A " << obj.availableSize() << ")"
<< obj.candidateObj();
}
+ /** \relates Selectable::Impl Stream output */
+ inline std::ostream & dumpOn( std::ostream & str, const Selectable::Impl & obj )
+ {
+ str << '[' << obj.kind() << ']' << obj.name() << ": " << obj.status() << endl;
+ dumpRange( str << " (I " << obj.installedSize() << ") ", obj.installedBegin(), obj.installedEnd() );
+ if ( obj.installedEmpty() )
+ str << endl << " ";
+ dumpRange( str << " (A " << obj.availableSize() << ") ", obj.availableBegin(), obj.availableEnd() ) << endl;
+ return str;
+ }
/////////////////////////////////////////////////////////////////
} // namespace ui
///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/ui/SelectableTraits.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ui/SelectableTraits.h?rev=10797&r1=10796&r2=10797&view=diff
==============================================================================
--- trunk/libzypp/zypp/ui/SelectableTraits.h (original)
+++ trunk/libzypp/zypp/ui/SelectableTraits.h Fri Aug 8 13:34:40 2008
@@ -32,7 +32,7 @@
/** */
struct SelectableTraits
{
- /** Oder on AvalableItemSet.
+ /** Oder on AvailableItemSet.
* \li repository priority
* \li best Arch
* \li best Edition
@@ -65,12 +65,38 @@
}
};
+ /** Oder on InstalledItemSet.
+ * \li repository priority
+ * \li best Arch
+ * \li best Edition
+ * \li ResObject::constPtr as fallback.
+ */
+ struct IOrder : public std::binary_function
+ {
+ // NOTE: operator() provides LESS semantics to order the set.
+ // So LESS means 'prior in set'. We want 'newer' install time
+ // at the beginning of the set.
+ //
+ bool operator()( const PoolItem & lhs, const PoolItem & rhs ) const
+ {
+ Date ldate = lhs->installtime();
+ Date rdate = rhs->installtime();
+ if ( ldate != rdate )
+ return( ldate > rdate );
+
+ // no more criteria, still equal:
+ // use the ResObject::constPtr (the poiner value)
+ // (here it's arbitrary whether < or > )
+ return lhs.resolvable() < rhs.resolvable();
+ }
+ };
+
typedef std::set AvailableItemSet;
typedef AvailableItemSet::iterator available_iterator;
typedef AvailableItemSet::const_iterator available_const_iterator;
typedef AvailableItemSet::size_type available_size_type;
- typedef std::set InstalledItemSet;
+ typedef std::set InstalledItemSet;
typedef AvailableItemSet::iterator installed_iterator;
typedef AvailableItemSet::const_iterator installed_const_iterator;
typedef AvailableItemSet::size_type installed_size_type;
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org