#include <zypp/base/Algorithm.h>
#include <zypp/base/Functional.h>
#include <zypp/base/ProvideNumericId.h>
+#include <zypp/base/ProvideNumericId.h>
#include "zypp/NVRAD.h"
#include "zypp/ResPool.h"
///////////////////////////////////////////////////////////////////
-struct XByInstalled : public std::unary_function<ui::Selectable::constPtr,bool>
-{
- bool operator()( const ui::Selectable::constPtr & obj ) const
+template <class _Iterator, class _Filter, class _Function>
+ inline _Function for_each_if( _Iterator begin_r, _Iterator end_r,
+ _Filter filter_r,
+ _Function fnc_r )
{
- return obj->hasInstalledObj();
+ for ( _Iterator it = begin_r; it != end_r; ++it )
+ {
+ if ( filter_r( *it ) )
+ {
+ fnc_r( *it );
+ }
+ }
+ return fnc_r;
}
-};
-template<>
- struct PrintPtr<ui::Selectable::Ptr> : public std::unary_function<ui::Selectable::Ptr, bool>
+struct PoolItemSelect
+{
+ void operator()( const PoolItem & pi ) const
{
- bool operator()( const ui::Selectable::Ptr & obj )
- {
- if ( obj ) {
- MIL << obj->modifiedBy() << " " << obj->hasLicenceConfirmed() << endl;
- obj->set_status( ui::S_Install );
- obj->setLicenceConfirmed( true );
- MIL << "a " << obj->modifiedBy() << " " << obj->hasLicenceConfirmed() << endl;
- obj->set_status( ui::S_Del );
- obj->setLicenceConfirmed( false );
- MIL << "b " << obj->modifiedBy() << " " << obj->hasLicenceConfirmed() << endl;
-
-#if 0
- USR << *obj << std::endl;
- std::for_each( obj->availableBegin(), obj->availableEnd(),
- PrintPtr<ResObject::constPtr>() );
- if ( obj->availableBegin() != obj->availableEnd() )
- SEC << PrintPtr<ResObject::constPtr>()(*obj->availableBegin() )
- << " " << asKind<Package>(*obj->availableBegin())->vendor() << endl;
-#endif
- }
- else
- USR << "(NULL)" << std::endl;
- return true;
- }
- };
+ if ( pi->source().numericId() == 2 )
+ pi.status().setTransact( true, ResStatus::USER );
+ }
+};
-struct Mpool
+struct PrintPoolItem
{
- bool operator()( const PoolItem & pi )
+ void operator()( const PoolItem & pi ) const
{
- return pi.status().isLocked();
- return true;
+ USR << pi->source().numericId() << " " << pi << endl;
}
};
{
//zypp::base::LogControl::instance().logfile( "xxx" );
INT << "===[START]==========================================" << endl;
-
ResPool pool( getZYpp()->pool() );
- if ( 1 )
+ if ( 0 )
{
Measure x( "initTarget " + sysRoot.asString() );
getZYpp()->initTarget( sysRoot );
INT << "Added target: " << pool << endl;
}
- SourceManager::sourceManager()->restore( sysRoot );
- if ( SourceManager::sourceManager()->allSources().empty() )
- {
- Source_Ref src( createSource( instSrc ) );
- SourceManager::sourceManager()->addSource( src );
- SourceManager::sourceManager()->store( sysRoot, true );
- }
+ if ( 0 ) {
+ SourceManager::sourceManager()->restore( sysRoot );
+ if ( SourceManager::sourceManager()->allSources().empty() )
+ {
+ Source_Ref src( createSource( instSrc ) );
+ SourceManager::sourceManager()->addSource( src );
+ SourceManager::sourceManager()->store( sysRoot, true );
+ }
- Source_Ref src( *SourceManager::sourceManager()->Source_begin() );
- getZYpp()->addResolvables( src.resolvables() );
- INT << "Added source: " << pool << endl;
+ Source_Ref src( *SourceManager::sourceManager()->Source_begin() );
+ getZYpp()->addResolvables( src.resolvables() );
+ INT << "Added source: " << pool << endl;
+ }
+
+
+ Source_Ref src1( createSource( "dir:/mounts/machcd2/CDs/SUSE-Linux-10.1-Build_830-Addon-BiArch/CD1" ) );
+ Source_Ref src2( createSource( "dir:/mounts/machcd2/CDs/SUSE-Linux-10.1-Build_830-i386/CD1" ) );
+ INT << "Pool: " << pool << endl;
+ getZYpp()->addResolvables( src1.resolvables() );
+ INT << "Added source1: " << pool << endl;
+ getZYpp()->addResolvables( src2.resolvables() );
+ INT << "Added source2: " << pool << endl;
NameKindProxy s( nameKindProxy<Selection>( pool, "default" ) );
MIL << s << endl;
+ if ( ! s.availableEmpty() )
+ {
+ PoolItem def( * s.availableBegin() );
+ def.status().setTransact( true, ResStatus::USER );
+ }
+ MIL << "est " << getZYpp()->resolver()->establishPool() << endl;
+ MIL << "slv " << getZYpp()->resolver()->resolvePool() << endl;
+
+
+ for_each( pool.byKindBegin<Package>(), pool.byKindEnd<Package>(),
+ PoolItemSelect() );
+ INT << "FIN: " << pool << endl;
+ for_each_if( pool.begin(), pool.end(),
+ resfilter::ByTransact(),
+ PrintPoolItem() );
#if 0
Source_Ref src( *SourceManager::sourceManager()->Source_begin() );
-------------------------------------------------------------------
+Tue Apr 4 14:43:15 CEST 2006 - ma@suse.de
+
+- Fixed candidate handling in ui::Selectable. (#156589)
+
+-------------------------------------------------------------------
Tue Apr 4 14:06:23 CEST 2006 - dmacvicar@suse.de
-- fix #162984 , gpg hangs because the matching data file
+- fix #162984 , gpg hangs because the matching data file
for the key cannot be find. (dmacvicar)
- Fix restore of YUM source using the same cache dir semantics as
-Â susetags instead of assuming there is a cache if a cache_dir
+ susetags instead of assuming there is a cache if a cache_dir
was given. (dmacvicar)
-------------------------------------------------------------------
-------------------------------------------------------------------
Fri Mar 31 18:28:59 CEST 2006 - sh@suse.de
-- Added zypp/ui/UserWantedPackages to support the UI's
- "automatic changes" dialog (bug #152700)
+- Added zypp/ui/UserWantedPackages to support the UI's
+ "automatic changes" dialog (bug #152700)
-------------------------------------------------------------------
Fri Mar 31 18:02:05 CEST 2006 - jsrain@suse.de
PoolItem Selectable::Impl::setCandidate( ResObject::constPtr byUser_r )
{
+ PoolItem oldCand = _candidate;
_candidate = PoolItem();
- for ( availableItem_const_iterator it = availableBegin();
- it != availableEnd(); ++it )
+
+ if ( byUser_r ) // must be in available list
{
- if ( it->resolvable() == byUser_r )
+ for ( availableItem_const_iterator it = availableBegin();
+ it != availableEnd(); ++it )
{
- _candidate = *it;
- break;
+ if ( it->resolvable() == byUser_r )
+ {
+ _candidate = *it;
+ break;
+ }
}
}
+
if ( ! ( _candidate || _availableItems.empty() ) )
{
-#warning actually select with respect to an installed items arch
- _candidate = *_availableItems.begin();
+ if ( installedObj() )
+ {
+ for ( availableItem_const_iterator it = availableBegin();
+ it != availableEnd(); ++it )
+ {
+ if ( installedObj()->arch() == (*it)->arch() )
+ _candidate = *it;
+ break;
+ }
+ }
+ else
+ _candidate = *_availableItems.begin();
}
+
+ if ( _candidate != oldCand )
+ {
+ if ( oldCand )
+ {
+ ResStatus::TransactValue tv( oldCand.status().getTransactValue() );
+ ResStatus::TransactByValue tb( oldCand.status().getTransactByValue() );
+ oldCand.status().resetTransact( ResStatus::USER );
+ if ( _candidate )
+ {
+ _candidate.status().resetTransact( ResStatus::USER );
+ _candidate.status().setTransactValue( tv, tb );
+ }
+ }
+ }
+
return _candidate;
}