From ee96ac8726128ca2997ec8470e8ad9a72bf44799 Mon Sep 17 00:00:00 2001 From: Klaus Kaempf Date: Mon, 23 Jan 2006 11:58:01 +0000 Subject: [PATCH] backup --- devel/devel.kkaempf/Buffer.cc | 3 +- devel/devel.kkaempf/HelixExtract.cc | 12 +- devel/devel.kkaempf/HelixExtract.h | 12 +- devel/devel.kkaempf/HelixPackageImpl.cc | 333 +++----------------------------- devel/devel.kkaempf/HelixPackageImpl.h | 43 ++--- devel/devel.kkaempf/HelixParser.cc | 129 ++++++------- devel/devel.kkaempf/HelixParser.h | 52 ++--- devel/devel.kkaempf/HelixSourceImpl.cc | 119 ++++++++---- devel/devel.kkaempf/HelixSourceImpl.h | 33 ++-- devel/devel.kkaempf/Makefile.am | 5 +- devel/devel.kkaempf/dummy-packages.xml | 35 ++-- devel/devel.kkaempf/rcparse.cc | 2 +- 12 files changed, 260 insertions(+), 518 deletions(-) diff --git a/devel/devel.kkaempf/Buffer.cc b/devel/devel.kkaempf/Buffer.cc index 35095c0..ba6e311 100644 --- a/devel/devel.kkaempf/Buffer.cc +++ b/devel/devel.kkaempf/Buffer.cc @@ -502,8 +502,7 @@ bufferMapFile (const string & filename) ByteArray *byte_array = NULL; if (uncompress_memory (data, s.st_size, &byte_array)) { - WAR << "Uncompression of '" << filename - << "' failed" << endl; + WAR << "Uncompression of '" << filename << "' failed" << endl; } else { buf = (Buffer *)malloc(sizeof (Buffer)); buf->data = byte_array->data; diff --git a/devel/devel.kkaempf/HelixExtract.cc b/devel/devel.kkaempf/HelixExtract.cc index 917b935..7c6ad77 100644 --- a/devel/devel.kkaempf/HelixExtract.cc +++ b/devel/devel.kkaempf/HelixExtract.cc @@ -33,10 +33,11 @@ using namespace std; using namespace zypp; -using namespace zypp::solver::detail; + +namespace zypp { int -extractHelixBuffer (const char buf[], size_t len, Channel_Ptr channel, ResolvableStoreCallback callback, ResStore *store) +extractHelixBuffer (const char *buf, size_t len, solver::detail::Channel_Ptr channel, HelixSourceImpl *impl) { // _DBG("HelixExtract") << "extract_packages_from_helix_buffer(" << buf << "...," << (long)len << ",...)" << endl; @@ -44,7 +45,7 @@ extractHelixBuffer (const char buf[], size_t len, Channel_Ptr channel, Resolvabl return 1; HelixParser parser (channel); - parser.parseChunk (buf, len, callback, store); + parser.parseChunk (buf, len, impl); parser.done (); return 0; @@ -52,7 +53,7 @@ extractHelixBuffer (const char buf[], size_t len, Channel_Ptr channel, Resolvabl int -extractHelixFile (const std::string & filename, Channel_Ptr channel, ResolvableStoreCallback callback, ResStore *store) +extractHelixFile (const std::string & filename, solver::detail::Channel_Ptr channel, HelixSourceImpl *impl) { Buffer *buf; @@ -63,10 +64,11 @@ extractHelixFile (const std::string & filename, Channel_Ptr channel, ResolvableS if (buf == NULL) return -1; - extractHelixBuffer ((const char *)(buf->data), buf->size, channel, callback, store); + extractHelixBuffer ((const char *)(buf->data), buf->size, channel, impl); bufferUnmapFile (buf); return 0; } +} // namespace zypp diff --git a/devel/devel.kkaempf/HelixExtract.h b/devel/devel.kkaempf/HelixExtract.h index b5a6406..08073ee 100644 --- a/devel/devel.kkaempf/HelixExtract.h +++ b/devel/devel.kkaempf/HelixExtract.h @@ -32,10 +32,16 @@ #include "zypp/solver/temporary/XmlNodePtr.h" #include "zypp/solver/temporary/ChannelPtr.h" -typedef bool (*ResolvableStoreCallback) (zypp::Resolvable::Ptr res, zypp::ResStore *store); +#include "HelixParser.h" -int extractHelixBuffer (const char data[], size_t len, zypp::solver::detail::Channel_Ptr channel, ResolvableStoreCallback callback, zypp::ResStore *store); -int extractHelixFile (const std::string & filename, zypp::solver::detail::Channel_Ptr channel, ResolvableStoreCallback callback, zypp::ResStore *store); +namespace zypp { + +class HelixSourceImpl; + +int extractHelixBuffer (const char *data, size_t len, solver::detail::Channel_Ptr channel, HelixSourceImpl *impl); +int extractHelixFile (const std::string & filename, solver::detail::Channel_Ptr channel, HelixSourceImpl *impl); + +} #endif /* HELIXEXTRACT_H */ diff --git a/devel/devel.kkaempf/HelixPackageImpl.cc b/devel/devel.kkaempf/HelixPackageImpl.cc index 8d9e2fc..eaa3efd 100644 --- a/devel/devel.kkaempf/HelixPackageImpl.cc +++ b/devel/devel.kkaempf/HelixPackageImpl.cc @@ -16,320 +16,51 @@ using namespace std; using namespace zypp::detail; -using namespace zypp::solver::detail; /////////////////////////////////////////////////////////////////// namespace zypp { ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////// - namespace detail - { - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : HelixPackageImpl - // - /////////////////////////////////////////////////////////////////// - - /** Default ctor - */ - HelixPackageImpl::HelixPackageImpl( - const HelixParser & parsed - ) - : _summary(parsed.summary), - _description(parsed.description), - _group(parsed.group), - _install_only(parsed.installOnly), - _size_package(parsed.fileSize), - _size_installed(parsed.installedSize) - { - } - - /** Package summary */ - Label HelixPackageImpl::summary() const - { return _summary; } - - /** Package description */ - Text HelixPackageImpl::description() const - { return _description; } - - Text HelixPackageImpl::insnotify() const - // metadata doesn't priovide this attribute - { return ResObjectImplIf::insnotify(); } - - Text HelixPackageImpl::delnotify() const - // metadata doesn't priovide this attribute - { return ResObjectImplIf::delnotify(); } - - ByteCount HelixPackageImpl::size() const -#warning fixme - { return 0; } - - bool HelixPackageImpl::providesSources() const - { return ResObjectImplIf::providesSources(); } - - Label HelixPackageImpl::instSrcLabel() const - { return ResObjectImplIf::instSrcLabel(); } - - Vendor HelixPackageImpl::instSrcVendor() const - { return ResObjectImplIf::instSrcVendor(); } - - /** */ - Date HelixPackageImpl::buildtime() const - { return _buildtime; } - - /** */ - std::string HelixPackageImpl::buildhost() const - { return _buildhost; } - - /** */ - Date HelixPackageImpl::installtime() const - { return PackageImplIf::installtime(); } - - /** */ - std::string HelixPackageImpl::distribution() const -#warning fixme - { return string(); } - - /** */ - Vendor HelixPackageImpl::vendor() const - { return _vendor; } - - /** */ - Label HelixPackageImpl::license() const - { return _license; } - - /** */ - std::string HelixPackageImpl::packager() const - { return _packager; } - - /** */ - PackageGroup HelixPackageImpl::group() const - { return _group; } - - /** */ - Changelog HelixPackageImpl::changelog() const - { return _changelog; } - - /** Don't ship it as class Url, because it might be - * in fact anything but a legal Url. */ - std::string HelixPackageImpl::url() const - { return _url; } - - /** */ - std::string HelixPackageImpl::os() const - // metadata doesn't priovide this attribute - { return PackageImplIf::os(); } - - /** */ - Text HelixPackageImpl::prein() const - // metadata doesn't priovide this attribute - { return PackageImplIf::prein(); } - - /** */ - Text HelixPackageImpl::postin() const - // metadata doesn't priovide this attribute - { return PackageImplIf::postin(); } - - /** */ - Text HelixPackageImpl::preun() const - // metadata doesn't priovide this attribute - { return PackageImplIf::preun(); } - - /** */ - Text HelixPackageImpl::postun() const - // metadata doesn't priovide this attribute - { return PackageImplIf::postun(); } - - /** */ - ByteCount HelixPackageImpl::sourcesize() const -#warning fixme - { return 0; } - - /** */ - ByteCount HelixPackageImpl::archivesize() const -#warning fixme - { return 0; } - - /** */ - Text HelixPackageImpl::authors() const - { return _authors; } - - /** */ - Text HelixPackageImpl::filenames() const - { return _filenames; } - - License HelixPackageImpl::licenseToConfirm() const - { return _license_to_confirm; } - - /** */ - std::string HelixPackageImpl::type() const - { return _type; } +/////////////////////////////////////////////////////////////////// +// +// CLASS NAME : HelixPackageImpl +// +/////////////////////////////////////////////////////////////////// - /** */ - std::list HelixPackageImpl::keywords() const - { return _keywords; } +/** Default ctor +*/ +HelixPackageImpl::HelixPackageImpl (const zypp::HelixParser & parsed) + : _summary(parsed.summary) + , _description() + , _group(parsed.section) + , _install_only(parsed.installOnly) + , _size_installed(parsed.installedSize) + , _size_archive(parsed.fileSize) +{ + _description.push_back(parsed.description); +} - bool HelixPackageImpl::installOnly() const - { return _install_only; } +/** Package summary */ +Label HelixPackageImpl::summary() const +{ return _summary; } - unsigned HelixPackageImpl::mediaId() const - { return _mediaid; } +/** Package description */ +Text HelixPackageImpl::description() const +{ return _description; } - CheckSum HelixPackageImpl::checksum() const - { return _checksum; } +PackageGroup HelixPackageImpl::group() const +{ return _group; } - std::list HelixPackageImpl::deltaRpms() const - { return _delta_rpms; } +ByteCount HelixPackageImpl::size() const +{ return _size_installed; } - std::list HelixPackageImpl::patchRpms() const - { return _patch_rpms; } +/** */ +ByteCount HelixPackageImpl::archivesize() const +{ return _size_archive; } -#if 0 - /** */ - std::list HelixPackageImpl::insnotify() const - { return std::list(); } - /** */ - std::list HelixPackageImpl::delnotify() const - { return std::list(); } - /** */ - unsigned HelixPackageImpl::packageSize() const - { return _size_package; } - /** */ - unsigned HelixPackageImpl::archiveSize() const - { return _size_archive; } - /** */ - unsigned HelixPackageImpl::installedSize() const - { return _size_installed; } -// FIXME do not understand items below - /** */ - bool HelixPackageImpl::providesSources() const - { - return false; - } - /** */ - std::string HelixPackageImpl::instSrcLabel() const - { - return ""; - } - /** */ - std::string HelixPackageImpl::instSrcVendor() const - { - return ""; - } - /** */ - unsigned HelixPackageImpl::instSrcRank() const - { - return 0; - } - /** */ - std::string HelixPackageImpl::buildhost() const - { - return _buildhost; - } - /** */ - std::string HelixPackageImpl::distribution() const - { - return ""; - } - /** */ - std::string HelixPackageImpl::vendor() const - { - return _vendor; - } - /** */ - std::string HelixPackageImpl::license() const - { - return _license; - } - /** */ - std::list HelixPackageImpl::licenseToConfirm() const - { - return std::list(); - } - /** */ - std::string HelixPackageImpl::packager() const - { - return _packager; - } - /** */ - std::string HelixPackageImpl::group() const - { - return _group; - } - /** */ - std::list HelixPackageImpl::changelog() const - {} - /** */ - std::string HelixPackageImpl::url() const - { - return _url; - } - /** */ - std::string HelixPackageImpl::os() const - {} - /** */ - std::list HelixPackageImpl::prein() const - {} - /** */ - std::list HelixPackageImpl::postin() const - {} - /** */ - std::list HelixPackageImpl::preun() const - {} - /** */ - std::list HelixPackageImpl::postun() const - {} - /** */ - std::string HelixPackageImpl::sourcepkg() const - { return _sourcepkg; } - /** */ - std::list HelixPackageImpl::authors() const - { return _authors; } - /** */ - std::list HelixPackageImpl::filenames() const - {} - /** */ - std::list HelixPackageImpl::recommends() const - {} - /** */ - std::list HelixPackageImpl::suggests() const - {} - /** */ - std::string HelixPackageImpl::location() const - {} - /** */ - std::string HelixPackageImpl::md5sum() const - {} - /** */ - std::string HelixPackageImpl::externalUrl() const - {} - /** */ - std::list HelixPackageImpl::patchRpmBaseVersions() const - {} - /** */ - unsigned HelixPackageImpl::patchRpmSize() const - {} - /** */ - bool HelixPackageImpl::forceInstall() const - {} - /** */ - std::string HelixPackageImpl::patchRpmMD5() const - {} - /** */ - bool HelixPackageImpl::isRemote() const - {} - /** */ - bool HelixPackageImpl::prefererCandidate() const - {} +bool HelixPackageImpl::installOnly() const +{ return _install_only; } -#endif - } // namespace yum - ///////////////////////////////////////////////////////////////// - } // namespace source - /////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////// } // namespace zypp /////////////////////////////////////////////////////////////////// diff --git a/devel/devel.kkaempf/HelixPackageImpl.h b/devel/devel.kkaempf/HelixPackageImpl.h index e194074..0a2b4b7 100644 --- a/devel/devel.kkaempf/HelixPackageImpl.h +++ b/devel/devel.kkaempf/HelixPackageImpl.h @@ -18,29 +18,22 @@ /////////////////////////////////////////////////////////////////// namespace zypp { ///////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////// - namespace detail - { ////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - // - // CLASS NAME : HelixPackageImpl - // - /** Class representing a package - */ - class HelixPackageImpl : public zypp::detail::PackageImplIf - { - public: +/////////////////////////////////////////////////////////////////// +// +// CLASS NAME : HelixPackageImpl +// +/** Class representing a package +*/ +class HelixPackageImpl : public detail::PackageImplIf +{ +public: class HelixParser; /** Default ctor */ - HelixPackageImpl( - const HelixParser & data - ); -#if 0 + HelixPackageImpl( const zypp::HelixParser & data ); + /** Package summary */ virtual Label summary() const; /** Package description */ @@ -51,22 +44,20 @@ namespace zypp /** */ virtual ByteCount archivesize() const; /** */ + virtual bool installOnly() const; + /** */ - protected: +protected: Label _summary; Text _description; PackageGroup _group; + bool _install_only; ByteCount _size_installed; ByteCount _size_archive; -#endif - }; - /////////////////////////////////////////////////////////////////// - } // namespace detail - ///////////////////////////////////////////////////////////////// - } // namespace solver - /////////////////////////////////////////////////////////////////// + + }; ///////////////////////////////////////////////////////////////// } // namespace zypp /////////////////////////////////////////////////////////////////// diff --git a/devel/devel.kkaempf/HelixParser.cc b/devel/devel.kkaempf/HelixParser.cc index bca7183..9c210a7 100644 --- a/devel/devel.kkaempf/HelixParser.cc +++ b/devel/devel.kkaempf/HelixParser.cc @@ -25,6 +25,8 @@ #include #include #include "HelixParser.h" +#include "HelixPackageImpl.h" +#include "HelixSourceImpl.h" #include "zypp/ResObject.h" #include "zypp/CapFactory.h" @@ -34,42 +36,33 @@ #include "zypp/base/String.h" #include "zypp/base/Logger.h" -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - namespace detail - { /////////////////////////////////////////////////////////////////// - using namespace std; +using namespace zypp; //--------------------------------------------------------------------------- static Resolvable::Kind string2kind (const std::string & str) { - Resolvable::Kind kind = ResTraits::kind; + Resolvable::Kind kind = ResTraits::kind; if (!str.empty()) { if (str == "package") { // empty } else if (str == "patch") { - kind = ResTraits::kind; + kind = ResTraits::kind; } else if (str == "pattern") { - kind = ResTraits::kind; + kind = ResTraits::kind; } else if (str == "script") { - kind = ResTraits::kind; + kind = ResTraits