locks enabled
authorStefan Schubert <schubi@suse.de>
Fri, 24 Feb 2006 16:29:39 +0000 (16:29 +0000)
committerStefan Schubert <schubi@suse.de>
Fri, 24 Feb 2006 16:29:39 +0000 (16:29 +0000)
zypp/solver/detail/Helper.cc
zypp/solver/detail/QueueItemRequire.cc
zypp/solver/detail/QueueItemUninstall.cc
zypp/solver/detail/ResolverUpgrade.cc
zypp/solver/detail/SolutionAction.cc

index c9b8bc9..4a90ab6 100644 (file)
@@ -124,8 +124,9 @@ class LookForUpdate : public resfilter::PoolItemFilterFunctor
 
     bool operator()( PoolItem_Ref provider )
     {
-       if (!uninstalled                                                        // none yet
+       if ((!uninstalled                                                       // none yet
            || uninstalled->edition().compare( provider->edition() ) < 0)       // or a better one
+           && !provider.status().isLocked())                                   // is not locked
        {
            uninstalled = provider;                                             // store 
        }
@@ -141,7 +142,6 @@ PoolItem_Ref
 Helper::findUpdateItem (const ResPool & pool, PoolItem_Ref item)
 {
     LookForUpdate info;
-#warning FIXME, should not report locked update candidates.
 
     invokeOnEach( pool.byNameBegin( item->name() ),
                  pool.byNameEnd( item->name() ),
@@ -164,8 +164,12 @@ class LookForReinstall : public resfilter::PoolItemFilterFunctor
 
     bool operator()( PoolItem_Ref provider )
     {
-       uninstalled = provider;
-       return false;                           // stop here, we found it
+       if (provider.status().isLocked()) {
+           return true; // search next
+       } else {
+           uninstalled = provider;
+           return false;                               // stop here, we found it
+       }
     }
 };
 
@@ -174,7 +178,6 @@ PoolItem_Ref
 Helper::findReinstallItem (const ResPool & pool, PoolItem_Ref item)
 {
     LookForReinstall info;
-#warning FIXME, should not report locked update candidates.
 
     invokeOnEach( pool.byNameBegin( item->name() ),
                  pool.byNameEnd( item->name() ),
index 3f1014b..37a4421 100644 (file)
@@ -186,8 +186,7 @@ struct RequireProcess
        if (! (status.isToBeUninstalled() || status.isImpossible())
            && ! context->isParallelInstall( provider )
            && context->itemIsPossible( provider )
-#warning Locks not implemented
-//         && ! pool->itemIsLocked( provider )
+           && ! provider.status().isLocked() 
        ) {
 
            // if we found a to-be-installed provider, choose this and drop all others
@@ -250,12 +249,9 @@ struct NoInstallableProviders
                  || ! 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
-#if 0
-       } else if (pool->itemIsLocked (provider)) {
+       } else if (provider.status().isLocked()) {
            misc_info = new ResolverInfoMisc (RESOLVER_INFO_TYPE_LOCKED_PROVIDER, requirer, RESOLVER_INFO_PRIORITY_VERBOSE, match);
            misc_info->setOtherPoolItem (provider);
-#endif
        }
 
        if (misc_info != NULL) {
index c89d0de..d9f5d20 100644 (file)
@@ -313,16 +313,14 @@ QueueItemUninstall::process (ResolverContext_Ptr context, QueueItemList & qil)
 
     if (status.staysInstalled()) {
 
-#warning Needs Locks
-#if 0
        if (! _explicitly_requested
-           && pool().itemIsLocked (_item)) {
+           && _item.status().isLocked()) {
 
            ResolverInfo_Ptr misc_info = new ResolverInfoMisc (RESOLVER_INFO_TYPE_UNINSTALL_LOCKED, _item, RESOLVER_INFO_PRIORITY_VERBOSE);
            context->addError (misc_info);
            goto finished;
        }
-#endif
+       
        this->logInfo (context);
 
        if (_cap_leading_to_uninstall != Capability()           // non-empty _cap_leading_to_uninstall
index 0549818..a84130e 100644 (file)
@@ -296,14 +296,11 @@ MIL << "found installed " << installed << " for item " << candidate << endl;
       }
     }
 
-#warning FIXME needs locks
-#if 0
-    if ( item->isLocked() ) {
+    if ( item.status().isLocked() ) {
       MIL << "doUpgrade available: SKIP taboo candidate " << item << endl;
       ++opt_stats_r.pre_nocand;
       continue;
     }
-#endif
 
     ++opt_stats_r.pre_avcand;
 #warning this should add the best candidate
@@ -416,15 +413,12 @@ MIL << "split matched !" << endl;
       continue;
     }
 
-#warning This needs locks
-#if 0
-    if ( (*it)->is_taboo() ) {
-      MIL << "SKIP taboo: " << (*it)->installedObj() << endl;
+    if ( (*it).status().isLocked() ) {
+      MIL << "SKIP taboo: " << (*it) << endl;
       ++opt_stats_r.chk_is_taboo;
       _update_items.push_back ( *it ); // remember in problem list ?
       continue;
     }
-#endif
 
     CandidateMap::iterator cand_it = candidatemap.find(installed);
 
index 653535d..62148b1 100644 (file)
@@ -149,9 +149,7 @@ TransactionSolutionAction::execute(Resolver & resolver) const
                _item.status().setToBeUninstalled (ResStatus::USER);
            break;
        case UNLOCK:
-           ERR << "Not implemented yet" << endl;
-           ret = false;
-#warning Unlocking items not implemented
+           _item.status().setLock (false, ResStatus::USER);
            break;
        default:
            ERR << "Wrong TransactionKind" << endl;