From b66f1ecb7a7aa548b8ae4718fefb833bcdba705c Mon Sep 17 00:00:00 2001 From: Zakk Date: Sun, 4 Oct 2026 19:23:08 +1100 Subject: [PATCH] build(package): follow aports and openwrt/packages conventions The OpenWrt Makefile pins doona-precompressed to the same doona with EXTRA_DEPENDS, as utils/vim does for vim-runtime, derives PKG_VERSION from PKG_REAL_VERSION and downloads every archive unconditionally, as net/v2raya does. The APKBUILD derives the tag from pkgver, names its split functions with a leading underscore and moves the fonts with amove, per the aports coding style. Neither repository has a placeholder hash, so the packaging scripts fill the hashes with `make package/doona/check FIXUP=1` and `abuild checksum`, and the release run keeps the filled recipes as artifacts under the default retention. --- .github/workflows/release.yml | 17 ++++++++++++++--- install/README.md | 34 +++++++++++++++++++++------------- install/alpine/APKBUILD | 27 ++++++++++++++------------- install/openwrt/doona/Makefile | 21 ++++++--------------- tools/package-alpine.sh | 6 ++++-- tools/package-openwrt.sh | 13 ++++++++----- 6 files changed, 67 insertions(+), 51 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0115eeee..9a4af479 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -96,6 +96,8 @@ jobs: GH_TOKEN: ${{ github.token }} run: | node tools/fetch-honk.mjs release + # The sums job copies every intermediate artifact into release-assets, so they keep one day; release-assets + # and the recipes keep the repository's default retention. - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: archives @@ -217,6 +219,11 @@ jobs: path: release/alpine/ if-no-files-found: error retention-days: 1 + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: alpine-recipe + path: release/alpine-recipe/ + if-no-files-found: error openwrt-apk: needs: [build] @@ -235,8 +242,8 @@ jobs: # The SDK image builds as its own unprivileged user, which needs to write the output directory. - name: Build the OpenWrt apk packages run: | - mkdir -p release/openwrt - chmod 777 release/openwrt + mkdir -p release/openwrt release/openwrt-recipe + chmod 777 release/openwrt release/openwrt-recipe docker run --rm -v "$PWD:/src" -w /src "$OPENWRT_SDK_IMAGE" sh tools/package-openwrt.sh "$NPM" - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: @@ -244,6 +251,11 @@ jobs: path: release/openwrt/ if-no-files-found: error retention-days: 1 + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: openwrt-recipe + path: release/openwrt-recipe/ + if-no-files-found: error # Collects every package next to the archives and sums them, so the release job only uploads. sums: @@ -267,7 +279,6 @@ jobs: name: release-assets path: release/ if-no-files-found: error - retention-days: 1 release: needs: [build, nfpm, alpine, openwrt-apk, sums] diff --git a/install/README.md b/install/README.md index 2518652a..86f6ea09 100644 --- a/install/README.md +++ b/install/README.md @@ -3,23 +3,31 @@ Each file follows a package that already exists in the target repository; keep them in step with that model rather than with each other. -| File | Modelled on | -| --------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `nfpm/doona.yaml`, `nfpm/doona-fonts.yaml`, `nfpm/doona-precompressed.yaml` | the nfpm configs in [daeuniverse/repo-for-linux](https://github.com/daeuniverse/repo-for-linux/tree/main/nfpm) (`dae.yaml`, `v2ray-rules-dat.yaml`) | -| `openwrt/doona/Makefile` | [openwrt/packages](https://github.com/openwrt/packages) `net/v2ray-geodata` (data-only, `PKGARCH:=all`, `Download/` blocks) and `net/v2raya` (unpacking a release tarball in `Build/Prepare`) | -| `alpine/APKBUILD` | [aports](https://gitlab.alpinelinux.org/alpine/aports) `community/font-noto-cjk` (noarch, subpackage) | -| `gentoo/net-proxy/doona` | the [gentoo-zh overlay](https://github.com/gentoo-zh/overlay)'s dashboards (`net-proxy/zashboard`, `net-proxy/daed` with its upstream `web.zip`): release archives in `SRC_URI`, `doins -r`, fonts behind a USE flag | -| `nix/package.nix` | [nixpkgs](https://github.com/NixOS/nixpkgs) prebuilt web packages using `fetchurl` and `stdenvNoCC` | -| the AUR `doona-bin` (separate repository) | v2rayA's `install/aur/v2raya-bin/PKGBUILD` | +| File | Modelled on | +| --------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `nfpm/doona.yaml`, `nfpm/doona-fonts.yaml`, `nfpm/doona-precompressed.yaml` | the nfpm configs in [daeuniverse/repo-for-linux](https://github.com/daeuniverse/repo-for-linux/tree/main/nfpm) (`dae.yaml`, `v2ray-rules-dat.yaml`) | +| `openwrt/doona/Makefile` | [openwrt/packages](https://github.com/openwrt/packages) `net/v2ray-geodata` (data-only, `PKGARCH:=all`, `Download/` blocks), `net/v2raya` (unpacking a release tarball in `Build/Prepare`), `utils/vim` (`EXTRA_DEPENDS` on the same version) and `net/netdiscover` (`PKG_REAL_VERSION`) | +| `alpine/APKBUILD` | [aports](https://gitlab.alpinelinux.org/alpine/aports) `community/font-noto-cjk` (noarch, `_extra` split function) and its `CODINGSTYLE.md` | +| `gentoo/net-proxy/doona` | the [gentoo-zh overlay](https://github.com/gentoo-zh/overlay)'s dashboards (`net-proxy/zashboard`, `net-proxy/daed` with its upstream `web.zip`): release archives in `SRC_URI`, `doins -r`, fonts behind a USE flag | +| `nix/package.nix` | [nixpkgs](https://github.com/NixOS/nixpkgs) prebuilt web packages using `fetchurl` and `stdenvNoCC` | +| the AUR `doona-bin` (separate repository) | v2rayA's `install/aur/v2raya-bin/PKGBUILD` | The OpenWrt, Alpine, Gentoo and Nix recipes are not yet submitted to their repositories. All four consume the prebuilt program archive, with the font archive where enabled; the OpenWrt and Alpine recipes also package the precompressed archive. -Before submission, replace the marked OpenWrt and Nix hashes using `SHA256SUMS`, generate Alpine checksums with -`abuild checksum`, and generate the Gentoo `Manifest` with `ebuild … manifest`. -The release workflow generates and attaches `SHA256SUMS`; it does not replace recipe placeholders. -After publishing the assets, fill the three OpenWrt hashes, run `abuild checksum`, generate the Gentoo `Manifest` -with `ebuild doona-0.1.0_beta13.ebuild manifest`, and replace both Nix `lib.fakeHash` values. +The OpenWrt and Alpine recipes hold the hashes of the last published archives. Neither repository has a +placeholder for an archive that is not published yet: maintainers run `make package/doona/check FIXUP=1` and +`abuild checksum` after a version bump. `tools/package-openwrt.sh` and `tools/package-alpine.sh` run those commands +against the archives they package, and the release workflow keeps the results as the `openwrt-recipe` and +`alpine-recipe` artifacts. After publishing a release, copy both from its run into the repository: + +```sh +gh run download -n openwrt-recipe -D install/openwrt/doona +gh run download -n alpine-recipe -D install/alpine +``` + +Before submitting the Gentoo and Nix recipes, generate the Gentoo `Manifest` with +`ebuild doona-0.1.0_beta13.ebuild manifest` and replace both Nix `lib.fakeHash` values using `SHA256SUMS`. The release workflow builds Alpine and OpenWrt 25.12 apk packages from the APKBUILD and the OpenWrt Makefile, using the archives of the same run instead of the download URLs: `tools/package-alpine.sh` runs `abuild` in an Alpine 3.24 diff --git a/install/alpine/APKBUILD b/install/alpine/APKBUILD index e2fa7bf9..2b7ec922 100644 --- a/install/alpine/APKBUILD +++ b/install/alpine/APKBUILD @@ -1,17 +1,17 @@ +# Contributor: Zakkaus # Maintainer: Zakkaus pkgname=doona pkgver=0.1.0_beta13 -_tag=v0.1.0-beta.13 -_upstream_ver=${_tag#v} pkgrel=0 +_pkgver=${pkgver/_beta/-beta.} pkgdesc="Web UI for the daeuniverse engines" url="https://github.com/Zakkaus/doona" arch="noarch" license="GPL-3.0-only AND 0BSD AND Apache-2.0 AND BSD-3-Clause AND ISC AND MIT AND CC-BY-3.0 AND CC-BY-4.0 AND CC-BY-SA-4.0 AND CC0-1.0 AND LicenseRef-GitHub-Logos" -subpackages="$pkgname-doc $pkgname-fonts:fonts:noarch $pkgname-precompressed:precompressed:noarch" -source="$pkgname-$_upstream_ver.tar.gz::$url/releases/download/$_tag/$pkgname-$_upstream_ver.tar.gz - $pkgname-fonts-$_upstream_ver.tar.gz::$url/releases/download/$_tag/$pkgname-fonts-$_upstream_ver.tar.gz - $pkgname-precompressed-$_upstream_ver.tar.gz::$url/releases/download/$_tag/$pkgname-precompressed-$_upstream_ver.tar.gz +subpackages="$pkgname-doc $pkgname-fonts:_fonts $pkgname-precompressed:_precompressed" +source="$url/releases/download/v$_pkgver/$pkgname-$_pkgver.tar.gz + $url/releases/download/v$_pkgver/$pkgname-fonts-$_pkgver.tar.gz + $url/releases/download/v$_pkgver/$pkgname-precompressed-$_pkgver.tar.gz " options="!check" # static files builddir="$srcdir" @@ -19,9 +19,9 @@ builddir="$srcdir" # The archives hold their files at the root: unpack each into its own directory. unpack() { mkdir -p "$srcdir"/web "$srcdir"/fonts "$srcdir"/precompressed - tar -xzf "$srcdir"/$pkgname-$_upstream_ver.tar.gz -C "$srcdir"/web - tar -xzf "$srcdir"/$pkgname-fonts-$_upstream_ver.tar.gz -C "$srcdir"/fonts - tar -xzf "$srcdir"/$pkgname-precompressed-$_upstream_ver.tar.gz -C "$srcdir"/precompressed + tar -xzf "$srcdir"/$pkgname-$_pkgver.tar.gz -C "$srcdir"/web + tar -xzf "$srcdir"/$pkgname-fonts-$_pkgver.tar.gz -C "$srcdir"/fonts + tar -xzf "$srcdir"/$pkgname-precompressed-$_pkgver.tar.gz -C "$srcdir"/precompressed } package() { @@ -31,17 +31,18 @@ package() { install -Dm644 "$srcdir"/web/NOTICE -t "$pkgdir"/usr/share/doc/$pkgname/ install -Dm644 "$srcdir"/web/LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/ install -Dm644 "$srcdir"/web/LICENSES/*.txt -t "$pkgdir"/usr/share/licenses/$pkgname/ + cp -a "$srcdir"/fonts/fonts "$pkgdir"/usr/share/doona/ } -fonts() { +_fonts() { pkgdesc="Noto Sans TC/SC for doona" license="OFL-1.1" depends="$pkgname=$pkgver-r$pkgrel" - mkdir -p "$subpkgdir"/usr/share/doona - cp -a "$srcdir"/fonts/fonts "$subpkgdir"/usr/share/doona/ + amove usr/share/doona/fonts } -precompressed() { +# amove cannot select the .br and .gz files across the tree, so they come from their own archive. +_precompressed() { pkgdesc="Brotli and gzip copies of doona's text assets" depends="$pkgname=$pkgver-r$pkgrel" mkdir -p "$subpkgdir"/usr/share/doona diff --git a/install/openwrt/doona/Makefile b/install/openwrt/doona/Makefile index 5de5e597..9a76613a 100644 --- a/install/openwrt/doona/Makefile +++ b/install/openwrt/doona/Makefile @@ -5,13 +5,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=doona -PKG_VERSION:=0.1.0_beta13 -PKG_RELEASE:=1 PKG_REAL_VERSION:=0.1.0-beta.13 -PKG_TAG:=v$(PKG_REAL_VERSION) +PKG_VERSION:=$(subst -beta.,_beta,$(PKG_REAL_VERSION)) +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_REAL_VERSION).tar.gz -PKG_SOURCE_URL:=https://github.com/Zakkaus/doona/releases/download/$(PKG_TAG)/ +PKG_SOURCE_URL:=https://github.com/Zakkaus/doona/releases/download/v$(PKG_REAL_VERSION)/ PKG_HASH:=b0ceb42853d202b702a8921860e69a75a4a94d87d0f41f9f2d8d0cded84b7674 PKG_LICENSE:=GPL-3.0-only 0BSD Apache-2.0 BSD-3-Clause ISC MIT CC-BY-3.0 CC-BY-4.0 CC-BY-SA-4.0 CC0-1.0 LicenseRef-GitHub-Logos @@ -22,7 +21,7 @@ include $(INCLUDE_DIR)/package.mk FONTS_FILE:=$(PKG_NAME)-fonts-$(PKG_REAL_VERSION).tar.gz define Download/doona-fonts - URL:=https://github.com/Zakkaus/doona/releases/download/$(PKG_TAG)/ + URL:=https://github.com/Zakkaus/doona/releases/download/v$(PKG_REAL_VERSION)/ URL_FILE:=$(FONTS_FILE) FILE:=$(FONTS_FILE) HASH:=6b3ee310ca4f80666b3436f3c866521edd3efe8720987abb9b763496788fa78c @@ -30,10 +29,9 @@ endef PRECOMPRESSED_FILE:=$(PKG_NAME)-precompressed-$(PKG_REAL_VERSION).tar.gz define Download/doona-precompressed - URL:=https://github.com/Zakkaus/doona/releases/download/$(PKG_TAG)/ + URL:=https://github.com/Zakkaus/doona/releases/download/v$(PKG_REAL_VERSION)/ URL_FILE:=$(PRECOMPRESSED_FILE) FILE:=$(PRECOMPRESSED_FILE) - HASH:=0000000000000000000000000000000000000000000000000000000000000000 endef define Package/doona/template @@ -69,6 +67,7 @@ define Package/doona-precompressed $(call Package/doona/template) TITLE:=Precompressed assets for doona DEPENDS:=+doona + EXTRA_DEPENDS:=doona (=$(PKG_VERSION)-r$(PKG_RELEASE)) endef define Package/doona-precompressed/description @@ -80,18 +79,14 @@ define Build/Prepare mkdir -p $(PKG_BUILD_DIR)/web ; \ gzip -dc $(DL_DIR)/$(PKG_SOURCE) | $(HOST_TAR) -C $(PKG_BUILD_DIR)/web $(TAR_OPTIONS) ; \ ) -ifneq ($(CONFIG_PACKAGE_doona-fonts),) ( \ mkdir -p $(PKG_BUILD_DIR)/fonts ; \ gzip -dc $(DL_DIR)/$(FONTS_FILE) | $(HOST_TAR) -C $(PKG_BUILD_DIR)/fonts $(TAR_OPTIONS) ; \ ) -endif -ifneq ($(CONFIG_PACKAGE_doona-precompressed),) ( \ mkdir -p $(PKG_BUILD_DIR)/precompressed ; \ gzip -dc $(DL_DIR)/$(PRECOMPRESSED_FILE) | $(HOST_TAR) -C $(PKG_BUILD_DIR)/precompressed $(TAR_OPTIONS) ; \ ) -endif endef define Build/Compile @@ -115,12 +110,8 @@ define Package/doona-precompressed/install $(CP) $(PKG_BUILD_DIR)/precompressed/* $(1)/usr/share/doona/ endef -ifneq ($(CONFIG_PACKAGE_doona-fonts),) $(eval $(call Download,doona-fonts)) -endif -ifneq ($(CONFIG_PACKAGE_doona-precompressed),) $(eval $(call Download,doona-precompressed)) -endif $(eval $(call BuildPackage,doona)) $(eval $(call BuildPackage,doona-fonts)) $(eval $(call BuildPackage,doona-precompressed)) diff --git a/tools/package-alpine.sh b/tools/package-alpine.sh index d14ce7ee..f5c03b0b 100755 --- a/tools/package-alpine.sh +++ b/tools/package-alpine.sh @@ -2,7 +2,7 @@ # Builds the Alpine packages from install/alpine/APKBUILD and the archives in release/, as root in an Alpine container: # docker run --rm -v "$PWD:/src" -w /src alpine:3.24 sh tools/package-alpine.sh 0.1.0-beta.13 # abuild signs each package with a key generated for this run; release/alpine/ receives the packages and the public -# key as doona-alpine.rsa.pub. +# key as doona-alpine.rsa.pub, and release/alpine-recipe/ the APKBUILD with this version and its checksums. set -eu cd "$(dirname "$0")/.." @@ -20,7 +20,7 @@ trap 'exit 1' HUP INT TERM # abuild names the repository after the APKBUILD's grandparent directory. mkdir -p "$work/alpine/doona" "$work/distfiles" cp "release/doona-$NPM.tar.gz" "release/doona-fonts-$NPM.tar.gz" "release/doona-precompressed-$NPM.tar.gz" "$work/distfiles/" -sed -e "s/^pkgver=.*/pkgver=$pkgver/" -e "s/^_tag=.*/_tag=v$NPM/" install/alpine/APKBUILD > "$work/alpine/doona/APKBUILD" +sed "s/^pkgver=.*/pkgver=$pkgver/" install/alpine/APKBUILD > "$work/alpine/doona/APKBUILD" # apk finds the key by the file name abuild records in each signature, so it takes a fixed name. export PACKAGER='Zakkaus ' @@ -42,4 +42,6 @@ for package in "$REPODEST"/alpine/*/*.apk; do cp "$package" "release/alpine/$name-$NPM-r$pkgrel.alpine.apk" done cp "$work/doona-alpine.rsa.pub" release/alpine/ +mkdir -p release/alpine-recipe +cp "$work/alpine/doona/APKBUILD" release/alpine-recipe/ ls -l release/alpine diff --git a/tools/package-openwrt.sh b/tools/package-openwrt.sh index 49934192..90e36957 100755 --- a/tools/package-openwrt.sh +++ b/tools/package-openwrt.sh @@ -3,7 +3,8 @@ # container (any target: the packages are PKGARCH all): # docker run --rm -v "$PWD:/src" -w /src openwrt/sdk:x86-64-25.12.5 sh tools/package-openwrt.sh 0.1.0-beta.13 # The SDK signs only the package index, with a key generated for this run. release/openwrt/ receives the packages -# under the names that index records, the index as doona-openwrt.adb and its public key as doona-openwrt.pem. +# under the names that index records, the index as doona-openwrt.adb and its public key as doona-openwrt.pem; +# release/openwrt-recipe/ receives the Makefile with this version and the hashes of these archives. set -eu cd "$(dirname "$0")/.." @@ -17,15 +18,15 @@ repo=$PWD sdk=${OPENWRT_SDK:-/builder} mkdir -p "$sdk/package/doona" "$sdk/dl" -# The archives in dl/ stand in for the Download blocks; their hashes were checked when release/ was built. -sed -e "s/^PKG_VERSION:=.*/PKG_VERSION:=$pkgver/" -e "s/^PKG_REAL_VERSION:=.*/PKG_REAL_VERSION:=$NPM/" \ - -e 's/^\([[:space:]]*\(PKG_\)\{0,1\}HASH:=\).*/\1skip/' \ - install/openwrt/doona/Makefile > "$sdk/package/doona/Makefile" +# The archives in dl/ stand in for the downloads. +sed "s/^PKG_REAL_VERSION:=.*/PKG_REAL_VERSION:=$NPM/" install/openwrt/doona/Makefile > "$sdk/package/doona/Makefile" cp "release/doona-$NPM.tar.gz" "release/doona-fonts-$NPM.tar.gz" "release/doona-precompressed-$NPM.tar.gz" "$sdk/dl/" cd "$sdk" printf 'CONFIG_PACKAGE_%s=m\n' doona doona-fonts doona-precompressed >> .config make defconfig +# FIXUP=1 writes the archives' hashes into the Makefile, as a maintainer does after a version bump. +make package/doona/check FIXUP=1 V=s make package/doona/compile package/index V=s pkgrel=$(sed -n 's/^PKG_RELEASE:=//p' "$repo/install/openwrt/doona/Makefile") @@ -35,4 +36,6 @@ for name in doona doona-fonts doona-precompressed; do done cp bin/packages/*/base/packages.adb "$repo/release/openwrt/doona-openwrt.adb" cp public-key.pem "$repo/release/openwrt/doona-openwrt.pem" +mkdir -p "$repo/release/openwrt-recipe" +cp package/doona/Makefile "$repo/release/openwrt-recipe/" ls -l "$repo/release/openwrt"