3

I have an APKBUILD and associated files (patches, et cetera), and I would like to build and install it locally. I'm aware that I can build it with abuild, but this doesn't seem to keep the package afterwards. How do I build and install a package from an APKBUILD in Alpine Linux?

Newbyte
  • 856
  • 1
  • 9
  • 31

1 Answers1

2

Actually, abuild does keep the built .apk package. It will be placed in a local repository created by abuild that's located in ~/packages. If you want, you can add this to your repository list by adding the path in /etc/apk/repositories. You will have to add a separate entry for each channel you want to install packages built for, so if you want to include the three of testing, community, and main you'd have to add something like this to the file:

/home/<username>/packages/main
/home/<username>/packages/community
/home/<username>/packages/testing

You will then be able to install the package the usual way:

# apk add <package name>

There is also the option of just installing the apk directly by doing something like this:

# apk add ~/packages/<channel>/<architecture/<package name>-<package version>.apk

For example:

# apk add ~/packages/testing/x86_64/giara-0.2-r0.apk
Newbyte
  • 856
  • 1
  • 9
  • 31
  • 1
    Make sure to copy your public rsa key located in `~/.abuild` (created by abuild-keygen) to `/etc/apk/keys`. If you run `abuild-keygen -ain`, this is done automatically. – Ikke Dec 01 '20 at 08:19
  • I tried running `abuild package` and it finishes without error but no package is output in `~/packages` -- what `abuild` step puts it there? – rakslice Mar 24 '23 at 05:49
  • 1
    @rakslice I just run `abuild -r` after setting up according to this wiki page: https://wiki.alpinelinux.org/wiki/Creating_an_Alpine_package – Newbyte Mar 24 '23 at 12:53