## Process this file with automake to produce Makefile.in
## ##################################################
-noinst_PROGRAMS = Main Main.debug
+noinst_PROGRAMS = Main Main.debug Msg Msg.debug Patch Patch.debug Script Script.debug
## ##################################################
Main_debug_SOURCES = $(Main_SOURCES)
Main_debug_LDFLAGS = -static
+Msg_SOURCES = Msg.cc
+
+Msg_debug_SOURCES = $(Msg_SOURCES)
+Msg_debug_LDFLAGS = -static
+
+Patch_SOURCES = Patch.cc
+
+Patch_debug_SOURCES = $(Patch_SOURCES)
+Patch_debug_LDFLAGS = -static
+
+Script_SOURCES = Script.cc
+
+Script_debug_SOURCES = $(Script_SOURCES)
+Script_debug_LDFLAGS = -static
+
## ##################################################
.PHONY: always
--- /dev/null
+#include <iostream>
+#include <fstream>
+#include <iterator>
+#include <algorithm>
+#include <set>
+#include <map>
+#include <list>
+#include <vector>
+#include <ext/hash_set>
+#include <ext/hash_map>
+#include <ext/rope>
+
+#include <zypp/base/Logger.h>
+#include <zypp/base/String.h>
+
+///////////////////////////////////////////////////////////////////
+
+#include <zypp/Message.h>
+#include <zypp/detail/MessageImpl.h>
+
+
+using namespace std;
+using namespace zypp;
+
+class MyMessageImpl : public detail::MessageImpl
+{
+ public:
+ MyMessageImpl (std::string text)
+ : MessageImpl (ResName ("message1"),
+ Edition (),
+ Arch ("noarch"))
+ {
+ _text = text;
+ }
+};
+
+/******************************************************************
+**
+**
+** FUNCTION NAME : main
+** FUNCTION TYPE : int
+**
+** DESCRIPTION :
+*/
+int main( int argc, char * argv[] )
+{
+ INT << "===[START]==========================================" << endl;
+
+ MyMessageImpl p ("My message to be shown to user");
+
+ DBG << p << endl;
+ DBG << " \"" << p.text() << "\"" << endl;
+
+ INT << "===[END]============================================" << endl;
+ return 0;
+}
--- /dev/null
+#include <iostream>
+#include <fstream>
+#include <iterator>
+#include <algorithm>
+#include <set>
+#include <map>
+#include <list>
+#include <vector>
+#include <ext/hash_set>
+#include <ext/hash_map>
+#include <ext/rope>
+
+#include <zypp/base/Logger.h>
+#include <zypp/base/String.h>
+
+///////////////////////////////////////////////////////////////////
+
+#include <zypp/Message.h>
+#include <zypp/detail/MessageImpl.h>
+#include <zypp/Patch.h>
+#include <zypp/detail/PatchImpl.h>
+#include <zypp/Package.h>
+#include <zypp/detail/PackageImpl.h>
+
+
+using namespace std;
+using namespace zypp;
+
+class MyPatchImpl : public detail::PatchImpl
+{
+ public:
+ MyPatchImpl (std::string name, std::list<ResolvablePtr> atoms)
+ : PatchImpl (ResName (name),
+ Edition (),
+ Arch ("noarch"))
+ {
+ _reboot_needed = false;
+ _atoms = atoms;
+ }
+};
+
+/******************************************************************
+**
+**
+** FUNCTION NAME : main
+** FUNCTION TYPE : int
+**
+** DESCRIPTION :
+*/
+int main( int argc, char * argv[] )
+{
+ INT << "===[START]==========================================" << endl;
+
+ std::list<ResolvablePtr> atoms;
+
+ ResName _name( "foo" );
+ Edition _edition( "1.0", "42" );
+ Arch _arch( "i386" );
+ detail::PackageImplPtr pi( new detail::PackageImpl(_name,_edition,_arch) );
+ PackagePtr p (new Package (pi));
+ atoms.push_back (p);
+
+ ResName _name2( "bar" );
+ Edition _edition2( "1.0", "43" );
+ Arch _arch2( "noarch" );
+ detail::PackageImplPtr pi2( new detail::PackageImpl(_name,_edition,_arch) );
+ PackagePtr p2 (new Package (pi2));
+ atoms.push_back (p2);
+
+ MyPatchImpl q ("patch1", atoms);
+ DBG << q << endl;
+ DBG << q.interactive () << endl;
+
+ INT << "====================================================" << endl;
+
+ ResName _name3( "msg" );
+ Arch _arch3( "noarch" );
+ detail::MessageImplPtr mi( new detail::MessageImpl(_name,Edition (),_arch3));
+ MessagePtr m (new Message (mi));
+ atoms.push_back (m);
+
+ MyPatchImpl q2 ("patch2", atoms);
+ DBG << q2 << endl;
+ DBG << q2.interactive () << endl;
+
+ INT << "===[END]============================================" << endl;
+ return 0;
+}
--- /dev/null
+#include <iostream>
+#include <fstream>
+#include <iterator>
+#include <algorithm>
+#include <set>
+#include <map>
+#include <list>
+#include <vector>
+#include <ext/hash_set>
+#include <ext/hash_map>
+#include <ext/rope>
+
+#include <zypp/base/Logger.h>
+#include <zypp/base/String.h>
+
+///////////////////////////////////////////////////////////////////
+
+#include <zypp/Script.h>
+#include <zypp/detail/ScriptImpl.h>
+
+
+using namespace std;
+using namespace zypp;
+
+class MyScriptImpl : public detail::ScriptImpl
+{
+ public:
+ MyScriptImpl (std::string do_script, std::string undo_script = "")
+ : ScriptImpl (ResName ("script1"),
+ Edition (),
+ Arch ("noarch"))
+ {
+ _do_script = do_script;
+ _undo_script = undo_script;
+ }
+};
+
+/******************************************************************
+**
+**
+** FUNCTION NAME : main
+** FUNCTION TYPE : int
+**
+** DESCRIPTION :
+*/
+int main( int argc, char * argv[] )
+{
+ INT << "===[START]==========================================" << endl;
+
+ MyScriptImpl p ("#!/bin/bash\ndo_script");
+
+ DBG << p << endl;
+ DBG << " \"" << p.do_script() << "\"" << endl;
+ DBG << " \"" << p.undo_script() << "\"" << endl;
+ DBG << " " << p.undo_available() << endl;
+
+ INT << "====================================================" << endl;
+
+ MyScriptImpl q ("#!/bin/bash\ndo_script", "#!/bin/bash\nundo_script");
+
+ DBG << q << endl;
+ DBG << " \"" << q.do_script() << "\"" << endl;
+ DBG << " \"" << q.undo_script() << "\"" << endl;
+ DBG << " " << q.undo_available() << endl;
+
+ INT << "===[END]============================================" << endl;
+ return 0;
+}
#include "zypp/base/Logger.h"
#include "zypp/Message.h"
-#include "zypp/detail/ResolvableImpl.h"
-#include "zypp//Resolvable.h"
+#include "zypp/detail/MessageImpl.h"
using namespace std;
#include <iosfwd>
-#include "zypp/detail/MessageImpl.h"
#include "zypp/Resolvable.h"
///////////////////////////////////////////////////////////////////
#include "zypp/base/Logger.h"
#include "zypp/Patch.h"
-#include "zypp/detail/ResolvableImpl.h"
-#include "zypp//Resolvable.h"
+#include "zypp/detail/PatchImpl.h"
using namespace std;
#include <iosfwd>
-#include "zypp/detail/PatchImpl.h"
#include "zypp/Resolvable.h"
///////////////////////////////////////////////////////////////////
#include "zypp/base/Logger.h"
#include "zypp/Script.h"
-#include "zypp/detail/ResolvableImpl.h"
-#include "zypp//Resolvable.h"
+#include "zypp/detail/ScriptImpl.h"
using namespace std;
#include <iosfwd>
-#include "zypp/detail/ScriptImpl.h"
#include "zypp/Resolvable.h"
///////////////////////////////////////////////////////////////////
#include "zypp/base/Logger.h"
#include "zypp/detail/PatchImpl.h"
#include "zypp/Patch.h"
+#include "zypp/Package.h"
using namespace std;
bool PatchImpl::interactive () {
if (_reboot_needed)
+ {
+ DBG << "Patch needs reboot" << endl;
return true;
+ }
atom_list not_installed = not_installed_atoms ();
for (atom_list::iterator it = not_installed.begin ();
it != not_installed.end ();
it++)
{
if ((std::string)((*it)->kind ()) == "message")
- // FIXME package with license
{
+ DBG << "Patch contains a message" << endl;
return true;
}
+ if ((std::string)((*it)->kind ()) == "package")
+ {
+ ResolvablePtr r = *it;
+ // FIXME package with license
+// if (r->licenseToConfirm() != "")
+ if (false)
+ {
+ DBG << "Package has a license to be shown to user" << endl;
+ return true;
+ }
+ }
}
return false;
}
it != _atoms.end ();
it++)
{
- if (false) // FIXME check if atom/resolvable is not installed
+ if (true) // FIXME check if atom/resolvable is not installed
{
ret.push_back (*it);
}