Edit file File name : ap-pkg-binarypkg.html Content : <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" /> <title>2. Binary packages (from old Packaging Manual) — Debian Policy Manual v4.6.0.1</title> <link rel="stylesheet" type="text/css" href="_static/pygments.css" /> <link rel="stylesheet" type="text/css" href="_static/nature.css" /> <script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script> <script src="_static/jquery.js"></script> <script src="_static/underscore.js"></script> <script src="_static/doctools.js"></script> <link rel="index" title="Index" href="genindex.html" /> <link rel="search" title="Search" href="search.html" /> <link rel="next" title="3. Source packages (from old Packaging Manual)" href="ap-pkg-sourcepkg.html" /> <link rel="prev" title="1. Introduction and scope of these appendices" href="ap-pkg-scope.html" /> </head><body> <div class="related" role="navigation" aria-label="related navigation"> <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="ap-pkg-sourcepkg.html" title="3. Source packages (from old Packaging Manual)" accesskey="N">next</a> |</li> <li class="right" > <a href="ap-pkg-scope.html" title="1. Introduction and scope of these appendices" accesskey="P">previous</a> |</li> <li class="nav-item nav-item-0"><a href="index.html">Debian Policy Manual v4.6.0.1</a> »</li> <li class="nav-item nav-item-this"><a href=""><span class="section-number">2. </span>Binary packages (from old Packaging Manual)</a></li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body" role="main"> <section id="binary-packages-from-old-packaging-manual"> <h1><span class="section-number">2. </span>Binary packages (from old Packaging Manual)<a class="headerlink" href="#binary-packages-from-old-packaging-manual" title="Permalink to this headline">¶</a></h1> <p>See <em class="manpage">deb(5)</em> and <a class="reference internal" href="#s-pkg-controlarea"><span class="std std-ref">Package control information files</span></a>.</p> <section id="creating-package-files-dpkg-deb"> <span id="s-pkg-bincreating"></span><h2><span class="section-number">2.1. </span>Creating package files - <code class="docutils literal notranslate"><span class="pre">dpkg-deb</span></code><a class="headerlink" href="#creating-package-files-dpkg-deb" title="Permalink to this headline">¶</a></h2> <p>All manipulation of binary package files is done by <code class="docutils literal notranslate"><span class="pre">dpkg-deb</span></code>; it’s the only program that has knowledge of the format. (<code class="docutils literal notranslate"><span class="pre">dpkg-deb</span></code> may be invoked by calling <code class="docutils literal notranslate"><span class="pre">dpkg</span></code>, as <code class="docutils literal notranslate"><span class="pre">dpkg</span></code> will spot that the options requested are appropriate to <code class="docutils literal notranslate"><span class="pre">dpkg-deb</span></code> and invoke that instead with the same arguments.)</p> <p>In order to create a binary package, you must make a directory tree which contains all the files and directories you want to have in the file system data part of the package. In Debian-format source packages, this directory is usually either <code class="docutils literal notranslate"><span class="pre">debian/tmp</span></code> or <code class="docutils literal notranslate"><span class="pre">debian/pkg</span></code>, relative to the top of the package’s source tree.</p> <p>They should have the locations (relative to the root of the directory tree you’re constructing) ownerships and permissions which you want them to have on the system when they are installed.</p> <p>With current versions of <code class="docutils literal notranslate"><span class="pre">dpkg</span></code> the uid/username and gid/groupname mappings for the users and groups being used should be the same on the system where the package is built and the one where it is installed.</p> <p>You need to add one special directory to the root of the miniature file system tree you’re creating: <code class="docutils literal notranslate"><span class="pre">DEBIAN</span></code>. It should contain the control information files, notably the binary package control file (see <a class="reference internal" href="#s-pkg-controlfile"><span class="std std-ref">The main control information file: control</span></a>).</p> <p>The <code class="docutils literal notranslate"><span class="pre">DEBIAN</span></code> directory will not appear in the file system archive of the package, and so won’t be installed by <code class="docutils literal notranslate"><span class="pre">dpkg</span></code> when the package is unpacked.</p> <p>When you’ve prepared the package, you should invoke:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">dpkg</span> <span class="o">--</span><span class="n">build</span> <span class="n">directory</span> </pre></div> </div> <p>This will build the package in <code class="docutils literal notranslate"><span class="pre">directory.deb</span></code>. (<code class="docutils literal notranslate"><span class="pre">dpkg</span></code> knows that <code class="docutils literal notranslate"><span class="pre">--build</span></code> is a <code class="docutils literal notranslate"><span class="pre">dpkg-deb</span></code> option, so it invokes <code class="docutils literal notranslate"><span class="pre">dpkg-deb</span></code> with the same arguments to build the package.)</p> <p>See the <em class="manpage">dpkg-deb(8)</em> man page for details of how to examine the contents of this newly-created file. You may find the output of following commands enlightening:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">dpkg</span><span class="o">-</span><span class="n">deb</span> <span class="o">--</span><span class="n">info</span> <span class="n">filename</span><span class="o">.</span><span class="n">deb</span> <span class="n">dpkg</span><span class="o">-</span><span class="n">deb</span> <span class="o">--</span><span class="n">contents</span> <span class="n">filename</span><span class="o">.</span><span class="n">deb</span> <span class="n">dpkg</span> <span class="o">--</span><span class="n">contents</span> <span class="n">filename</span><span class="o">.</span><span class="n">deb</span> </pre></div> </div> <p>To view the copyright file for a package you could use this command:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">dpkg</span> <span class="o">--</span><span class="n">fsys</span><span class="o">-</span><span class="n">tarfile</span> <span class="n">filename</span><span class="o">.</span><span class="n">deb</span> <span class="o">|</span> <span class="n">tar</span> <span class="n">xOf</span> <span class="o">-</span> <span class="o">--</span><span class="n">wildcards</span> \<span class="o">*/</span><span class="n">copyright</span> <span class="o">|</span> <span class="n">pager</span> </pre></div> </div> </section> <section id="package-control-information-files"> <span id="s-pkg-controlarea"></span><h2><span class="section-number">2.2. </span>Package control information files<a class="headerlink" href="#package-control-information-files" title="Permalink to this headline">¶</a></h2> <p>The control information portion of a binary package is a collection of files with names known to <code class="docutils literal notranslate"><span class="pre">dpkg</span></code>. It will treat the contents of these files specially - some of them contain information used by <code class="docutils literal notranslate"><span class="pre">dpkg</span></code> when installing or removing the package; others are scripts which the package maintainer wants <code class="docutils literal notranslate"><span class="pre">dpkg</span></code> to run.</p> <p>It is possible to put other files in the package control information file area, but this is not generally a good idea (though they will largely be ignored).</p> <p>Here is a brief list of the control information files supported by <code class="docutils literal notranslate"><span class="pre">dpkg</span></code> and a summary of what they’re used for.</p> <dl> <dt><code class="docutils literal notranslate"><span class="pre">control</span></code></dt><dd><p>This is the key description file used by <code class="docutils literal notranslate"><span class="pre">dpkg</span></code>. It specifies the package’s name and version, gives its description for the user, states its relationships with other packages, and so forth. See <a class="reference internal" href="ch-controlfields.html#s-sourcecontrolfiles"><span class="std std-ref">Source package control files – debian/control</span></a> and <a class="reference internal" href="ch-controlfields.html#s-binarycontrolfiles"><span class="std std-ref">Binary package control files – DEBIAN/control</span></a>.</p> <p>It is usually generated automatically from information in the source package by the <code class="docutils literal notranslate"><span class="pre">dpkg-gencontrol</span></code> program, and with assistance from <code class="docutils literal notranslate"><span class="pre">dpkg-shlibdeps</span></code>. See <a class="reference internal" href="ap-pkg-sourcepkg.html"><span class="doc">Source packages (from old Packaging Manual)</span></a>.</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">postinst</span></code>, <code class="docutils literal notranslate"><span class="pre">preinst</span></code>, <code class="docutils literal notranslate"><span class="pre">postrm</span></code>, <code class="docutils literal notranslate"><span class="pre">prerm</span></code></dt><dd><p>These are executable files (usually scripts) which <code class="docutils literal notranslate"><span class="pre">dpkg</span></code> runs during installation, upgrade and removal of packages. They allow the package to deal with matters which are particular to that package or require more complicated processing than that provided by <code class="docutils literal notranslate"><span class="pre">dpkg</span></code>. Details of when and how they are called are in <a class="reference internal" href="ch-maintainerscripts.html"><span class="doc">Package maintainer scripts and installation procedure</span></a>.</p> <p>It is very important to make these scripts idempotent. See <a class="reference internal" href="ch-maintainerscripts.html#s-idempotency"><span class="std std-ref">Maintainer scripts idempotency</span></a>.</p> <p>The maintainer scripts are not guaranteed to run with a controlling terminal and may not be able to interact with the user. See <a class="reference internal" href="ch-maintainerscripts.html#s-controllingterminal"><span class="std std-ref">Controlling terminal for maintainer scripts</span></a>.</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">conffiles</span></code> This file contains a list of configuration files which</dt><dd><p>are to be handled automatically by <code class="docutils literal notranslate"><span class="pre">dpkg</span></code> (see <a class="reference internal" href="ap-pkg-conffiles.html"><span class="doc">Configuration file handling (from old Packaging Manual)</span></a>). Note that not necessarily every configuration file should be listed here.</p> </dd> <dt><code class="docutils literal notranslate"><span class="pre">shlibs</span></code></dt><dd><p>This file contains a list of the shared libraries supplied by the package, with dependency details for each. This is used by <code class="docutils literal notranslate"><span class="pre">dpkg-shlibdeps</span></code> when it determines what dependencies are required in a package control file. The <code class="docutils literal notranslate"><span class="pre">shlibs</span></code> file format is described on <a class="reference internal" href="ch-sharedlibs.html#s-shlibs"><span class="std std-ref">The shlibs File Format</span></a>.</p> </dd> </dl> </section> <section id="the-main-control-information-file-control"> <span id="s-pkg-controlfile"></span><h2><span class="section-number">2.3. </span>The main control information file: <code class="docutils literal notranslate"><span class="pre">control</span></code><a class="headerlink" href="#the-main-control-information-file-control" title="Permalink to this headline">¶</a></h2> <p>The most important control information file used by <code class="docutils literal notranslate"><span class="pre">dpkg</span></code> when it installs a package is <code class="docutils literal notranslate"><span class="pre">control</span></code>. It contains all the package’s “vital statistics”.</p> <p>The binary package control files of packages built from Debian sources are made by a special tool, <code class="docutils literal notranslate"><span class="pre">dpkg-gencontrol</span></code>, which reads <code class="docutils literal notranslate"><span class="pre">debian/control</span></code> and <code class="docutils literal notranslate"><span class="pre">debian/changelog</span></code> to find the information it needs. See <a class="reference internal" href="ap-pkg-sourcepkg.html"><span class="doc">Source packages (from old Packaging Manual)</span></a> for more details.</p> <p>The fields in binary package control files are listed in <a class="reference internal" href="ch-controlfields.html#s-binarycontrolfiles"><span class="std std-ref">Binary package control files – DEBIAN/control</span></a>.</p> <p>A description of the syntax of control files and the purpose of the fields is available in <a class="reference internal" href="ch-controlfields.html"><span class="doc">Control files and their fields</span></a>.</p> </section> <section id="time-stamps"> <span id="s-sb-4"></span><h2><span class="section-number">2.4. </span>Time Stamps<a class="headerlink" href="#time-stamps" title="Permalink to this headline">¶</a></h2> <p>See <a class="reference internal" href="ch-source.html#s-timestamps"><span class="std std-ref">Time Stamps</span></a>.</p> </section> </section> <div class="clearer"></div> </div> </div> </div> <div class="sphinxsidebar" role="navigation" aria-label="main navigation"> <div class="sphinxsidebarwrapper"> <h3><a href="index.html">Table of Contents</a></h3> <ul> <li><a class="reference internal" href="#">2. Binary packages (from old Packaging Manual)</a><ul> <li><a class="reference internal" href="#creating-package-files-dpkg-deb">2.1. Creating package files - <code class="docutils literal notranslate"><span class="pre">dpkg-deb</span></code></a></li> <li><a class="reference internal" href="#package-control-information-files">2.2. Package control information files</a></li> <li><a class="reference internal" href="#the-main-control-information-file-control">2.3. The main control information file: <code class="docutils literal notranslate"><span class="pre">control</span></code></a></li> <li><a class="reference internal" href="#time-stamps">2.4. Time Stamps</a></li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="ap-pkg-scope.html" title="previous chapter"><span class="section-number">1. </span>Introduction and scope of these appendices</a></p> <h4>Next topic</h4> <p class="topless"><a href="ap-pkg-sourcepkg.html" title="next chapter"><span class="section-number">3. </span>Source packages (from old Packaging Manual)</a></p> <div role="note" aria-label="source link"> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="_sources/ap-pkg-binarypkg.rst.txt" rel="nofollow">Show Source</a></li> </ul> </div> <div id="searchbox" style="display: none" role="search"> <h3 id="searchlabel">Quick search</h3> <div class="searchformwrapper"> <form class="search" action="search.html" method="get"> <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/> <input type="submit" value="Go" /> </form> </div> </div> <script>$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related" role="navigation" aria-label="related navigation"> <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="ap-pkg-sourcepkg.html" title="3. Source packages (from old Packaging Manual)" >next</a> |</li> <li class="right" > <a href="ap-pkg-scope.html" title="1. Introduction and scope of these appendices" >previous</a> |</li> <li class="nav-item nav-item-0"><a href="index.html">Debian Policy Manual v4.6.0.1</a> »</li> <li class="nav-item nav-item-this"><a href=""><span class="section-number">2. </span>Binary packages (from old Packaging Manual)</a></li> </ul> </div> <div class="footer" role="contentinfo"> Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.2.0. </div> </body> </html> Save