From f612a5e07ff3133d17c825eff5a9c9e9eca36f18 Mon Sep 17 00:00:00 2001 From: Duncan Mac-Vicar P Date: Thu, 18 May 2006 14:14:59 +0000 Subject: [PATCH] - fix missing package descriptions due to filtered packages by incompatible architectures. (#159109) --- zypp/base/DefaultFalseBool.h | 56 ++++++++++++++++++++++++++++++ zypp/base/Makefile.am | 1 + zypp/source/susetags/PackagesLangParser.cc | 36 +++++-------------- zypp/source/susetags/PackagesParser.cc | 5 +++ zypp/source/susetags/SuseTagsImpl.cc | 2 +- zypp/source/susetags/SuseTagsImpl.h | 5 ++- 6 files changed, 76 insertions(+), 29 deletions(-) create mode 100644 zypp/base/DefaultFalseBool.h diff --git a/zypp/base/DefaultFalseBool.h b/zypp/base/DefaultFalseBool.h new file mode 100644 index 0000000..9fa1cc2 --- /dev/null +++ b/zypp/base/DefaultFalseBool.h @@ -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 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 diff --git a/zypp/base/Makefile.am b/zypp/base/Makefile.am index 61e75bb..52d91fa 100644 --- a/zypp/base/Makefile.am +++ b/zypp/base/Makefile.am @@ -13,6 +13,7 @@ baseincludedir = $(pkgincludedir)/base baseinclude_HEADERS = \ Debug.h \ Deprecated.h \ + DefaultFalseBool.h \ \ Algorithm.h \ Exception.h \ diff --git a/zypp/source/susetags/PackagesLangParser.cc b/zypp/source/susetags/PackagesLangParser.cc index 2addbb6..60291fb 100644 --- a/zypp/source/susetags/PackagesLangParser.cc +++ b/zypp/source/susetags/PackagesLangParser.cc @@ -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." <::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; } diff --git a/zypp/source/susetags/PackagesParser.cc b/zypp/source/susetags/PackagesParser.cc index 2bd2504..773bc8b 100644 --- a/zypp/source/susetags/PackagesParser.cc +++ b/zypp/source/susetags/PackagesParser.cc @@ -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" ) { diff --git a/zypp/source/susetags/SuseTagsImpl.cc b/zypp/source/susetags/SuseTagsImpl.cc index c7fac2d..be18b9f 100644 --- a/zypp/source/susetags/SuseTagsImpl.cc +++ b/zypp/source/susetags/SuseTagsImpl.cc @@ -581,7 +581,7 @@ namespace zypp MIL << content.size() << " packages parsed" << std::endl; int counter =0; - for ( std::map::const_iterator it = _is_shared.begin(); it != _is_shared.end(); ++it) + for ( std::map::const_iterator it = _is_shared.begin(); it != _is_shared.end(); ++it) { if( it->second) counter++; diff --git a/zypp/source/susetags/SuseTagsImpl.h b/zypp/source/susetags/SuseTagsImpl.h index e024ba2..d01ac95 100644 --- a/zypp/source/susetags/SuseTagsImpl.h +++ b/zypp/source/susetags/SuseTagsImpl.h @@ -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 _package_data; // list of packages which depend on another package for its data - std::map _is_shared; + std::map _is_shared; + // list of packages which provide data to another package + std::map _provides_shared_data; // list of translation files std::list _pkg_translations; -- 2.7.4