#include "zypp/ResPoolProxy.h"
#include "zypp/ResPool.h"
#include "zypp/ResFilters.h"
-#include "zypp/CapFilters.h"
#include "zypp/Package.h"
#include "zypp/Pattern.h"
#include "zypp/Language.h"
#include "zypp/ResPool.h"
#include "zypp/ResPoolManager.h"
#include "zypp/ResFilters.h"
-#include "zypp/CapFilters.h"
#include "zypp/Package.h"
#include "zypp/Pattern.h"
#include "zypp/Language.h"
#include "zypp/ZYppFactory.h"
#include "zypp/ResPoolProxy.h"
-#include <zypp/CapMatchHelper.h>
#include "zypp/ZYppCallbacks.h"
#include "zypp/NVRAD.h"
#include "zypp/ResPool.h"
#include "zypp/ResFilters.h"
-#include "zypp/CapFilters.h"
#include "zypp/Package.h"
#include "zypp/Pattern.h"
#include "zypp/Language.h"
#include "zypp/NVRAD.h"
#include "zypp/ResPool.h"
#include "zypp/ResFilters.h"
-#include "zypp/CapFilters.h"
#include "zypp/ResObjects.h"
#include "zypp/Digest.h"
#include "zypp/PackageKeyword.h"
{
virtual Action requestMedia( Url & source
, unsigned mediumNr
+ , const std::string & label
, Error error
- , const std::string & description )
+ , const std::string & description
+ , const std::vector<std::string> & devices
+ , unsigned int & dev_current )
{
SEC << __FUNCTION__ << endl
<< " " << source << endl
<< " " << mediumNr << endl
+ << " " << label << endl
<< " " << error << endl
- << " " << description << endl;
+ << " " << description << endl
+ << " " << devices << endl
+ << " " << dev_current << endl;
return IGNORE;
}
};
#include "zypp/ZYppFactory.h"
#include "zypp/ResPoolProxy.h"
-#include <zypp/CapMatchHelper.h>
#include "zypp/ZYppCallbacks.h"
#include "zypp/NVRAD.h"
#include "zypp/ResPool.h"
#include "zypp/ResFilters.h"
-#include "zypp/CapFilters.h"
#include "zypp/Package.h"
#include "zypp/Pattern.h"
#include "zypp/Language.h"
#include "zypp/NVRAD.h"
#include "zypp/ResPool.h"
#include "zypp/ResFilters.h"
-#include "zypp/CapFilters.h"
#include <zypp/SourceFactory.h>
#include <zypp/source/susetags/SuseTagsImpl.h>
#include "zypp/ResPool.h"
#include "zypp/ResFilters.h"
-#include "zypp/CapFilters.h"
#include <zypp/SourceFactory.h>
#include <zypp/source/susetags/SuseTagsImpl.h>
BOOST_CHECK_EQUAL(replacer1("http://foo/$arch/bar"),
"http://foo/"+ ZConfig::instance().systemArchitecture().asString() + "/bar");
- getZYpp()->setArchitecture(Arch("i686"));
+ ZConfig::instance().setSystemArchitecture(Arch("i686"));
BOOST_CHECK_EQUAL(replacer1("http://foo/$arch/bar/$basearch"),
"http://foo/i686/bar/i386");
#include "zypp/base/Logger.h"
#include "zypp/TranslatedText.h"
-#include "zypp/ZYppFactory.h"
-#include "zypp/ZYpp.h"
+#include "zypp/ZConfig.h"
#include <boost/test/auto_unit_test.hpp>
BOOST_AUTO_TEST_CASE(translatedtext_test)
{
- ZYpp::Ptr god;
-
- god = getZYpp();
-
TranslatedText testTT;
MIL << "Locale: en" << std::endl;
- god->setTextLocale(Locale("en"));
+ ZConfig::instance().setTextLocale(Locale("en"));
testTT.setText("default");
MIL << "value: '" << testTT.text() << "'" << std::endl;
BOOST_CHECK_EQUAL( testTT.text(), "default" );
BOOST_CHECK_EQUAL( testTT.text(), "default english" );
MIL << "Locale: es_ES" << std::endl;
- god->setTextLocale(Locale("es_ES"));
+ ZConfig::instance().setTextLocale(Locale("es_ES"));
BOOST_CHECK_EQUAL( testTT.text(), "default english" );
BOOST_CHECK_EQUAL( testTT.text(), "hola Spain" );
MIL << "Locale: null" << std::endl;
- god->setTextLocale(Locale());
+ ZConfig::instance().setTextLocale(Locale());
BOOST_CHECK_EQUAL( testTT.text(), "default" );
}
Callback.h
Capabilities.h
Capability.h
- CapAndItem.h
- CapFilters.h
CapMatch.h
- CapMatchHelper.h
Changelog.h
CheckSum.h
CountryCode.h
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/CapAndItem.h
- *
-*/
-#ifndef ZYPP_CAPANDITEM_H
-#define ZYPP_CAPANDITEM_H
-
-#include "zypp/base/Deprecated.h"
-
-#include "zypp/PoolItem.h"
-#include "zypp/Capability.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-
- ///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : CapAndItem
- //
- /**
- *
- * \deprecated no longer supported
- */
- struct ZYPP_DEPRECATED CapAndItem
- {
- friend std::ostream & operator<<( std::ostream & str, const CapAndItem & obj );
- public:
- Capability cap;
- PoolItem item;
-
- CapAndItem( Capability c, PoolItem i )
- : cap( c )
- , item( i )
- { }
- };
-
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-#endif // ZYPP_CAPANDITEM_H
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/CapFilters.h
- *
-*/
-#ifndef ZYPP_CAPFILTERS_H
-#define ZYPP_CAPFILTERS_H
-
-#include "zypp/base/Deprecated.h"
-#include "zypp/base/Functional.h"
-#include "zypp/Capability.h"
-#include "zypp/ResObject.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace capfilter
- { /////////////////////////////////////////////////////////////////
-
- /** \defgroup CAPFILTERS Filter functors operating on Capability.
- * \ingroup g_Functor
- */
- //@{
-
- /** */
- typedef std::unary_function<Capability, bool> CapabilityFilterFunctor;
-
- /** */
- struct ZYPP_DEPRECATED ByRefers : public CapabilityFilterFunctor
- {
- ZYPP_DEPRECATED bool operator()( const Capability & c ) const
- {
- return false; //c.refers() == _refers;
- }
-
- ZYPP_DEPRECATED ByRefers( Resolvable::Kind refers_r )
- : _refers( refers_r )
- {}
- ZYPP_DEPRECATED ByRefers( ResObject::constPtr p )
- : _refers( p->kind() )
- {}
- ZYPP_DEPRECATED ByRefers( const Capability & cap_r )
- //: _refers( cap_r.refers() )
- {}
- Resolvable::Kind _refers;
- };
-
- /** */
- struct ZYPP_DEPRECATED ByIndex : public CapabilityFilterFunctor
- {
- ZYPP_DEPRECATED bool operator()( const Capability & c ) const
- {
- return false; //c.index() == _index;
- }
-
- ZYPP_DEPRECATED ByIndex( const std::string & index_r )
- : _index( index_r )
- {}
- ZYPP_DEPRECATED ByIndex( const Capability & cap_r )
- //: _index( cap_r.index() )
- {}
- std::string _index;
- };
-
- /** */
- struct ByCapMatch : public CapabilityFilterFunctor
- {
- bool operator()( const Capability & c ) const
- {
- return _lhs.matches( c ) == _expect;
- }
-
- ByCapMatch( const Capability & cap_r, CapMatch expect_r = CapMatch::yes )
- : _lhs( cap_r )
- , _expect( expect_r )
- {}
- Capability _lhs;
- CapMatch _expect;
- };
-
- //@}
- /////////////////////////////////////////////////////////////////
- } // namespace capfilter
- ///////////////////////////////////////////////////////////////////^
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-#endif // ZYPP_CAPFILTERS_H
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/CapMatchHelper.h
- *
-*/
-#ifndef ZYPP_CAPMATCHHELPER_H
-#define ZYPP_CAPMATCHHELPER_H
-
-#include "zypp/base/Algorithm.h"
-#include "zypp/base/Function.h"
-#include "zypp/ResPool.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-
- /** Functor testing whether argument matches a certain Capability.
- * \ingroup g_Functor
- * \ingroup CAPFILTERS
- */
- class MatchesCapability
- {
- public:
- MatchesCapability( const Capability & lhs_r )
- : _lhs( lhs_r )
- {}
-
- bool operator()( const CapAndItem & capitem_r ) const
- { return operator()( capitem_r.cap ); }
-
- bool operator()( const Capability & rhs_r ) const
- { return( _lhs.matches( rhs_r ) == CapMatch::yes ); }
-
- private:
- const Capability & _lhs;
- };
-
- /** \defgroup CAPMATCHHELPER Find matching Capabilities.
- * \ingroup g_Algorithm
- */
- //@{
-
- /** Algorithm invoking \c action_r on each \ref Capabilities entry
- * that matches a given \ref Capability.
- */
- inline int forEachMatchIn( Capabilities::const_iterator begin_r,
- Capabilities::const_iterator end_r,
- const Capability & lhs_r,
- function<bool(const Capability &)> action_r )
- {
- return invokeOnEach( begin_r, end_r,
- MatchesCapability( lhs_r ), // filter
- action_r );
- }
-
- /** Algorithm invoking \c action_r on each \ref Capabilities entry
- * that matches a given \ref Capability.
- */
- inline int forEachMatchIn( const Capabilities & capset_r,
- const Capability & lhs_r,
- function<bool(const Capability &)> action_r )
- {
- return invokeOnEach( capset_r.begin(), capset_r.end(),
- MatchesCapability( lhs_r ), // filter
- action_r );
- }
-
- /** Algorithm invoking \c action_r on each matching \ref Capability
- * in a \ref ResPool.
- *
- * \code
- * // Returns wheter willing to collect more items.
- * bool consume( const CapAndItem & cai_r );
- *
- * ResPool _pool;
- * Capability _cap;
- * // Invoke consume on all provides that match _cap
- * forEachMatchIn( _pool, Dep::PROVIDES, _cap, consume );
- * \endcode
- *
- * \relates ResPool.
- * \see ForEachMatchInPool
- */
- inline int forEachMatchIn( const ResPool & pool_r, const Dep & dep_r,
- const Capability & lhs_r,
- function<bool(const CapAndItem &)> action_r )
- {
- std::string index( lhs_r.index() );
- return invokeOnEach( pool_r.byCapabilityIndexBegin( index, dep_r ),
- pool_r.byCapabilityIndexEnd( index, dep_r ),
- MatchesCapability( lhs_r ), // filter
- action_r );
- }
-
-
- ///////////////////////////////////////////////////////////////////
-
- /** Functor invoking \c action_r on each matching \ref Capability
- * in a \ref Capabilities.
- *
- * Functor is provided to ease using \ref forEachMatchIn as action
- * in other algorithms (nested loop over two Capabilitiess).
- */
- class ForEachMatchInCapabilities
- {
- public:
- typedef function<bool(const Capability &, const Capability &)> Action;
-
- public:
- ForEachMatchInCapabilities( const Capabilities & set_r, const Action & action_r )
- : _set( set_r )
- , _action( action_r )
- {}
-
- bool operator()( const Capability & cap_r ) const
- {
- return( forEachMatchIn( _set, cap_r, bind( _action, _1, cap_r ) )
- >= 0 ); // i.e. _action did not return false
- }
-
- private:
- const Capabilities & _set;
- Action _action;
- };
-
- /** Invoke \c action_r on each matching pair of Capabilities within
- * two Capabilitiess. */
- inline int forEachMatchIn( const Capabilities & lhs_r,
- const Capabilities & rhs_r,
- function<bool(const Capability &, const Capability &)> action_r )
- {
- return invokeOnEach( lhs_r.begin(), lhs_r.end(),
- ForEachMatchInCapabilities( rhs_r, action_r ) );
- }
- ///////////////////////////////////////////////////////////////////
-
- namespace capmatch_detail {
- struct AlwaysFalse
- {
- bool operator()( const Capability &, const Capability & ) const
- { return false; }
- bool operator()( const Capability & ) const
- { return false; }
- };
- }
-
- /** Return \c true if the Capabilities contains at least one Capabilitiy
- * that matches.
- */
- inline bool hasMatches( const Capabilities & lhs_r, const Capability & rhs_r )
- {
- return( forEachMatchIn( lhs_r, rhs_r, capmatch_detail::AlwaysFalse() ) < 0 );
- }
-
- /** Return \c true if the Capabilitiess contain at least one pair of
- * Capabilities that match.
- */
- inline bool hasMatches( const Capabilities & lhs_r, const Capabilities & rhs_r )
- {
- return( forEachMatchIn( lhs_r, rhs_r, capmatch_detail::AlwaysFalse() ) < 0 );
- }
-
- ///////////////////////////////////////////////////////////////////
-
-
- /** Functor invoking \c action_r on each matching \ref Capability
- * in a \ref ResPool.
- *
- * Functor is provided to ease using \ref forEachMatchIn as action
- * in other algorithms.
- *
- * \code
- * bool consume( const CapAndItem & cai_r );
- *
- * ResPool _pool;
- * PoolItem _pi;
- *
- * // Invoke consume on all PoolItems obsoleted by pi.
- * // short: forEachPoolItemMatchedBy( _pool, _pi, Dep::OBSOLETES, consume );
- * for_each( _pi->dep(Dep::OBSOLETES).begin(),
- * _pi->dep(Dep::OBSOLETES).end(),
- * ForEachMatchInPool( _pool, Dep::PROVIDES, consume ) );
- *
- * // Invoke consume on all PoolItems obsoleting pi.
- * // short: forEachPoolItemMatching( _pool, Dep::OBSOLETES, _pi, consume );
- * for_each( pi->dep(Dep::PROVIDES).begin(),
- * pi->dep(Dep::PROVIDES).end(),
- * ForEachMatchInPool( _pool, Dep::OBSOLETES, consume ) );
- *
- * \endcode
- *
- * \ingroup g_Functor
- * \ingroup CAPFILTERS
- * \relates ResPool.
- * \see forEachPoolItemMatchedBy
- * \see forEachPoolItemMatching
- */
- class ForEachMatchInPool
- {
- public:
- typedef function<bool(const CapAndItem &)> Action;
-
- public:
- ForEachMatchInPool( const ResPool & pool_r,
- const Dep & dep_r,
- const Action & action_r )
- : _pool ( pool_r )
- , _dep ( dep_r )
- , _action( action_r )
- {}
-
- bool operator()( const Capability & cap_r ) const
- {
- return( forEachMatchIn( _pool, _dep, cap_r, _action )
- >= 0 ); // i.e. _action did not return false
- }
-
- private:
- ResPool _pool;
- Dep _dep;
- Action _action;
- };
-
- /** Find all items in a ResPool matched by a certain PoolItems
- * dependency set.
- *
- * Iterates <tt>poolitem_r->dep(poolitemdep_r)</tt>
- * and invokes \c action_r on each item in \c pool_r,
- * that provides a match.
- * \code
- * bool consume( const CapAndItem & cai_r );
- *
- * ResPool _pool;
- * PoolItem _pi;
- *
- * // Invoke consume on all PoolItems obsoleted by pi.
- * forEachPoolItemMatchedBy( _pool, _pi, Dep::OBSOLETES, consume );
- * \endcode
- *
- * \note \c action_r is invoked for each matching Capability. So if
- * the same PoolItem provides multiple matches, \c action_r refers
- * to the same PoolItem multiple times. It may as well be that
- * \c poolitem_r provides a matching Capability. Use \ref OncePerPoolItem
- * to compensate this if neccessary.
- */
- inline int forEachPoolItemMatchedBy( const ResPool & pool_r,
- const PoolItem & poolitem_r,
- const Dep & poolitemdep_r,
- function<bool(const CapAndItem &)> action_r )
- {
- return invokeOnEach( poolitem_r->dep(poolitemdep_r).begin(),
- poolitem_r->dep(poolitemdep_r).end(),
- ForEachMatchInPool( pool_r, Dep::PROVIDES, action_r ) );
- }
-
- /** Find all items in a ResPool matching a certain PoolItem.
- *
- * Iterates <tt>poolitem_r->dep(Dep::PROVIDES)</tt>
- * and invoking \c action_r on each item in \c pool_r,
- * that provides a match.
- * \code
- * bool consume( const CapAndItem & cai_r );
- *
- * ResPool _pool;
- * PoolItem _pi;
- *
- * // Invoke consume on all PoolItems obsoleting pi.
- * forEachPoolItemMatching( _pool, Dep::OBSOLETES, _pi, consume );
- * \endcode
- *
- * \note \c action_r is invoked for each matching Capability. So if
- * the same PoolItem provides multiple matches, \c action_r refers
- * to the same PoolItem multiple times. It may as well be that
- * \c poolitem_r provides a matching Capability. Use \ref OncePerPoolItem
- * to compensate this if neccessary.
- */
- inline int forEachPoolItemMatching( const ResPool & pool_r,
- const Dep & pooldep_r,
- const PoolItem & poolitem_r,
- function<bool(const CapAndItem &)> action_r )
- {
- return invokeOnEach( poolitem_r->dep(Dep::PROVIDES).begin(),
- poolitem_r->dep(Dep::PROVIDES).end(),
- ForEachMatchInPool( pool_r, pooldep_r, action_r ) );
- }
-
- /** Functor translating \ref CapAndItem actions into \ref PoolItem
- * actions avoiding multiple invocations for the same \ref PoolItem.
- *
- * Additionally you may omit invocation of \a action_r for a
- * specific PoolItem.
- *
- * Even if no _action is given, the PoolItems that would have been
- * processed are collected in a std::set, available via
- * \ref collectedItems.
- *
- * \code
- * bool consume( const CapAndItem & cai_r );
- * bool consumePi( const PoolItem & pi_r );
- *
- * ResPool _pool;
- * PoolItem _pi;
- *
- * // Invoke consume on all PoolItems obsoleted by pi.
- * // Once for each matching Capability, thus the same PoolItem
- * // might be involved mutiple times.
- * forEachPoolItemMatchedBy( _pool, _pi, Dep::OBSOLETES,
- * consume );
- *
- * // Invoke consume on all PoolItems obsoleted by pi.
- * // Once for each PoolItem, still including _pi in case
- * // it provides a match by itself.
- * forEachPoolItemMatchedBy( _pool, _pi, Dep::OBSOLETES,
- * OncePerPoolItem( consumePi ) );
- *
- * // Invoke consume on all PoolItems obsoleted by pi.
- * // Once for each PoolItem, omitting invokation for
- * // _pi (in case it obsoletes itself).
- * forEachPoolItemMatchedBy( _pool, _pi, Dep::OBSOLETES,
- * OncePerPoolItem( consumePi, _pi ) );
- * \endcode
- * \ingroup g_Functor
- * \ingroup CAPFILTERS
- */
- struct OncePerPoolItem
- {
- public:
- typedef function<bool(const PoolItem &)> Action;
-
- public:
- explicit
- OncePerPoolItem( const PoolItem & self_r = PoolItem() )
- : _self ( self_r )
- , _uset ( new std::set<PoolItem> )
- {}
-
- OncePerPoolItem( const Action & action_r,
- const PoolItem & self_r = PoolItem() )
- : _action( action_r )
- , _self ( self_r )
- , _uset ( new std::set<PoolItem> )
- {}
-
- bool operator()( const CapAndItem & cai_r ) const
- {
- if ( cai_r.item == _self ) // omit _self
- return true;
- // intentionally collect items in _uset even
- // if no _action specified.
- if ( _uset->insert( cai_r.item ).second
- && _action )
- return _action( cai_r.item );
-
- return true;
- }
-
- const std::set<PoolItem> & collectedItems() const
- { return *_uset; }
-
- private:
- Action _action;
- PoolItem _self;
- shared_ptr<std::set<PoolItem> > _uset;
- };
-
-
- //@}
-
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-#endif // ZYPP_CAPMATCHHELPER_H
class Capability: protected sat::detail::PoolMember,
private base::SafeBool<Capability>
{
- public:
- // legacy
- std::string index() const ZYPP_DEPRECATED;
-
public:
enum CtorFlag { PARSED, UNPARSED };
inline CapDetail Capability::detail() const { return CapDetail( _id ); }
- inline std::string Capability::index() const
- {
- CapDetail cap( _id );
- return( cap.isSimple() ? cap.name().asString() : std::string() );
- }
-
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
#include <fstream>
#include <boost/function.hpp>
-#include <zypp/base/Regex.h>
-#include <zypp/base/String.h>
+#include "zypp/base/Regex.h"
+#include "zypp/base/String.h"
#include "zypp/base/Logger.h"
#include "zypp/base/IOStream.h"
#include "zypp/PoolItem.h"
-#include "zypp/CapMatchHelper.h"
#undef ZYPP_BASE_LOGGER_LOGGROUP
#define ZYPP_BASE_LOGGER_LOGGROUP "locks"
{
namespace locks
{
-
+#if 0
//
// collect matching names
//
return regexed;
}
-
+#endif
//
// assign Lock to installed pool item
//
-struct ItemLockerFunc
-{
- ItemLockerFunc( const string lock_str )
- : _lock_str(lock_str)
- {}
-
- bool operator()( const CapAndItem &cai_r )
- {
- PoolItem item(cai_r.item);
- MIL << "Locking " << cai_r.item << "(matched by " << _lock_str << ")" << endl;
- item.status().setLock( true, ResStatus::USER);
- return true;
- }
-
- string _lock_str;
-};
-
struct AddLockToPool
{
AddLockToPool( const ResPool &pool )
{ _openchecksum = val_r; return *this; }
public:
- /** \deprecated use \ref setLocation or \ref changeMedianr */
- ZYPP_DEPRECATED OnMediaLocation & xsetMedianr( unsigned val_r )
- { return changeMedianr( val_r ); }
- /** \deprecated use \ref setLocation or \ref changeFilename */
- ZYPP_DEPRECATED OnMediaLocation & xsetFilename( const Pathname & val_r )
- { return changeFilename( val_r ); }
-
/** Individual manipulation of \c medianr.
* Using \ref setLocation is prefered.
*/
#include "zypp/base/Functional.h"
#include "zypp/Resolvable.h"
-#include "zypp/CapFilters.h"
#include "zypp/PoolItem.h"
#include "zypp/Repository.h"
-#include "zypp/CapAndItem.h"
///////////////////////////////////////////////////////////////////
namespace zypp
std::string _alias;
};
-
+
/** Select ResObject by Edition using \a _Compare functor.
*
* Selects ResObject if <tt>_Compare( ResObject->edition(), _edition )</tt>
}
};
-
-
- ///////////////////////////////////////////////////////////////////
-
- /** Select ResObject if at least one Capability with
- * index \a index_r was found in dependency \a depType_r.
- */
- struct ByCapabilityIndex
- {
- bool operator()( const CapAndItem & /*cai*/ ) const
- {
- return true; // its all in the PoolImpl !
- }
- };
-
-
- /** Select ResObject if at least one Capability with
- * index \a index_r was found in dependency \a depType_r.
- */
- struct ByCapMatch
- {
- bool operator()( const CapAndItem & cai ) const
- {
- return cai.cap.matches( _cap ) == CapMatch::yes;
- }
- ByCapMatch( const Capability & cap_r )
- : _cap( cap_r )
- {}
- Capability _cap;
- };
-
-
- /** Select PoolItem by uninstalled. */
- struct ByCaIUninstalled
- {
- bool operator()( const CapAndItem & cai ) const
- {
- return cai.item.status().isUninstalled();
- }
- };
-
- /** Select PoolItem by installed. */
- struct ByCaIInstalled
- {
- bool operator()( const CapAndItem & cai ) const
- {
- return cai.item.status().isInstalled();
- }
- };
-
- /** Select PoolItem by transact. */
- struct ByCaITransact
- {
- bool operator()( const CapAndItem & cai ) const
- {
- return cai.item.status().transacts();
- }
- };
-
- /** Select PoolItem by not transact. */
- struct ByCaINotTransact
- {
- bool operator()( const CapAndItem & cai ) const
- {
- return !(cai.item.status().transacts());
- }
- };
-
-
- /** Select CapAndItem by kind. */
- struct ByCaIKind
- {
- ByCaIKind( const ResObject::Kind & kind_r )
- : _kind( kind_r )
- {}
-
- bool operator()( const CapAndItem & cai ) const
- {
- return cai.item->kind() == _kind;
- }
-
- ResObject::Kind _kind;
- };
-
- /** */
- template<class _Res>
- inline ByCaIKind byCaIKind()
- { return ByCaIKind( ResTraits<_Res>::kind ); }
-
- ///////////////////////////////////////////////////////////////////
-
//@}
/////////////////////////////////////////////////////////////////
} // namespace resfilter
PoolItem ResPool::find( const sat::Solvable & slv_r ) const
{ return _pimpl->find( slv_r ); }
- ResPool::byCapabilityIndex_iterator ResPool::byCapabilityIndexBegin( const std::string & index_r, Dep depType_r ) const
- { return _pimpl->_caphashfake.begin(); }
-
- ResPool::byCapabilityIndex_iterator ResPool::byCapabilityIndexEnd( const std::string & index_r, Dep depType_r ) const
- { return _pimpl->_caphashfake.end(); }
-
-
ResPool::size_type ResPool::knownRepositoriesSize() const
{ return _pimpl->knownRepositories().size(); }
typedef pool::PoolTraits::size_type size_type;
typedef pool::PoolTraits::const_iterator const_iterator;
- typedef pool::PoolTraits::byCapabilityIndex_iterator byCapabilityIndex_iterator;
- typedef pool::PoolTraits::AdditionalCapabilities AdditionalCapabilities;
- typedef pool::PoolTraits::repository_iterator repository_iterator;
+ typedef pool::PoolTraits::AdditionalCapabilities AdditionalCapabilities;
+ typedef pool::PoolTraits::repository_iterator repository_iterator;
public:
/** Singleton ctor. */
//@}
public:
- /** \name Iterate through all ResObjects with a certain name (all kinds).
- * \deprecated Instead of iterating byName and filter byKind use ByIdent iterator.
- */
+ /** \name Iterate through all ResObjects with a certain name (all kinds). */
//@{
typedef zypp::resfilter::ByName ByName;
typedef filter_iterator<ByName,const_iterator> byName_iterator;
- byName_iterator ZYPP_DEPRECATED byNameBegin( const std::string & name_r ) const
+ byName_iterator byNameBegin( const std::string & name_r ) const
{ return make_filter_begin( ByName(name_r), *this ); }
- byName_iterator ZYPP_DEPRECATED byNameEnd( const std::string & name_r ) const
+ byName_iterator byNameEnd( const std::string & name_r ) const
{ return make_filter_end( ByName(name_r), *this ); }
//@}
- public:
- /** \name Iterate through all ResObjects which have at least
- * one Capability with index \a index_r in dependency \a depType_r.
- *
- * \deprecated If you're looking for providers of a certain capability
- * use \ref sat::WhatProvides. That's currently the only index provided.
- */
- //@{
- byCapabilityIndex_iterator ZYPP_DEPRECATED byCapabilityIndexBegin( const std::string & index_r, Dep depType_r ) const;
-
- byCapabilityIndex_iterator ZYPP_DEPRECATED byCapabilityIndexEnd( const std::string & index_r, Dep depType_r ) const;
- //@}
-
public:
/** \name Iterate through all Repositories that contribute ResObjects.
*/
void resetSystemArchitecture()
{ setSystemArchitecture( defaultSystemArchitecture() ); }
- /** use setSystemArchitecture */
- ZYPP_DEPRECATED void overrideSystemArchitecture( const Arch & arch_r )
- { setSystemArchitecture( arch_r ); }
-
public:
/** The autodetected prefered locale for translated texts.
*/
#include "zypp/base/LogTools.h"
#include "zypp/pool/PoolImpl.h"
-#include "zypp/Package.h"
-#include "zypp/VendorAttr.h"
-
-#include "zypp/sat/Pool.h"
-#include "zypp/Repository.h"
using std::endl;
namespace zypp
{ /////////////////////////////////////////////////////////////////
- std::ostream & operator<<( std::ostream & str, const CapAndItem & obj )
- {
- return str << "{" << obj.cap << ", " << obj.item << "}";
- }
-
///////////////////////////////////////////////////////////////////
namespace pool
{ /////////////////////////////////////////////////////////////////
mutable shared_ptr<ResPoolProxy> _poolProxy;
mutable scoped_ptr<KnownRepositories> _knownRepositoriesPtr;
-
- public:
- /** \bug FAKE capindex */
- const PoolTraits::CapItemContainerT _caphashfake;
};
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
- class CapAndItem;
-
///////////////////////////////////////////////////////////////////
namespace pool
{ /////////////////////////////////////////////////////////////////
typedef transform_iterator<Id2ItemValueSelector, Id2ItemT::const_iterator>
byIdent_iterator;
-
/* list of known Repositories */
typedef std::list<Repository> RepoContainerT;
typedef RepoContainerT::const_iterator repository_iterator;
-
- // internal organization
- typedef std::list<zypp::CapAndItem> CapItemContainerT; // (why,who) pairs
- typedef std::map<std::string,CapItemContainerT> CapItemStoreT; // capability.index -> (why,who) pairs
- typedef std::map<Dep,CapItemStoreT> DepCapItemContainerT; // Dep -> (capability.index -> (why,who) pairs)
-
- typedef CapItemContainerT::iterator capitemiterator;
- typedef CapItemContainerT::const_iterator const_capitemiterator;
- typedef CapItemContainerT::size_type capitemsize_type;
- /** hashed by capability index */
- typedef const_capitemiterator byCapabilityIndex_iterator;
-
-
typedef PoolImpl Impl;
typedef shared_ptr<PoolImpl> Impl_Ptr;
typedef shared_ptr<const PoolImpl> Impl_constPtr;
#include "zypp/base/Algorithm.h"
#include "zypp/ResPool.h"
#include "zypp/ResFilters.h"
-#include "zypp/CapFilters.h"
#include "zypp/sat/SATResolver.h"
#include "zypp/sat/Pool.h"
#include "zypp/sat/WhatProvides.h"
#include "zypp/base/Algorithm.h"
#include "zypp/ResPool.h"
#include "zypp/ResFilters.h"
-#include "zypp/CapFilters.h"
#include "zypp/RepoInfo.h"
using namespace std;
#include "zypp/ResFilters.h"
#include "zypp/ResStatus.h"
-#include "zypp/CapAndItem.h"
#include "zypp/NameKindProxy.h"
#include "zypp/sat/SATResolver.h"
#include "zypp/sat/Pool.h"
#include "zypp/base/Algorithm.h"
#include "zypp/ResPool.h"
#include "zypp/ResFilters.h"
-#include "zypp/CapFilters.h"
#include "zypp/solver/detail/ProblemSolutionUnlock.h"
using namespace std;
#include "zypp/base/Algorithm.h"
#include "zypp/ResPool.h"
#include "zypp/ResFilters.h"
-#include "zypp/CapFilters.h"
#include "zypp/sat/Pool.h"
#include "zypp/sat/Solvable.h"
#include "zypp/sat/SATResolver.h"
#include "zypp/ResPool.h"
#include "zypp/ResStatus.h"
#include "zypp/ResFilters.h"
-#include "zypp/CapFilters.h"
#include "zypp/Capability.h"
#include "zypp/VendorAttr.h"
#include "zypp/Package.h"
#include "zypp/base/Algorithm.h"
#include "zypp/ResPool.h"
#include "zypp/ResFilters.h"
-#include "zypp/CapFilters.h"
/////////////////////////////////////////////////////////////////////////
#include "zypp/ExternalProgram.h"
#include "zypp/Repository.h"
-#include "zypp/CapMatchHelper.h"
#include "zypp/ResFilters.h"
#include "zypp/target/CommitLog.h"
#include "zypp/target/TargetImpl.h"
} // namespace
///////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace
- { /////////////////////////////////////////////////////////////////
-
- /** Helper removing obsoleted non-Package from store. */
- struct StorageRemoveObsoleted
- {
- StorageRemoveObsoleted(const PoolItem & byPoolitem_r )
- : _byPoolitem( byPoolitem_r )
- {}
-
- bool operator()( const PoolItem & poolitem_r ) const
- {
- if ( ! poolitem_r.status().isInstalled() )
- return true;
-
- if ( isKind<Package>(poolitem_r.resolvable()) )
- {
- ERR << "Ignore unsupported Package/non-Package obsolete: "
- << _byPoolitem << " obsoletes " << poolitem_r << endl;
- return true;
- }
-
- try
- {
- // delete poolitem_r.resolvable()
- MIL<< "Obsoleted: " << poolitem_r << " (by " << _byPoolitem << ")" << endl;
- }
- catch ( Exception & excpt_r )
- {
- ZYPP_CAUGHT( excpt_r );
- WAR << "Failed obsolete: " << poolitem_r << " (by " << _byPoolitem << ")" << endl;
- }
-
- return true;
- }
-
- private:
- const PoolItem _byPoolitem;
- };
-
- /** Helper processing non-Package obsoletes.
- *
- * Scan \a pool_r for items obsoleted \a byPoolitem_r and remove them from
- * \a storage_r.
- */
- void obsoleteMatchesFromStorage( const ResPool & pool_r,
- const PoolItem & byPoolitem_r )
- {
- forEachPoolItemMatchedBy( pool_r, byPoolitem_r, Dep::OBSOLETES,
- OncePerPoolItem( StorageRemoveObsoleted( byPoolitem_r ) ) );
- }
-
- /////////////////////////////////////////////////////////////////
- } // namespace
- ///////////////////////////////////////////////////////////////////
-
/** Helper for PackageProvider queries during commit. */
struct QueryInstalledEditionHelper
{
{
if (it->status().isToBeInstalled())
{
- // Process OBSOLETES and remove them from store.
- obsoleteMatchesFromStorage( pool_r, *it );
-
bool success = false;
try
{
#include "zypp/base/Algorithm.h"
#include "zypp/base/Function.h"
#include "zypp/ResPool.h"
-#include "zypp/CapMatchHelper.h"
using std::endl;
/** Store Patterns matching an \c Includes capability in \c _patternMap. */
void expandInclude( const Capability & include_r )
{
- forEachMatchIn( _pool, Dep::PROVIDES, include_r,
- bind( &Impl::storeIncludeMatch, this, _1 ) );
- }
-
- /** Store a Pattern in \c _patternMap. */
- bool storeIncludeMatch( const CapAndItem & capitem_r )
- {
- _patternMap[asKind<Pattern>(capitem_r.item)];
- //DBG << mapEntry(*_patternMap.find(asKind<Pattern>(capitem_r.item))) << endl;
- return true;
+ sat::WhatProvides w( include_r );
+ for_( it, w.begin(), w.end() )
+ {
+ _patternMap[asKind<Pattern>(PoolItem(*it))];
+ }
}
private:
/** Return true if Capability \c extends_r is provided by Pattern. */
bool providedBy( const Pattern::constPtr & pat_r, const Capability & extends_r )
{
- std::string index( extends_r.index() );
- return( std::find_if( _pool.byCapabilityIndexBegin( index, Dep::PROVIDES ),
- _pool.byCapabilityIndexEnd( index, Dep::PROVIDES ),
- bind( &Impl::providedByFilter, this, pat_r, extends_r, _1 ) )
- != _pool.byCapabilityIndexEnd( index, Dep::PROVIDES ) );
- }
-
- /** Return true if \c capitem_r refers to \c pat_r and matches \c extends_r. */
- bool providedByFilter( const Pattern::constPtr & pat_r, const Capability & extends_r,
- const CapAndItem & capitem_r ) const
- {
- return( capitem_r.item == pat_r
- && extends_r.matches( capitem_r.cap ) == CapMatch::yes );
+ if ( !pat_r )
+ return false;
+
+ sat::Solvable pat( pat_r->satSolvable() );
+ sat::WhatProvides w( extends_r );
+ for_( it, w.begin(), w.end() )
+ {
+ if ( pat == *it )
+ return true;
+ }
+ return false;
}
private: