aboutsummaryrefslogtreecommitdiff
blob: bec16d7450c2376e382498455098547af908117a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://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/html; charset=utf-8" />
    
    <title>API &mdash; Autodep documentation</title>
    <link rel="stylesheet" href="_static/default.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '0.1',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="top" title="Autodep documentation" href="index.html" />
    <link rel="prev" title="Internals" href="architecture.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="architecture.html" title="Internals"
             accesskey="P">previous</a> |</li>
        <li><a href="index.html">Autodep</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="api">
<h1>API<a class="headerlink" href="#api" title="Permalink to this headline"></a></h1>
<div class="section" id="module-logfs.fstracer">
<span id="logfs-fstracer"></span><h2>logfs.fstracer<a class="headerlink" href="#module-logfs.fstracer" title="Permalink to this headline"></a></h2>
<p>This module is a bridge between low-level logging services and high level 
handling dependency logic.</p>
<p>It can be used to launch a program and get all file events</p>
<dl class="function">
<dt id="logfs.fstracer.getfsevents">
<tt class="descclassname">logfs.fstracer.</tt><tt class="descname">getfsevents</tt><big>(</big><em>prog_name</em>, <em>arguments</em>, <em>approach='hooklib'</em>, <em>filterproc=&lt;function defaultfilter at 0x1b2bc80&gt;</em><big>)</big><a class="reference internal" href="_modules/logfs/fstracer.html#getfsevents"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#logfs.fstracer.getfsevents" title="Permalink to this definition"></a></dt>
<dd><p>Launches a program and gets file access events</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>prog_name</strong> &#8211; name of program</li>
<li><strong>arguments</strong> &#8211; list of program&#8217;s arguments</li>
<li><strong>approach</strong> &#8211; a logging approach(&#8216;hooklib&#8217; or &#8216;fusefs&#8217;)</li>
<li><strong>filterproc</strong> &#8211; filter function, this function should take 3 strings:
name of event, name of file and stage, and return a <em>True</em> if event is 
allowed and <em>False</em> instead. Name of event is one of <em>&#8216;open&#8217;</em>, <em>&#8216;read&#8217;</em> or
<em>&#8216;write&#8217;</em>. Default function always returns <em>True</em>.</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><strong>list</strong> with two elements - <em>success</em> events and <em>failed</em> events.
Each element is dictionary <strong>stage-&gt;file information</strong>.
File information is also a dictionary <strong>filename-&gt;type of events</strong>.
Type of events for success events is a 2-element tuple: <em>(was file readed,
was file writed)</em>. For failed events it is also 2-element tuple:
<em>(was file not found, was file blocked by filterproc)</em>. Each element of 
tuple can be <em>True</em> or <em>False</em>. Both elements of tuple can be <em>False</em>.
Stage can be <em>&#8216;unknown&#8217;</em></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</div>
<div class="section" id="package-utils">
<h2>package_utils<a class="headerlink" href="#package-utils" title="Permalink to this headline"></a></h2>
<p>This package contains modules which works with the Portage system</p>
<span class="target" id="module-package_utils.portage_log_parser"></span><dl class="function">
<dt id="package_utils.portage_log_parser.get_list_of_merged_packages">
<tt class="descclassname">package_utils.portage_log_parser.</tt><tt class="descname">get_list_of_merged_packages</tt><big>(</big><em>starttime=0</em>, <em>endtime=-1</em><big>)</big><a class="reference internal" href="_modules/package_utils/portage_log_parser.html#get_list_of_merged_packages"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#package_utils.portage_log_parser.get_list_of_merged_packages" title="Permalink to this definition"></a></dt>
<dd><p>Parses an emerge log and finds first successfully merged packages chain</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>starttime</strong> &#8211; start time for searching(in seconds since 1970)</li>
<li><strong>starttime</strong> &#8211; end time for searching(in seconds since 1970).</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><strong>list</strong> of package names</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<span class="target" id="module-package_utils.portage_utils"></span><dl class="function">
<dt id="package_utils.portage_utils.get_all_packages_files">
<tt class="descclassname">package_utils.portage_utils.</tt><tt class="descname">get_all_packages_files</tt><big>(</big><big>)</big><a class="headerlink" href="#package_utils.portage_utils.get_all_packages_files" title="Permalink to this definition"></a></dt>
<dd><p>Memory-hungry operation</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><strong>set</strong> of all files that belongs to package</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="package_utils.portage_utils.getfilesbypackage">
<tt class="descclassname">package_utils.portage_utils.</tt><tt class="descname">getfilesbypackage</tt><big>(</big><em>packagename</em><big>)</big><a class="reference internal" href="_modules/package_utils/portage_utils.html#getfilesbypackage"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#package_utils.portage_utils.getfilesbypackage" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><strong>packagename</strong> &#8211; name of package</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><strong>list</strong> of files in package with name <em>packagename</em></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="package_utils.portage_utils.getpackagesbyfiles">
<tt class="descclassname">package_utils.portage_utils.</tt><tt class="descname">getpackagesbyfiles</tt><big>(</big><em>files</em><big>)</big><a class="reference internal" href="_modules/package_utils/portage_utils.html#getpackagesbyfiles"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#package_utils.portage_utils.getpackagesbyfiles" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><strong>files</strong> &#8211; list of filenames</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><strong>dictionary</strong> file-&gt;package, if file doesn&#8217;t belong to any
package it not returned as key of this dictionary</td>
</tr>
</tbody>
</table>
</dd></dl>

