This file is indexed.

/usr/share/doc/python-apt/html/tutorials/apt-get.html is in python-apt-doc 0.8.3ubuntu7.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
<!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>Doing stuff apt-get does &mdash; python-apt 0.8.3ubuntu7 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.8.3ubuntu7',
        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="python-apt 0.8.3ubuntu7 documentation" href="../index.html" />
    <link rel="up" title="Tutorials" href="index.html" />
    <link rel="next" title="Contributing to python-apt" href="contributing.html" />
    <link rel="prev" title="Writing your own apt-cdrom" href="apt-cdrom.html" />
    <link rel="shortcut icon" type="image/png" href="../_static/py.png" />
 

  </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="contributing.html" title="Contributing to python-apt"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="apt-cdrom.html" title="Writing your own apt-cdrom"
             accesskey="P">previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="../index.html">python-apt 0.8.3ubuntu7 documentation</a> &raquo;</li>

          <li><a href="index.html" accesskey="U">Tutorials</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="doing-stuff-apt-get-does">
<h1>Doing stuff <strong class="command">apt-get</strong> does<a class="headerlink" href="#doing-stuff-apt-get-does" title="Permalink to this headline"></a></h1>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Author:</th><td class="field-body">Julian Andres Klode &lt;<a class="reference external" href="mailto:jak&#37;&#52;&#48;debian&#46;org">jak<span>&#64;</span>debian<span>&#46;</span>org</a>&gt;</td>
</tr>
<tr class="field-even field"><th class="field-name">Release:</th><td class="field-body">0.8.3ubuntu7</td>
</tr>
<tr class="field-odd field"><th class="field-name">Date:</th><td class="field-body">April 18, 2012</td>
</tr>
</tbody>
</table>
<p>The following article will show how you can use python-apt to do actions done
by the <strong class="command">apt-get</strong> command.</p>
<div class="section" id="printing-the-uris-of-all-index-files">
<h2>Printing the URIs of all index files<a class="headerlink" href="#printing-the-uris-of-all-index-files" title="Permalink to this headline"></a></h2>
<p>We all now that we can print the URIs of all our index files by running a
simple <tt class="docutils literal"><span class="pre">apt-get</span> <span class="pre">-s</span> <span class="pre">--print-uris</span> <span class="pre">update</span></tt>. We can do the same. Responsible for
the source entries is the class <a class="reference internal" href="../library/apt_pkg.html#apt_pkg.SourceList" title="apt_pkg.SourceList"><tt class="xref py py-class docutils literal"><span class="pre">apt_pkg.SourceList</span></tt></a>, which can be
combined with an <a class="reference internal" href="../library/apt_pkg.html#apt_pkg.Acquire" title="apt_pkg.Acquire"><tt class="xref py py-class docutils literal"><span class="pre">apt_pkg.Acquire</span></tt></a> object using <tt class="xref py py-meth docutils literal"><span class="pre">get_indexes()</span></tt>.</p>
<p>First of all, we have to create the objects:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">acquire</span> <span class="o">=</span> <span class="n">apt_pkg</span><span class="o">.</span><span class="n">Acquire</span><span class="p">()</span>
<span class="n">slist</span> <span class="o">=</span> <span class="n">apt_pkg</span><span class="o">.</span><span class="n">SourceList</span><span class="p">()</span>
</pre></div>
</div>
<p>Now we have to parse /etc/apt/sources.list and its friends, by using
<a class="reference internal" href="../library/apt_pkg.html#apt_pkg.SourceList.read_main_list" title="apt_pkg.SourceList.read_main_list"><tt class="xref py py-meth docutils literal"><span class="pre">apt_pkg.SourceList.read_main_list()</span></tt></a>:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">slist</span><span class="o">.</span><span class="n">read_main_list</span><span class="p">()</span>
</pre></div>
</div>
<p>The <strong>slist</strong> object now knows about the location of the indexes. We now have
to load those indexes into the <em>acquire</em> object by calling
<a class="reference internal" href="../library/apt_pkg.html#apt_pkg.SourceList.get_indexes" title="apt_pkg.SourceList.get_indexes"><tt class="xref py py-meth docutils literal"><span class="pre">apt_pkg.SourceList.get_indexes()</span></tt></a>:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">slist</span><span class="o">.</span><span class="n">get_indexes</span><span class="p">(</span><span class="n">acquire</span><span class="p">,</span> <span class="bp">True</span><span class="p">)</span>
</pre></div>
</div>
<p>The first argument is the acquire object into which we will load these indexes,
and the second argument means that we want to fetch all indexes. Now the only
thing left to do is iterating over the list of items and printing out their
URIs. Luckily, there is <a class="reference internal" href="../library/apt_pkg.html#apt_pkg.Acquire.items" title="apt_pkg.Acquire.items"><tt class="xref py py-attr docutils literal"><span class="pre">apt_pkg.Acquire.items</span></tt></a> which allows us to
iterate over the items:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">acquire</span><span class="o">.</span><span class="n">items</span><span class="p">:</span>
    <span class="k">print</span> <span class="n">item</span><span class="o">.</span><span class="n">desc_uri</span>
