APT: Difference between revisions

From SprezzOSWiki
Line 37: Line 37:
==Packaging==
==Packaging==
===Recipes===
===Recipes===
====Autoreconf=====
====Autoreconf====
* Run <tt>autoreconf</tt> at the configure step using debhelper:
* Run <tt>autoreconf</tt> at the configure step using debhelper:
** Add a Build-Depends on dh-autoreconf
** Add a Build-Depends on dh-autoreconf

Revision as of 20:11, 29 December 2012

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

Packaging

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 ./autogensh
  • 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/class/cmake.mk
  • Pass arguments to cmake from CDBS:
    • Augment and export DEB_CMAKE_CFLAGS, eg:
export DEB_CMAKE_CFLAGS+=-DGLIB_DISABLE_DEPRECATION_WARNINGS