Throw exception if a contentfile does not define a single metadata file
authorMichael Andres <ma@suse.de>
Mon, 10 Mar 2008 13:20:03 +0000 (13:20 +0000)
committerMichael Andres <ma@suse.de>
Mon, 10 Mar 2008 13:20:03 +0000 (13:20 +0000)
zypp/RepoManager.cc
zypp/parser/susetags/RepoIndex.cc
zypp/parser/susetags/RepoIndex.h
zypp/repo/susetags/Downloader.cc

index 033e58d..cbdd4b5 100644 (file)
@@ -86,20 +86,14 @@ namespace zypp
     struct RepoCollector
     {
       RepoCollector()
-      {
-        MIL << endl;
-      }
+      {}
 
       ~RepoCollector()
-      {
-        MIL << endl;
-      }
+      {}
 
       bool collect( const RepoInfo &repo )
       {
-        //MIL << "here in collector: " << repo.alias() << endl;
         repos.push_back(repo);
-        //MIL << "added: " << repo.alias() << endl;
         return true;
       }
 
index a76c843..41e62a8 100644 (file)
@@ -10,7 +10,7 @@
  *
 */
 #include <iostream>
-//#include "zypp/base/Logger.h"
+#include "zypp/base/LogTools.h"
 
 #include "zypp/parser/susetags/RepoIndex.h"
 
@@ -30,6 +30,14 @@ namespace zypp
 
       IMPL_PTR_TYPE(RepoIndex);
 
+      std::ostream & RepoIndex::dumpOn( std::ostream & str ) const
+      {
+        return str
+            << "RepoIndex checksums: META files " << metaFileChecksums.size()
+            << ", HASH files " << mediaFileChecksums.size()
+            << ", KEY files " << signingKeys.size();
+      }
+
       /////////////////////////////////////////////////////////////////
     } // namespace susetags
     ///////////////////////////////////////////////////////////////////
index 824ae43..391a262 100644 (file)
@@ -65,7 +65,7 @@ namespace zypp
 
        protected:
          /** Overload to realize std::ostream & operator\<\<. */
-         //virtual std::ostream & dumpOn( std::ostream & str ) const;
+         virtual std::ostream & dumpOn( std::ostream & str ) const;
       };
       //////////////////////////////////////////////////////////////////
 
index e165e9d..6b5ccb8 100644 (file)
@@ -85,11 +85,21 @@ void Downloader::download( MediaSetAccess &media,
   {
     ZYPP_THROW( ParseException( (dest_dir+_path).asString() + ": " + "No repository index in content file." ) );
   }
-  
+  MIL << "RepoIndex: " << _repoindex << endl;
+  if ( _repoindex->metaFileChecksums.empty() )
+  {
+    ZYPP_THROW( ParseException( (dest_dir+_path).asString() + ": " + "No metadata checksums in content file." ) );
+  }
+  if ( _repoindex->signingKeys.empty() )
+  {
+    WAR << "No signing keys defined." << endl;
+  }
+
   // Prepare parsing
   descr_dir = _repoindex->descrdir; // path below reporoot
   //_datadir  = _repoIndex->datadir;  // path below reporoot
-  
+
+
   for ( RepoIndex::FileChecksumMap::const_iterator it = _repoindex->metaFileChecksums.begin();
         it != _repoindex->metaFileChecksums.end();
         ++it )
@@ -125,7 +135,7 @@ void Downloader::download( MediaSetAccess &media,
     {
       // take all patterns in one go
     }
-    else if ( str::endsWith( it->first, ".pat" ) 
+    else if ( str::endsWith( it->first, ".pat" )
               || str::endsWith( it->first, ".pat.gz" ) )
     {
 
@@ -166,7 +176,7 @@ void Downloader::download( MediaSetAccess &media,
     location.setChecksum( it->second );
     this->enqueueDigested(location);
   }
-  
+
   for ( RepoIndex::FileChecksumMap::const_iterator it = _repoindex->signingKeys.begin();
         it != _repoindex->signingKeys.end();
         ++it )
@@ -175,7 +185,7 @@ void Downloader::download( MediaSetAccess &media,
     location.setChecksum( it->second );
     this->enqueueDigested(location);
   }
-  
+
   this->start( dest_dir, media );
 }