--- /dev/null
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ 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
baseinclude_HEADERS = \
Debug.h \
Deprecated.h \
+ DefaultFalseBool.h \
\
Algorithm.h \
Exception.h \
_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" )
{
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;
}
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" )
{
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++;
#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"
// 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;