Alpine package format
This material is work-in-progress ... Do not follow instructions here until this notice is removed. |
From apk-tools-2.0_pre15 there is support for signing of packages and indexes. This introduced a new format for both packages and indexes. This document describes the new format.
The new apk package are 2 combined tar.gz packages, control.tar.gz and data.tar.gz. The final .apk package is created by concatenating control.tar.gz and data.tar.gz.
For example:
cat $controldir/control.tar.gz $controldir/data.tar.gz > mypackage-1.0-r0.apk
control.tar.gz
The control package contains
- .PKGINFO
- .pre-install/upgrade/deinstall (optional)
- .post-install/upgrade/deinstall (optional)
Since the data.tar.gz will follow the after the control.tar.gz, the end-of-tar record in the tar archive must be removed. This is done by filtering the tar package through abuild-tar --cut:
tar -c .PKGNIFO .pre-install | abuild-tar --cut | gzip -9 > $controldir/control.tar.gz
.PKGINFO
the .PKGINFO is very similar to archlinux's .PKGINFO.
Format is key[space]=[space]value.
key = value
The following keys are supported:
- pkgname - the name of package
- pkgver - the version, including the pkgrel.
- depends (each dependency has its own line)
- datahash
.*-install/upgrade/deinstall
The .pre-install, .pre-upgrade, .pre-deinstall scripts are executed before respectively, install, upgrade or uninstallation of a package. Apk will halt current action if script exits with error.
The .post-* scripts are executed after respecitvely install, upgade or uninstall of a package.
data.tar.gz
The data is a tar package with checksums embedded in the tar headers. The tar headers with checksuma are created by filtering the tar archive via the abuild-tar utility.
The data.tar.gz can be created with:
cd $pkgdir tar -c . | abuild-tar --hash | gzip -9 > $controldir/data.tar.gz
The reason for creating data.tar.gz separately is because a hash will be created and stored in .PKGINFO for future package signing.