zypp/capability/Makefile \
zypp/parser/Makefile \
zypp/parser/yum/Makefile \
- zypp/parser/yum/schema/Makefile
+ zypp/parser/yum/schema/Makefile \
+ zypp/source/Makefile \
+ zypp/source/yum/Makefile
)
dnl ==================================================
## ##################################################
-LDADD = $(top_srcdir)/zypp/lib@PACKAGE@.la /usr/lib/libxml2.a /usr/lib/libz.a
+LDADD = $(top_srcdir)/zypp/lib@PACKAGE@.la
## ##################################################
AM_CXXFLAGS = -pg
-LDADD = $(top_srcdir)/zypp/lib@PACKAGE@.la /usr/lib/libxml2.a /usr/lib/libz.a
+LDADD = $(top_srcdir)/zypp/lib@PACKAGE@.la
## ##################################################
#include <zypp/Capability.h>
#include <zypp/capability/CapabilityImpl.h>
+#include <zypp/parser/yum/YUMParser.h>
+#include <zypp/base/Logger.h>
+#include <zypp/source/yum/YUMScriptImpl.h>
+
#include <map>
#include <set>
#include <zypp/CapFactory.h>
+using namespace zypp::detail;
+
using namespace std;
using namespace zypp;
+using namespace zypp::parser::YUM;
+using namespace zypp::source::YUM;
-class PACKAGE {
- public:
- string name;
- string version;
- string release;
- string arch;
- list<Capability> requires;
-};
-
-class MESSAGE {
- public:
- string name;
- string type;
- string text;
-};
-
-class SCRIPT {
- public:
- string name;
- string do_script;
- string undo_script;
-};
-
-class PATCH {
- public:
- string name;
- list<PACKAGE> pack;
- list<MESSAGE> msg;
- list<SCRIPT> scr;
-};
CapFactory _f;
};
IMPL_PTR_TYPE(MyMessageImpl)
-DEFINE_PTR_TYPE(MyScriptImpl)
-class MyScriptImpl : public detail::ScriptImpl
-{
- public:
- MyScriptImpl (string name, std::string do_script, std::string undo_script = "")
- : ScriptImpl (name,
- Edition (),
- Arch ("noarch"))
- {
- _do_script = do_script;
- _undo_script = undo_script;
- }
-};
-IMPL_PTR_TYPE(MyScriptImpl)
-
void AddDependency (detail::ResolvableImplPtr res, Capability& cap) {
Dependencies deps = res->deps();
CapSet req = deps.requires();
class MyPatchImpl : public detail::PatchImpl
{
public:
- MyPatchImpl( PATCH & p )
+ MyPatchImpl( YUMPatchData & p )
: PatchImpl (p.name,
Edition (),
Arch ("noarch"))
// Process atoms
atom_list atoms;
- for (list<PACKAGE>::iterator it = p.pack.begin();
+
+ for (std::list<YUMPatchAtom>::iterator it = p.atoms.begin();
+ it != p.atoms.end();
+ it++)
+ {
+ if (it->type == "script")
+ {
+ ScriptImplPtr impl = new YUMScriptImpl( *it->script );
+ AddDependency(impl, cap);
+ ScriptPtr script = new Script(impl);
+ cout << *script << endl;
+ cout << script->deps() << endl;
+ atoms.push_back(script);
+ }
+ }
+
+/* for (list<PACKAGE>::iterator it = p.pack.begin();
it != p.pack.end();
it++)
{
DBG << p->deps() << endl;
atoms.push_back( p );
}
- for (list<SCRIPT>::iterator it = p.scr.begin();
- it != p.scr.end();
- it++)
- {
- detail::ScriptImplPtr pi( new MyScriptImpl(
- it->name,
- it->do_script,
- it->undo_script));
- AddDependency( pi, cap );
- ScriptPtr p( new Script( pi ));
- DBG << *p << endl;
- DBG << p->deps() << endl;
- atoms.push_back( p );
- }
-
+*/
// FIXME mve this piece of code after solutions are selected
// this orders the atoms of a patch
ResolvablePtr previous;
INT << "===[START]==========================================" << endl;
// filling structures
-
+/*
PACKAGE foo;
foo.name = "foo";
foo.version = "3.0";
ptch.pack = pkgs;
ptch.msg = msgs;
ptch.scr = scrs;
+*/
+PatchPtr patch1;
+YUMPatchParser iter(cin,"");
+for (;
+ !iter.atEnd();
+ ++iter) {
+ MyPatchImplPtr q(new MyPatchImpl(**iter));
+ patch1 = new Patch (q);
+ }
+if (iter.errorStatus())
+ throw *iter.errorStatus();
-// process the patch
-MyPatchImplPtr q (new MyPatchImpl (ptch));
-PatchPtr patch1 (new Patch (q));
+
+// process the patch
DBG << patch1 << endl;
DBG << *patch1 << endl;
AM_CXXFLAGS = -pg
-LDADD = $(top_srcdir)/zypp/lib@PACKAGE@.la /usr/lib/libxml2.a /usr/lib/libz.a
+LDADD = $(top_srcdir)/zypp/lib@PACKAGE@.la
## ##################################################
detail/lib@PACKAGE@_detail.la \
capability/lib@PACKAGE@_capability.la \
parser/lib@PACKAGE@_parser.la \
- parser/yum/lib@PACKAGE@_parser_yum.la
+ source/lib@PACKAGE@_source.la
## ##################################################
XMLNodeIterator.cc \
LibXMLHelper.cc
+lib@PACKAGE@_parser_la_LIBADD = yum/lib@PACKAGE@_parser_yum.la \
+ -lxml2 \
+ -lz
+
## ##################################################
--- /dev/null
+## Process this file with automake to produce Makefile.in
+## ##################################################
+
+SUBDIRS = yum
+
+## ##################################################
+
+include_HEADERS = \
+ Source.h
+
+
+noinst_LTLIBRARIES = lib@PACKAGE@_source.la
+
+## ##################################################
+
+lib@PACKAGE@_source_la_SOURCES = \
+ Source.cc
+
+lib@PACKAGE@_source_la_LIBADD = yum/lib@PACKAGE@_source_yum.la
+
+## ##################################################
--- /dev/null
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/detail/ResolvableImpl.cc
+ *
+*/
+#include <iostream>
+
+#include "zypp/source/Source.h"
+
+using namespace std;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace source
+ { /////////////////////////////////////////////////////////////////
+ IMPL_PTR_TYPE(Source)
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace detail
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
--- /dev/null
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/detail/Source.h
+ *
+*/
+#ifndef ZYPP_DETAIL_SOURCE_H
+#define ZYPP_DETAIL_SOURCE_H
+
+#include <string>
+
+#include "zypp/base/ReferenceCounted.h"
+#include "zypp/base/NonCopyable.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace source
+ { /////////////////////////////////////////////////////////////////
+ DEFINE_PTR_TYPE(Source)
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : Source
+ //
+ /**
+ * \todo Assert \c deps provide 'name=edition'.
+ */
+ class Source : public base::ReferenceCounted, private base::NonCopyable
+ {
+ public:
+ };
+ ///////////////////////////////////////////////////////////////////
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace source
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_DETAIL_SOURCE_H
--- /dev/null
+## Process this file with automake to produce Makefile.in
+## ##################################################
+
+SUBDIRS =
+
+## ##################################################
+
+include_HEADERS = \
+ YUMScriptImpl.h
+
+
+noinst_LTLIBRARIES = lib@PACKAGE@_source_yum.la
+
+## ##################################################
+
+lib@PACKAGE@_source_yum_la_SOURCES = \
+ YUMScriptImpl.cc
+
+## ##################################################
--- /dev/null
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/detail/ScriptImpl.cc
+ *
+*/
+
+#include "zypp/source/yum/YUMScriptImpl.h"
+
+using namespace std;
+using namespace zypp::detail;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace source
+ { /////////////////////////////////////////////////////////////////
+ namespace YUM
+ {
+ IMPL_PTR_TYPE(YUMScriptImpl)
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : YUMScriptImpl
+ //
+ ///////////////////////////////////////////////////////////////////
+
+ /** Default ctor */
+ YUMScriptImpl::YUMScriptImpl(
+ const zypp::parser::YUM::YUMPatchScript & parsed
+ )
+ : ScriptImpl(
+ parsed.name,
+ Edition(parsed.ver, parsed.rel, strtol(parsed.epoch.c_str(), NULL, 10)),
+ Arch("noarch")
+ )
+ {
+ _do_script = parsed.do_script;
+ _undo_script = parsed.undo_script;
+/*
+ std::list<YUMDependency> provides;
+ std::list<YUMDependency> conflicts;
+ std::list<YUMDependency> obsoletes;
+ std::list<YUMDependency> freshen;
+ std::list<YUMDependency> requires;
+
+
+*/
+ }
+ } // namespace YUM
+ /////////////////////////////////////////////////////////////////
+ } // namespace source
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
--- /dev/null
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/detail/ScriptImpl.h
+ *
+*/
+#ifndef ZYPP_SOURCE_YUM_YUMSCRIPTIMPL_H
+#define ZYPP_SOURCE_YUM_YUMSCRIPTIMPL_H
+
+#include "zypp/detail/ScriptImpl.h"
+#include "zypp/parser/yum/YUMParserData.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace source
+ { /////////////////////////////////////////////////////////////////
+ namespace YUM
+ { //////////////////////////////////////////////////////////////
+
+ DEFINE_PTR_TYPE(YUMScriptImpl)
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : YUMScriptImpl
+ //
+ /** Class representing an update script */
+ class YUMScriptImpl : public detail::ScriptImpl
+ {
+ public:
+ /** Default ctor */
+ YUMScriptImpl( const zypp::parser::YUM::YUMPatchScript & parsed );
+ };
+ ///////////////////////////////////////////////////////////////////
+ } // namespace YUM
+ /////////////////////////////////////////////////////////////////
+ } // namespace source
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_SOURCE_YUM_YUMSCRIPTIMPL_H