</pre></div>
</div>
<p>In the end a program could look like this:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="c">#!/usr/bin/python</span>
<span class="sd">&quot;&quot;&quot;Print out the URIs of all indexes files.</span>

<span class="sd">This behaves somewhat like apt-get --print-uris update.&quot;&quot;&quot;</span>
<span class="kn">import</span> <span class="nn">apt_pkg</span>


<span class="k">def</span> <span class="nf">main</span><span class="p">():</span>
    <span class="n">apt_pkg</span><span class="o">.</span><span class="n">init_config</span><span class="p">()</span>
    <span class="n">apt_pkg</span><span class="o">.</span><span class="n">init_system</span><span class="p">()</span>
    <span class="n">acquire</span> <span class="o">=</span> <span class="n">apt_pkg</span><span class="o">.</span><span class="n">Acquire</span><span class="p">()</span>
    <span class="n">slist</span> <span class="o">=</span> <span class="n">apt_pkg</span><span class="o">.</span><span class="n">SourceList</span><span class="p">()</span>
    <span class="c"># Read the list</span>
    <span class="n">slist</span><span class="o">.</span><span class="n">read_main_list</span><span class="p">()</span>
    <span class="c"># Add all indexes to the fetcher.</span>
    <span class="n">slist</span><span class="o">.</span><span class="n">get_indexes</span><span class="p">(</span><span class="n">acquire</span><span class="p">,</span> <span class="bp">True</span><span class="p">)</span>

    <span class="c"># Now print the URI of every item.</span>
    <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">acquire</span><span class="o">.</span><span class="n">items</span><span class="p">:</span>
        <span class="k">print</span> <span class="n">item</span><span class="o">.</span><span class="n">desc_uri</span>

<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&#39;__main__&#39;</span><span class="p">:</span>
    <span class="n">main</span><span class="p">()</span>
</pre></div>
</div>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../contents.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Doing stuff <strong class="command">apt-get</strong> does</a><ul>
<li><a class="reference internal" href="#printing-the-uris-of-all-index-files">Printing the URIs of all index files</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="apt-cdrom.html"
                        title="previous chapter">Writing your own apt-cdrom</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="contributing.html"
                        title="next chapter">Contributing to python-apt</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../_sources/tutorials/apt-get.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" />
      <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="contributing.html" title="Contributing to python-apt"
             >next</a> |</li>
        <li class="right" >
          <a href="apt-cdrom.html" title="Writing your own apt-cdrom"
             >previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="../index.html">python-apt 0.8.3ubuntu7 documentation</a> &raquo;</li>

          <li><a href="index.html" >Tutorials</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2009-2010, Julian Andres Klode &lt;jak@debian.org&gt;.
      Last updated on Apr 18, 2012.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
    </div>
  </body>
</html>