Downstream updates: Alpine Linux - PowerDNS/pdns GitHub Wiki

Useful reference: https://wiki.alpinelinux.org/wiki/Creating_an_Alpine_package

Outside docker

$ git clone [email protected]:alpine/aports.git
$ docker run -ti --rm -v $(pwd)/aports:/aports alpine:edge

Inside docker

(for adduser, match your outside UID)

/ # apk add alpine-sdk sudo
/ # adduser -D -u 1000 peter
/ # addgroup peter abuild
/ # echo 'peter ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
/ # su - peter
~ $ git config --global user.name 'Peter van Dijk'
~ $ git config --global user.email '[email protected]'
~ $ abuild-keygen -a -i

The commands above could be stored in a reusable setup script.

now, edit aports/community/pdns/APKBUILD (or similar for recursor or dnsdist). Update the version number at the top, and reset pkgrel to 0.

OR: instead of editing the file, doing a build, etc., run abump pdns-4.8.0 in /aports/community/pdns inside your Docker container. This will bump the version, update hashes, attempt a build, and then even git commit for you (so make sure to create your new branch first).

Continuing inside docker:

~ $ cd /aports/community/pdns
/aports/community/pdns $ abuild checksum
>>> pdns: Fetching https://downloads.powerdns.com/releases/pdns-4.5.1.tar.bz2
>>> pdns: Updating the sha512sums in APKBUILD...
/aports/community/pdns $ 
/aports/community/pdns $ abuild -r
>>> pdns: Building community/pdns 4.5.1-r (using abuild 3.8.0_rc4-r0) started Mon, 26 Jul 2021 13:53:37 +0000
[lots of output omitted]
>>> ERROR: pdns: The following patches failed to apply:
  pdns-boost-containers-exceptions.patch
>>> ERROR: pdns: prepare failed
[lots of output snipped]

NOTE! After the error, there are 150 more lines of output. You're not done until you see the output below.

We should have checked if any of the applied patches are no longer relevant! I removed the patch from the APKBUILD, then continued inside Docker:

/aports/community/pdns $ git rm pdns-boost-containers-exceptions.patch 
rm 'community/pdns/pdns-boost-containers-exceptions.patch'
/aports/community/pdns $ abuild -r
[...]
>>> pdns*: Create pdns-4.5.1-r0.apk
>>> pdns: Build complete at Mon, 26 Jul 2021 14:10:16 +0000 elapsed time 0h 10m 15s
>>> pdns: Cleaning up srcdir
>>> pdns: Cleaning up pkgdir
>>> pdns: Uninstalling dependencies...
[...]
>>> pdns: Updating the community/x86_64 repository index...
>>> pdns: Signing the index...

Ok, let's test. Inside Docker still:

/aports/community/pdns $ sudo apk add --repository /home/peter/packages/community pdns
(1/5) Installing boost1.76-program_options (1.76.0-r0)
(2/5) Installing luajit (2.1_p20210510-r0)
(3/5) Installing libsodium (1.0.18-r0)
(4/5) Installing sqlite-libs (3.36.0-r0)
(5/5) Installing pdns (4.5.1-r0)
Executing pdns-4.5.1-r0.pre-install
Executing busybox-1.33.0-r2.trigger
OK: 223 MiB in 58 packages
/aports/community/pdns $ pdns_server  --version
Jul 26 14:12:14 PowerDNS Authoritative Server 4.5.1 (C) 2001-2021 PowerDNS.COM BV

Looks good!

Outside of Docker, review the diff, commit to a new branch, and push it to your fork:

$ git diff
[...]
$ git checkout -b pdns-4.5.1
$ git commit -am 'community/pdns: upgrade to 4.5.1'
$ git push -u habbie HEAD
[...]
remote: To create a merge request for pdns-4.5.1, visit:
remote:   https://gitlab.alpinelinux.org/Habbie/aports/-/merge_requests/new?merge_request%5Bsource_branch%5D=pdns-4.5.1
[...]

Visit the URL. If it 404s, hit 'Sign in' at the bottom (I'm assuming you already have an account, of course - I log in with GitHub which is easy).

In this case, I made https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/23635