User:Encode/XDG package building

From Alpine Linux
Revision as of 20:42, 19 October 2022 by Encode (talk | contribs) (Package building without polluting $HOME)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
This material is work-in-progress ...

I customize some packages locally, if you plan to develop you will probably need to also do a few more things (for example: "PACKAGER" in /etc/abuild.conf).
(Last edited by Encode on 19 Oct 2022.)

Todo: Use a dedicated user.
Make abuild-rootbld work with XDG (bubblewrap).


Prerequisites

Install the alpine-sdk package, which is a metapackage that pulls in most essential packages:

# apk add alpine-sdk

Add the package building user to the abuild group to use $ abuild -r:

# addgroup USER abuild

In ~/.profile you will need:

Contents of ~/.profile

export ABUILD_USERDIR="${XDG_CONFIG_HOME}"/abuild
Note: You will need to log out/in for these to take effect.

Make the directory to hold sources and configure the security keys:

$ mkdir ~/src $ abuild-keygen -a -i

When it says "Enter file in which to save the key:..." you should see:

 [/home/USER/$XDG_CONFIG_HOME/abuild/....rsa]

hit Enter. Enter your pass to install into /etc/apk/keys/.

Change where built packages go:

Contents of /etc/abuild.conf

REPODEST=/home/USER/src/.alpine-packages/

Fetch latest APKBUILD files

This will clone them into ~/src/aports:

$ cd ~/src/ $ git clone 'https://git.alpinelinux.org/aports'

Build the package

Change into the directory for the package:

$ cd ~/src/aports/REPO/PACKAGE

Edit the APKBUILD as needed and update the checksum:

$ abuild checksum

Build the package & install the local package:

$ abuild -r # apk add -uX ~/src/.alpine-package/community/ PACKAGE

See also