added YUM product handling
authorJiri Srain <jsrain@suse.cz>
Mon, 28 Nov 2005 15:13:37 +0000 (15:13 +0000)
committerJiri Srain <jsrain@suse.cz>
Mon, 28 Nov 2005 15:13:37 +0000 (15:13 +0000)
zypp/detail/ProductImplIf.h
zypp/detail/ResObjectImplIf.h
zypp/source/yum/Makefile.am
zypp/source/yum/YUMProductImpl.cc [new file with mode: 0644]
zypp/source/yum/YUMProductImpl.h [new file with mode: 0644]
zypp/source/yum/YUMSource.cc
zypp/source/yum/YUMSource.h

index 8cb7e44..5b2a78d 100644 (file)
@@ -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;
     };
     ///////////////////////////////////////////////////////////////////
 
index 536fa3e..aada665 100644 (file)
@@ -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
index d5e2396..a0dbd71 100644 (file)
@@ -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 (file)
index 0000000..f68920b
--- /dev/null
@@ -0,0 +1,94 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file zypp/source/yum/YUMProductImpl.cc
+ *
+*/
+
+#include "zypp/source/yum/YUMProductImpl.h"
+#include "zypp/source/yum/YUMSource.h"
+#include <zypp/CapFactory.h>
+#include "zypp/parser/yum/YUMParserData.h"
+#include <zypp/parser/yum/YUMParser.h>
+#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 (file)
index 0000000..0d7f237
--- /dev/null
@@ -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
index e970f18..59aa10c 100644 (file)
 #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 <zypp/base/Logger.h>
-
-#include <zypp/CapFactory.h>
+#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<YUMProductImpl> 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
index a08d42c..ad414e7 100644 (file)
@@ -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(