installed objects verified by the solver, but actually installed.
Thus removed satisfiedProduct iterator, fixed Selctables.
- Removed class ProductInfo as we keep Product.
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();
}
}
- 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;
-------------------------------------------------------------------
+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)
PoolQueryResult.cc
ProblemSolution.cc
Product.cc
- ProductInfo.cc
ProgressData.cc
ProvideFilePolicy.cc
PublicKey.cc
ProblemSolution.h
ProblemTypes.h
Product.h
- ProductInfo.h
ProgressData.h
ProvideFilePolicy.h
PublicKey.h
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
- //
- // 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
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/ProductInfo.cc
- *
-*/
-#include <iostream>
-#include "zypp/base/LogTools.h"
-
-#include "zypp/ProductInfo.h"
-#include "zypp/PoolItem.h"
-#include "zypp/Package.h"
-
-using std::endl;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-
- namespace
- {
- /** Fast check whether a \ref sat::Solvable provides product metadata.
- * Return the solvable or \ref sat::noSolvable.
- */
- sat::Solvable ifProductInfoProvided( sat::Solvable solvable_r )
- {
-#warning THIS SHOULD BE REPLACED BY A FAST TEST E.G. productName
- // and use detail::IdType lookupIdAttribute for this test
-
- if ( solvable_r.lookupStrAttribute( sat::SolvAttr::productShortlabel ).empty() )
- return sat::Solvable::noSolvable;
- return solvable_r;
- }
-
- /** List attribute helper */
- void fillList( std::list<Url> & ret_r, sat::Solvable solv_r, sat::SolvAttr attr_r )
- {
- sat::LookupAttr query( attr_r, solv_r );
- for_( it, query.begin(), query.end() )
- {
- try // ignore malformed urls
- {
- ret_r.push_back( Url( it.asString() ) );
- }
- catch( const url::UrlException & )
- {}
- }
- }
-
- /** List attribute helper */
- void fillList( std::list<std::string> & ret_r, sat::Solvable solv_r, sat::SolvAttr attr_r )
- {
- sat::LookupAttr query( attr_r, solv_r );
- for_( it, query.begin(), query.end() )
- {
- ret_r.push_back( it.asString() );
- }
- }
- }
-
- ///////////////////////////////////////////////////////////////////
-
- const ProductInfo ProductInfo::noProductInfo;
-
- ///////////////////////////////////////////////////////////////////
- //
- // METHOD NAME : ProductInfo::ProductInfo
- // METHOD TYPE : Ctor
- //
- ProductInfo::ProductInfo()
- {}
-
- ProductInfo::ProductInfo( sat::Solvable solvable_r )
- : sat::Solvable( ifProductInfoProvided( solvable_r ) )
- {}
-
- ProductInfo::ProductInfo( const PoolItem & poolItem_r )
- : sat::Solvable( ifProductInfoProvided( poolItem_r.satSolvable() ) )
- {}
-
- ProductInfo::ProductInfo( const ResTraits<ResObject>::constPtrType & package_r )
- : sat::Solvable( package_r ? ifProductInfoProvided( package_r->satSolvable() )
- : sat::Solvable::noSolvable )
- {}
-
- /******************************************************************
- **
- ** FUNCTION NAME : operator<<
- ** FUNCTION TYPE : std::ostream &
- */
- std::ostream & operator<<( std::ostream & str, const ProductInfo & obj )
- {
-#warning provide reasonable output
- return str << obj.satSolvable();
- }
-
- ///////////////////////////////////////////////////////////////////
-
- PoolItem ProductInfo::poolItem() const
- {
- return PoolItem( *this );
- }
-
- ResTraits<Package>::constPtrType ProductInfo::package() const
- {
- return make<Package>( *this );
- }
-
- ///////////////////////////////////////////////////////////////////
-
-#warning DUMMIES RETURNING THE PACKAGE ATTRIBUTES
- std::string ProductInfo::name() const
- { return sat::Solvable::name(); }
-
- Edition ProductInfo::edition() const
- { return sat::Solvable::edition(); }
-
- Arch ProductInfo::arch() const
- { return sat::Solvable::arch(); }
-
- Vendor ProductInfo::vendor() const
- { return sat::Solvable::vendor().asString(); }
-
- std::string ProductInfo::summary( const Locale & lang_r ) const
- { return package() ? package()->summary( lang_r ) : std::string(); }
-
- std::string ProductInfo::description( const Locale & lang_r ) const
- { return package() ? package()->description( lang_r ) : std::string(); }
-
-
-#warning REVIEW THESE OLD PRODUCT ARTTRIBUTES
-
- std::string ProductInfo::type() const
- { return lookupStrAttribute( sat::SolvAttr::productType ); }
-
- Url ProductInfo::releaseNotesUrl() const
- {
- std::list<Url> ret;
- fillList( ret, satSolvable(), sat::SolvAttr::productRelnotesurl );
- if ( ! ret.empty() )
- return ret.front();
- return Url();
- }
-
- std::list<Url> ProductInfo::updateUrls() const
- {
- std::list<Url> ret;
- fillList( ret, satSolvable(), sat::SolvAttr::productUpdateurls );
- return ret;
- }
-
- std::list<Url> ProductInfo::extraUrls() const
- {
- std::list<Url> ret;
- fillList( ret, satSolvable(), sat::SolvAttr::productExtraurls );
- return ret;
- }
-
- std::list<Url> ProductInfo::optionalUrls() const
- {
- std::list<Url> ret;
- fillList( ret, satSolvable(), sat::SolvAttr::productOptionalurls );
- return ret;
- }
-
- std::list<std::string> ProductInfo::flags() const
- {
- std::list<std::string> ret;
- fillList( ret, satSolvable(), sat::SolvAttr::productFlags );
- return ret;
- }
-
- std::string ProductInfo::shortName() const
- { return lookupStrAttribute( sat::SolvAttr::productShortlabel ); }
-
- std::string ProductInfo::longName( const Locale & /*lang_r*/ ) const
- { return std::string(); }
-
- std::string ProductInfo::distributionName() const
- { return lookupStrAttribute( sat::SolvAttr::productDistproduct ); }
-
- Edition ProductInfo::distributionEdition() const
- { return Edition( lookupStrAttribute( sat::SolvAttr::productDistversion ) ); }
-
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/ProductInfo.h
- *
-*/
-#ifndef ZYPP_PRODUCTINFO_H
-#define ZYPP_PRODUCTINFO_H
-
-#include <iosfwd>
-
-#include "zypp/sat/Solvable.h"
-#include "zypp/Locale.h"
-#include "zypp/Vendor.h"
-#include "zypp/Repository.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-
- class Url;
-
- ///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : ProductInfo
- //
- /** Product metadata.
- *
- * \ref ProductInfo allows to retrieve product related metadata, that
- * might be associated with certain packages. This class basically
- * provides the information stored in an \c /etc/products.d entry.
- *
- * \ref ProductInfo is provided by \ref Package.
- *
- * The underlying \c private \ref sat::Solvable either refers to
- * an associated package providing product related metadata, or
- * is \ref sat::noSolvable.
- */
- class ProductInfo : private sat::Solvable
- {
- public:
- /** Represents no \ref ProductInfo. */
- static const ProductInfo noProductInfo;
-
- public:
- /** Default ctor creates \ref noProductInfo. */
- ProductInfo();
-
- /** ProductInfo associated with a \ref sat::Solvable or \ref noProductInfo. */
- explicit ProductInfo( sat::Solvable solvable_r );
-
- /** ProductInfo associated with a \ref PoolItem or \ref noProductInfo. */
- explicit ProductInfo( const PoolItem & poolItem_r );
-
- /** ProductInfo associated with a \ref ResObject or \ref noProductInfo. */
- explicit ProductInfo( const ResTraits<ResObject>::constPtrType & package_r );
-
- public:
-#ifndef SWIG // Swig treats it as syntax error
- /** Whether this represents a valid- or \ref noProductInfo. */
- using sat::Solvable::operator bool_type;
-#endif
-
- public:
- /** \name Access the associated \ref Package.
- */
- //@{
- /** Access the associated \ref sat:::Solvable. */
- sat::Solvable satSolvable() const
- { return *this; }
-
- /** Access the associated \ref PoolItem. */
- PoolItem poolItem() const;
-
- /** Access the associated \ref Package. */
- ResTraits<Package>::constPtrType package() const;
- //@}
-
- public:
- /** \name Product metadata.
- */
- //@{
- /** Whether this represents an installed Product. */
- using sat::Solvable::isSystem;
-
- std::string name() const;
- Edition edition() const;
- Arch arch() const;
- Vendor vendor() const;
-
- std::string summary( const Locale & lang_r = Locale() ) const;
- std::string description( const Locale & lang_r = Locale() ) const;
-
- /** The \ref Repository this \ref Product belongs to. */
- using sat::Solvable::repository;
-
- /** \ref RepoInfo associated with the repository
- * providing this product.
- */
- RepoInfo repoInfo() const { return repository().info(); }
-
-
- //----------------------------------------------
- // These are the old Product attibutes to be revieved:
-
- /** Get the product type (base, add-on) */
- std::string type() const;
-
- /** The URL to download the release notes for this product */
- Url releaseNotesUrl() const;
-
- /**
- * Online updates for the product.
- * They are complementary, not alternatives. #163192
- */
- std::list<Url> updateUrls() const;
-
- /**
- * Additional software for the product
- * They are complementary, not alternatives.
- */
- std::list<Url> extraUrls() const;
-
- /**
- * Optional software for the product
- * (for example. Non OSS repositories)
- * They are complementary, not alternatives.
- */
- std::list<Url> optionalUrls() const;
-
- /** The product flags */
- std::list<std::string> flags() const;
-
- /** Untranslated short name like <tt>SLES 10</tt>*/
- std::string shortName() const;
-
- /** Translated long name like <tt>SUSE Linux Enterprise Server 10</tt>*/
- std::string longName( const Locale & lang_r = Locale() ) const;
-
- /** Vendor specific distribution id. */
- std::string distributionName() const;
-
- /** Vendor specific distribution version. */
- Edition distributionEdition() const;
- //@}
- };
- ///////////////////////////////////////////////////////////////////
-
- /** \relates ProductInfo Stream output */
- std::ostream & operator<<( std::ostream & str, const ProductInfo & obj );
-
- /** \relates ProductInfo */
- inline bool operator==( const ProductInfo & lhs, const ProductInfo & rhs )
- { return lhs.satSolvable() == rhs.satSolvable(); }
-
- /** \relates ProductInfo */
- inline bool operator!=( const ProductInfo & lhs, const ProductInfo & rhs )
- { return lhs.satSolvable() != rhs.satSolvable(); }
-
- /** \relates ProductInfo */
- inline bool operator<( const ProductInfo & lhs, const ProductInfo & rhs )
- { return lhs.satSolvable() < rhs.satSolvable(); }
-
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-#endif // ZYPP_PRODUCTINFO_H
*
*/
-#include <zypp/base/Logger.h>
#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;
///////////////////////////////////////////////////////////////////
- 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 ); }
namespace zypp
{ /////////////////////////////////////////////////////////////////
- class ProductInfo;
-
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : ResObject
//@}
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.
/** \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_iterator<filter::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.
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>
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
///////////////////////////////////////////////////////////////////
#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"
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 + ">";
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;
}
&& 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 ?
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();
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;
// 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 )
{
}
repoTable[repo]->addResolvable (*it);
}
- }
+ }
return true;
}
control.addDependencies (resolver.extraRequires(), resolver.extraConflicts());
control.addDependencies (SystemCheck::instance().requiredSystemCap(),
- SystemCheck::instance().conflictSystemCap());
+ SystemCheck::instance().conflictSystemCap());
return true;
}
*file << TAB << "<locale name=\"" << iter->code()
<< "\" />" << endl;
}
-
+
if (forceResolve)
*file << TAB << "<forceResolve/>" << endl;
if (onlyRequires)
*file << TAB << "<onlyRequires/>" << endl;
-
+
*file << "</setup>" << endl
<< "<trial>" << endl
<< "<showpool all=\"yes\"/>" << endl;
{
*file << "</trial>" << endl
<< "</test>" << endl;
- delete(file);
+ delete(file);
}
void HelixControl::installResolvable(const ResObject::constPtr &resObject,
** 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
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;
/** 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
////////////////////////////////////////////////////////////////////////
- /**
- * 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;
+ //}
////////////////////////////////////////////////////////////////////////
*/
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;
*/
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;
/** \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
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;
}
#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
{ /////////////////////////////////////////////////////////////////
*/
struct Selectable::Impl
{
- friend std::ostream & operator<<( std::ostream & str, const Selectable::Impl & obj );
-
public:
typedef SelectableTraits::AvailableItemSet AvailableItemSet;
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
///////////////////////////////////////////////////////////////////
/** */
struct SelectableTraits
{
- /** Oder on AvalableItemSet.
+ /** Oder on AvailableItemSet.
* \li repository priority
* \li best Arch
* \li best Edition
}
};
+ /** Oder on InstalledItemSet.
+ * \li repository priority
+ * \li best Arch
+ * \li best Edition
+ * \li ResObject::constPtr as fallback.
+ */
+ struct IOrder : public std::binary_function<PoolItem,PoolItem,bool>
+ {
+ // 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<PoolItem,AVOrder> AvailableItemSet;
typedef AvailableItemSet::iterator available_iterator;
typedef AvailableItemSet::const_iterator available_const_iterator;
typedef AvailableItemSet::size_type available_size_type;
- typedef std::set<PoolItem,AVOrder> InstalledItemSet;
+ typedef std::set<PoolItem,IOrder> InstalledItemSet;
typedef AvailableItemSet::iterator installed_iterator;
typedef AvailableItemSet::const_iterator installed_const_iterator;
typedef AvailableItemSet::size_type installed_size_type;