From 95e4c8deaabb55c46e4473035904079f4a66b5a4 Mon Sep 17 00:00:00 2001 From: Thomas Scholtes Date: Tue, 27 May 2025 13:34:23 +0200 Subject: [PATCH] Add arch packaging --- .woodpecker/build-arch.yaml | 31 ++++++++++++++++++ RELEASE.md | 19 +++++++++++ arch/.gitignore | 1 + arch/README.md | 37 ++++++++++++++++++++++ arch/generate-srcinfo.sh | 11 +++++++ arch/publish.sh | 39 +++++++++++++++++++++++ arch/radicle-desktop/.SRCINFO | 32 +++++++++++++++++++ arch/radicle-desktop/.gitignore | 3 ++ arch/radicle-desktop/PKGBUILD | 56 +++++++++++++++++++++++++++++++++ 9 files changed, 229 insertions(+) create mode 100644 .woodpecker/build-arch.yaml create mode 100644 arch/.gitignore create mode 100644 arch/README.md create mode 100755 arch/generate-srcinfo.sh create mode 100755 arch/publish.sh create mode 100644 arch/radicle-desktop/.SRCINFO create mode 100644 arch/radicle-desktop/.gitignore create mode 100644 arch/radicle-desktop/PKGBUILD diff --git a/.woodpecker/build-arch.yaml b/.woodpecker/build-arch.yaml new file mode 100644 index 000000000..952fdf590 --- /dev/null +++ b/.woodpecker/build-arch.yaml @@ -0,0 +1,31 @@ +when: + - event: pull_request + - event: push + branch: main + - event: manual + +steps: + build-arch: + image: docker.io/library/archlinux:base-devel + when: + - path: "arch/*" + - event: manual + commands: + - pacman -Sy --noconfirm git + - useradd -m builder + - 'echo "builder ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/builder' + - chown -R builder:builder /home/builder + - su builder + - set -e + - cd /home/builder + - rm -rf radicle-bin && git clone https://aur.archlinux.org/radicle-bin.git --depth=1 + - makepkg --dir radicle-bin --install --syncdeps --noconfirm + - cd $CI_WORKSPACE/arch/radicle-desktop + # Ensure .SCRINFO is up-to-date + - makepkg --printsrcinfo > .SRCINFO && git diff --exit-code .SRCINFO + - | + CI=true \ + BUILDDIR=/home/builder/build \ + PKGDEST=/home/builder/ \ + SRCDEST=/home/builder/ \ + makepkg --syncdeps --noconfirm --force diff --git a/RELEASE.md b/RELEASE.md index 66d8f2f5c..29fc87428 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -10,8 +10,26 @@ - Build the macOS app locally: `npm run tauri build`. - Make sure to clean any transient dependencies with `cargo clean && rm -rf node_modules` before building. - Upload the macOS build to [MinIO][0] in the same folder as the latest Linux build. +- Publish Arch Linux package (See `arch/README.md` for more information) + - Update `pkgver` in `arch/PKGBUILD` to match the release version + - Update `_commit` in `arch/PKGBUILD` to the release commit created above + - Regenerate `.SRCINFO` with + + ```bash + cd arch && ./generate-srcinfo.sh + ``` + + - Create a patch with the changes and wait for CI to pass + - Create a patch on [radworks-product][1] to [update the download links][2]. - Once merged, publish the website: `git push github main`. +- Publish the Arch package by pushing changes to the [Arch User Repository][4]: + + ```bash + cd arch && ./publish.sh + ``` + + You need to be a maintainer of the AUR package to push. - Announce the release on Zulip, following the [previous announcement format][3]. - Resolve the previous release topic on Zulip. @@ -19,3 +37,4 @@ [1]: https://app.radicle.xyz/nodes/seed.radicle.garden/rad:z4Rxw3J2gX8SJgUYJ3h1KvQCAYoKS [2]: https://app.radicle.xyz/nodes/seed.radicle.garden/rad:z4Rxw3J2gX8SJgUYJ3h1KvQCAYoKS/commits/17c25b85b123d9766c774cc414e3ffdfc7b69771 [3]: https://radicle.zulipchat.com/#narrow/channel/409174-announcements/topic/radicle-desktop.20v0.2E2.2E0.20.28early.20preview.29/with/514356912 +[4]: https://aur.archlinux.org/packages/radicle-desktop diff --git a/arch/.gitignore b/arch/.gitignore new file mode 100644 index 000000000..76f0167e7 --- /dev/null +++ b/arch/.gitignore @@ -0,0 +1 @@ +radicle-desktop.git diff --git a/arch/README.md b/arch/README.md new file mode 100644 index 000000000..8d91c66ef --- /dev/null +++ b/arch/README.md @@ -0,0 +1,37 @@ +# Packaging for Arch Linux + +This folder contains the `PKGBUILD` script for building the `radicle-desktop` +Arch Linux package. + +## Arch User Repository + +This folder is mirrored to the Arch User Repository as +[`radicle-desktop`][aur-pkg] so user can install it from there. + +Whenever a change is made to the `radicle-desktop` folder it can be synched to +the AUR using the `./publish.sh ` script. + +Before you push any changes, make sure that the package builds properly, see +“Build QA” below. + +You need to be a maintainer of the `radicle-desktop` to be allowed to push +changes. To become a maintainer ask one of the existing maintainers to add you. + +## Build QA + +There is a [Woodpecker CI workflow][workflow] to ensure that the package builds +correctly on Arch Linux. + +You can run the workflow locally. + +```bash +woodpecker-cli \ + exec .woodpecker/build-arch.yaml \ + --repo-path . \ + --volumes paccache:/var/cache/pacman,builder:/home/builder +``` + +Using `--volumes` is optional and improves caching between multiple runs. + +[aur-pkg]: https://aur.archlinux.org/packages/radicle-desktop +[workflow]: ../.woodpecker/build-arch.yaml diff --git a/arch/generate-srcinfo.sh b/arch/generate-srcinfo.sh new file mode 100755 index 000000000..733dd840c --- /dev/null +++ b/arch/generate-srcinfo.sh @@ -0,0 +1,11 @@ +#!/usr/bin/bash + +exec docker run \ + --user 1000 \ + --rm --volume "$(pwd):/workdir:ro" \ + --env BUILDDIR=/tmp \ + --env PKGDEST=/tmp \ + --env SRCDEST=/tmp \ + --workdir /workdir \ + archlinux:base-devel makepkg --printsrcinfo > .SRCINFO + diff --git a/arch/publish.sh b/arch/publish.sh new file mode 100755 index 000000000..870bff640 --- /dev/null +++ b/arch/publish.sh @@ -0,0 +1,39 @@ +#!/usr/bin/bash + +set -euo pipefail + +push=true + +while [[ $# -gt 0 ]]; do + case "$1" in + --no-push) + push=false + shift + ;; + *) + commit_message="$1" + shift + ;; + esac +done + +if [[ -z "${commit_message:-}" ]]; then + echo "Please provide a commit message as an argument: $0 [--no-push] \"Release vX.Y.Z\"" + exit 1 +fi + +if [[ ! -d radicle-desktop.git ]]; then + git clone ssh://aur.archlinux.org/radicle-desktop.git radicle-desktop.git +fi + +pushd radicle-desktop.git >/dev/null +export GIT_PAGER="" +git checkout master +git pull +cp --archive ../radicle-desktop/* ../radicle-desktop/.* . +git diff +git commit --all --message "$commit_message" +if [[ "$push" == true ]]; then + git push +fi +popd >/dev/null diff --git a/arch/radicle-desktop/.SRCINFO b/arch/radicle-desktop/.SRCINFO new file mode 100644 index 000000000..0e4da3240 --- /dev/null +++ b/arch/radicle-desktop/.SRCINFO @@ -0,0 +1,32 @@ +pkgbase = radicle-desktop + pkgdesc = Radicle desktop app + pkgver = 0.4.1 + pkgrel = 1 + url = https://www.radworks.garden/ + arch = x86_64 + license = GPL-3.0-only + makedepends = git + makedepends = openssl + makedepends = appmenu-gtk-module + makedepends = libappindicator-gtk3 + makedepends = librsvg + makedepends = rustup + makedepends = npm + makedepends = nodejs + depends = radicle-node-bin + depends = cairo + depends = desktop-file-utils + depends = gdk-pixbuf2 + depends = glib2 + depends = gtk3 + depends = hicolor-icon-theme + depends = libsoup + depends = pango + depends = webkit2gtk-4.1 + options = !strip + options = !emptydirs + options = !lto + source = radicle-desktop::git+https://seed.radicle.xyz/z4D5UCArafTzTQpDZNQRuqswh3ury.git#commit=33dd37714b7dbf56a11339a4c6f56f11d8b85351 + sha256sums = SKIP + +pkgname = radicle-desktop diff --git a/arch/radicle-desktop/.gitignore b/arch/radicle-desktop/.gitignore new file mode 100644 index 000000000..929ea1d61 --- /dev/null +++ b/arch/radicle-desktop/.gitignore @@ -0,0 +1,3 @@ +/src +/pkg +/radicle-desktop diff --git a/arch/radicle-desktop/PKGBUILD b/arch/radicle-desktop/PKGBUILD new file mode 100644 index 000000000..07d340a02 --- /dev/null +++ b/arch/radicle-desktop/PKGBUILD @@ -0,0 +1,56 @@ +# Maintainer: Thomas Scholtes +# +# shellcheck shell=bash disable=SC2034 disable=SC2154 + +_commit=33dd37714b7dbf56a11339a4c6f56f11d8b85351 +pkgname=radicle-desktop +pkgver='0.4.1' +pkgrel='1' +pkgdesc='Radicle desktop app' +arch=('x86_64') +url='https://www.radworks.garden/' +license=('GPL-3.0-only') +depends=( + 'radicle-node-bin' + # See https://v2.tauri.app/distribute/aur/#building-from-source + 'cairo' + 'desktop-file-utils' + 'gdk-pixbuf2' + 'glib2' + 'gtk3' + 'hicolor-icon-theme' + 'libsoup' + 'pango' + 'webkit2gtk-4.1' +) +makedepends=( + # See https://v2.tauri.app/distribute/aur/#building-from-source + 'git' + 'openssl' + 'appmenu-gtk-module' + 'libappindicator-gtk3' + 'librsvg' + 'rustup' + 'npm' + 'nodejs' +) +options=('!strip' '!emptydirs' '!lto') +source=("$pkgname::git+https://seed.radicle.xyz/z4D5UCArafTzTQpDZNQRuqswh3ury.git#commit=$_commit") +sha256sums=('SKIP') + +prepare() { + cd "$pkgname" || return 1 + + npm install + cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')" +} + +build() { + cd "$pkgname" || return 1 + + npx tauri build --bundles deb +} + +package() { + cp -a $pkgname/target/release/bundle/deb/${pkgname}_${pkgver}_*/data/* "${pkgdir}" +}