#include "zypp/base/Easy.h"
#include "zypp/base/LogTools.h"
#include "zypp/base/SerialNumber.h"
-#include "zypp/base/Deprecated.h"
+#include "zypp/APIConfig.h"
#include "zypp/pool/PoolTraits.h"
#include "zypp/ResPoolProxy.h"
/** Test whether the lock status differs from the remembered UserLockQuery bit. */
static int diffLock( const ResStatus & status_r )
{
- if ( status_r.isLocked() == status_r.isUserLockQueryMatch() )
+ bool userLock( status_r.isUserLocked() );
+ if ( userLock == status_r.isUserLockQueryMatch() )
return 0;
- return status_r.isLocked() ? 1 : -1;
+ return userLock ? 1 : -1;
}
};
}
public:
- typedef PoolTraits::AutoSoftLocks AutoSoftLocks;
- typedef PoolTraits::autoSoftLocks_iterator autoSoftLocks_iterator;
-
- const AutoSoftLocks & autoSoftLocks() const
- { return _autoSoftLocks; }
-
- bool autoSoftLockAppliesTo( sat::Solvable solv_r ) const
- { return( _autoSoftLocks.find( solv_r.ident() ) != _autoSoftLocks.end() ); }
-
- void setAutoSoftLocks( const AutoSoftLocks & newLocks_r )
- {
- MIL << "Apply " << newLocks_r.size() << " AutoSoftLocks: " << newLocks_r << endl;
- _autoSoftLocks = newLocks_r;
- // now adjust the pool status
- for_( it, begin(), end() )
- {
- if ( ! it->status().isKept() )
- continue;
-
- if ( autoSoftLockAppliesTo( it->satSolvable() ) )
- it->status().setSoftLock( ResStatus::USER );
- else
- it->status().resetTransact( ResStatus::USER );
- }
- }
-
- void getActiveSoftLocks( AutoSoftLocks & activeLocks_r )
- {
- activeLocks_r = _autoSoftLocks; // current soft-locks
- AutoSoftLocks todel; // + names to be deleted
- AutoSoftLocks toins; // - names to be installed
-
- for_( it, begin(), end() )
- {
- ResStatus & status( it->status() );
- if ( ! status.isByUser() )
- continue; // ignore non-uer requests
-
- switch ( status.getTransactValue() )
- {
- case ResStatus::KEEP_STATE:
- // ma@: Filter only items included in the recommended set?
- activeLocks_r.insert( it->satSolvable().ident() );
- break;
- case ResStatus::LOCKED:
- // NOOP
- break;
- case ResStatus::TRANSACT:
- (status.isInstalled() ? todel : toins).insert( it->satSolvable().ident() );
- break;
- }
- }
- for_( it, todel.begin(), todel.end() )
- {
- activeLocks_r.insert( *it );
- }
- for_( it, toins.begin(), toins.end() )
- {
- activeLocks_r.erase( *it );
- }
- }
-
- public:
const ContainerT & store() const
{
checkSerial();
bool addedItems = false;
std::list<PoolItem> addedProducts;
- if ( pool.capacity() != _store.capacity() )
- {
- _store.resize( pool.capacity() );
- }
+ _store.resize( pool.capacity() );
if ( pool.capacity() )
{
// remember products for buddy processing (requires clean store)
if ( s.isKind( ResKind::product ) )
addedProducts.push_back( pi );
- // and on the fly check for weak locks...
- if ( autoSoftLockAppliesTo( s ) )
- {
- pi.status().setSoftLock( ResStatus::USER );
- }
if ( !addedItems )
addedItems = true;
}
mutable shared_ptr<ResPoolProxy> _poolProxy;
private:
- /** Set of solvable idents that should be soft locked per default. */
- AutoSoftLocks _autoSoftLocks;
/** Set of queries that define hardlocks. */
HardLockQueries _hardLockQueries;
};