Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018MsAYv5RhNLE54fPrviVgS
4.2 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
What this is
A personal Gentoo ebuild repository (overlay), repo name azy5030, EAPI 8,
masters = gentoo, thin + unsigned Manifests (metadata/layout.conf). It packages
software not in the main ::gentoo tree. Currently one package:
dev-util/gitea-runner. Hosted on a self-hosted Gitea at git.azy.dev whose repos
use SHA-256 object format.
The vendored-build model (the core design)
dev-util/gitea-runner is a go-module ebuild built offline from upstream
gitea/runner source. Gentoo's build sandbox has no network, so Go modules cannot be
fetched at build time. Instead they are vendored ahead of time:
- The upstream source archive is
SRC_URI'd from gitea.com's/api/v1/.../archiveendpoint (a plaingit clone/go getis never used). - A vendor tarball (
${P}-vendor.tar.xz, the result ofgo mod vendor, packed deterministically) is uploaded as a release asset on this repo and is the secondSRC_URI.S="${WORKDIR}/runner". dev-util/gitea-runner/Manifestpins BLAKE2B/SHA512 of both tarballs.emergeverifies against the Manifest, then compiles offline fromvendor/.
Consequences when editing the ebuild:
LICENSEmust cover every vendored module's license, not just upstream's MIT. The bump PR checklist suggestsgo-licenses report ./...to confirm.BDEPENDGo version tracks upstream'sgo.modgodirective.- The version string is injected via ldflags into
gitea.com/gitea/runner/internal/pkg/ver.version; CI assertsgitea-runner --versionechoesv${PV}. If upstream moves that symbol path, the build "succeeds" but reports the wrong version.
Bumping to a new upstream version
This is automated by scripts/bump-version.sh (run daily by bump.yaml, or
workflow_dispatch). To do it manually you must reproduce its steps, because a version
bump is never just renaming the ebuild — the vendor tarball must be regenerated and
re-uploaded as a release asset, or the build will fail Manifest verification. The script:
- Reads the latest
vX.Y.Zfrom upstreamreleases.rss; compares to the newest committed ebuild. Exits early if up to date or if abump/gitea-runner-<ver>branch already exists. - Downloads the source archive, runs
go mod vendor, packs a reproducible*-vendor.tar.xz(--sort=name --mtime='UTC 1970-01-01' --owner=0 --group=0). - Creates/reuses a release tagged
${PN}-${ver}-vendorand uploads the tarball asset. git mvs the ebuild to the new version, rewritesBDEPEND's Go version from upstreamgo.mod, and regenerates the Manifest withpkgdev manifest(after copying both distfiles into/var/cache/distfilesand wiring a temporaryrepos.conf).- Validates:
pkgcheck scan, thenemerge+gitea-runner --version | grep v${ver}. - Commits, pushes the branch, opens a PR against
master.
Requires a BUMP_TOKEN repo secret (scopes: repository read/write, write release) plus
a Gentoo env with go pkgdev git curl xz jq.
CI (.gitea/workflows/ci.yaml)
Runs on every push inside a gentoo/stage3:amd64-openrc container (the runs-on label
only schedules onto the Docker-backend runner). Steps: emerge-webrsync to sync
::gentoo → configure portage (disables binpkg signature verification so prebuilt deps
like dev-lang/go are pulled, not compiled) → check out via curl + tar, not
actions/checkout (it breaks on SHA-256 Gitea repos) into /var/db/repos/azy5030 →
pkgcheck scan → emerge → assert gitea-runner --version matches the ebuild version.
Conventions / gotchas
- YAML is linted by
.yamllint.yaml(relaxed: line-length and document-start disabled;truthy.check-keys: falsesoon:is allowed unquoted). metadata/md5-cache/is gitignored — portage regenerates it on sync, so never commit it (a stalegitea-runner-1.0.4file may linger on disk untracked).- The bump script and CI deliberately preserve the scheme of
GITHUB_SERVER_URL: on the self-hosted runner it is an internalhttp://endpoint. Don't hardcodehttps. - New packages must be added to
profiles/categories(currently justdev-util).