APT: Difference between revisions

From SprezzOSWiki
 
(18 intermediate revisions by the same user not shown)
Line 34: Line 34:
===Working with dscs===
===Working with dscs===
* <tt>apt-src(1p)</tt> -- Downloads, builds, and upgrades locally-unpackaged <tt>.dsc</tt> files
* <tt>apt-src(1p)</tt> -- Downloads, builds, and upgrades locally-unpackaged <tt>.dsc</tt> files
==Repositories==
A repository toplevel contains at least two subdirectories, <tt>dists</tt> and <tt>pool</tt>.
===dists===
<tt>dists</tt> contains subdirectories corresponding to distributions, and optionally symlinks (to facilitate distribution aliases). Each subdirectory contains:
* <tt>Release</tt> -- Information about the distribution (including what components are available), and cryptographic hashes of all files in subdirectories of the distribution toplevel,
* <tt>Release.gpg</tt> -- A signature of <tt>Release</tt>
* <tt>InRelease</tt> -- A copy of <tt>Release</tt> with an inline signature
* subdirectories corresponding to each Component contained within <tt>Release</tt>. Within each is:
** Contents files listing the files in each package, used by <tt>apt-file</tt>
** Subdirectories corresponding to the various architectures contained in each distributionXcomponent, containing:
*** <tt>Packages</tt> -- A listing of control file data from the packages in this distributionXcomponentXarchitecture
*** <tt>Packages.gz</tt> -- A compressed version of same
*** <tt>Release</tt> -- Information about this distributionXcomponentXarchitecture
===pools===
<tt>pools</tt> contains subdirectories corresponding to components. Within each component's subdirectory are 52 subdirectories, a-z and liba-libz. Within each is a subdirectory for every source package prefixed by that subdirectory's name. Within each of these subdirectories are the various outputs of the package-building process:
* An original source file
* A gzipped diff
* A .dsc file
* Generated packages


==Packaging==
==Packaging==
===Best Practices===
* Make sure <tt>dh_install</tt> is invoked with <tt>--fail-missing</tt>. This can be done in cdbs by adding to <tt>rules</tt>:
<pre>DEB_DH_INSTALL_ARGS+=--fail-missing</pre>
or in debhelper with:
<pre>override_dh_install:
        dh_install --fail-missing</pre>
* Remove .la files unless they're truly necessary. In CDBS, add something like the following to <tt>rules</tt>:
<pre>common-build-arch::
        find debian -name '*.la' -delete -print</pre>
Alternatively, simply don't install these files. In that case, add <tt>-X.la</tt> to <tt>dh_install --fail-missing</tt>.
===Recipes===
===Recipes===
====Autoreconf====
====Autoreconf====
Line 47: Line 79:
** Override dh_autoreconf, and pass the script as a parameter:
** Override dh_autoreconf, and pass the script as a parameter:
<pre>override_dh_autoreconf:
<pre>override_dh_autoreconf:
         dh_autoreconf ./autogensh</pre>
         dh_autoreconf ./autogen.sh</pre>
* Call ./autogen.sh at the configure step, but using CDBS:
* Call ./autogen.sh at the configure step, but using CDBS:
** Add a Build-Depends on dh-autoreconf
** Add a Build-Depends on dh-autoreconf
Line 56: Line 88:
** Add the following to rules:
** Add the following to rules:
<pre>DEB_CONFIGURE_EXTRA_FLAGS += extraarg</pre>
<pre>DEB_CONFIGURE_EXTRA_FLAGS += extraarg</pre>
====Cmake====
====Cmake====
* Use <tt>cmake</tt> with CDBS:
* Use <tt>cmake</tt> with CDBS:
** Add the following to rules:
** Add the following to rules:
<pre>include /usr/share/cdbs/1/class/cmake.mk</pre>
<pre>include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/cmake.mk</pre>
* Pass arguments to <tt>cmake</tt> from CDBS:
* Pass arguments to <tt>cmake</tt> from CDBS:
** Augment and export DEB_CMAKE_CFLAGS, eg:
** Augment and export DEB_CMAKE_CFLAGS, eg:
<pre>export DEB_CMAKE_CFLAGS+=-DGLIB_DISABLE_DEPRECATION_WARNINGS</pre>
<pre>export DEB_CMAKE_CFLAGS+=-DGLIB_DISABLE_DEPRECATION_WARNINGS
export DEB_CMAKE_EXTRA_FLAGS+="-DCMAKE_BACKWARDS_COMPATIBILITY=2.2"
</pre>
 
