- Catch and report media errors when proving packages. (bnc #457652)
authorMichael Andres <ma@suse.de>
Thu, 11 Dec 2008 16:16:23 +0000 (16:16 +0000)
committerMichael Andres <ma@suse.de>
Thu, 11 Dec 2008 16:16:23 +0000 (16:16 +0000)
VERSION.cmake
package/libzypp.changes
zypp/repo/PackageProvider.cc

index 22fccf2..23b81cf 100644 (file)
@@ -61,7 +61,7 @@
 SET(LIBZYPP_MAJOR "5")
 SET(LIBZYPP_COMPATMINOR "23")
 SET(LIBZYPP_MINOR "24")
-SET(LIBZYPP_PATCH "7")
+SET(LIBZYPP_PATCH "8")
 #
 # LAST RELEASED: 5.24.7 (23)
 # (The number in parenthesis is LIBZYPP_COMPATMINOR)
index 72a9605..b5f923f 100644 (file)
@@ -1,4 +1,10 @@
 -------------------------------------------------------------------
+Thu Dec 11 17:13:06 CET 2008 - ma@suse.de
+
+- Catch and report media errors when proving packages. (bnc #457652)
+- revision 11926
+
+-------------------------------------------------------------------
 Wed Dec 10 16:09:08 CET 2008 - ma@suse.de
 
 - Remove obsolete zypp.conf::productsdir and deprecate 
index e5b6a04..5172e19 100644 (file)
@@ -103,14 +103,44 @@ namespace zypp
           {
             ret = doProvidePackage();
           }
-        catch ( const Exception & excpt )
+        catch ( const UserRequestException & excpt )
           {
+            // UserRequestException e.g. from failOnChecksumError was already reported.
             ERR << "Failed to provide Package " << _package << endl;
             if ( ! _retry )
               {
                 ZYPP_RETHROW( excpt );
               }
           }
+        catch ( const Exception & excpt )
+          {
+            ERR << "Failed to provide Package " << _package << endl;
+            if ( ! _retry )
+              {
+                // Aything else gets reported
+                std::string package_str = _package->name() + "-" + _package->edition().asString();
+
+                // TranslatorExplanation %s = name of the package being processed.
+                std::string detail_str( str::form(_("Failed to provide Package %s. Do you want to retry retrieval?"), package_str.c_str() ) );
+                detail_str += str::form( "\n\n%s\n%s", excpt.asUserString().c_str(), excpt.historyAsString().c_str() );
+
+                switch ( report()->problem( _package, repo::DownloadResolvableReport::IO, detail_str.c_str() ) )
+                {
+                      case repo::DownloadResolvableReport::RETRY:
+                        _retry = true;
+                        break;
+                      case repo::DownloadResolvableReport::IGNORE:
+                        ZYPP_THROW(SkipRequestException("User requested skip of corrupted file"));
+                        break;
+                      case repo::DownloadResolvableReport::ABORT:
+                        ZYPP_THROW(AbortRequestException("User requested to abort"));
+                        break;
+                      default:
+                        ZYPP_RETHROW( excpt );
+                        break;
+                }
+              }
+          }
       } while ( _retry );
 
       report()->finish( _package, repo::DownloadResolvableReport::NO_ERROR, std::string() );