fix: automate arch packaging

using docker just like debian. This makes the scripts easier to
reproduce.
This commit is contained in:
Asger Gitz-Johansen 2024-08-19 19:42:46 +02:00
parent e8602e1e1f
commit 347c8605c9
5 changed files with 44 additions and 5 deletions

3
.gitignore vendored
View File

@ -1,7 +1,10 @@
out/
examples/
artifacts/
pkg/
compile_commands.json
.cache/
*.tar.gz
*.log
*.zst
PKGBUILD

View File

@ -4,9 +4,9 @@ pkgver=1.0.0
pkgrel=1
epoch=
pkgdesc="A simple / minimal CI (Continuous Integration) system"
arch=('x86_64') # TODO: also arm64 when you're not tired
url="gitea.local:3000/agj/sci"
license=('GPL-3.0-or-later') # TODO: add LICENSE file and header
arch=('x86_64')
url="https://git.gtz.dk/agj/sci"
license=('GPL-3.0-or-later')
groups=()
depends=("glibc"
"util-linux-libs")
@ -22,7 +22,7 @@ install=
changelog=
source=("$pkgname-$pkgver.tar.gz")
noextract=()
sha256sums=("948092bdcc3591afcdc205263832a06c838aa9d524c762b061e91cffa04b7d63")
sha256sums=("SRC_SHA256")
validpgpkeys=()
build() {

View File

@ -11,7 +11,7 @@
- [ ] Seventh things seventh, package the sucker (arch, debian, alpine, docker)
- [x] archlinux
- https://wiki.archlinux.org/title/Creating_packages
- [ ] debian
- [x] debian
- see `/home/agj/documents/Projects/packaging/deb-packaging-tutorial.pdf`
- just use docker.
- [ ] alpine

15
arch-builder.dockerfile Normal file
View File

@ -0,0 +1,15 @@
FROM archlinux
RUN pacman -Sy --noconfirm base-devel
ARG DOCKER_USER=arch
# Set user and group
ARG user=appuser
ARG group=appuser
ARG uid=1000
ARG gid=1000
RUN groupadd -g ${gid} ${group}
RUN useradd -u ${uid} -g ${group} -s /bin/sh -m ${user} # <--- the '-m' create a user home directory
ENV USER=${user}
# Switch to user
USER ${uid}:${gid}

21
scripts/package-sci-arch.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
archbuilder_image=$(docker images | grep archbuilder)
set -e
if [ -z $archbuilder_image ]; then
echo "building archbuilder image..."
docker build -t archbuilder -f arch-builder.dockerfile .
fi
echo "building source dist..."
make dist
SRC_SHA256=$(sha256sum sci-1.0.0.tar.gz | awk '{ print $1 }')
echo $SRC_SHA256
sed "s/SRC_SHA256/$SRC_SHA256/g" < PKGBUILD.in > PKGBUILD
echo "building arch package in archbuilder docker image..."
docker run --rm -it -v .:/src archbuilder sh -c '\
cd && \
cp /src/sci-1.0.0.tar.gz /src/PKGBUILD . && \
makepkg && \
cp *.zst /src
'