From f0461242eab6b4a306a1ef348f48db91ee1254be Mon Sep 17 00:00:00 2001 From: Sean Casey <4674433+CaseyLabs@users.noreply.github.com> Date: Fri, 3 Apr 2026 15:57:54 -0600 Subject: [PATCH] Fix issues in Arch Linux AUR publishing process --- .SRCINFO | 18 ++++++++++++++++++ .github/workflows/publish-aur.yml | 12 +++++++----- PKGBUILD | 17 ++++++++++------- 3 files changed, 35 insertions(+), 12 deletions(-) create mode 100644 .SRCINFO diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 0000000..a79aadb --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,18 @@ +pkgbase = numa-git + pkgdesc = Portable DNS resolver in Rust — .numa local domains, ad blocking, developer overrides, DNS-over-HTTPS + pkgver = 0.9.1.r0.g1234abc + pkgrel = 1 + url = https://github.com/razvandimescu/numa + arch = x86_64 + arch = aarch64 + license = MIT + makedepends = cargo + makedepends = git + depends = gcc-libs + depends = glibc + provides = numa + conflicts = numa + source = numa::git+https://github.com/razvandimescu/numa.git + sha256sums = SKIP + +pkgname = numa-git diff --git a/.github/workflows/publish-aur.yml b/.github/workflows/publish-aur.yml index 53dc7b2..cece93a 100644 --- a/.github/workflows/publish-aur.yml +++ b/.github/workflows/publish-aur.yml @@ -128,13 +128,15 @@ jobs: # METADATA GENERATION: # '.SRCINFO' is a machine-readable version of the PKGBUILD. - # The AUR website uses this file to display package details like dependencies and version. - # We generate it inside an Arch container to ensure 'makepkg' is available. + # We must run this as a non-root user ('builduser') inside the container. docker run --rm -v $(pwd):/pkg archlinux:latest /bin/bash -c " - pacman -Syu --noconfirm --needed binutils git + pacman -Syu --noconfirm --needed binutils git sudo + useradd -m builduser + chown -R builduser:builduser /pkg cd /pkg - git config --global --add safe.directory '*' - makepkg --printsrcinfo > .SRCINFO + sudo -u builduser git config --global --add safe.directory '*' + # "makepkg -od" fetches the source first so pkgver() can calculate the version. + sudo -u builduser makepkg -od && sudo -u builduser makepkg --printsrcinfo > .SRCINFO " # Set the commit identity using secrets for security and auditability. diff --git a/PKGBUILD b/PKGBUILD index 7c761ae..f9fee77 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -15,34 +15,37 @@ source=("$_pkgname::git+$url.git") sha256sums=('SKIP') pkgver() { - cd "$_pkgname" - git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g' | sed 's/^v//' + cd "$srcdir/$_pkgname" + ( set -o pipefail + git describe --long --tags 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' || + printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" + ) | sed 's/^v//' } prepare() { - cd "$_pkgname" + cd "$srcdir/$_pkgname" export RUSTUP_TOOLCHAIN=stable cargo fetch --locked } build() { - cd "$_pkgname" + cd "$srcdir/$_pkgname" export RUSTUP_TOOLCHAIN=stable cargo build --frozen --release } check() { - cd "$_pkgname" + cd "$srcdir/$_pkgname" export RUSTUP_TOOLCHAIN=stable cargo test --frozen } package() { - cd "$_pkgname" + cd "$srcdir/$_pkgname" install -Dm755 "target/release/$_pkgname" "$pkgdir/usr/bin/$_pkgname" # Install service file with patched path - sed 's|/usr/local/bin/numa|/usr/bin/numa|g' numa.service > numa.service.patched + sed 's|ExecStart=/usr/local/bin/numa|ExecStart=/usr/bin/numa /etc/numa.toml|g' numa.service > numa.service.patched install -Dm644 "numa.service.patched" "$pkgdir/usr/lib/systemd/system/numa.service" install -Dm644 "numa.toml" "$pkgdir/etc/numa.toml"