From 1c316e875a1d37efe5961072e343d6b8064e809e Mon Sep 17 00:00:00 2001 From: unkin-agent Date: Sat, 26 Sep 2026 21:13:56 +1000 Subject: [PATCH] Add go-cache-plugin vendored package (#174) go-cache-plugin is a GOCACHEPROG implementation that backs the Go build cache with S3, wanted via dnf on workstations and estate hosts. Upstream publishes no tags or releases, so the build pins a commit and the version is that commit's date. - Add `rpms/go-cache-plugin` metadata, build.sh and nfpm.yaml - Compile `cmd/go-cache-plugin` at commit 3031b5d with `GOTOOLCHAIN=go1.26.1` - Ship the single binary at `/usr/bin/go-cache-plugin` - Build for almalinux/el9 and fedora 42/43/44 Reviewed-on: https://git.unkin.net/unkin/rpmbuilder/pulls/174 Co-authored-by: unkin-agent Co-committed-by: unkin-agent --- rpms/go-cache-plugin/metadata.yaml | 22 +++++++++++++++++ rpms/go-cache-plugin/resources/build.sh | 17 +++++++++++++ rpms/go-cache-plugin/resources/nfpm.yaml | 31 ++++++++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 rpms/go-cache-plugin/metadata.yaml create mode 100755 rpms/go-cache-plugin/resources/build.sh create mode 100644 rpms/go-cache-plugin/resources/nfpm.yaml diff --git a/rpms/go-cache-plugin/metadata.yaml b/rpms/go-cache-plugin/metadata.yaml new file mode 100644 index 0000000..dcfa2c5 --- /dev/null +++ b/rpms/go-cache-plugin/metadata.yaml @@ -0,0 +1,22 @@ +name: go-cache-plugin +github: tailscale/go-cache-plugin +description: A GOCACHEPROG implementation that backs the Go build cache with S3. +arch: amd64 +platform: linux +maintainer: Tailscale +homepage: https://github.com/tailscale/go-cache-plugin +license: BSD-3-Clause +dist_tag: true +builds: +- repository: + - almalinux/el9 + image: git.unkin.net/unkin/almalinux9-rpmbuilder:latest + release: 1 + version: 2026.7.22 +- repository: + - fedora/42 + - fedora/43 + - fedora/44 + image: git.unkin.net/unkin/almalinux9-rpmbuilder:latest + release: 1 + version: 2026.7.22 diff --git a/rpms/go-cache-plugin/resources/build.sh b/rpms/go-cache-plugin/resources/build.sh new file mode 100755 index 0000000..760db8d --- /dev/null +++ b/rpms/go-cache-plugin/resources/build.sh @@ -0,0 +1,17 @@ +#!/usr/bin/bash +set -e + +# Upstream publishes no tags or releases; PACKAGE_VERSION dates this commit. +COMMIT=3031b5d01c50d2748a32c7c9386ea7049883f38e + +# go.mod requires go 1.26.1 +export GOTOOLCHAIN=go1.26.1 + +# Compile the go-cache-plugin binary using Go +GOBIN=/app go install github.com/tailscale/go-cache-plugin/cmd/go-cache-plugin@${COMMIT} + +# Process nfpm.yaml with envsubst +envsubst < /app/resources/nfpm.yaml > /app/nfpm.yaml + +# Build the RPM +nfpm pkg --config /app/nfpm.yaml --target /app/dist --packager rpm diff --git a/rpms/go-cache-plugin/resources/nfpm.yaml b/rpms/go-cache-plugin/resources/nfpm.yaml new file mode 100644 index 0000000..cdbac3a --- /dev/null +++ b/rpms/go-cache-plugin/resources/nfpm.yaml @@ -0,0 +1,31 @@ +# nfpm.yaml + +name: ${PACKAGE_NAME} +version: ${PACKAGE_VERSION} +release: ${PACKAGE_RELEASE} +arch: ${PACKAGE_ARCH} +platform: ${PACKAGE_PLATFORM} +section: default +priority: extra +description: "${PACKAGE_DESCRIPTION}" + +maintainer: ${PACKAGE_MAINTAINER} +homepage: ${PACKAGE_HOMEPAGE} +license: ${PACKAGE_LICENSE} + +disable_globbing: false + +replaces: + - go-cache-plugin + +provides: + - go-cache-plugin + +# Files to include in the package +contents: + - src: /app/go-cache-plugin + dst: /usr/bin/go-cache-plugin + file_info: + mode: 0755 + owner: root + group: root