From db0ea80b41473100c9f8d80be1b952de539c0585 Mon Sep 17 00:00:00 2001 From: Jiri Srain Date: Mon, 28 Nov 2005 15:13:37 +0000 Subject: [PATCH] added YUM product handling --- zypp/detail/ProductImplIf.h | 5 ++- zypp/detail/ResObjectImplIf.h | 2 +- zypp/source/yum/Makefile.am | 6 ++- zypp/source/yum/YUMProductImpl.cc | 94 +++++++++++++++++++++++++++++++++++++++ zypp/source/yum/YUMProductImpl.h | 70 +++++++++++++++++++++++++++++ zypp/source/yum/YUMSource.cc | 26 ++++++++--- zypp/source/yum/YUMSource.h | 4 ++ 7 files changed, 196 insertions(+), 11 deletions(-) create mode 100644 zypp/source/yum/YUMProductImpl.cc create mode 100644 zypp/source/yum/YUMProductImpl.h diff --git a/zypp/detail/ProductImplIf.h b/zypp/detail/ProductImplIf.h index 8cb7e44..5b2a78d 100644 --- a/zypp/detail/ProductImplIf.h +++ b/zypp/detail/ProductImplIf.h @@ -37,8 +37,9 @@ namespace zypp public: /** Get the category of the product */ - virtual std::string category() const - { return std::string(); } + virtual std::string category() const = 0; + virtual Label vendor() const = 0; + virtual Label displayName() const = 0; }; /////////////////////////////////////////////////////////////////// diff --git a/zypp/detail/ResObjectImplIf.h b/zypp/detail/ResObjectImplIf.h index 536fa3e..aada665 100644 --- a/zypp/detail/ResObjectImplIf.h +++ b/zypp/detail/ResObjectImplIf.h @@ -20,7 +20,7 @@ #include "zypp/NeedAType.h" // volatile include propagating type drafts // will be defined =0 later -#define PURE_VIRTUAL +#define PURE_VIRTUAL =0 /////////////////////////////////////////////////////////////////// namespace zypp diff --git a/zypp/source/yum/Makefile.am b/zypp/source/yum/Makefile.am index d5e2396..a0dbd71 100644 --- a/zypp/source/yum/Makefile.am +++ b/zypp/source/yum/Makefile.am @@ -10,7 +10,8 @@ include_HEADERS = \ YUMScriptImpl.h \ YUMMessageImpl.h \ YUMPackageImpl.h \ - YUMPatchImpl.h + YUMPatchImpl.h \ + YUMProductImpl.h noinst_LTLIBRARIES = lib@PACKAGE@_source_yum.la @@ -22,6 +23,7 @@ lib@PACKAGE@_source_yum_la_SOURCES = \ YUMScriptImpl.cc \ YUMMessageImpl.cc \ YUMPackageImpl.cc \ - YUMPatchImpl.cc + YUMPatchImpl.cc \ + YUMProductImpl.cc ## ################################################## diff --git a/zypp/source/yum/YUMProductImpl.cc b/zypp/source/yum/YUMProductImpl.cc new file mode 100644 index 0000000..f68920b --- /dev/null +++ b/zypp/source/yum/YUMProductImpl.cc @@ -0,0 +1,94 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ +/** \file zypp/source/yum/YUMProductImpl.cc + * +*/ + +#include "zypp/source/yum/YUMProductImpl.h" +#include "zypp/source/yum/YUMSource.h" +#include +#include "zypp/parser/yum/YUMParserData.h" +#include +#include "zypp/Package.h" +#include "zypp/Script.h" +#include "zypp/Message.h" +#include "zypp/base/Logger.h" + + +using namespace std; +using namespace zypp::detail; +using namespace zypp::parser::yum; + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ ///////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////// + namespace source + { ///////////////////////////////////////////////////////////////// + namespace yum + { + /////////////////////////////////////////////////////////////////// + // + // CLASS NAME : YUMProductImpl + // + /////////////////////////////////////////////////////////////////// + + /** Default ctor + * \bug CANT BE CONSTUCTED THAT WAY ANYMORE + */ + YUMProductImpl::YUMProductImpl( + const zypp::parser::yum::YUMProductData & parsed, + YUMSource * src + ) + : _category(parsed.type), + _vendor(parsed.vendor)//, +// _displayname(parsed.displayname), +// _description(parsed.description) + {} + + std::string YUMProductImpl::category() const + { return _category; } + + Label YUMProductImpl::vendor() const + { return _vendor; } + + Label YUMProductImpl::displayName() const + { return _displayname; } + + Label YUMProductImpl::summary() const + { return ResObjectImplIf::summary(); } + + Text YUMProductImpl::description() const + { return _description; } + + Text YUMProductImpl::insnotify() const + { return ResObjectImplIf::insnotify(); } + + Text YUMProductImpl::delnotify() const + { return ResObjectImplIf::delnotify(); } + + FSize YUMProductImpl::size() const + { return ResObjectImplIf::size(); } + + bool YUMProductImpl::providesSources() const + { return ResObjectImplIf::providesSources(); } + + Label YUMProductImpl::instSrcLabel() const + { return ResObjectImplIf::instSrcLabel(); } + + Vendor YUMProductImpl::instSrcVendor() const + { return ResObjectImplIf::instSrcVendor(); } + + } // namespace yum + ///////////////////////////////////////////////////////////////// + } // namespace source + /////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////// +} // namespace zypp +/////////////////////////////////////////////////////////////////// diff --git a/zypp/source/yum/YUMProductImpl.h b/zypp/source/yum/YUMProductImpl.h new file mode 100644 index 0000000..0d7f237 --- /dev/null +++ b/zypp/source/yum/YUMProductImpl.h @@ -0,0 +1,70 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ +/** \file zypp/source/yum/YUMProductImpl.h + * +*/ +#ifndef ZYPP_SOURCE_YUM_YUMPRODUCTIMPL_H +#define ZYPP_SOURCE_YUM_YUMPRODUCTIMPL_H + +#include "zypp/detail/ProductImpl.h" +#include "zypp/parser/yum/YUMParserData.h" +#include "zypp/source/yum/YUMSource.h" + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ ///////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////// + namespace source + { ///////////////////////////////////////////////////////////////// + namespace yum + { ////////////////////////////////////////////////////////////// + + /////////////////////////////////////////////////////////////////// + // + // CLASS NAME : YUMProductImpl + // + /** Class representing a patch + */ + class YUMProductImpl : public detail::ProductImplIf + { + public: + /** Default ctor */ + YUMProductImpl( + const zypp::parser::yum::YUMProductData & parsed, + YUMSource * src + ); + std::string category() const; + Label vendor() const; + Label displayName() const; + Label summary() const; + Text description() const; + Text insnotify() const; + Text delnotify() const; + FSize size() const; + bool providesSources() const; + Label instSrcLabel() const; + Vendor instSrcVendor() const; + protected: + std::string _category; + Label _vendor; + Label _displayname; + Text _description; + + + + }; + /////////////////////////////////////////////////////////////////// + } // namespace yum + ///////////////////////////////////////////////////////////////// + } // namespace source + /////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////// +} // namespace zypp +/////////////////////////////////////////////////////////////////// +#endif // ZYPP_SOURCE_YUM_YUMPRODUCTIMPL_H diff --git a/zypp/source/yum/YUMSource.cc b/zypp/source/yum/YUMSource.cc index e970f18..59aa10c 100644 --- a/zypp/source/yum/YUMSource.cc +++ b/zypp/source/yum/YUMSource.cc @@ -15,10 +15,10 @@ #include "zypp/source/yum/YUMScriptImpl.h" #include "zypp/source/yum/YUMMessageImpl.h" #include "zypp/source/yum/YUMPatchImpl.h" +#include "zypp/source/yum/YUMProductImpl.h" -#include - -#include +#include "zypp/base/Logger.h" +#include "zypp/CapFactory.h" using namespace std; using namespace zypp::detail; @@ -94,6 +94,23 @@ namespace zypp return script; } + Product::Ptr YUMSource::createProduct( + const zypp::parser::yum::YUMProductData & parsed + ) + { + shared_ptr impl(new YUMProductImpl(parsed, this)); + Dependencies _deps = createDependencies(parsed, + Resolvable::Kind("Product")); + Product::Ptr product = detail::makeResolvableFromImpl( + parsed.name, + Edition( parsed.ver, parsed.rel ), + Arch( "noarch" ), + impl + ); + product->setDeps(_deps); + return product; + } + Patch::Ptr YUMSource::createPatch( const zypp::parser::yum::YUMPatchData & parsed ) @@ -155,9 +172,6 @@ namespace zypp it != parsed.requires.end(); it++) { - // FIXME do not create the string this way - // FIXME other types than only packages - // FIXME use also the flags if (it->pre == "1") _prerequires.insert(createCapability(*it, my_kind)); else diff --git a/zypp/source/yum/YUMSource.h b/zypp/source/yum/YUMSource.h index a08d42c..ad414e7 100644 --- a/zypp/source/yum/YUMSource.h +++ b/zypp/source/yum/YUMSource.h @@ -18,6 +18,7 @@ #include "zypp/Message.h" #include "zypp/Script.h" #include "zypp/Patch.h" +#include "zypp/Product.h" using namespace zypp::parser::yum; @@ -54,6 +55,9 @@ namespace zypp Patch::Ptr createPatch( const zypp::parser::yum::YUMPatchData & parsed ); + Product::Ptr createProduct( + const zypp::parser::yum::YUMProductData & parsed + ); Dependencies createDependencies( -- 2.7.4