+++ /dev/null
-#include <iostream>
-#include <string>
-#include <zypp/base/Logger.h>
-#include <zypp/detail/PackageImpl.h>
-#include <zypp/Package.h>
-
-using namespace std;
-using namespace zypp;
-using namespace base;
-
-/******************************************************************
-**
-**
-** FUNCTION NAME : main
-** FUNCTION TYPE : int
-**
-** DESCRIPTION :
-*/
-int main( int argc, char * argv[] )
-{
- INT << "===[START]==========================================" << endl;
-
- std::string _name( "foo" );
- Edition _edition( "1.0", "42" );
- Arch _arch( "i386" );
-
-
- detail::PackageImplPtr pi( new detail::PackageImpl(_name,_edition,_arch) );
- DBG << pi << endl;
- DBG << *pi << endl;
- constPackagePtr foo( new Package( pi ) );
- DBG << foo << endl;
- DBG << *foo << endl;
-
-
- detail::constPackageImplPtr c( pi );
- detail::PackageImplPtr cc( const_pointer_cast<detail::PackageImpl>(c) );
-
-
- INT << "===[END]============================================" << endl;
- return 0;
-}
SUBDIRS = yum
-noinst_PROGRAMS = Main Main.debug Msg Msg.debug Patch Patch.debug Script Script.debug PatchSelect PatchSelect.debug PatchRead PatchRead.debug
+noinst_PROGRAMS = Msg Msg.debug Patch Patch.debug Script Script.debug PatchSelect PatchSelect.debug PatchRead PatchRead.debug
## ##################################################
## ##################################################
-Main_SOURCES = Main.cc
-
-Main_debug_SOURCES = $(Main_SOURCES)
-Main_debug_LDFLAGS = -static
-
Msg_SOURCES = Msg.cc
Msg_debug_SOURCES = $(Msg_SOURCES)
#include <iostream>
#include <zypp/base/Logger.h>
#include <zypp/detail/MessageImpl.h>
+#include <zypp/Message.h>
using namespace std;
{
public:
MyMessageImpl (std::string text)
- : MessageImpl ("message1",
- Edition (),
- Arch ("noarch"))
{
_text = text;
}
{
INT << "===[START]==========================================" << endl;
- MyMessageImpl p ("My message to be shown to user");
+ std::string text = "My message to be shown to user";
+ std::string _name( "msg1" );
+ Edition _edition( "1.0", "42" );
+ Arch _arch( "noarch" );
+ base::shared_ptr<detail::MessageImpl> mp1(new MyMessageImpl(text));
+ Message::Ptr m( detail::makeResolvableFromImpl( _name, _edition, _arch, mp1));
- DBG << p << endl;
- DBG << " \"" << p.text() << "\"" << endl;
+ DBG << *m << endl;
+ DBG << " \"" << m->text() << "\"" << endl;
INT << "===[END]============================================" << endl;
return 0;
#include <zypp/detail/MessageImpl.h>
#include <zypp/detail/PatchImpl.h>
#include <zypp/Package.h>
+#include <zypp/Patch.h>
#include <zypp/detail/PackageImpl.h>
class MyPatchImpl : public detail::PatchImpl
{
public:
- MyPatchImpl (std::string name, std::list<ResolvablePtr> atoms)
- : PatchImpl (name,
- Edition (),
- Arch ("noarch"))
+ MyPatchImpl (detail::PatchImpl::AtomList atoms)
{
_reboot_needed = false;
_atoms = atoms;
{
INT << "===[START]==========================================" << endl;
- atom_list atoms;
+ detail::PatchImpl::AtomList atoms;
std::string _name( "foo" );
Edition _edition( "1.0", "42" );
Arch _arch( "i386" );
- detail::PackageImplPtr pi( new detail::PackageImpl(_name,_edition,_arch) );
- PackagePtr p (new Package (pi));
+ base::shared_ptr<detail::PackageImpl> pi( new detail::PackageImpl );
+ Package::Ptr p( detail::makeResolvableFromImpl( _name, _edition, _arch, pi ));
atoms.push_back (p);
std::string _name2( "bar" );
Edition _edition2( "1.0", "43" );
Arch _arch2( "noarch" );
- detail::PackageImplPtr pi2(new detail::PackageImpl(_name2,_edition2,_arch2));
- PackagePtr p2 (new Package (pi2));
+ base::shared_ptr<detail::PackageImpl> pi2(new detail::PackageImpl);
+ Package::Ptr p2( detail::makeResolvableFromImpl( _name, _edition, _arch, pi2));
atoms.push_back (p2);
- MyPatchImpl q ("patch1", atoms);
- DBG << q << endl;
- DBG << " Interactive: " << q.interactive () << endl;
- atom_list a = q.all_atoms ();
- for (atom_list::iterator it = a.begin (); it != a.end (); it++)
+ base::shared_ptr<detail::PatchImpl> pt1(new MyPatchImpl(atoms));
+ Patch::Ptr q( detail::makeResolvableFromImpl( std::string("patch1"), _edition, _arch, pt1));
+ DBG << *q << endl;
+ DBG << " Interactive: " << q->interactive () << endl;
+ Patch::AtomList a = q->atoms ();
+ for (Patch::AtomList::iterator it = a.begin (); it != a.end (); it++)
{
DBG << " " << **it << endl;
}
INT << "====================================================" << endl;
std::string _name3( "msg" );
+ Edition _ed3( "1.0", "42" );
Arch _arch3( "noarch" );
- detail::MessageImplPtr mi(new detail::MessageImpl(_name3,Edition (),_arch3));
- MessagePtr m (new Message (mi));
+ base::shared_ptr<detail::MessageImpl> mi(new detail::MessageImpl);
+ Message::Ptr m (detail::makeResolvableFromImpl( _name3, _ed3, _arch3, mi));
+
atoms.push_back (m);
- MyPatchImpl q2 ("patch2", atoms);
- DBG << q2 << endl;
- DBG << " Interactive: " << q2.interactive () << endl;
- a = q2.all_atoms ();
- for (atom_list::iterator it = a.begin (); it != a.end (); it++)
+ base::shared_ptr<detail::PatchImpl> pt2(new MyPatchImpl(atoms));
+ Patch::Ptr q2( detail::makeResolvableFromImpl( std::string("patch2"), _edition, _arch, pt2));
+ DBG << *q2 << endl;
+ DBG << " Interactive: " << q2->interactive () << endl;
+ a = q2->atoms ();
+ for (Patch::AtomList::iterator it = a.begin (); it != a.end (); it++)
{
DBG << " " << **it << endl;
}
#include <zypp/parser/yum/YUMParser.h>
#include <zypp/base/Logger.h>
#include <zypp/source/yum/YUMScriptImpl.h>
+#include <zypp/source/yum/YUMMessageImpl.h>
+#include <zypp/source/yum/YUMPackageImpl.h>
#include <map>
CapFactory _f;
-DEFINE_PTR_TYPE(MyMessageImpl)
-class MyMessageImpl : public detail::MessageImpl
-{
- public:
- MyMessageImpl (string name, string type, std::string text)
- : MessageImpl (name,
- Edition (),
- Arch ("noarch"))
- {
- _text = text;
- _type = type;
- }
-};
-IMPL_PTR_TYPE(MyMessageImpl)
-
void AddDependency (detail::ResolvableImplPtr res, Capability& cap) {
Dependencies deps = res->deps();
CapSet req = deps.requires();
Capability cap( _f.parse( p.name, ResKind( "patch" )));
// Process atoms
- atom_list atoms;
+ detail::PatchImpl::AtomList atoms;
for (std::list<YUMPatchAtom>::iterator it = p.atoms.begin();
it != p.atoms.end();
cout << script->deps() << endl;
atoms.push_back(script);
}
+ else if (it->type == "message")
+ {
+ MessageImplPtr impl = new YUMMessageImpl( *it->message );
+ AddDependency(impl, cap);
+ MessagePtr message = new Message(impl);
+ cout << *message << endl;
+ cout << message->deps() << endl;
+ atoms.push_back(message);
+ }
+ else if (it->type == "package")
+ {
+ PackageImplPtr impl = new YUMPackageImpl( *it->package );
+ AddDependency(impl, cap);
+ PackagePtr package = new Package(impl);
+ cout << *package << endl;
+ cout << package->deps() << endl;
+ atoms.push_back(package);
+ }
}
-/* for (list<PACKAGE>::iterator it = p.pack.begin();
- it != p.pack.end();
- it++)
- {
- detail::PackageImplPtr pi( new detail::PackageImpl(
- it->name,
- Edition( it->version, it->release ),
- Arch( it->arch )));
- AddDependency( pi, cap );
- AddAllRequires( pi, it->requires );
- PackagePtr p( new Package( pi ));
- DBG << *p << endl;
- DBG << p->deps() << endl;
- atoms.push_back( p );
- }
- for (list<MESSAGE>::iterator it = p.msg.begin();
- it != p.msg.end();
- it++)
- {
- detail::MessageImplPtr pi( new MyMessageImpl(
- it->name,
- it->type,
- it->text));
- AddDependency( pi, cap );
- MessagePtr p( new Message( 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;
bool first = true;
- for (atom_list::iterator it = atoms.begin();
+ for (detail::PatchImpl::AtomList::iterator it = atoms.begin();
it != atoms.end();
it++)
{
{
INT << "===[START]==========================================" << endl;
-// filling structures
-/*
-PACKAGE foo;
-foo.name = "foo";
-foo.version = "3.0";
-foo.release = "5";
-foo.arch = "noarch";
-
-PACKAGE foocomp;
-foocomp.name = "foo-compat";
-foocomp.version = "3.0";
-foocomp.release = "5";
-foocomp.arch = "noarch";
-foocomp.requires.push_back( Capability( _f.parse( "foo", ResKind( "package" ))));
-
-PACKAGE bar;
-bar.name = "bar";
-bar.version = "2.8";
-bar.release = "2";
-bar.arch = "noarch";
-
-MESSAGE msg;
-msg.name = "msg";
-msg.type = "OK";
-msg.text = "Hello World";
-
-SCRIPT scr;
-scr.name = "scr";
-scr.do_script = "/bin/bash";
-scr.undo_script = "/bin/unbash";
-
-list<PACKAGE> pkgs;
-list<MESSAGE> msgs;
-list<SCRIPT> scrs;
-
-pkgs.push_back( foo );
-pkgs.push_back( foocomp );
-pkgs.push_back( bar );
-msgs.push_back( msg );
-scrs.push_back( scr );
-
-PATCH ptch;
-ptch.name = "patch";
-ptch.pack = pkgs;
-ptch.msg = msgs;
-ptch.scr = scrs;
-*/
PatchPtr patch1;
YUMPatchParser iter(cin,"");
for (;
DBG << patch1 << endl;
DBG << *patch1 << endl;
-atom_list at = patch1->atoms();
-for (atom_list::iterator it = at.begin();
+Patch::AtomList at = patch1->atoms();
+for (Patch::AtomList::iterator it = at.begin();
it != at.end();
it++)
{
{
INT << "===[START]==========================================" << endl;
- atom_list atoms;
+ PatchImpl::AtomList atoms;
std::string _name( "foo" );
Edition _edition( "1.0", "42" );
MyPatchImplPtr q (new MyPatchImpl ("patch1", atoms, "recommended"));
PatchPtr patch1 (new Patch (q));
- atom_list atoms2;
+ PatchImpl::AtomList atoms2;
std::string _name3( "msg" );
Arch _arch3( "noarch" );
detail::MessageImplPtr mi(new detail::MessageImpl(_name3,Edition (),_arch3));
#include <iostream>
#include <zypp/base/Logger.h>
#include <zypp/detail/ScriptImpl.h>
+#include <zypp/Script.h>
using namespace std;
{
public:
MyScriptImpl (std::string do_script, std::string undo_script = "")
- : ScriptImpl ("script1",
- Edition (),
- Arch ("noarch"))
{
_do_script = do_script;
_undo_script = undo_script;
{
INT << "===[START]==========================================" << endl;
- MyScriptImpl p ("#!/bin/bash\ndo_script");
+ std::string do_script = "#!/bin/bash\ndo_script";
+ std::string undo_script = "#!/bin/bash\nundo_script";
+ std::string _name( "script1" );
+ Edition _edition( "1.0", "42" );
+ Arch _arch( "noarch" );
+ base::shared_ptr<detail::ScriptImpl> sp1(new MyScriptImpl(do_script));
+ Script::Ptr s( detail::makeResolvableFromImpl( _name, _edition, _arch, sp1));
- DBG << p << endl;
- DBG << " \"" << p.do_script() << "\"" << endl;
- DBG << " \"" << p.undo_script() << "\"" << endl;
- DBG << " " << p.undo_available() << endl;
+ DBG << *s << endl;
+ DBG << " \"" << s->do_script() << "\"" << endl;
+ DBG << " \"" << s->undo_script() << "\"" << endl;
+ DBG << " " << s->undo_available() << endl;
INT << "====================================================" << endl;
- MyScriptImpl q ("#!/bin/bash\ndo_script", "#!/bin/bash\nundo_script");
+ base::shared_ptr<detail::ScriptImpl> sp2(new MyScriptImpl(do_script, undo_script));
+ Script::Ptr s2( detail::makeResolvableFromImpl( _name, _edition, _arch, sp2));
- DBG << q << endl;
- DBG << " \"" << q.do_script() << "\"" << endl;
- DBG << " \"" << q.undo_script() << "\"" << endl;
- DBG << " " << q.undo_available() << endl;
+ DBG << *s2 << endl;
+ DBG << " \"" << s2->do_script() << "\"" << endl;
+ DBG << " \"" << s2->undo_script() << "\"" << endl;
+ DBG << " " << s2->undo_available() << endl;
INT << "===[END]============================================" << endl;
return 0;