From ac9900c400ff07bed0a6022586d5419624f3a53f Mon Sep 17 00:00:00 2001 From: Michael Andres Date: Fri, 3 Jun 2011 23:26:55 +0200 Subject: [PATCH] backup --- devel/devel.ma/PluginTest.cc | 31 +++++++++++++++++++++++++++++++ devel/devel.ma/PluginTest.py | 24 ++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100755 devel/devel.ma/PluginTest.py diff --git a/devel/devel.ma/PluginTest.cc b/devel/devel.ma/PluginTest.cc index c2856ec..249c7be 100644 --- a/devel/devel.ma/PluginTest.cc +++ b/devel/devel.ma/PluginTest.cc @@ -74,6 +74,14 @@ PluginFrame receive() } // namespace zypp /////////////////////////////////////////////////////////////////// +#define DOLOG(C) USR << #C << ": " << endl; C; + +namespace zypp { + namespace target { + void testCommitPlugins( const Pathname & path_r ); + } +} + /****************************************************************** ** ** FUNCTION NAME : main @@ -86,6 +94,29 @@ try { INT << "===[START]==========================================" << endl; ////////////////////////////////////////////////////////////////// + zypp::target::testCommitPlugins( "/tmp/pltest" ); + + if ( 0 ) + { + Pathname script( "PluginTest.py" ); + PluginScript plugin( script ); + USR << plugin << endl; + + DOLOG( plugin.open() ); + + DOLOG( plugin.send( PluginFrame( "PLUGINBEGIN" ) ) ); + + PluginFrame ret; + DOLOG( ret = plugin.receive() ); + MIL << ret << endl; + + DOLOG( plugin.send( PluginFrame( "PLUGINEND" ) ) ); + DOLOG( ret = plugin.receive() ); + MIL << ret << endl; + + DOLOG( plugin.close() ); + } + if ( 0 ) { Pathname script( ZConfig::instance().pluginsPath()/"system/spacewalkx" ); if ( PathInfo( script ).isX() ) diff --git a/devel/devel.ma/PluginTest.py b/devel/devel.ma/PluginTest.py new file mode 100755 index 0000000..e3a5873 --- /dev/null +++ b/devel/devel.ma/PluginTest.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python +# +# ZYpp plugin +# +import os +import sys +import traceback +import time + +from zypp_plugin import Plugin + +class MyPlugin(Plugin): + + def PLUGINBEGIN(self, headers, body): + # commit is going to start. + #self.error( {}, 'oops' ) + self.ack() + + def PLUGINEND(self, headers, body): + # commit ended + self.ack() + +plugin = MyPlugin() +plugin.main() -- 2.7.4