create an 'Atom' for <package...> within <atom>
authorKlaus Kaempf <kkaempf@suse.de>
Sat, 25 Feb 2006 19:19:11 +0000 (19:19 +0000)
committerKlaus Kaempf <kkaempf@suse.de>
Sat, 25 Feb 2006 19:19:11 +0000 (19:19 +0000)
zypp/source/yum/Makefile.am
zypp/source/yum/YUMAtomImpl.cc [new file with mode: 0644]
zypp/source/yum/YUMAtomImpl.h [new file with mode: 0644]
zypp/source/yum/YUMSourceImpl.cc
zypp/source/yum/YUMSourceImpl.h

index e4516c4..ed16e25 100644 (file)
@@ -13,6 +13,7 @@ sourceyumincludedir = $(pkgincludedir)/source/yum
 sourceyuminclude_HEADERS =             \
        YUMSourceImpl.h                 \
        YUMScriptImpl.h                 \
+       YUMAtomImpl.h                   \
        YUMMessageImpl.h                \
        YUMPackageImpl.h                \
        YUMPatchImpl.h                  \
@@ -28,6 +29,7 @@ noinst_LTLIBRARIES =  lib@PACKAGE@_source_yum.la
 lib@PACKAGE@_source_yum_la_SOURCES =   \
        YUMSourceImpl.cc                \
        YUMScriptImpl.cc                \
+       YUMAtomImpl.cc                  \
        YUMMessageImpl.cc               \
        YUMPackageImpl.cc               \
        YUMPatchImpl.cc                 \
diff --git a/zypp/source/yum/YUMAtomImpl.cc b/zypp/source/yum/YUMAtomImpl.cc
new file mode 100644 (file)
index 0000000..c009729
--- /dev/null
@@ -0,0 +1,51 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file zypp/source/yum/YUMAtomImpl.cc
+ *
+*/
+
+#include "zypp/source/yum/YUMAtomImpl.h"
+
+using namespace std;
+using namespace zypp::detail;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////
+  namespace source
+  { /////////////////////////////////////////////////////////////////
+    namespace yum
+    {
+      ///////////////////////////////////////////////////////////////////
+      //
+      //        CLASS NAME : YUMAtomImpl
+      //
+      ///////////////////////////////////////////////////////////////////
+
+      /** Default ctor
+      */
+      YUMAtomImpl::YUMAtomImpl(
+       Source_Ref source_r
+      )
+      : _source(source_r)
+      {
+      }
+
+      Source_Ref YUMAtomImpl::source() const
+      { return _source; }
+
+
+    } // namespace yum
+    /////////////////////////////////////////////////////////////////
+  } // namespace source
+  ///////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
diff --git a/zypp/source/yum/YUMAtomImpl.h b/zypp/source/yum/YUMAtomImpl.h
new file mode 100644 (file)
index 0000000..43eaf68
--- /dev/null
@@ -0,0 +1,54 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file zypp/source/yum/YUMAtomImpl.h
+ *
+*/
+#ifndef ZYPP_SOURCE_YUM_YUMATOMIMPL_H
+#define ZYPP_SOURCE_YUM_YUMATOMIMPL_H
+
+#include "zypp/source/SourceImpl.h"
+#include "zypp/detail/AtomImpl.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////
+  namespace source
+  { /////////////////////////////////////////////////////////////////
+    namespace yum
+    { //////////////////////////////////////////////////////////////
+
+      ///////////////////////////////////////////////////////////////////
+      //
+      //        CLASS NAME : YUMAtomImpl
+      //
+      /** Class representing a message
+      */
+      class YUMAtomImpl : public detail::AtomImplIf
+      {
+      public:
+        /** Default ctor */
+        YUMAtomImpl(
+         Source_Ref source_r
+       );
+
+      private:
+       Source_Ref _source;
+      public:
+       Source_Ref source() const;
+      };
+      ///////////////////////////////////////////////////////////////////
+    } // namespace yum
+    /////////////////////////////////////////////////////////////////
+  } // namespace source
+  ///////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_SOURCE_YUM_YUMATOMIMPL_H
index f6a0bfe..6827ee4 100644 (file)
@@ -11,6 +11,7 @@
 */
 
 #include "zypp/source/yum/YUMSourceImpl.h"
+#include "zypp/source/yum/YUMAtomImpl.h"
 #include "zypp/source/yum/YUMPackageImpl.h"
 #include "zypp/source/yum/YUMScriptImpl.h"
 #include "zypp/source/yum/YUMMessageImpl.h"
@@ -490,43 +491,18 @@ namespace zypp
     }
   }
 
