Skip to content

TOOLS-4173 - derive package version from git tags via build/version - #81

Open
pvinh-spike wants to merge 1 commit into
masterfrom
pvinh/update-version-script
Open

TOOLS-4173 - derive package version from git tags via build/version#81
pvinh-spike wants to merge 1 commit into
masterfrom
pvinh/update-version-script

Conversation

@pvinh-spike

Copy link
Copy Markdown
Contributor

Summary

Makes build/version the single source of truth for act's package versioning and wires it into the deb/rpm Makefiles, so packages are versioned from git tags and successive builds are orderable. Ported from asmt#42 and aligned to the canonical aerospike-server resolver (build/README-VERSIONING.md there).

Changes

  • build/version — unified resolver with three modes:

    • build/version -v → master: bare x.y; dev branches: full git describe (x.y-<n>-g<sha>)
    • build/version -r → master: build number (first-parent commits since the tag, 0 on the tag); dev: 0
    • default → x.y-n

    Anchors on the bare x.y tag via --match '[0-9]*.[0-9]*' (never a leading-v tag the Debian Version: rejects), falls back to the short SHA, and resolves the branch through CI env vars for detached-HEAD checkouts (actions/checkout). Release line is master.

  • pkg/Makefile.debREV = build/version -v, BUILD_NUMBER = build/version -r + 1; version/revision now consistent between the control Version: and the .deb filename.

  • pkg/Makefile.rpmRPM_VERSION = $(subst -,_,$(REV)) (rpm forbids - in Version:), Release = BUILD_NUMBER.

  • pkg/rpm/act.specRelease: 1Release: @RELEASE@%{?dist} so the build number reaches rpm.

The +1 makes the tagged release (and dev builds) revision 1; unlike aerospike-server, act tags the release commit directly (no line-open marker tag), so -r is 0 there and the Makefile adds the 1.

Resulting package names

RPM DEB
master on tag act-6.7-1.el8.x86_64.rpm act_6.7-1ubuntu24.04_amd64.deb
master N past tag act-6.7-<N+1>.el8… act_6.7-<N+1>ubuntu24.04…
dev branch act-6.7_9_g489893fb9-1.el8… act_6.7-9-g489893fb9-1ubuntu24.04_amd64.deb

(dev rpm uses _ in the describe segment because rpm Version: cannot contain -.)

Note

The package version now comes from git tags, not src/common/version.h. version.h still drives the compiled binary's reported version (ACT version …), so between releases a master build's package tracks the last tag while the binary reports version.h. version.h is intentionally left unchanged by this PR.

Test plan

  • bash -n build/version; all modes + error paths exercised
  • Scratch-repo verification: master on/off-tag, dev branch, detached-HEAD via GITHUB_REF
  • make -f pkg/Makefile.{deb,rpm} print-REV/print-BUILD_NUMBER resolve correctly
  • CI build produces the expected .deb/.rpm names on a real Linux runner

🤖 Generated with Claude Code

@pvinh-spike
pvinh-spike requested a review from mcoberly2 July 28, 2026 22:11
pvinh-spike added a commit to aerospike/aerospike-tools-validation that referenced this pull request Jul 28, 2026
Rework build/version into the single source of truth for versioning, mirroring
the aerospike-server resolver, and wire it into deb/rpm packaging. Ported from
aerospike/act#81 (adapted for 3-part semver x.y.z).

- build/version: -v (bare x.y.z on master, full git-describe with sha on dev
  branches), -r (build number: first-parent commits since the tag, 0 on the
  tag; 0 on dev), default (x.y.z-n). Anchors on the bare x.y.z tag via
  --match '[0-9]*.[0-9]*.[0-9]*' (never a leading-v tag the Debian Version:
  rejects), falls back to the short sha, and resolves the branch through CI env
  vars for detached-HEAD checkouts. Replaces the previous describe+awk stub
  that stripped every build to bare x.y.z (no build number, no dev descriptor).
- pkg/Makefile.{deb,rpm}: REV = build/version -v, BUILD_NUMBER = -r + 1 so the
  tagged release and dev builds are revision 1 and successive master builds are
  orderable. rpm maps '-' -> '_' in Version (rpm forbids '-').
- pkg/rpm/asvalidation.spec: Release 1 -> @Release@ so the build number reaches rpm.

Package names:
  master on tag  asvalidation_2.2.0-1<os>_<arch>.deb   asvalidation-2.2.0-1.<dist>.<arch>.rpm
  dev            asvalidation_2.2.0-<n>-g<sha>-1<os>   asvalidation-2.2.0_<n>_g<sha>-1.<dist>

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
pvinh-spike added a commit to aerospike/aerospike-tools-validation that referenced this pull request Jul 28, 2026
Rework build/version into the single source of truth for versioning, mirroring
the aerospike-server resolver, and wire it into deb/rpm packaging. Ported from
aerospike/act#81 (adapted for 3-part semver x.y.z).

- build/version: -v (bare x.y.z on master, full git-describe with sha on dev
  branches), -r (build number, 1-based: first-parent commits since the tag + 1,
  so the tagged release is 1; dev branches are 1), default (x.y.z-n). Anchors on
  the bare x.y.z tag via --match '[0-9]*.[0-9]*.[0-9]*' (never a leading-v tag the
  Debian Version: rejects), falls back to the short sha, and resolves the branch
  through CI env vars for detached-HEAD checkouts. Replaces the previous
  describe+awk stub that stripped every build to bare x.y.z (no build number, no
  dev descriptor).
- pkg/Makefile.{deb,rpm}: REV = build/version -v, BUILD_NUMBER = build/version -r,
  so successive master builds are orderable. rpm maps '-' -> '_' in Version
  (rpm forbids '-').
- pkg/rpm/asvalidation.spec: Release 1 -> @Release@ so the build number reaches rpm.

Package names:
  master on tag  asvalidation_2.2.0-1<os>_<arch>.deb   asvalidation-2.2.0-1.<dist>.<arch>.rpm
  dev            asvalidation_2.2.0-<n>-g<sha>-1<os>   asvalidation-2.2.0_<n>_g<sha>-1.<dist>

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Rework build/version into the single source of truth for versioning, mirroring
the aerospike-server resolver, and wire it into deb/rpm packaging.

- build/version: -v (bare x.y on master, full git-describe with sha on dev
  branches), -r (build number, 1-based: first-parent commits since the tag + 1,
  so the tagged release is 1; dev branches are 1), default (x.y-n). Anchors on
  the bare x.y tag via --match '[0-9]*.[0-9]*' (never a leading-v tag the Debian
  Version: rejects), falls back to the short SHA, and resolves the branch through
  CI env vars for detached-HEAD checkouts.
- pkg/Makefile.{deb,rpm}: REV = build/version -v, BUILD_NUMBER = build/version -r,
  so successive master builds are orderable. rpm maps '-' -> '_' in Version
  (rpm forbids '-').
- pkg/rpm/act.spec: Release 1 -> @Release@ so the build number reaches rpm.

Package names:
  master on tag  act_6.7-1<os>_<arch>.deb   act-6.7-1.<dist>.<arch>.rpm
  dev            act_6.7-<n>-g<sha>-1<os>   act-6.7_<n>_g<sha>-1.<dist>

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant