read content file on construction, and make provideProduct only insert
authorDuncan Mac-Vicar P <dmacvicar@suse.de>
Tue, 18 Apr 2006 14:24:10 +0000 (14:24 +0000)
committerDuncan Mac-Vicar P <dmacvicar@suse.de>
Tue, 18 Apr 2006 14:24:10 +0000 (14:24 +0000)
the already read product object into the store, this should fix
https://bugzilla.novell.com/show_bug.cgi?id=165826

zypp/source/susetags/SuseTagsImpl.cc
zypp/source/susetags/SuseTagsImpl.h

index e7c1815..7d7f2da 100644 (file)
@@ -241,6 +241,8 @@ namespace zypp
           ZYPP_CAUGHT(excpt_r);
           WAR << "Verifier not found" << endl;
         }
+        
+        readContentFile();
       }
 
       void SuseTagsImpl::createResolvables(Source_Ref source_r)
@@ -339,7 +341,7 @@ namespace zypp
       std::string SuseTagsImpl::unique_id (void) const
       { return _media_id; }
 
-      void SuseTagsImpl::provideProducts(Source_Ref source_r, ResStore &store)
+      void SuseTagsImpl::readContentFile()
       {
         Pathname p;
         bool cache = cacheExists();
@@ -427,7 +429,7 @@ namespace zypp
           
           ProductMetadataParser p;
           p.parse( _content_file, factory.createFrom(this) );
-          Product::Ptr product = p.result;
+          _product = p.result;
           
           // data dir is the same, it is determined by the content file
           _data_dir = _path + p.prodImpl->_data_dir;
@@ -440,8 +442,8 @@ namespace zypp
           else
             _descr_dir = _orig_descr_dir;
           
-          MIL << "Product: " << product->summary() << endl;
-          store.insert( product );
+          MIL << "Read product: " << _product->summary() << endl;
+          
           _prodImpl = p.prodImpl;
          _autorefresh = p.volatile_content && media::MediaAccess::canBeVolatile( _url );
         }
@@ -450,6 +452,12 @@ namespace zypp
         }
       }
 
+      void SuseTagsImpl::provideProducts(Source_Ref source_r, ResStore &store)
+      {
+        MIL << "Adding product: " << _product->summary() << " to the store" << endl;
+        store.insert( _product );
+      }
+      
       void SuseTagsImpl::verifyFile( const Pathname &path, const std::string &key)
       {
         // for old products, we dont check anything.
index e75ade7..5cde655 100644 (file)
@@ -17,6 +17,7 @@
 
 #include "zypp/Pathname.h"
 #include "zypp/source/SourceImpl.h"
+#include "zypp/Product.h"
 #include "zypp/source/susetags/SuseTagsProductImpl.h"
 
 ///////////////////////////////////////////////////////////////////
@@ -90,6 +91,8 @@ namespace zypp
         */
         virtual void factoryInit();
        
+        void readContentFile();
+        
        void provideProducts(Source_Ref source_r, ResStore& store);
        void providePackages(Source_Ref source_r, ResStore& store);
        void provideSelections(Source_Ref source_r, ResStore& store);
@@ -131,6 +134,7 @@ namespace zypp
          * we need it to access the checksums if we are in verify mode
          */
         detail::ResImplTraits<SuseTagsProductImpl>::Ptr _prodImpl;
+        Product::Ptr _product;
        
       };
       ///////////////////////////////////////////////////////////////////