- fix missing package descriptions due to filtered packages
authorDuncan Mac-Vicar P <dmacvicar@suse.de>
Thu, 18 May 2006 14:14:59 +0000 (14:14 +0000)
committerDuncan Mac-Vicar P <dmacvicar@suse.de>
Thu, 18 May 2006 14:14:59 +0000 (14:14 +0000)
  by incompatible architectures. (#159109)

zypp/base/DefaultFalseBool.h [new file with mode: 0644]
zypp/base/Makefile.am
zypp/source/susetags/PackagesLangParser.cc
zypp/source/susetags/PackagesParser.cc
zypp/source/susetags/SuseTagsImpl.cc
zypp/source/susetags/SuseTagsImpl.h

diff --git a/zypp/base/DefaultFalseBool.h b/zypp/base/DefaultFalseBool.h
new file mode 100644 (file)
index 0000000..9fa1cc2
--- /dev/null
@@ -0,0 +1,56 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file      zypp/base/DefaultFalseBool.h
+ *
+*/
+#ifndef ZYPP_BASE_DefaultFalseBool_H
+#define ZYPP_BASE_DefaultFalseBool_H
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+    ///////////////////////////////////////////////////////////////////
+    //
+    // CLASS NAME : DefaultFalseBool<_Tp>
+    //
+    /** Bool whose default value is false
+     *
+     * Useful for map<T, bool> where if the entry is not present
+     * you get a undefined bool
+     *
+    */
+      class DefaultFalseBool
+      {
+        public:
+        /** DefaultCtor */
+        DefaultFalseBool() : _b(false)
+        {}
+        
+        /** Dtor */
+        ~DefaultFalseBool()
+        {}
+         
+        operator bool() const
+        { return _b; }
+        
+        bool operator =(bool a)
+        {
+          _b = a;
+          return a;
+        }
+        
+        private:
+        bool _b;
+      };
+
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_BASE_DefaultFalseBool_H
index 61e75bb..52d91fa 100644 (file)
@@ -13,6 +13,7 @@ baseincludedir = $(pkgincludedir)/base
 baseinclude_HEADERS =  \
        Debug.h         \
        Deprecated.h    \
+       DefaultFalseBool.h      \
        \
        Algorithm.h     \
        Exception.h     \
index 2addbb6..60291fb 100644 (file)
@@ -73,39 +73,26 @@ namespace zypp
             _nvra = NVRA( words[0], Edition(words[1],words[2]), arch );
             // only discard the package if it is not compatible AND it does not provide data
             // to other packages
-           if (!arch.compatibleWith( _system_arch ) && !_sourceImpl->_is_shared[_nvra])
+               
+            if (!arch.compatibleWith( _system_arch ) && !_sourceImpl->_provides_shared_data[_nvra])
             {
                _current = NULL;
                return;
            }
-
-            PkgContent::const_iterator it = _content.find(NVRAD(_nvra));
-           if (it == _content.end())
-            {
-              // package not found in the master package list
-               _current = NULL;
-                _notfound.insert(_nvra);
-           }
-           else
-            {
-              //WAR << "Data for package " << words[0] << " " << words[1] << " " << words[2] << "  " << Arch(words[3]) << " coming..." << endl;
-               _count++;
-               _current = it->second;
-           }
-
+            
+            _count++;
           }
          else if ( stag_r.name == "Sum" )
           {
-           if (_current != NULL)
-             _sourceImpl->_package_data[_nvra]._summary = TranslatedText( stag_r.value, _lang);
+            _sourceImpl->_package_data[_nvra]._summary = TranslatedText( stag_r.value, _lang);
           }
         }
 
         /* Consume MulitTag data. */
         virtual void consume( const MultiTag & mtag_r )
         {
-          if ( _current == NULL )
-            return;
+          //if ( _current == NULL )
+          //  return;
 
           if ( mtag_r.name == "Des" )
             {
@@ -143,13 +130,8 @@ namespace zypp
           return;
         }
 
-        MIL << "Ending after " << p._count << " langs with " << content_r.size() << " packages and " << p._notfound.size() << " not founds." <<endl;
-        WAR << "Not found packages:" << std::endl;
-        for ( std::set<NVRA>::const_iterator it = p._notfound.begin(); it != p._notfound.end(); ++it)
-        {
-          NVRA nvra = *it;
-          WAR << "-> " << nvra.name << " " << nvra.edition << " " << nvra.arch << std::endl;
-        }
+        MIL << "packages.LANG parser done. [ Total packages: " << content_r.size() << " ] [ Package data: " << sourceimpl->_package_data.size() << " ]" << std::endl;
+        
         return;
       }
 
index 2bd2504..773bc8b 100644 (file)
@@ -242,6 +242,11 @@ namespace zypp
             XXX << "package " << _nvrad << " shares data with " << shared_desc << std::endl;
             _isShared = true;
             _pkgImpl->_data_index = shared_desc;
+            // mark the refering package as a package providing data to others
+            // because we cant filter those by architecture to save memory
+            // or we run in missing package descriptions for x86_64 packages
+            // which depends on a ppc package for its data.
+            _sourceImpl->_provides_shared_data[ _pkgImpl->_data_index] = true;
           }
          if ( stag_r.name == "Grp" )
          {
index c7fac2d..be18b9f 100644 (file)
@@ -581,7 +581,7 @@ namespace zypp
         MIL << content.size() << " packages parsed" << std::endl;
         
         int counter =0;
-        for ( std::map<NVRA,bool>::const_iterator it = _is_shared.begin(); it != _is_shared.end(); ++it)
+        for ( std::map<NVRA, DefaultFalseBool>::const_iterator it = _is_shared.begin(); it != _is_shared.end(); ++it)
         {
           if( it->second)
             counter++;
index e024ba2..d01ac95 100644 (file)
@@ -17,6 +17,7 @@
 
 #include "zypp/Pathname.h"
 #include "zypp/source/SourceImpl.h"
+#include "zypp/base/DefaultFalseBool.h"
 #include "zypp/Product.h"
 #include "zypp/CheckSum.h"
 #include "zypp/source/susetags/SuseTagsProductImpl.h"
@@ -156,7 +157,9 @@ namespace zypp
         // shared data between packages with same NVRA
         std::map<NVRA, SuseTagsPackageImplData> _package_data;
         // list of packages which depend on another package for its data
-        std::map<NVRA, bool> _is_shared;
+        std::map<NVRA, DefaultFalseBool> _is_shared;
+        // list of packages which provide data to another package
+        std::map<NVRA, DefaultFalseBool> _provides_shared_data;
 
         // list of translation files
         std::list<std::string> _pkg_translations;