From 1dc49e2ecffdcfd6e0503ef183771850451e5eab Mon Sep 17 00:00:00 2001 From: Eugene Blikh Date: Thu, 6 Aug 2026 22:49:01 +0300 Subject: [PATCH] apk: ship dolt-git-hook as a -hook subpackage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The hook binary was the one piece of this repo not in the apk — the deployment's Dockerfile.git cloned the repo and compiled it from source at a separately pinned revision (SRHT_DOLT_HOOK_REV), which meant a second version pin to keep in lockstep, a build-time dependency on the git host, and a full Go toolchain stage in the git image rebuild. Add dolt-git-hook to the Makefile's BINARIES (same guarded target pattern) and split it into a dolt.sr.ht-hook subpackage: the git.sr.ht container needs only this 9 MB binary, not the 126 MB doltsrht service the main package carries. The deployment can now apk-add the subpackage at the same pinned version as the service. --- APKBUILD | 9 +++++++++ Makefile | 11 ++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/APKBUILD b/APKBUILD index 8800cf53cf367c976d90c71f8fe33019ab16d8e4..9cd0aa7a182900f274ff7318651805106f78675a 100644 --- a/APKBUILD +++ b/APKBUILD @@ -17,6 +17,10 @@ license="MIT" # !tracedeps — CGO_ENABLED=0 with -tags gms_pure_go, so the binaries are # static: no ICU, no gozstd, nothing to trace options="!check !tracedeps" +# The hook subpackage carries dolt-git-hook alone: it is installed into the +# git.sr.ht container (as its post-update-script), not the dolt one, and +# pulling the full service package in there would drag doltsrht along. +subpackages="$pkgname-hook:hook" source="" builddir="$startdir" @@ -58,3 +62,8 @@ package() { # MIGRATIONDIR and STATICDIR are both derived from SHAREDIR, so they follow. make install PREFIX="$pkgdir/usr" } + +hook() { + pkgdesc="post-update hook that provisions companion Dolt databases (for the git.sr.ht container)" + amove usr/bin/dolt-git-hook +} diff --git a/Makefile b/Makefile index a1512ca66724dca62a2c7b418b17dd2eb465109f..a6550b88c48771140db339479f2a33fd685287f3 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,8 @@ GOBUILD=$(GO) build $(if $(GO_TAGS),-tags "$(GO_TAGS)",) BINARIES=\ doltsrht \ - doltsrht-migrate + doltsrht-migrate \ + dolt-git-hook # Default target builds the Go binaries only. CSS (all-share) is deliberately # kept off the default path because sassc/minify are not always installed on @@ -58,6 +59,14 @@ doltsrht-migrate: echo "skip $@: ./cmd/doltsrht-migrate not present yet"; \ fi +dolt-git-hook: + @if [ -d ./cmd/dolt-git-hook ]; then \ + echo "$(GOBUILD) -o $@ ./cmd/dolt-git-hook"; \ + $(GOBUILD) -o $@ ./cmd/dolt-git-hook; \ + else \ + echo "skip $@: ./cmd/dolt-git-hook not present yet"; \ + fi + # Compile every buildable package; used as the CI build gate. build: $(GOBUILD) ./...