ResPool::byCapabilityIndex_iterator ResPool::byCapabilityIndexEnd( const std::string & index_r, Dep depType_r ) const
{ return make_filter_iterator( ByCapabilityIndex(), _pimpl->_caphash.end( index_r, depType_r ), _pimpl->_caphash.end( index_r, depType_r ) ); }
- void ResPool::eraseInstalled()
- { // doesnotwork (const_pointer_cast<pool::PoolTraits::Impl_constPtr>(_pimpl))->eraseInstalled();
- return; }
-
/******************************************************************
**
** FUNCTION NAME : operator<<
PoolImpl::~PoolImpl()
{}
- /******************************************************************
- **
- ** FUNCTION NAME : eraseInstalled
- ** FUNCTION TYPE : void
- */
- void PoolImpl::eraseInstalled( )
- {
- MIL << "eraseInstalled()" << endl;
- for (ContainerT::iterator it = _store.begin(); it != _store.end();) {
- PoolItem item = *it;
- if (item.status().isInstalled()) {
- ContainerT::iterator next = it; ++next;
- _store.erase( item );
- _namehash.erase( item );
- _caphash.erase( item );
- it = next;
- }
- else {
- ++it;
- }
- }
- }
/******************************************************************
**
void ZYppImpl::removeResolvables (const ResStore& store)
{
- for (ResStore::iterator it = store.begin(); it != store.end(); it++)
+ for (ResStore::iterator it = store.begin(); it != store.end(); ++it)
{
_pool.erase(*it);
}
}
+ void ZYppImpl::removeInstalledResolvables ()
+ {
+ for (ResPool::const_iterator it = pool().begin(); it != pool().end(); ++it)
+ {
+ if (it->status().isInstalled())
+ _pool.erase(*it);
+ }
+ }
+
Target_Ptr ZYppImpl::target() const
{
if (! _target)
void ZYppImpl::initTarget(const Pathname & root, bool commit_only)
{
- if (_target && _target->root() == root) {
- MIL << "Repeated call to initTarget()" << endl;
- return;
+ if (_target) {
+ if (_target->root() == root) {
+ MIL << "Repeated call to initTarget()" << endl;
+ return;
+ }
+ removeInstalledResolvables( );
}
-
- _target = new Target(root);
+ _target = new Target( root );
if (!commit_only)
{
- _target->enableStorage(root);
- addResolvables (_target->resolvables(), true);
+ _target->enableStorage( root );
+ addResolvables( _target->resolvables(), true );
}
}
void ZYppImpl::finishTarget()
{
-#warning not removing target resolvables for now
-// if (_target)
-// removeResolvables (_target->resolvables());
+ if (_target)
+ removeInstalledResolvables();
_target = 0;
}
ZYPP_THROW( Exception("Target not initialized.") );
ZYpp::CommitResult res;
+
// must redirect to Target::Impl. This kind of commit should not be
// in the Target interface.
+
res._result = _target->commit( pool(), medianr_r,
res._errors, res._remaining, res._srcremaining );
+ // reload new status from target
+
+ removeInstalledResolvables();
+ addResolvables( _target->resolvables(), true );
+
MIL << "Commit (medianr " << medianr_r << ") returned: "
<< res._result
<< " (errors " << res._errors.size()
<< ", remaining " << res._remaining.size()
<< ", srcremaining " << res._srcremaining.size()
<< ")" << endl;
+
return res;
}