-  static void augmentCapSet( const CapSet & from, CapSet & to )
-  {
-    for (CapSet::const_iterator it = from.begin(); it != from.end(); ++it) {
-       to.insert( *it );
-    }
-    return;
-  }
-
-  static void augmentDependencies( const Dependencies & from, Dependencies & to )
-  {
-MIL << "augmentDependencies(" << from << ")" << endl;
-#define AUG_CAP_SET(tag) augmentCapSet( from[Dep::tag], to[Dep::tag] )
-      AUG_CAP_SET(PROVIDES);
-      AUG_CAP_SET(REQUIRES);
-      AUG_CAP_SET(PREREQUIRES);
-      AUG_CAP_SET(OBSOLETES);
-      AUG_CAP_SET(CONFLICTS);
-      AUG_CAP_SET(FRESHENS);
-      AUG_CAP_SET(RECOMMENDS);
-      AUG_CAP_SET(SUGGESTS);
-      AUG_CAP_SET(SUPPLEMENTS);
-      AUG_CAP_SET(ENHANCES);
-#undef AUG_CAP_SET
-MIL << "=> (" << to << ")" << endl;
-  }
-
   void YUMSourceImpl::augmentPackage(
     const zypp::parser::yum::YUMPatchPackage & parsed
   )
   {
     try
     {
+       Edition edition( parsed.ver, parsed.rel, parsed.epoch );
        NVRA nvra( parsed.name,
-                  Edition( parsed.ver, parsed.rel, parsed.epoch ),
+                  edition,
                   Arch( parsed.arch ) );
 
-DBG << "augmentPackage(" << nvra << ")" << endl;
+       DBG << "augmentPackage(" << nvra << ")" << endl;
 
        PackageImplMapT::const_iterator it = _package_impl.find( nvra );
        if (it == _package_impl.end()) {
@@ -535,34 +511,39 @@ DBG << "augmentPackage(" << nvra << ")" << endl;
        }
        ResImplTraits<YUMPackageImpl>::Ptr impl = it->second.impl;
        Package::Ptr package = it->second.package;
-DBG << "found " << *package << ", impl " << impl << endl;
+       //DBG << "found " << *package << ", impl " << impl << endl;
 
        _store.erase( package );
        impl->unmanage();
-DBG << "Erased old package " << endl;
 
-       Dependencies deps = createDependencies( parsed, ResTraits<Package>::kind );
-
-DBG << "augmenting " << deps << endl;
-
-       augmentDependencies( package->deps(), deps );
+       // create Atom
 
-DBG << "augmenting done " << endl;
+       CapFactory f;
+       Dependencies deps = createDependencies( parsed, ResTraits<Package>::kind );
+       deps[Dep::REQUIRES].insert( f.parse( ResTraits<Package>::kind, parsed.name, Rel::EQ, edition ) );
+       NVRAD atomdata( nvra, deps );
+       ResImplTraits<YUMAtomImpl>::Ptr atomimpl = new YUMAtomImpl( package->source() );
+       Atom::Ptr atom = detail::makeResolvableFromImpl(
+           atomdata, atomimpl
+       );
+       DBG << "Inserting atom " << *atom << endl;
+       //DBG << "with deps " << deps << endl;
+       _store.insert( atom );
 
        // Collect augmented package data
-       NVRAD dataCollect( nvra, deps );
+       NVRAD packagedata( nvra, package->deps() );
 
-DBG << "NVRAD " << (NVRA)dataCollect << endl;
+       //DBG << "NVRAD " << (NVRA)packagedata << endl;
 
-       Package::Ptr augmented_package = detail::makeResolvableFromImpl(
-           dataCollect, impl
+#warning add patchrpm, deltarpm, etc. to YUMPackageImpl here
+       Package::Ptr new_package = detail::makeResolvableFromImpl(
+           packagedata, impl
        );
 
-DBG << "augmented_package " << *augmented_package << endl;
+       //DBG << "new_package " << *new_package << endl;
+
+       _store.insert( new_package );
 
-DBG << "Inserting augmented package " << endl;
-       _store.insert( augmented_package );
-DBG << "Done" << endl;
        return;
     }
     catch (const Exception & excpt_r)
index 6a33d49..3078187 100644 (file)
@@ -17,6 +17,7 @@
 #include "zypp/source/yum/YUMPackageImpl.h"
 #include "zypp/parser/yum/YUMParserData.h"
 #include "zypp/Package.h"
+#include "zypp/Atom.h"
 #include "zypp/Message.h"
 #include "zypp/Script.h"
 #include "zypp/Patch.h"