====Testing====
* To disable the testing step in debhelper, override dh_auto_test with any empty target:
<pre>override_dh_auto_test:</pre>
* To override the testing step in cdbs, provide the nocheck option:
<pre>DEB_BUILD_OPTIONS=nocheck</pre>
 
===Watchfiles===
Watchfiles are used together with the <tt>uscan</tt> tool to check for new upstream releases.
* [https://launchpad.net/ Launchpad]: <pre>http://launchpad.net/package/+download .*/package-([\d\.]+)\.tar\..*</pre>
* [http://sourceforge.net/ SourceForge]: <pre>http://sf.net/owner/package-([\d\.]+)\.tar\..*</pre>
* [http://github.com GitHub tag]: <pre>https://github.com/owner/package/tags/ .*/v([\d\.]+)\.tar\..*</pre>
 
==See Also==
* [[Raptorial]]
 
{{Handbook}}


[[CATEGORY: SprezzOS Manual]]
[[CATEGORY: Glossaried]]
[[CATEGORY: Glossaried]]

Latest revision as of 05:28, 9 May 2013

The Advanced Packaging Tool and its various frontends form the package management core of Debian and Debian-derived distributions such as SprezzOS. There are two types of packages -- sources (.dsc) and binaries (.deb). A source package typically contains (usually platform-neutral) original source code and associated files from an upstream vendor. In addition to making available these source packages, the distribution builds zero or more (usually several) binary packages from each source package. Most users will make exclusive use of binary packages, but source packages are available to facilitate unlimited customization, optimization, and flexibility. It is quite possible to build all installed packages locally from source, though not usually desirable.

There are roughly 5,000 ways to do any given thing with APT. I do not mean to imply that this is a feature.

Default paths

  • /var/lib/apt and /var/lib/dpkg -- the local APT database. It's best not to touch these by hand.
  • /var/cache/apt/archives -- locally downloaded packages.
  • /etc/apt/trusted.gpg.* -- the local key database
  • /etc/apt/sources.* -- the local archives database
  • /etc/apt/apt.conf.* -- the local configuration database
  • /var/cache/apt/apt-file -- the local Contents database
  • /var/log/apt/ and /var/log/aptitude* -- local APT and aptitude logs

Relevant man pages

  • deb(5) -- The deb binary package format, since Debian 0.93. Older versions are documented in deb-old(5).
  • deb-version(5) -- Version number semantics.

Working with the database

  • apt-get(8) -- command line interactive package tool
  • dpkg(1) -- command line local package database management
  • aptitude(8) -- modern ncurses interactive package tool.
  • dselect(1) -- horrible old ncurses interactive package tool. Avoid at all costs.
  • apt-cache(8), dpkg-query(1) -- query the database

Special databases

  • apt-key(8) -- manage the key database
  • apt-file(8) -- query the Contents database (file contents of packages in archives)
  • apt-mark(8) -- manage automatic-installs database

Creating packages

  • deb-control(5) -- The control files required to generate binary packages from source.
    • A given source package maps to a single control file, in which it is described.
    • A given source package can yield one or more binary packages. Each will have an entry in the control file.
  • dch(1), debchange(1) -- Tools for managing changelog files.

Working with debs

  • dpkg-deb(1) -- Unpacks, packs, dumps information about local .deb files.

Working with dscs

  • apt-src(1p) -- Downloads, builds, and upgrades locally-unpackaged .dsc files

Repositories

A repository toplevel contains at least two subdirectories, dists and pool.

dists

dists contains subdirectories corresponding to distributions, and optionally symlinks (to facilitate distribution aliases). Each subdirectory contains:

  • Release -- Information about the distribution (including what components are available), and cryptographic hashes of all files in subdirectories of the distribution toplevel,
  • Release.gpg -- A signature of Release
  • InRelease -- A copy of Release with an inline signature
  • subdirectories corresponding to each Component contained within Release. Within each is:
    • Contents files listing the files in each package, used by apt-file
    • Subdirectories corresponding to the various architectures contained in each distributionXcomponent, containing:
      • Packages -- A listing of control file data from the packages in this distributionXcomponentXarchitecture
      • Packages.gz -- A compressed version of same
      • Release -- Information about this distributionXcomponentXarchitecture

pools

pools contains subdirectories corresponding to components. Within each component's subdirectory are 52 subdirectories, a-z and liba-libz. Within each is a subdirectory for every source package prefixed by that subdirectory's name. Within each of these subdirectories are the various outputs of the package-building process:

  • An original source file
  • A gzipped diff
  • A .dsc file
  • Generated packages


Packaging

Best Practices

  • Make sure dh_install is invoked with --fail-missing. This can be done in cdbs by adding to rules:
DEB_DH_INSTALL_ARGS+=--fail-missing

or in debhelper with:

override_dh_install:
        dh_install --fail-missing
  • Remove .la files unless they're truly necessary. In CDBS, add something like the following to rules:
common-build-arch::
        find debian -name '*.la' -delete -print

Alternatively, simply don't install these files. In that case, add -X.la to dh_install --fail-missing.

Recipes

Autoreconf

  • Run autoreconf at the configure step using debhelper:
    • Add a Build-Depends on dh-autoreconf
    • Replace %: with
%:
        dh $@ --with autoreconf
  • Run ./autogen.sh rather than autoreconf, still using debhelper:
    • Repeat the steps taken above
    • Override dh_autoreconf, and pass the script as a parameter:
override_dh_autoreconf:
        dh_autoreconf ./autogen.sh
  • Call ./autogen.sh at the configure step, but using CDBS:
    • Add a Build-Depends on dh-autoreconf
    • Add the following:
include /usr/share/cdbs/1/rules/autoreconf.mk
DEB_DH_AUTORECONF_ARGS += $(CURDIR)/autogen.sh
  • Pass an extra argument to configure using CDBS:
    • Add the following to rules:
DEB_CONFIGURE_EXTRA_FLAGS += extraarg

Cmake

  • Use cmake with CDBS:
    • Add the following to rules:
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/cmake.mk
  • Pass arguments to cmake from CDBS:
    • Augment and export DEB_CMAKE_CFLAGS, eg:
export DEB_CMAKE_CFLAGS+=-DGLIB_DISABLE_DEPRECATION_WARNINGS
export DEB_CMAKE_EXTRA_FLAGS+="-DCMAKE_BACKWARDS_COMPATIBILITY=2.2"

Testing

  • To disable the testing step in debhelper, override dh_auto_test with any empty target:
override_dh_auto_test:
  • To override the testing step in cdbs, provide the nocheck option:
DEB_BUILD_OPTIONS=nocheck

Watchfiles

Watchfiles are used together with the uscan tool to check for new upstream releases.

  • Launchpad:
    http://launchpad.net/package/+download .*/package-([\d\.]+)\.tar\..*
  • SourceForge:
    http://sf.net/owner/package-([\d\.]+)\.tar\..*
  • GitHub tag:
    https://github.com/owner/package/tags/ .*/v([\d\.]+)\.tar\..*

See Also

{{#switch:|subgroup|child=|none=|#default=

}}{{#ifeq:|Template|{{#ifeq:|child||{{#ifeq:|subgroup||{{#switch:apt

|doc
|sandbox
|testcases =
|#default = {{#switch:
 |plainlist
 |hlist
 |hlist hnum
 |hlist vcard
 |vcard hlist = 
 |#default = hlist
 }}
}}

}}}}}}