Components

To handle Debian package source code, meta-debian needs to provide some extra functions/tasks. The following contents are not all but main components which are defined and usually used in meta-debian.

Classes

debian-package.bbclass

Class debian-package is inherited by recipes. This class provides tasks to extract source code and apply Debian patches.

debian-source.bbclass

Class debian-source is inherited by conf/distro/deby.conf. This class provides an eventhandler to fetch information from Debian apt repository. This information will be used for downloading source code.

Tasks

do_debian_unpack_extra

This is a task, defined by debian-package.bbclass to unpack Debian source code into one folder. This task runs after do_unpack and before do_debian_patch

do_debian_patch

This is a task, defined by debian-package.bbclass to apply Debian patches. These Debian patches can be applied by quilt, dpatch or manually with patch. This task runs after do_debian_unpack_extra and before do_patch.

debian_source_eventhandler

This is an eventhandler, defined by debian-source.bbclass to generate Debian package source code information: PV, URI, checksum. These kinds of information are fetched from dists/buster/main/source/Sources.xz in Debian apt repository. This eventhandler runs when bb.event.ParseStarted is fired.

Variables

DEBIAN_SRC_URI

URI to fetch Debian package source code. By default, this variable is generated automatically in recipes-debian/sources/<source_name>.inc.

Example:

DEBIAN_SRC_URI = " \
    ${DEBIAN_MIRROR}/main/f/flex/flex_2.6.4-6.2.dsc;name=flex_2.6.4-6.2.dsc \
    ${DEBIAN_MIRROR}/main/f/flex/flex_2.6.4.orig.tar.gz;name=flex_2.6.4.orig.tar.gz \
    ${DEBIAN_MIRROR}/main/f/flex/flex_2.6.4-6.2.diff.gz;name=flex_2.6.4-6.2.diff.gz;apply=no \
"

DEBIAN_UNPACK_DIR

Path to source code directory after unpacked. This variable is initialized in debian-package.bbclass with default value ${WORKDIR}/${BP}

DEBIAN_PATCH_TYPE

Decide action to apply patches for the source package. Normally, this variable will only need to be set if patch type cannot be detected by debian/source/format. Possible value:

  • quilt: if package uses quilt for applying patches.
  • dpatch: if package uses dpatch for applying patches.
  • nopatch: if there is no Debian patch.
  • abnormal: if none of the three conditions above matched. Recipe will need to define its own way to apply patches by defining function debian_patch_abnormal or overwriting do_debian_patch.

DEBIAN_QUILT_PATCHES

Path to Debian patches folder, by default is ${DEBIAN_UNPACK_DIR}/debian/patches. In some cases, this variable need to be unset because DEBIAN_PATCH_TYPE is quilt but there is no patch. For example, package gawk has debian/source/format is 3.0 (quilt) but there is no patch in debian subfolder.

DEBIAN_USE_SNAPSHOT

Select snapshot.debian.org as the Debian source package download location, by default is 0. If you want to download package from snapshot.debianorg, you need to set 1.

BPN

In meta-debian, BPN is not just "a version of the PN variable with common prefixes and suffixes removed" but the real Debian source package name and usually used to specify directory path.
For examples: ${WORKDIR}/${BPN}-${PV}, ${libdir}/${BPN}, ${datadir}/${BPN}, ...