Skip to content

apkg packaging styles

In order to support different packaging formats, tools, and systems, apkg introduces the concept of packaging style. Each packaging style in apkg.pkgstyles such as deb, rpm, or arch contains common functions to perform packaging on a corresponding packaging platform.

apkg.pkgstyle module provides discovery of individual packaging styles which are in turn used to handle packaging on target distro by apkg commands such as apkg srcpkg and apkg build.

This means that all platform specific code is contained in separate files (arch.py, deb.py, rpm.py) which are maintained independently. Breakage in apkg.pkgstyles.rpm will only affect builds on rpm platforms. New packaging styles can be added easily, external plugin support is planned.

When needed by apkg, packaging style is chosen automatically based on target distro and/or files present in selected package template.

Each pkgstyle provides SUPPORTED_DISTROS list of supported distro IDs as returned by python distro module.

See also a list of all distros supported by apkg.

arch

apkg package style for Arch linux.

source template: PKGBUILD

source package: PKGBUILD

packages: *.zst

supported distros: arch , manjaro

file: apkg/pkgstyles/arch.py

deb

apkg package style for Debian and its many clones such as Ubuntu or Mint.

source template: content of debian/ dir (control, changelog, ...)

source package: *.dsc + archives

packages: *.deb

required distro packages:

  • core: devscripts
  • isolated build: pbuilder

template variables:

  • now: current date in Debian changelog format (RFC 2822)

supported distros: debian , linuxmint , pop , raspbian , ubuntu

file: apkg/pkgstyles/deb.py

nix

apkg package style for Nix (NixOS.org).

source template:

  • default.nix as-if in https://github.com/NixOS/nixpkgs
  • top-level.nix that simply wraps it to work outside that official tree, in particular it should substitute the source archive; e.g. see apkg/distro/pkg/nix/top-level.nix

source package: the same, just with templates substituted

packages: symlink to your local nix store (for the primary package output)

supported distros: nix , nixos

file: apkg/pkgstyles/nix.py

rpm

apkg package style for RPM-based distros such as Fedora, CentOS, SUSE, RHEL.

source template: *.spec and friends

source package: *.src.rpm

packages: *.rpm

required distro packages:

  • core: rpm-build
  • isolated build: mock

template variables:

  • now: current date in RPM changelog format

supported distros: almalinux , centos , fedora , opensuse , oracle , pidora , rhel , rocky , scientific

file: apkg/pkgstyles/rpm.py