diff --git a/.gitignore b/.gitignore index 4fc3cbe..8d27763 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ packaging/alpine/*/*/tmp/ packaging/alpine/*/*/*.apk packaging/alpine/*/*/*.tar.* !packaging/alpine/*/*/*-vendor.tar.gz +!packaging/alpine/local/lavinmq/lavinmq-*-shards.tar.gz +!packaging/alpine/local/lavinmq/lavinmq-*-assets.tar.gz diff --git a/packaging/alpine/local/gitea/APKBUILD b/packaging/alpine/local/gitea/APKBUILD index 2384a21..1a74827 100644 --- a/packaging/alpine/local/gitea/APKBUILD +++ b/packaging/alpine/local/gitea/APKBUILD @@ -1,7 +1,7 @@ # Maintainer: Joachim Schlöffel pkgname=gitea pkgver=28.1.0 -pkgrel=0 +pkgrel=1 pkgdesc="Self-hosted Git service written in Go" url="https://about.gitea.com/" arch="x86_64 aarch64" diff --git a/packaging/alpine/local/greptimedb/APKBUILD b/packaging/alpine/local/greptimedb/APKBUILD index 4fc78da..53fd612 100644 --- a/packaging/alpine/local/greptimedb/APKBUILD +++ b/packaging/alpine/local/greptimedb/APKBUILD @@ -1,7 +1,7 @@ # Maintainer: Joachim Schlöffel pkgname=greptimedb pkgver=1.2.1 -pkgrel=4 +pkgrel=5 pkgdesc="Cloud-native observability database for metrics, logs, and traces" url="https://github.com/GreptimeTeam/greptimedb" arch="x86_64" diff --git a/packaging/alpine/local/lavinmq/APKBUILD b/packaging/alpine/local/lavinmq/APKBUILD index ee83f00..ffc272d 100644 --- a/packaging/alpine/local/lavinmq/APKBUILD +++ b/packaging/alpine/local/lavinmq/APKBUILD @@ -1,6 +1,6 @@ # Maintainer: Joachim Schlöffel pkgname=lavinmq -pkgver=2.10.1 +pkgver=2.10.2 pkgrel=1 pkgdesc="High-performance AMQP and MQTT message queue server" url="https://github.com/cloudamqp/lavinmq" @@ -82,9 +82,9 @@ _logrotate() { } sha512sums=" -1c2c932a0698227abfe8353988ea75b48f9048f183d85410797af5bc14495e2cb4497e72acc8fc9ff9ef8f78e8ebb648a1b40b5cf7f1b86e18597d10297417ff lavinmq-2.10.1.tar.gz -d0dfdd5c0e474024f57deb9e31c76e3f176e798c8d21dea53d3aea1b05436bd03fa34e69ccddf322bc89adedce5f379df5a316cddbbdfe12520e5bf672ad8228 lavinmq-2.10.1-shards.tar.gz -ae3cea2534b211abbcbd1e4fcb6da73dfaf383a19aef1c45f367cba77492cc20a7ce8283fc42f26c0a023149114c369bed307fb8cde0b8f27fba61165092e986 lavinmq-2.10.1-assets.tar.gz +35757407adb6fdd6378c65cde229471bd362b6a7fdc13279658312ef8a7304c0557619a1394a0b4cf33ef25ffb6c039f65c217f2af37bf12fc01b73d84e55e69 lavinmq-2.10.2.tar.gz +d0dfdd5c0e474024f57deb9e31c76e3f176e798c8d21dea53d3aea1b05436bd03fa34e69ccddf322bc89adedce5f379df5a316cddbbdfe12520e5bf672ad8228 lavinmq-2.10.2-shards.tar.gz +ae3cea2534b211abbcbd1e4fcb6da73dfaf383a19aef1c45f367cba77492cc20a7ce8283fc42f26c0a023149114c369bed307fb8cde0b8f27fba61165092e986 lavinmq-2.10.2-assets.tar.gz 62a609d50f28db960098c4c84ce4f1dad78413366a9a9aca18fe321114d687be3bf7b71924d4ace69bd74383c5ac40d2ee09ae0eef9c1bfe653b97448e42e110 lavinmq.confd 1853196e70297b5c4a2207fde50df735620cf6d99c4994644fd676bffaf863d67300ad7ae771c4bbb86fce1a0485c2a7968cf912c5f5bb878e08b15e5a28ba1b lavinmq.initd 9999dd6a96bd29a3d0bda1b2110af940b15acf1250a0f3ba6c93d16bd62063ab1c1dfa4c237da99bbb401150517abde59e2c7275f4b72c3eb7c90e1ce61d43b9 lavinmq.logrotate diff --git a/packaging/alpine/local/lavinmq/README.md b/packaging/alpine/local/lavinmq/README.md index 006de39..c1c0d0c 100644 --- a/packaging/alpine/local/lavinmq/README.md +++ b/packaging/alpine/local/lavinmq/README.md @@ -55,23 +55,14 @@ Wrapper settings in `/etc/conf.d/lavinmq`: 1. In `APKBUILD`, set `pkgver` to the new upstream version and reset `pkgrel` to `0`. -2. Add versioned vendored archives for the locked Shards dependencies and - frontend assets. If the new upstream `shard.lock` and the asset rules in its - `Makefile` are unchanged, the existing archives can be reused under the new - names: +2. Generate the versioned, locked Shards and frontend-asset archives: ```sh - cd packaging/alpine/local/lavinmq - cp lavinmq-2.10.1-shards.tar.gz lavinmq--shards.tar.gz - cp lavinmq-2.10.1-assets.tar.gz lavinmq--assets.tar.gz - git add -f lavinmq--shards.tar.gz lavinmq--assets.tar.gz + ALPINE_PACKAGE=lavinmq mise run apk:update-generated ``` - When `shard.lock` changes, extract the upstream source, run - `shards install --production` in it, and create the shards archive with - `tar -czf lavinmq--shards.tar.gz lib`. If the asset rules change, - download the files specified by the new `Makefile` to a staging directory - and create `lavinmq--assets.tar.gz` from that directory's contents. + The hook uses the upstream `shard.lock` and `Makefile`, so it also refreshes + the bundled inputs when either dependency list changes. 3. From the repository root, refresh checksums and build the package: ```sh diff --git a/packaging/alpine/local/lavinmq/lavinmq-2.10.1-assets.tar.gz b/packaging/alpine/local/lavinmq/lavinmq-2.10.1-assets.tar.gz deleted file mode 100644 index 6c501e4..0000000 Binary files a/packaging/alpine/local/lavinmq/lavinmq-2.10.1-assets.tar.gz and /dev/null differ diff --git a/packaging/alpine/local/lavinmq/lavinmq-2.10.1-shards.tar.gz b/packaging/alpine/local/lavinmq/lavinmq-2.10.1-shards.tar.gz deleted file mode 100644 index cc9c905..0000000 Binary files a/packaging/alpine/local/lavinmq/lavinmq-2.10.1-shards.tar.gz and /dev/null differ diff --git a/packaging/alpine/local/lavinmq/lavinmq-2.10.0-assets.tar.gz b/packaging/alpine/local/lavinmq/lavinmq-2.10.2-assets.tar.gz similarity index 100% rename from packaging/alpine/local/lavinmq/lavinmq-2.10.0-assets.tar.gz rename to packaging/alpine/local/lavinmq/lavinmq-2.10.2-assets.tar.gz diff --git a/packaging/alpine/local/lavinmq/lavinmq-2.10.0-shards.tar.gz b/packaging/alpine/local/lavinmq/lavinmq-2.10.2-shards.tar.gz similarity index 100% rename from packaging/alpine/local/lavinmq/lavinmq-2.10.0-shards.tar.gz rename to packaging/alpine/local/lavinmq/lavinmq-2.10.2-shards.tar.gz diff --git a/packaging/alpine/local/lavinmq/scripts/update-generated-sources.sh b/packaging/alpine/local/lavinmq/scripts/update-generated-sources.sh new file mode 100755 index 0000000..7f02bb0 --- /dev/null +++ b/packaging/alpine/local/lavinmq/scripts/update-generated-sources.sh @@ -0,0 +1,55 @@ +#!/usr/bin/env bash +set -euo pipefail + +package_dir="${PACKAGE_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}" +repo_root="${REPO_ROOT:-$(cd "${package_dir}/../../../.." && pwd)}" +pkgver="$(awk -F= '$1 == "pkgver" { print $2; exit }' "${package_dir}/APKBUILD")" +distfiles_dir="${repo_root}/.cache/apk-distfiles" +shards_cache_dir="${repo_root}/.cache/shards" +source_archive="${distfiles_dir}/lavinmq-${pkgver}.tar.gz" +shards_archive="${package_dir}/lavinmq-${pkgver}-shards.tar.gz" +assets_archive="${package_dir}/lavinmq-${pkgver}-assets.tar.gz" +tmpdir="$(mktemp -d)" +assets_dir="${tmpdir}/assets" + +cleanup() { + rm -rf "${tmpdir}" +} +trap cleanup EXIT + +mkdir -p "${distfiles_dir}" "${shards_cache_dir}" +if [[ ! -f "${source_archive}" ]]; then + curl --fail --location --retry 3 --silent --show-error \ + --output "${source_archive}" \ + "https://github.com/cloudamqp/lavinmq/archive/refs/tags/v${pkgver}.tar.gz" +fi + +tar -xzf "${source_archive}" -C "${tmpdir}" +source_dir="${tmpdir}/lavinmq-${pkgver}" +if [[ ! -d "${source_dir}" ]]; then + printf 'unexpected LavinMQ source archive layout: %s\n' "${source_archive}" >&2 + exit 1 +fi + +# shard.lock pins the Crystal dependencies. `make js` fetches exactly the +# frontend assets declared by this upstream version's Makefile. +( + cd "${source_dir}" + SHARDS_CACHE_PATH="${shards_cache_dir}" shards install --production + make js +) + +tar --create --gzip --file "${shards_archive}" \ + --directory "${source_dir}" \ + --sort=name --mtime='UTC 1970-01-01' --owner=0 --group=0 --numeric-owner \ + lib +mkdir -p "${assets_dir}" +# The offline Makefile patch intentionally reads every asset from the root of +# .alpine-assets, including helpers.segment.js which upstream stores in chunks/. +find "${source_dir}/static/js/lib" -type f -exec cp -p {} "${assets_dir}/" \; +tar --create --gzip --file "${assets_archive}" \ + --directory "${assets_dir}" \ + --sort=name --mtime='UTC 1970-01-01' --owner=0 --group=0 --numeric-owner \ + . + +printf 'Updated %s and %s\n' "${shards_archive##*/}" "${assets_archive##*/}" diff --git a/packaging/alpine/local/nifi/APKBUILD b/packaging/alpine/local/nifi/APKBUILD index 0667790..db2bfb5 100644 --- a/packaging/alpine/local/nifi/APKBUILD +++ b/packaging/alpine/local/nifi/APKBUILD @@ -1,7 +1,7 @@ # Maintainer: Joachim Schlöffel pkgname=nifi pkgver=2.12.0 -pkgrel=0 +pkgrel=1 pkgdesc="Reliable system for processing and distributing data" url="https://nifi.apache.org/" arch="x86_64 aarch64" diff --git a/packaging/alpine/local/rclone-openrc/APKBUILD b/packaging/alpine/local/rclone-openrc/APKBUILD index 4a03c8a..62a32e4 100644 --- a/packaging/alpine/local/rclone-openrc/APKBUILD +++ b/packaging/alpine/local/rclone-openrc/APKBUILD @@ -1,7 +1,7 @@ # Maintainer: Joachim Schlöffel pkgname=rclone-openrc pkgver=0.1.0 -pkgrel=0 +pkgrel=1 pkgdesc="Generic, instance-capable OpenRC service for rclone" url="https://rclone.org/" arch="noarch" diff --git a/packaging/alpine/local/seaweedfs/APKBUILD b/packaging/alpine/local/seaweedfs/APKBUILD index 9106b00..7c9b086 100644 --- a/packaging/alpine/local/seaweedfs/APKBUILD +++ b/packaging/alpine/local/seaweedfs/APKBUILD @@ -1,7 +1,7 @@ # Maintainer: Joachim Schlöffel pkgname=seaweedfs pkgver=4.48 -pkgrel=3 +pkgrel=4 pkgdesc="Distributed storage system for object storage, file systems, and Iceberg tables" url="https://github.com/seaweedfs/seaweedfs" arch="x86_64 aarch64" diff --git a/scripts/apk/ci-package-cache.sh b/scripts/apk/ci-package-cache.sh index 8117634..f0eaef4 100755 --- a/scripts/apk/ci-package-cache.sh +++ b/scripts/apk/ci-package-cache.sh @@ -30,16 +30,30 @@ registry_key_url() { } download_registry_metadata() { - local arch url key_dir + local arch url key_dir http_status require_registry_config INSTANCE_URL "${instance_url}" require_registry_config PACKAGE_OWNER "${owner}" + declare -gA registry_index_available=() mkdir -p "${registry_cache}" url="$(registry_url)" for arch in ${arches}; do - curl --fail --silent --show-error --location \ + if http_status="$(curl --fail --silent --location \ --output "${registry_cache}/${arch}.APKINDEX.tar.gz" \ - "${url}/${arch}/APKINDEX.tar.gz" + --write-out '%{http_code}' \ + "${url}/${arch}/APKINDEX.tar.gz")"; then + registry_index_available["${arch}"]=1 + continue + fi + if [[ "${http_status}" == 404 ]]; then + registry_index_available["${arch}"]=0 + printf 'Registry index is absent: %s/%s/APKINDEX.tar.gz; treating it as empty\n' \ + "${url}" "${arch}" >&2 + continue + fi + printf 'failed to download registry index (%s): %s/%s/APKINDEX.tar.gz\n' \ + "${http_status:-curl error}" "${url}" "${arch}" >&2 + return 1 done key_dir="${registry_cache}/keys" mkdir -p "${key_dir}" @@ -59,6 +73,7 @@ load_registry_index() { declare -gA registry_latest_versions=() for arch in ${arches}; do + [[ "${registry_index_available[${arch}]:-0}" == 1 ]] || continue while IFS=$'\t' read -r package_name package_version; do [[ -n "${package_name}" && -n "${package_version}" ]] || continue registry_key="${arch}|${package_name}" diff --git a/scripts/apk/ci-smoke.sh b/scripts/apk/ci-smoke.sh index c6b6e5d..c9eb633 100755 --- a/scripts/apk/ci-smoke.sh +++ b/scripts/apk/ci-smoke.sh @@ -12,6 +12,7 @@ registry_url="${ALPINE_REGISTRY_URL:-}" registry_key="${ALPINE_REGISTRY_KEY:-}" read -r -a package_list <<< "${packages}" declare -A source_packages=() +local_repo_complete=0 while IFS= read -r package_dir; do while IFS= read -r spec; do @@ -26,18 +27,30 @@ for package in "${package_list[@]}"; do fi done +if [[ -d "${repo_dir}" ]]; then + local_repo_complete=1 + for package in "${package_list[@]}"; do + if ! compgen -G "${repo_dir}/${package}-*.apk" >/dev/null; then + local_repo_complete=0 + break + fi + done +fi + if [[ -d "${repo_dir}" ]]; then cp "${repo_dir}"/*.rsa.pub /etc/apk/keys/ echo "${repo_root}/packages/${repo_name}" >> /etc/apk/repositories fi -if [[ -n "${registry_url}" ]]; then +if [[ -n "${registry_url}" && "${local_repo_complete}" == 0 ]]; then if [[ ! -f "${registry_key}" ]]; then printf 'missing Alpine registry signing key: %s\n' "${registry_key:-}" >&2 exit 1 fi cp "${registry_key}" /etc/apk/keys/ echo "${registry_url}" >> /etc/apk/repositories +elif [[ -n "${registry_url}" ]]; then + printf 'Using the complete local Alpine repository; registry fallback is not needed\n' fi if [[ ! -d "${repo_dir}" && -z "${registry_url}" ]]; then