Sophie

Sophie

distrib > CentOS > 5 > i386 > media > os > by-pkgid > 608068f228165b6e5a4f2c11fda54521 > files > 30

rpm-apidocs-4.4.2.3-34.el5.i386.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>rpm: Rpm Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.7 -->
<div class="tabs">
  <ul>
    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="modules.html"><span>Modules</span></a></li>
    <li id="current"><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
    <li><a href="files.html"><span>Files</span></a></li>
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
  </ul></div>
<div class="tabs">
  <ul>
    <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
    <li><a href="functions.html"><span>Data&nbsp;Fields</span></a></li>
  </ul></div>
<h1>Rpm Class Reference<br>
<small>
[<a class="el" href="group__python.html">PYTHON API.</a>]</small>
</h1><!-- doxytag: class="Rpm" -->START HERE / RPM base module for the Python API.  
<a href="#_details">More...</a>
<p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
START HERE / RPM base module for the Python API. 
<p>
The rpm base module provides the main starting point for accessing RPM from Python. For most usage, call the TransactionSet method to get a transaction set (rpmts).<p>
For example: <div class="fragment"><pre class="fragment">        <span class="keyword">import</span> rpm

        ts = rpm.TransactionSet()
</pre></div><p>
The transaction set will open the RPM database as needed, so in most cases, you do not need to explicitly open the database. The transaction set is the workhorse of RPM.<p>
You can open another RPM database, such as one that holds all packages for a given Linux distribution, to provide packages used to solve dependencies. To do this, use the following code:<p>
<div class="fragment"><pre class="fragment"> rpm.addMacro('_dbpath', '/path/to/alternate/database')
 solvets = rpm.TransactionSet()
 solvets.openDB()
 rpm.delMacro('_dbpath')

<span class="preprocessor"> # Open default database</span>
<span class="preprocessor"> ts = rpm.TransactionSet()</span>
</pre></div><p>
This code gives you access to two RPM databases through two transaction sets (rpmts): ts is a transaction set associated with the default RPM database and solvets is a transaction set tied to an alternate database, which is very useful for resolving dependencies.<p>
The rpm methods used here are:<p>
<ul>
<li>addMacro(macro, value) <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>macro</em>&nbsp;</td><td>Name of macro to add </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>value</em>&nbsp;</td><td><a class="el" href="unionValue.html">Value</a> for the macro</td></tr>
  </table>
</dl>
</li><li>delMacro(macro) <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>macro</em>&nbsp;</td><td>Name of macro to delete </td></tr>
  </table>
</dl>
</li></ul>

<p>
<hr>The documentation for this class was generated from the following file:<ul>
<li>python/<a class="el" href="header-py_8c-source.html">header-py.c</a></ul>
<hr size="1"><address style="align: right;"><small>Generated on 1 Oct 2013 for rpm by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
</body>
</html>