Abuild and Helpers: Difference between revisions
m (nothing todo here, this page is FYI only) |
mNo edit summary |
||
(38 intermediate revisions by 8 users not shown) | |||
Line 1: | Line 1: | ||
The <code>abuild</code> package provides scripts necessary for creating packages for Alpine Linux. It implements functionality for building packages as well as additional commands and options for package maintenance. | |||
== | For package development and maintenance, it is recommended to install the <code>alpine-sdk</code>, which will install <code>abuild</code> in addition to other relevant tools. | ||
=== | |||
* The | {{Cmd|apk add alpine-sdk}} | ||
=== | The [https://gitlab.alpinelinux.org/alpine/abuild git repository] always contains the latest version of the scripts, example-files, and makefiles. | ||
== Building packages == | |||
=== | |||
[ | === Prerequisites === | ||
-- | |||
== | In order to use <code>abuild</code>: | ||
{{ | * The user executing <code>abuild</code> must be a member of the <code>abuild</code> group. | ||
* [[Abuild_and_Helpers#Setting_up_the_build_environment|The environment must be set up for abuild]]. | |||
=== Basic usage === | |||
If you just want to build a package from an [[APKBUILD Reference|APKBUILD]] file, only two command are needed. Both commands operate on an APKBUILD file in the current directory, so you should <code>cd</code> into the directory before running them. | |||
* <code>abuild checksum</code>: updates the checksums for source files. | |||
* <code>abuild -r</code>: builds the package. | |||
The [https://git.alpinelinux.org/abuild/tree/abuild.1.scd manual page] (available via <code>man abuild</code>) describes all options and commands for <code>abuild</code>. | |||
=== Building in a chroot === | |||
{{:Include:AbuildRootBld}} | |||
== Bumping a package version == | |||
The tool <code>abump</code> is a utility to bump pkgver in APKBUILD files if the package gets an update to a newer upstream release. <code>abump</code> will update the package's <code>pkgver</code>, rebuild it and create a new commit with the resulting changes. | |||
The [https://git.alpinelinux.org/abuild/tree/abump.1.scd manual page] (available via <code>man abump</code>) describes all options for <code>abump</code>. | |||
== Updating a package release == | |||
<!-- Shouldn't this be apkrel? None of the other packaging tools use "apkg...". Or perhaps it should be unified with abump? --> | |||
If you want to bump or reset the pkgrel value of your APKBUILD or test your APKBUILD files, <tt>apkgrel</tt> can assist you. | |||
{{Cmd|<nowiki>apkgrel -a|-h|-s NUM|-t|-z [-f] FILE...</nowiki>}} | |||
'''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 | |||
[[Category:Development]] | |||
== Generating new APKBUILDs == | |||
=== newapkbuild === | |||
To create the actual APKBUILD file {{Pkg|newapkbuild}} can serve you a template to start with. It will create a directory with the given package name, place an example/template APKBUILD file in the given directory, and fill some variables if those are provided. | |||
The [https://git.alpinelinux.org/abuild/tree/newapkbuild.1.scd manual page] (available via <code>man newapkbuild</code>) describes all options for <code>newapkbuild</code>. | |||
=== apkbuild-cpan === | |||
The [https://www.cpan.org/ Comprehensive Perl Archive Network] (CPAN) provides a large collection of perl software and documentation. <tt>apkbuild-cpan</tt> helps with the creation of APKBUILD for perl modules from CPAN. | |||
{{Cmd|apkbuild-cpan [create <Module::Name> <nowiki>| check | recreate | update | upgrade]</nowiki>}} | |||
This command is provided by the {{Pkg|apkbuild-cpan}} package. | |||
=== apkbuild-pypi === | |||
The [https://pypi.org/ Python Package Index] (PyPi) is a repository of software and libraries for the Python programming language. <tt>apkbuild-pypi</tt> helps with the creation of APKBUILD for python package hosted at PyPI. | |||
{{Cmd|apkbuild-pypi [create <package> <nowiki>| check | recreate | update | upgrade</nowiki>}} | |||
This command is provided by the {{Pkg|apkbuild-pypi}} package. | |||
[[Category:Python]] | |||
== Signing packages and indexes == | |||
=== abuild-sign === | |||
{{:Include:Abuild-sign}} | |||
=== abuild-tar === | |||
{{:Include:Abuild-tar}} | |||
=== buildrepo === | |||
{{:Include:Buildrepo}} | |||
== Setting up the build environment == | |||
=== abuild-keygen === | |||
{{:Include:Abuild-keygen}} | |||
<!-- ToDo | |||
=== cmp-apks-iso === | |||
=== devbuild === | |||
=== initramfs-init === | |||
--> |
Revision as of 10:08, 12 November 2024
The abuild
package provides scripts necessary for creating packages for Alpine Linux. It implements functionality for building packages as well as additional commands and options for package maintenance.
For package development and maintenance, it is recommended to install the alpine-sdk
, which will install abuild
in addition to other relevant tools.
apk add alpine-sdk
The git repository always contains the latest version of the scripts, example-files, and makefiles.
Building packages
Prerequisites
In order to use abuild
:
- The user executing
abuild
must be a member of theabuild
group. - The environment must be set up for abuild.
Basic usage
If you just want to build a package from an APKBUILD file, only two command are needed. Both commands operate on an APKBUILD file in the current directory, so you should cd
into the directory before running them.
abuild checksum
: updates the checksums for source files.abuild -r
: builds the package.
The manual page (available via man abuild
) describes all options and commands for abuild
.
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
rootbld
assumes your APKBUILD file is in a directory structure like aports or you need to set environment variable APORTSDIR
to current directory.
If the build process needs network access there has to bet set the net option in APKBUILD.
Note that using rootbld
inside a docker container requires additional configuration.
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.
The manual page (available via man abump
) describes all options for abump
.
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
Generating new APKBUILDs
newapkbuild
To create the actual APKBUILD file newapkbuild can serve you a template to start with. It will create a directory with the given package name, place an example/template APKBUILD file in the given directory, and fill some variables if those are provided.
The manual page (available via man newapkbuild
) describes all options for newapkbuild
.
apkbuild-cpan
The Comprehensive Perl Archive Network (CPAN) provides a large collection of perl software and documentation. apkbuild-cpan helps with the creation of APKBUILD for perl modules from CPAN.
apkbuild-cpan [create <Module::Name> | check | recreate | update | upgrade]
This command is provided by the apkbuild-cpan package.
apkbuild-pypi
The Python Package Index (PyPi) is a repository of software and libraries for the Python programming language. apkbuild-pypi helps with the creation of APKBUILD for python package hosted at PyPI.
apkbuild-pypi [create <package> | check | recreate | update | upgrade
This command is provided by the apkbuild-pypi package.
Signing packages and indexes
abuild-sign
abuild-sign is for signing indexes.
abuild-sign [-hq] [-k PRIVKEY] [-p PUBKEY] INDEXFILE...
abuild-sign options
- -h Show this help
- -k The private key to use for signing
- -p The name of public key. apk add will look for /etc/apk/keys/PUBKEY
abuild-tar
abuild-tar [--hash[=<algorithm>]] [--cut]
abuild-tar options
- --hash[=sha1|md5] Read tar archive from stdin, precalculate hash for regular entries and output tar archive on stdout
- --cut Remove the end of file tar record
buildrepo
The abuild
package provides scripts necessary for creating packages for Alpine Linux. It implements functionality for building packages as well as additional commands and options for package maintenance.
For package development and maintenance, it is recommended to install the alpine-sdk
, which will install abuild
in addition to other relevant tools.
apk add alpine-sdk
The git repository always contains the latest version of the scripts, example-files, and makefiles.
Building packages
Prerequisites
In order to use abuild
:
- The user executing
abuild
must be a member of theabuild
group. - The environment must be set up for abuild.
Basic usage
If you just want to build a package from an APKBUILD file, only two command are needed. Both commands operate on an APKBUILD file in the current directory, so you should cd
into the directory before running them.
abuild checksum
: updates the checksums for source files.abuild -r
: builds the package.
The manual page (available via man abuild
) describes all options and commands for abuild
.
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
rootbld
assumes your APKBUILD file is in a directory structure like aports or you need to set environment variable APORTSDIR
to current directory.
If the build process needs network access there has to bet set the net option in APKBUILD.
Note that using rootbld
inside a docker container requires additional configuration.
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.
The manual page (available via man abump
) describes all options for abump
.
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
Generating new APKBUILDs
newapkbuild
To create the actual APKBUILD file newapkbuild can serve you a template to start with. It will create a directory with the given package name, place an example/template APKBUILD file in the given directory, and fill some variables if those are provided.
The manual page (available via man newapkbuild
) describes all options for newapkbuild
.
apkbuild-cpan
The Comprehensive Perl Archive Network (CPAN) provides a large collection of perl software and documentation. apkbuild-cpan helps with the creation of APKBUILD for perl modules from CPAN.
apkbuild-cpan [create <Module::Name> | check | recreate | update | upgrade]
This command is provided by the apkbuild-cpan package.
apkbuild-pypi
The Python Package Index (PyPi) is a repository of software and libraries for the Python programming language. apkbuild-pypi helps with the creation of APKBUILD for python package hosted at PyPI.
apkbuild-pypi [create <package> | check | recreate | update | upgrade
This command is provided by the apkbuild-pypi package.
Signing packages and indexes
abuild-sign
abuild-sign is for signing indexes.
abuild-sign [-hq] [-k PRIVKEY] [-p PUBKEY] INDEXFILE...
abuild-sign options
- -h Show this help
- -k The private key to use for signing
- -p The name of public key. apk add will look for /etc/apk/keys/PUBKEY
abuild-tar
abuild-tar [--hash[=<algorithm>]] [--cut]
abuild-tar options
- --hash[=sha1|md5] Read tar archive from stdin, precalculate hash for regular entries and output tar archive on stdout
- --cut Remove the end of file tar record
buildrepo
Template loop detected: Include:Buildrepo
Setting up the build environment
abuild-keygen
For abuild a public/private rsa key pair is needed. The abuild-keygen
command from abuild package generates and configures the security keys.
$ doas abuild-keygen -a -i
abuild-keygen options
- -a Set PACKAGER_PRIVKEY=<generated key> in abuild.conf
- -i Install public key into /etc/apk/keys using sudo
- -h Show this help
- -n Non-interactive. Use defaults
- -q Quiet mode
Setting up the build environment
abuild-keygen
For abuild a public/private rsa key pair is needed. The abuild-keygen
command from abuild package generates and configures the security keys.
$ doas abuild-keygen -a -i
abuild-keygen options
- -a Set PACKAGER_PRIVKEY=<generated key> in abuild.conf
- -i Install public key into /etc/apk/keys using sudo
- -h Show this help
- -n Non-interactive. Use defaults
- -q Quiet mode