Alpine package format: Difference between revisions

From Alpine Linux
(correction: filenames in data.tar.gz should not start with leading ".")
(Redirected page to Apk spec)
Tag: New redirect
 
Line 1: Line 1:
{{Draft}}
#REDIRECT [[Apk_spec]]
 
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:
{{Cmd|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'':
 
<pre>tar -c .PKGNIFO .pre-install | abuild-tar --cut | gzip -9 > $controldir/control.tar.gz</pre>
 
=== .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.
 
[[Category:Development]] [[Category:Package Manager]]

Latest revision as of 01:38, 18 July 2022

Redirect to: