ResPool::const_nameiterator pend = pool.nameend(name);
for (ResPool::const_nameiterator it = pool.namebegin(name); it != pend; ++it) {
PoolItem item = it->second;
- if (item.status().isInstalled()
+ if (item.status().staysInstalled()
&& item->kind() == kind) {
if (!info( it->second ))
break;
}
}
- _DEBUG("Helper::findInstalledByNameAndKind (" << name << ", " << kind << ") => " << info.installed);
+ _XDEBUG("Helper::findInstalledByNameAndKind (" << name << ", " << kind << ") => " << info.installed);
return info.installed;
}
ResPool::const_nameiterator pend = pool.nameend(item->name());
for (ResPool::const_nameiterator it = pool.namebegin(item->name()); it != pend; ++it) {
PoolItem pos = it->second;
- if (pos.status().isUninstalled()
+ if (pos.status().staysUninstalled()
&& pos->kind() == item->kind()
&& item->edition().compare(pos->edition()) < 0)
{
}
}
- _DEBUG("Helper::findUpdateItem(" << item << ") => " << info.uninstalled);
+ _XDEBUG("Helper::findUpdateItem(" << item << ") => " << info.uninstalled);
return info.uninstalled;
}
ResPool::const_nameiterator pend = pool.nameend(item->name());
for (ResPool::const_nameiterator it = pool.namebegin(item->name()); it != pend; ++it) {
PoolItem pos = it->second;
- if (pos.status().isUninstalled()
+ if (pos.status().staysUninstalled()
&& pos->kind() == item->kind()
&& item->edition().compare(pos->edition()) == 0)
{
}
}
- _DEBUG("Helper::findReinstallItem(" << item << ") => " << info.uninstalled);
+ _XDEBUG("Helper::findReinstallItem(" << item << ") => " << info.uninstalled);
return info.uninstalled;
}
//
if ((provider.resolvable() != requestor.resolvable()) // resolvable could provide its own requirement
- && (!provider.status().isInstalled()) // only visit if provider is not already installed
+ && (!provider.status().staysInstalled()) // only visit if provider is not already installed
&& (toinstall.find(provider) != toinstall.end() // only look at resolvables
|| installed.find(provider) != installed.end())) { // we are currently considering anyways
tovisit.insert (provider);
//MIL << "UpgradeCandidate? " << candidate << ":[" << context->getStatus (candidate) << "]" << (item->edition().compare(candidate->edition())) << "<" << item->arch() << "," << candidate->arch() << ">" << endl;
// FIXME put this in the resfilter chain
+ ResStatus status = context->getStatus (candidate);
if ((item->edition().compare(candidate->edition()) < 0) // look at real upgrades
&& item->arch() == candidate->arch() // keep the architecture
- && (context->getStatus (candidate).staysUninstalled()
- || context->getStatus (candidate).isToBeUninstalled())) // FIXME: just for exercise-02conflict-03-test.xml
+ && (status.wasUninstalled()
+ || status.isToBeUninstalled()) // FIXME: just for exercise-02conflict-03-test.xml
// the original solver found the uninstalled foo-2.0.1 first, this solver
// finds the uninstallable first. In the end, we had a duplicate solution
// now we have no solution. Both results are right.
+ && (!status.isImpossible()) )
{
//MIL << "UpgradeCandidate! " << candidate << endl;
upgrades.push_back (candidate);
context->addError (misc_info);
}
- else if (status.isUninstalled()) {
+ else if (status.wasUninstalled()) {
- context->setStatus (provider, ResStatus::toBeUninstalled);
+ context->setStatus (provider, ResStatus::impossible);
ResolverInfoMisc_Ptr misc_info = new ResolverInfoMisc (RESOLVER_INFO_TYPE_CONFLICT_UNINSTALLABLE, provider, RESOLVER_INFO_PRIORITY_VERBOSE, provides);
}
else if ((status.isToBeUninstalled() && !status.isToBeUninstalledDueToUnlink())
+ || status.isImpossible()
|| status.isToBeUninstalledDueToObsolete()) {
/* This is the easy case -- we do nothing. */
// if we have freshens but none of the freshen deps were met, mark the _item as unneeded
// else we look at its requires to set it to satisfied or incomplete
- if (status.isUninstalled()
+ if (status.staysUninstalled()
&& freshens.size() > 0
&& iter == freshens.end())
{
for (PoolItemList::const_iterator iter = _needed_by.begin(); iter != _needed_by.end() && !still_needed; ++iter) {
ResStatus status = iter->status();
_XDEBUG("by: [status: " << status << "] " << *iter);
- if (! status.isToBeUninstalled()) {
+ if (! status.isToBeUninstalled()
+ && ! status.isImpossible())
+ {
still_needed = true;
}
}
needed this. */
if (context->verifying()
- && status.isToBeUninstalled()
+ && (status.isToBeUninstalled() || status.isImpossible())
&& !_needed_by.empty()) {
QueueItemUninstall_Ptr uninstall_item;
return true;
}
- if (!status.isToBeUninstalled()
+ if (! (status.isToBeUninstalled() || status.isImpossible())
&& ! context->isParallelInstall (provider)
&& ! uniq.has(provider)
&& context->itemIsPossible (provider)
string msg_str;
//const Capability match;
- ResStatus status = provider.status();
+ ResStatus status = context->getStatus( provider );
ResolverInfoMisc_Ptr misc_info;
} else if (context->isParallelInstall (provider)) {
misc_info = new ResolverInfoMisc (RESOLVER_INFO_TYPE_PARALLEL_PROVIDER, requirer, RESOLVER_INFO_PRIORITY_VERBOSE, match);
misc_info->setOtherPoolItem (provider);
- } else if (! context->itemIsPossible (provider)) {
+ } else if (status.isImpossible()
+ || ! context->itemIsPossible (provider)) {
misc_info = new ResolverInfoMisc (RESOLVER_INFO_TYPE_NOT_INSTALLABLE_PROVIDER, requirer, RESOLVER_INFO_PRIORITY_VERBOSE, match);
misc_info->setOtherPoolItem (provider);
#warning Locks not implemented
ResPool::const_nameiterator pend = pool().nameend(_requiring_item->name());
for (ResPool::const_nameiterator it = pool().namebegin(_requiring_item->name()); it != pend; ++it) {
PoolItem pos = it->second;
- if (pos.status().isUninstalled()
+ if (pos.status().staysUninstalled()
&& pos->kind() == _requiring_item->kind()
&& _requiring_item->edition().compare(pos->edition()) < 0)
{
for (CapSet::const_iterator iter = provides.begin(); iter != provides.end(); iter++) {
UninstallProcess info ( pool(), context, _item, _upgraded_to, qil, _remove_only, _soft);
-
+#if 0
//world()->foreachRequiringPoolItem (*iter, uninstall_process_cb, &info);
Dep dep( Dep::REQUIRES);
invokeOnEach( pool().byCapabilityIndexBegin( iter->index(), dep ),
pool().byCapabilityIndexEnd( iter->index(), dep ),
resfilter::callOnCapMatchIn( dep, *iter, functor::functorRef<bool,PoolItem,Capability>(info) ) );
+#endif
+ Capability c = *iter;
+ ResPool::const_indexiterator rend = pool().requiresend(c.index());
+ for (ResPool::const_indexiterator it = pool().requiresbegin(c.index()); it != rend; ++it) {
+ if (c.matches (it->second.first) == CapMatch::yes) {
+ if (!info( it->second.second, it->second.first))
+ break;
+ }
+ }
+
}
}
DBG << "CollectTransact(" << item << ")" << endl;
item.status().setNoTransact(ResStatus::APPL_LOW);// clear any solver/establish transactions
- if (status.isUninstalled()) { // transact && uninstalled
+ if (status.isToBeInstalled()) {
resolver.addPoolItemToInstall(item); // -> install!
}
- if (status.isInstalled()) { // transact && installed
+ if (status.isToBeUninstalled()) {
resolver.addPoolItemToRemove(item); // -> remove !
}
if (status.isIncomplete()) { // incomplete (re-install needed)
return false;
}
+ if (status.isImpossible()) {
+ ResolverInfo_Ptr misc_info = new ResolverInfoMisc (RESOLVER_INFO_TYPE_UNINSTALLABLE, item, RESOLVER_INFO_PRIORITY_VERBOSE);
+ addError (misc_info);
+ return false;
+ }
+
if (status.isUnneeded()) {
ResolverInfo_Ptr misc_info = new ResolverInfoMisc (RESOLVER_INFO_TYPE_INSTALL_UNNEEDED, item, RESOLVER_INFO_PRIORITY_VERBOSE);
addError (misc_info);
else
setStatus (item, ResStatus::toBeInstalled);
- if (status.isUninstalled()) {
+ if (status.wasUninstalled()) {
Resolvable::constPtr res = item.resolvable();
Package::constPtr pkg = asKind<Package>(res); // try to access it as a package
if (pkg) { // if its !=NULL, get size information
status = getStatus(item);
- if (status.isToBeUninstalled())
+ if (status.isToBeUninstalled()
+ || status.isImpossible())
return false;
if (status.isToBeInstalled())
setStatus (item, ResStatus::toBeInstalled);
}
- if (status.isUninstalled()) {
- Resolvable::constPtr res = item.resolvable();
+ if (old_item.status().wasUninstalled()) {
+ Resolvable::constPtr res = old_item.resolvable();
Package::constPtr pkg = asKind<Package>(res); // try to access it as a package
if (pkg) { // if its !=NULL, get size information
+ _install_size -= pkg->size();
+ }
+
+ res = item.resolvable();
+ pkg = asKind<Package>(res); // try to access it as a package
+ if (pkg) { // if its !=NULL, get size information
+
_download_size += pkg->archivesize();
_install_size += pkg->size();
- // FIXME: Incomplete
- // We should change installed_size to reflect the difference in
- // installed size between the old and new versions.
}
int priority;
}
if (status.isToBeUninstalled()
- && !status.isToBeUninstalledDueToUnlink()) {
+ && !status.isToBeUninstalledDueToUnlink())
+ {
return true;
}
- if (status.isUninstalled()
- || status.isToBeUninstalledDueToUnlink()) {
+ if (status.wasUninstalled()
+ || status.isImpossible()
+ || status.isToBeUninstalledDueToUnlink())
+ {
ResolverInfo_Ptr misc_info = new ResolverInfoMisc (RESOLVER_INFO_TYPE_UNINSTALLABLE, item, RESOLVER_INFO_PRIORITY_VERBOSE);
addInfo (misc_info);
}
else if (due_to_unlink) {
setStatus (item, ResStatus::toBeUninstalledDueToUnlink);
}
+ else if (status.wasUninstalled()) {
+ setStatus (item, ResStatus::impossible);
+ }
else {
setStatus (item, ResStatus::toBeUninstalled);
}
- if (status.isInstalled()) {
+ if (status.wasInstalled()) {
Resolvable::constPtr res = item.resolvable();
- Package::constPtr pkg = asKind<Package>(res); // try to access it as a package
+ Package::constPtr pkg = asKind<Package>(res); // try to access it as a package
if (pkg) { // if its !=NULL, get size information
_install_size -= pkg->size();
}
status = getStatus(item);
- if (status.staysInstalled()) {
+ if (status.wasInstalled()) {
setStatus (item, ResStatus::satisfied);
}
- else if (status.staysUninstalled()) {
+ else if (status.wasUninstalled()) {
setStatus (item, ResStatus::unneeded);
}
_XDEBUG( "ResolverContext[" << this << "]::satisfy(" << item << ":" << status << ")" );
- if (status.staysInstalled()) {
+ if (status.wasInstalled()) {
setStatus (item, ResStatus::complete);
}
- else if (status.staysUninstalled()) {
+ else if (status.wasUninstalled()) {
setStatus (item, ResStatus::satisfied);
}
_XDEBUG( "ResolverContext[" << this << "]::incomplete(" << item << "):" << status );
if (_establishing) {
- if (status.isInstalled()) {
+ if (status.wasInstalled()) {
setStatus (item, ResStatus::incomplete);
}
else {
_XDEBUG("ResolverContext::itemIsPresent(<" << status << ">" << item << ")");
return (status.staysInstalled()
- || ((status.isToBeInstalled() || status.isToBeInstalledSoft())
- && !status.isNeeded())
+ || (status.isToBeInstalled() && !status.isNeeded())
|| status.isSatisfied ());
}
// DONT add incomplete here, uninstall requests for incompletes must be handled
- return (status.isUninstalled()
- || status.isToBeUninstalled());
+ return (status.staysUninstalled()
+ || status.isToBeUninstalled()
+ || status.isImpossible());
}
{
InstallInfo *info = (InstallInfo *)data;
if (status.isToBeInstalled()
- && ! status.isInstalled ()
- && !Helper::findInstalledItem (info->pool, item))
+ && !Helper::findInstalledItem( info->pool, item))
{
if (info->fn) info->fn (item, status, info->rl);
++info->count;
{
SatisfyInfo *info = (SatisfyInfo *)data;
if (status.isSatisfied()
- && ! status.isInstalled ()
+ && ! status.staysInstalled ()
&& !Helper::findInstalledItem (info->pool, item))
{
if (info->fn) info->fn (item, status, info->rl);
PoolItem_Ref to_be_upgraded;
if (status.isToBeInstalled()
- && ! status.isInstalled ())
+ && ! status.staysInstalled ())
{
to_be_upgraded = Helper::findInstalledItem(info->pool, item);
UpgradeTable::const_iterator pos = info->upgrade_hash.find(item->name());
if (status.isToBeUninstalled ()
- && pos == info->upgrade_hash.end())
+ && pos == info->upgrade_hash.end()) // dont count upgrades
{
if (info->fn)
info->fn (item, status, info->rl);
//---------------------------------------------------------------------------
+// impossible
+
+typedef struct {
+ ResPool pool;
+ MarkedPoolItemFn fn;
+ int count;
+ void *data;
+} ImpossibleInfo;
+
+static void
+impossible_pkg_cb (PoolItem_Ref item, const ResStatus & status, void *data)
+{
+ ImpossibleInfo *info = (ImpossibleInfo *)data;
+
+ if (status.isImpossible ()) {
+ if (info->fn) info->fn (item, status, info->data);
+ ++info->count;
+ }
+}
+
+
+int
+ResolverContext::foreachImpossible (MarkedPoolItemFn fn, void *data)
+{
+ ImpossibleInfo info = { _pool, fn, 0, data };
+
+ foreachMarked (impossible_pkg_cb, (void *)&info);
+
+ return info.count;
+}
+
+
+//---------------------------------------------------------------------------
static void
install_count_cb (PoolItem_Ref item, const ResStatus & status, void *data)
{
int *count = (int *)data;
- if (! item.status().isInstalled ()) {
+ if (item.status().wasUninstalled ()) {
++*count;
}
}
uninstall_count_cb (PoolItem_Ref item, const ResStatus & status, void *data)
{
int *count = (int *)data;
- if (item.status().isInstalled ()) {
+ if (item.status().wasInstalled ()) {
++*count;
}
}
satisfy_count_cb (PoolItem_Ref item, const ResStatus & status, void *data)
{
int *count = (int *)data;
- if (! item.status().isInstalled ()) {
+ if (item.status().wasUninstalled ()) {
++*count;
}
}
struct RequirementPossible : public resfilter::OnCapMatchCallbackFunctor
{
+ ResolverContext_Ptr context;
bool flag;
- RequirementPossible ()
- : flag (false)
+ RequirementPossible( ResolverContext_Ptr ctx )
+ : context (ctx)
+ , flag (false)
{ }
bool operator()( PoolItem_Ref provider, const Capability & match )
{
- ResStatus status = provider.status();
+ ResStatus status = context->getStatus( provider );
- if (! status.isToBeUninstalled ()
+ if (! (status.isToBeUninstalled () || status.isImpossible())
|| status.isToBeUninstalledDueToUnlink())
{
flag = true;
bool
-ResolverContext::requirementIsPossible (const Capability & dependency) const
+ResolverContext::requirementIsPossible (const Capability & dependency)
{
- RequirementPossible info;
+ RequirementPossible info( this );
// world()->foreachProviding (dep, requirement_possible_cb, (void *)&info);
#if 0
bool
-ResolverContext::itemIsPossible (PoolItem_Ref item) const
+ResolverContext::itemIsPossible (PoolItem_Ref item)
{
CapSet requires = item->dep (Dep::REQUIRES);
for (CapSet::iterator iter = requires.begin(); iter != requires.end(); iter++) {
bool isAbsent (PoolItem_Ref item);
bool requirementIsMet (const Capability & cap, bool is_child = false);
- bool requirementIsPossible (const Capability & cap) const;
- bool itemIsPossible (const PoolItem_Ref item) const;
+ bool requirementIsPossible (const Capability & cap);
+ bool itemIsPossible (const PoolItem_Ref item);
bool isParallelInstall (const PoolItem_Ref item) const;
PoolItem_Ref getParallelInstall (const PoolItem_Ref item) const;
PoolItemList getIncompletes (void) const;
int incompleteCount (void) const;
+ int foreachImpossible (MarkedPoolItemFn fn, void *data);
+// PoolItemList getImpossibles (void);
+// int impossibleCount (void);
+
// add to the report log
void addInfo (ResolverInfo_Ptr info); // normal progress info
void addError (ResolverInfo_Ptr info); // error progress info
++opt_stats_r.pre_todel;
continue;
}
- if ( item.status().isInstalled() ) {
+ if ( item.status().staysInstalled() ) {
installed = item;
CandidateMap::const_iterator cand_it = candidatemap.find(installed);
if (cand_it != candidatemap.end()) {
continue;
}
MIL << "item " << item << " is installed, candidate is " << candidate << endl;
- if (candidate.status().isUnneeded()) { // seen already
- candidate.status().setUndetermined();
+ if (candidate.status().isSeen()) { // seen already
+ candidate.status().setSeen(true);
continue;
}
- candidate.status().setUnneeded(); // mark as seen
+ candidate.status().setSeen(true); // mark as seen
candidatemap[installed] = candidate;
}
else { // assume Uninstalled
- if (item.status().isUnneeded()) { // seen already
- item.status().setUndetermined();
+ if (item.status().isSeen()) { // seen already
+ item.status().setSeen(true);
continue;
}
candidate = item;
- candidate.status().setUnneeded(); // mark as seen
+ candidate.status().setSeen(true); // mark as seen
installed = Helper::findInstalledItem (_pool, candidate);
if (installed) { // check if we already have an installed
MIL << "found installed " << installed << " for item " << candidate << endl;
} // iterate over the complete pool
- // reset all unneeded
+ // reset all seen
for (PoolItemSet::const_iterator it = available.begin(); it != available.end(); ++it) {
- it->status().setUndetermined();
+ it->status().setSeen(false);
}
#warning Cant update from broken install medium like STABLE
PoolItem_Ref installed(*it);
ResStatus status (installed.status());
- if ( ! status.isInstalled() ) {
+ if ( ! status.staysInstalled() ) {
continue;
}
++opt_stats_r.chk_installed_total;
#endif
ResPool::const_indexiterator pend = pool().providesend(installed->name());
for (ResPool::const_indexiterator it = pool().providesbegin(installed->name()); it != pend; ++it) {
- if (it->second.second.status().isUninstalled()
+ if (it->second.second.status().staysUninstalled()
&& installedCap.matches (it->second.first) == CapMatch::yes) {
if (!info( it->second.second, it->second.first))
break;
PoolItem_Ref split_candidate = *ait;
MIL << " ==> ADD (splitted): " << split_candidate << endl;
if ( probably_dropped
- && split_candidate.status().isUninstalled()
+ && split_candidate.status().staysUninstalled()
&& doesObsoleteItem (split_candidate, installed))
{
probably_dropped = false;