<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.15"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>libzypp: Commit plugin</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="navtree.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="resize.js"></script> <script type="text/javascript" src="navtreedata.js"></script> <script type="text/javascript" src="navtree.js"></script> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ $(document).ready(initResizable); /* @license-end */</script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">libzypp  <span id="projectnumber">17.9.0</span> </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.15 --> <script type="text/javascript" src="menudata.js"></script> <script type="text/javascript" src="menu.js"></script> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ $(function() { initMenu('',false,false,'search.php','Search'); }); /* @license-end */</script> <div id="main-nav"></div> </div><!-- top --> <div id="side-nav" class="ui-resizable side-nav-resizable"> <div id="nav-tree"> <div id="nav-tree-contents"> <div id="nav-sync" class="sync"></div> </div> </div> <div id="splitbar" style="-moz-user-select:none;" class="ui-resizable-handle"> </div> </div> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ $(document).ready(function(){initNavTree('plugin-commit.html','');}); /* @license-end */ </script> <div id="doc-content"> <div class="PageDoc"><div class="header"> <div class="headertitle"> <div class="title">Commit plugin </div> </div> </div><!--header--> <div class="contents"> <div class="textblock"><dl class="section author"><dt>Author</dt><dd>Michael Andres <a href="#" onclick="location.href='mai'+'lto:'+'ma@'+'su'+'se.'+'de'; return false;">ma@su<span style="display: none;">.nosp@m.</span>se.d<span style="display: none;">.nosp@m.</span>e</a></dd></dl> <hr/> <h1><a class="anchor" id="intro"></a> Introduction</h1> <p>This is a statefull plugin executed during <a class="el" href="classzypp_1_1ZYpp.html#a27e3f9aa4c5c257acf2ad3720f5784d1">zypp::ZYpp::commit</a>. At the beginning of a commit all plugins found in <code>/usr/lib/zypp/plugins/commit</code> are launched. The plugins will receive messages as commit proceeds. Unless otherwise specified messages received need to be confirmed by sending an <code>ACC</code> message. Sending back an unexpected or <code>ERROR</code> message execution of the plugin will be canceled.</p> <p>If you have e.g. <code>zypp-plugin-python</code> installed a basic commit plugin could look like this:</p> <pre class="fragment">#!/usr/bin/env python # # zypp commit plugin # import os import sys from zypp_plugin import Plugin class MyPlugin(Plugin): def PLUGINBEGIN(self, headers, body): # commit is going to start. if headers.has_key('userdata'): print "Commit starts with TID '%s'" % headers['userdata'] self.ack() def PLUGINEND(self, headers, body): # commit ended self.ack() plugin = MyPlugin() plugin.main() </pre><dl class="section see"><dt>See also</dt><dd><a class="el" href="zypp-plugins.html#plugin-writing">Writing plugins</a></dd></dl> <hr/> <h1><a class="anchor" id="pluginbegin"></a> PLUGINBEGIN</h1> <pre class="fragment">PLUGINBEGIN userdata:TIDfoo42 ^@ </pre><p> Sent as 1st message after the plugin was launched. Prepare your plugin and send an <code>ACC</code> message when you are done. Commit will start after all plugins are initialized.</p> <ul> <li><code>userdata:stringval</code> Optional header sent if the application has provided a user data string. <dl class="section see"><dt>See also</dt><dd><a class="el" href="zypp-userdata.html">User data as transaction id</a></dd></dl> <hr/> </li> </ul> <h1><a class="anchor" id="commitbegin"></a> COMMITBEGIN (added in v1)</h1> <pre class="fragment">COMMITBEGIN { "TransactionStepList": [ <TransactionStep>,... ] } ^@ </pre><p> Sent before installation actually starts. The body contains a JSON encoded object providing the <code>TransactionStepList</code>, basically the list of install/remove actions the the commit is going to perform. Each <code>TransactionStep</code> is encoded as JSON object: </p><pre class="fragment"><TransactionStep> = { "type": <TypeString> # [optional] "stage": <StageString> # [optional] "solvable": <Solvable> } <TypeString> = <missing> # ignore; implicit or non-package actions | "-" # remove | "+" # install | "M" # multi version install; install keeping the old version; e.g. kernel <StageString> = <missing> # todo | "ok" # done | "err" # failed <Solvable> = { "n": <string> # name "e": <number> # epoch if not 0 [optional] "v": <string> # version "r": <string> # release "a": <string> # architecture } </pre><dl class="section see"><dt>See also</dt><dd><a class="el" href="classzypp_1_1sat_1_1Transaction_1_1Step.html">zypp::sat::Transaction::Step</a></dd></dl> <hr/> <h1><a class="anchor" id="commitend"></a> COMMITEND (added in v1)</h1> <pre class="fragment">COMMITEND { "TransactionStepList": [ <TransactionStep>,... ] } ^@ </pre><p> Sent at the end of commit. The body contains a JSON encoded object providing the final <code>TransactionStepList</code>. The <code>StepStage</code> indicates whether the action succeeded, failed or was skipped (still 'todo').</p> <dl class="section see"><dt>See also</dt><dd><a class="el" href="plugin-commit.html#commitbegin">COMMITBEGIN (added in v1)</a></dd></dl> <hr/> <h1><a class="anchor" id="pluginend"></a> PLUGINEND</h1> <pre class="fragment">PLUGINEND ^@ </pre><p> This message is sent at the end of commit. You should receive this message even if commit was aborted by some unexpected exception. </p> </div></div><!-- PageDoc --> </div><!-- contents --> </div><!-- doc-content --> <!-- start footer part --> <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> <ul> <li class="navelem"><a class="el" href="zypp-plugins.html">Extending ZYpp: Plugins and Hooks</a></li> <li class="footer">Generated by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.15 </li> </ul> </div> </body> </html>