<span class="target" id="module-package_utils.portage_misc_functions"></span><dl class="class">
<dt id="package_utils.portage_misc_functions.portage_api">
<em class="property">class </em><tt class="descclassname">package_utils.portage_misc_functions.</tt><tt class="descname">portage_api</tt><a class="reference internal" href="_modules/package_utils/portage_misc_functions.html#portage_api"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#package_utils.portage_misc_functions.portage_api" title="Permalink to this definition"></a></dt>
<dd><p>class for accessing the portage api</p>
<dl class="method">
<dt id="package_utils.portage_misc_functions.portage_api.get_best_visible_pkg">
<tt class="descname">get_best_visible_pkg</tt><big>(</big><em>pkg</em><big>)</big><a class="headerlink" href="#package_utils.portage_misc_functions.portage_api.get_best_visible_pkg" title="Permalink to this definition"></a></dt>
<dd><p>Gets best candidate on installing. Returns empty string if no found</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><strong>pkg</strong> &#8211; package name</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="package_utils.portage_misc_functions.portage_api.get_dep">
<tt class="descname">get_dep</tt><big>(</big><em>pkg, dep_type=['RDEPEND', 'DEPEND']</em><big>)</big><a class="headerlink" href="#package_utils.portage_misc_functions.portage_api.get_dep" title="Permalink to this definition"></a></dt>
<dd><p>Gets current dependencies of a package. Looks in portage db</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>pkg</strong> &#8211; name of package</li>
<li><strong>dep_type</strong> &#8211; type of dependencies to recurse. Can be [&#8220;DEPEND&#8221;] or 
[&#8220;RDEPEND&#8221;, &#8220;DEPEND&#8221;]</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><strong>set</strong> of packages names</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="package_utils.portage_misc_functions.portage_api.get_deps">
<tt class="descname">get_deps</tt><big>(</big><em>pkg, dep_type=['RDEPEND', 'DEPEND']</em><big>)</big><a class="reference internal" href="_modules/package_utils/portage_misc_functions.html#portage_api.get_deps"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#package_utils.portage_misc_functions.portage_api.get_deps" title="Permalink to this definition"></a></dt>
<dd><p>Gets current dependencies of a package on any depth 
All dependencies <strong>must</strong> be installed</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>pkg</strong> &#8211; name of package</li>
<li><strong>dep_type</strong> &#8211; type of dependencies to recurse. Can be [&#8220;DEPEND&#8221;] or 
[&#8220;RDEPEND&#8221;, &#8220;DEPEND&#8221;]</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><strong>set</strong> of packages names</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="package_utils.portage_misc_functions.portage_api.get_merge_list">
<tt class="descname">get_merge_list</tt><big>(</big><em>emergeargs</em><big>)</big><a class="headerlink" href="#package_utils.portage_misc_functions.portage_api.get_merge_list" title="Permalink to this definition"></a></dt>
<dd><p>Gets list of packages that emerge with emergeargs-arguments will merge
This function uses very internal functions of portage so 
it may be unreliable in various portage versions</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><strong>emergeargs</strong> &#8211; list of raw args of emerge, for example, [&#8216;-1&#8217;,&#8217;bash&#8217;]</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="package_utils.portage_misc_functions.portage_api.get_system_packages_list">
<tt class="descname">get_system_packages_list</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/package_utils/portage_misc_functions.html#portage_api.get_system_packages_list"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#package_utils.portage_misc_functions.portage_api.get_system_packages_list" title="Permalink to this definition"></a></dt>
<dd><p>returns all packages from system set. They are always implicit dependencies</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><strong>list</strong> of package names</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="package_utils.portage_misc_functions.portage_api.parse_emerge_args">
<tt class="descname">parse_emerge_args</tt><big>(</big><em>args</em><big>)</big><a class="reference internal" href="_modules/package_utils/portage_misc_functions.html#portage_api.parse_emerge_args"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#package_utils.portage_misc_functions.portage_api.parse_emerge_args" title="Permalink to this definition"></a></dt>
<dd><p>call emerge arguments parser</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><strong>args</strong> &#8211; arguments passed to emerge</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><strong>tuple</strong> (action string, options dictionary, files or atoms 
list)</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">API</a><ul>
<li><a class="reference internal" href="#module-logfs.fstracer">logfs.fstracer</a></li>
<li><a class="reference internal" href="#package-utils">package_utils</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="architecture.html"
                        title="previous chapter">Internals</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="_sources/api.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" size="18" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="architecture.html" title="Internals"
             >previous</a> |</li>
        <li><a href="index.html">Autodep</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2011, Alexander Bersenev.
      Last updated on Aug 04, 2011.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
    </div>
  </body>
</html>