- Fixed lost user request to abort during commit. BASE-SuSE-Code-11-Branch
authorMichael Andres <ma@suse.de>
Thu, 18 Dec 2008 21:32:18 +0000 (21:32 +0000)
committerMichael Andres <ma@suse.de>
Thu, 18 Dec 2008 21:32:18 +0000 (21:32 +0000)
VERSION.cmake
package/libzypp.changes
zypp/target/TargetCallbackReceiver.cc
zypp/target/TargetImpl.cc

index 81ff9ab..f46b263 100644 (file)
@@ -63,6 +63,6 @@ SET(LIBZYPP_COMPATMINOR "23")
 SET(LIBZYPP_MINOR "25")
 SET(LIBZYPP_PATCH "0")
 #
-# LAST RELEASED: 5.24.7 (23)
+# LAST RELEASED: 5.25.0 (23)
 # (The number in parenthesis is LIBZYPP_COMPATMINOR)
 #=======
index d7d8f89..483b7c5 100644 (file)
@@ -1,4 +1,11 @@
 -------------------------------------------------------------------
+Thu Dec 18 22:26:18 CET 2008 - ma@suse.de
+
+- Fixed lost user request to abort during commit. (bnc #388810, bnc #450273)
+- revision 11954
+- version 5.25.0 (23)
+
+-------------------------------------------------------------------
 Thu Dec 18 13:02:27 CET 2008 - ma@suse.de
 
 - Add Package::filelist, faster and less memory consuming 
index 3816f84..463fd9d 100644 (file)
@@ -72,6 +72,7 @@ namespace zypp
                case rpm::InstallResolvableReport::RETRY:
                    return rpm::RpmInstallReport::RETRY;
                case rpm::InstallResolvableReport::ABORT:
+                    _abort = true;
                    return rpm::RpmInstallReport::ABORT;
                case rpm::InstallResolvableReport::IGNORE:
                    return rpm::RpmInstallReport::IGNORE;
@@ -125,6 +126,7 @@ namespace zypp
         void RpmRemovePackageReceiver::start( const std::string & name )
        {
            _report->start( _resolvable );
+            _abort = false;
        }
 
         /**
@@ -150,6 +152,7 @@ namespace zypp
                case rpm::RemoveResolvableReport::RETRY:
                    return rpm::RpmRemoveReport::RETRY;
                case rpm::RemoveResolvableReport::ABORT:
+                    _abort = true;
                    return rpm::RpmRemoveReport::ABORT;
                case rpm::RemoveResolvableReport::IGNORE:
                    return rpm::RpmRemoveReport::IGNORE;
index 98a4d58..d5af084 100644 (file)
@@ -616,6 +616,11 @@ namespace zypp
       MIL << "Target loaded: " << system.solvablesSize() << " resolvables" << endl;
     }
 
+    ///////////////////////////////////////////////////////////////////
+    //
+    // COMMIT
+    //
+    ///////////////////////////////////////////////////////////////////
     ZYppCommitResult TargetImpl::commit( ResPool pool_r, const ZYppCommitPolicy & policy_rX )
     {
       // ----------------------------------------------------------------- //
@@ -702,7 +707,7 @@ namespace zypp
       ///////////////////////////////////////////////////////////////////
       // Remove/install packages.
       ///////////////////////////////////////////////////////////////////
-     commit (to_uninstall, policy_r, pool_r );
+     commit ( to_uninstall, policy_r, pool_r );
 
       if (policy_r.restrictToMedia() == 0)
       {                        // commit all
@@ -765,6 +770,11 @@ namespace zypp
     }
 
 
+    ///////////////////////////////////////////////////////////////////
+    //
+    // COMMIT internal
+    //
+    ///////////////////////////////////////////////////////////////////
     TargetImpl::PoolItemList
     TargetImpl::commit( const TargetImpl::PoolItemList & items_r,
                         const ZYppCommitPolicy & policy_r,
@@ -794,6 +804,12 @@ namespace zypp
             {
               localfile = packageCache.get( it );
             }
+            catch ( const AbortRequestException &e )
+            {
+              WAR << "commit aborted by the user" << endl;
+              abort = true;
+              break;
+            }
             catch ( const SkipRequestException &e )
             {
               ZYPP_CAUGHT( e );
@@ -812,8 +828,9 @@ namespace zypp
 #warning Exception handling
             // create a installation progress report proxy
             RpmInstallPackageReceiver progress( it->resolvable() );
-            progress.connect();
-            bool success = true;
+            progress.connect(); // disconnected on destruction.
+
+            bool success = false;
             rpm::RpmInstFlags flags;
             // Why force and nodeps?
             //
@@ -839,27 +856,34 @@ namespace zypp
               if ( progress.aborted() )
               {
                 WAR << "commit aborted by the user" << endl;
-                progress.disconnect();
-                success = false;
                 abort = true;
                 break;
               }
+              else
+              {
+                success = true;
+              }
             }
-            catch (Exception & excpt_r)
+            catch ( Exception & excpt_r )
             {
               ZYPP_CAUGHT(excpt_r);
               if ( policy_r.dryRun() )
               {
                 WAR << "dry run failed" << endl;
-                progress.disconnect();
                 break;
               }
               // else
-              WAR << "Install failed" << endl;
+              if ( progress.aborted() )
+              {
+                WAR << "commit aborted by the user" << endl;
+                abort = true;
+              }
+              else
+              {
+                WAR << "Install failed" << endl;
+              }
               remaining.push_back( *it );
-              progress.disconnect();
-              success = false;
-              break;
+              break; // stop
             }
 
             if ( success && !policy_r.dryRun() )
@@ -868,14 +892,13 @@ namespace zypp
               // Remember to check this package for presence of patch scripts.
               successfullyInstalledPackages.push_back( it->satSolvable() );
             }
-            progress.disconnect();
           }
           else
           {
-            bool success = true;
-
             RpmRemovePackageReceiver progress( it->resolvable() );
-            progress.connect();
+            progress.connect(); // disconnected on destruction.
+
+            bool success = false;
             rpm::RpmInstFlags flags( rpm::RPMINST_NODEPS );
             if (policy_r.dryRun()) flags |= rpm::RPMINST_TEST;
             try
@@ -886,24 +909,30 @@ namespace zypp
               if ( progress.aborted() )
               {
                 WAR << "commit aborted by the user" << endl;
-                progress.disconnect();
-                success = false;
                 abort = true;
                 break;
               }
+              else
+              {
+                success = true;
+              }
             }
             catch (Exception & excpt_r)
             {
-              WAR << "removal of " << p << " failed";
-              success = false;
               ZYPP_CAUGHT( excpt_r );
+              if ( progress.aborted() )
+              {
+                WAR << "commit aborted by the user" << endl;
+                abort = true;
+                break;
+              }
+              // else
+              WAR << "removal of " << p << " failed";
             }
-            if (success
-                && !policy_r.dryRun())
+            if ( success && !policy_r.dryRun() )
             {
               it->status().resetTransact( ResStatus::USER );
             }
-            progress.disconnect();
           }
         }
         else if ( ! policy_r.dryRun() ) // other resolvables (non-Package)