knowledge/technology/applications/package managers/alpine/Alpine Package.md

2 KiB

obj source
concept https://wiki.alpinelinux.org/wiki/Creating_an_Alpine_package

Alpine Package

Alpine Packages are packages for Alpine Linux and installable via apk.

Setup

The alpine-sdk is a metapackage that pulls in the most essential packages used to build new packages. Also install and configure a way to elevate privileges, such as sudo or doas, and an editor, such as vi, nano, micro.

apk add alpine-sdk
addgroup user abuild

Generate a key for package creation:

abuild-keygen -a -i

Build

For you build you need a APKBUILD file and abuild as a packaging tool.

Usage:

  • abuild checksum: updates the checksums for source files.
  • abuild -r: builds the package.

Building in a chroot

Install package abuild-rootbld:

apk add abuild-rootbld

You may now build your packages from source in an unprivileged sandbox based on bubblewrap with the command:

abuild rootbld

If the build process needs network access there has to bet set the net option in APKBUILD.

Bumping a package version

The tool abump is a utility to bump pkgver in APKBUILD files if the package gets an update to a newer upstream release. abump will update the package's pkgver, rebuild it and create a new commit with the resulting changes.

abump [-hR]

abump options

  • -h Show this help
  • -R Run abuild with -R for recursive building
  • -k Keep existing packages

Updating a package release

If you want to bump or reset the pkgrel value of your APKBUILD or test your APKBUILD files, apkgrel can assist you.

apkgrel -a|-h|-s NUM|-t|-z [-f] FILE...

apkgrel options

  • -a Add 1 to current pkgrel
  • -f Force, even if given files are not in proper format
  • -h Show this help
  • -s Set pkgrel to NUM
  • -t Only verify that files are in proper format
  • -z Set pkgrel to 0