Imported Upstream version 15.21.5
[platform/upstream/libzypp.git] / doc / autoinclude / Plugin-System.doc
1 /**
2
3 \page plugin-system System plugin
4
5 \author Michael Andres <ma@suse.de>
6
7 <HR><!-- ====================================================================== -->
8 \section intro Introduction
9
10 This is a statefull plugin executed at the end of \ref zypp::ZYpp::commit, if the system content has change, i.e. if packages have actually been installed or deleted.
11
12 All plugins found in \c /usr/lib/zypp/plugins/system are launched. Unless otherwise specified, messages received need to be confirmed by sending an \c ACC message. Sending back an unexpected or \c ERROR message, the execution of the plugin will be canceled.
13
14 If you have e.g. \c zypp-plugin-python installed a basic system plugin could look like this:
15
16 \verbatim
17 #!/usr/bin/env python
18 #
19 # zypp system plugin
20 #
21 import os
22 import sys
23 from zypp_plugin import Plugin
24
25 class MyPlugin(Plugin):
26
27   def PACKAGESETCHANGED(self, headers, body):
28
29     // Installation has ended. The set of installed packages has changed.
30     // ....
31
32     self.ack()
33   def
34
35 plugin = MyPlugin()
36 plugin.main()
37 \endverbatim
38
39 \see \ref plugin-writing
40
41 <HR><!-- ====================================================================== -->
42 \section pluginbegin PLUGINBEGIN
43 \verbatim
44 PLUGINBEGIN
45 userdata:TIDfoo42
46
47 ^@
48 \endverbatim
49 Sent as 1st message after the plugin was launched. Prepare your plugin and send an \c ACC message when you are done.
50
51 \li \c userdata:stringval Optional header sent if the application has provided a user data string. \see \ref zypp-userdata
52
53
54 <HR><!-- ====================================================================== -->
55 \section packagesetchanged PACKAGESETCHANGED
56 \verbatim
57 PACKAGESETCHANGED
58
59 ^@
60 \endverbatim
61 Installation has ended. The set of installed packages has changed.
62
63 \see \ref zypp::sat::Transaction::Step
64
65 <HR><!-- ====================================================================== -->
66 \section pluginend PLUGINEND
67 \verbatim
68 PLUGINEND
69
70 ^@
71 \endverbatim
72 This message is sent at the end before the plugin is closed. You should receive this message even if the action was aborted by some unexpected exception.
73
74
75 */