}
};
+// Handle items which provides a recommend -> remove it soft
+
+struct ProvidesItem
+{
+ const ResPool & pool;
+ QueueItemList & qil;
+ bool soft;
+
+ ProvidesItem (const ResPool & p, QueueItemList &l, bool s)
+ : pool(p)
+ , qil(l)
+ , soft(s)
+ { }
+
+
+ bool operator()( const CapAndItem & cai )
+ {
+ _XDEBUG("remove soft item (" << cai.item << ", " << cai.cap << ")");
+
+ QueueItemUninstall_Ptr uninstall_item = new QueueItemUninstall (pool, cai.item, QueueItemUninstall::EXPLICIT, soft);
+ uninstall_item->setUnlink ();
+ qil.push_back (uninstall_item);
+ return true;
+ }
+};
+
+
//-----------------------------------------------------------------------------
this->logInfo (context);
context->uninstall (_item, _upgraded_to /*bool*/, _due_to_obsolete, _unlink);
-
if (status.staysInstalled()) {
if (! _explicitly_requested
&& _item.status().isLocked()) {
resfilter::ByCapMatch( *iter ),
functor::functorRef<bool,CapAndItem>( establish ) );
}
+
+ // remove the items which have been recommended by the
+ CapSet recomments = _item->dep (Dep::RECOMMENDS);
+ for (CapSet::const_iterator iter = recomments.begin(); iter != recomments.end(); iter++) {
+ const Capability cap = *iter;
+ _XDEBUG("this recommends " << cap);
+ ProvidesItem provides( pool(), qil, true ); // soft
+
+ Dep dep(Dep::PROVIDES);
+ invokeOnEach( pool().byCapabilityIndexBegin( iter->index(), dep ),
+ pool().byCapabilityIndexEnd( iter->index(), dep ),
+ resfilter::ByCapMatch( *iter ),
+ functor::functorRef<bool,CapAndItem>( provides ) );
+ }
+
}
finished:
PoolItem_Ref installed = Helper::findInstalledByNameAndKind( pool, it->index(), it->refers() );
PoolItem_Ref uninstalled = Helper::findUninstalledByNameAndKind( pool, it->index(), it->refers() );
- if (uninstalled
- && !uninstalled.status().isLocked())
- {
- if (soft)
- uninstalled.status().setSoftTransact( install, ResStatus::SOLVER );
- else
- uninstalled.status().setTransact( install, ResStatus::SOLVER );
- }
- if (installed
- && !installed.status().isLocked())
- {
- if (soft)
- installed.status().setSoftTransact( false, ResStatus::SOLVER );
- else
- installed.status().setTransact( false, ResStatus::SOLVER );
+ if (install) {
+ if (uninstalled
+ && !uninstalled.status().isLocked())
+ {
+ if (soft)
+ uninstalled.status().setSoftTransact( install, ResStatus::SOLVER );
+ else
+ uninstalled.status().setTransact( install, ResStatus::SOLVER );
+ }
+ if (installed
+ && !installed.status().isLocked())
+ {
+ if (soft)
+ installed.status().setSoftTransact( false, ResStatus::SOLVER );
+ else
+ installed.status().setTransact( false, ResStatus::SOLVER );
+ }
+ } else {
+ // uninstall
+ if (uninstalled
+ && !uninstalled.status().isLocked())
+ {
+ if (soft)
+ uninstalled.status().setSoftTransact( false, ResStatus::SOLVER );
+ else
+ uninstalled.status().setTransact( false, ResStatus::SOLVER );
+ }
+ if (installed
+ && !installed.status().isLocked())
+ {
+ if (soft)
+ installed.status().setSoftTransact( true, ResStatus::SOLVER );
+ else
+ installed.status().setTransact( true, ResStatus::SOLVER );
+ }
}
if (!uninstalled
&& !installed)