Alpine package format: Difference between revisions

From Alpine Linux
(initial doc)
 
mNo edit summary
Line 1: Line 1:
DRAFT
{{Draft}}


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.
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.
Line 6: Line 6:


For example:
For example:
<pre>cat $controldir/control.tar.gz $controldir/data.tar.gz > mypackage-1.0-r0.apk</pre>
{{Cmd|cat $controldir/control.tar.gz $controldir/data.tar.gz > mypackage-1.0-r0.apk}}


== control.tar.gz ==
== control.tar.gz ==
Line 15: Line 15:


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'':
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>
<pre>tar -c .PKGNIFO .pre-install | abuild-tar --cut | gzip -9 > $controldir/control.tar.gz</pre>


Line 21: Line 22:


Format is ''key''[space]=[space]''value''.
Format is ''key''[space]=[space]''value''.
<pre>key = value</pre>
key = value


The following ''keys'' are supported:
The following ''keys'' are supported:
Line 30: Line 31:


=== .*-install/upgrade/deinstall ===
=== .*-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 .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.
The .post-* scripts are executed after respecitvely install, upgade or uninstall of a package.
Line 38: Line 39:


The data.tar.gz can be created with:
The data.tar.gz can be created with:
<pre>
 
cd $pkgdir
cd $pkgdir
tar -c . | abuild-tar --hash | gzip -9 > $controldir/data.tar.gz
tar -c . | abuild-tar --hash | gzip -9 > $controldir/data.tar.gz
</pre>


The reason for creating data.tar.gz separately is because a hash will be created and stored in .PKGINFO for future package signing.
The reason for creating data.tar.gz separately is because a hash will be created and stored in .PKGINFO for future package signing.

Revision as of 02:35, 24 June 2011

This material is work-in-progress ...

Do not follow instructions here until this notice is removed.
(Last edited by Fab on 24 Jun 2011.)

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.