fix(builder): bump test versions to next patch
After a stable tag vX.Y.Z, untagged commits now produce X.Y.(Z+1)~date.branch.n+gSHA so test DEBs sort above the last official release and still below the next official X.Y.(Z+1).
This commit is contained in:
@@ -11,7 +11,7 @@ With --docker, print the Docker tag rendering of that version.
|
||||
|
||||
Derivation (builder contract «版本号»):
|
||||
official HEAD exact-match of vX.Y.Z → X.Y.Z
|
||||
test nearest ancestor stable tag → X.Y.Z~YYYYMMDD.branch.n+gSHA
|
||||
test nearest ancestor stable tag vX.Y.Z → X.Y.(Z+1)~YYYYMMDD.branch.n+gSHA
|
||||
no tag no stable tag reachable from HEAD → 0.0.0~YYYYMMDD.branch+gSHA
|
||||
|
||||
YYYYMMDD is the build date. SOURCE_DATE_EPOCH, if set, is that instant in
|
||||
@@ -62,6 +62,15 @@ is_official_version() {
|
||||
[[ "$1" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]
|
||||
}
|
||||
|
||||
# Mechanical sort key: next patch of a stable tag / X.Y.Z version.
|
||||
# v1.2.0 → 1.2.1. Not a claim that the next official release is 1.2.1.
|
||||
bump_patch() {
|
||||
local v=$1 major minor patch
|
||||
v=${v#v}
|
||||
IFS=. read -r major minor patch <<<"$v"
|
||||
printf '%s.%s.%s' "$major" "$minor" "$((10#$patch + 1))"
|
||||
}
|
||||
|
||||
# Strip one leading v if present.
|
||||
strip_v() {
|
||||
local v=$1
|
||||
@@ -163,7 +172,7 @@ derive_canonical() {
|
||||
return
|
||||
fi
|
||||
n=$(gitc rev-list --count "${base}..HEAD")
|
||||
printf '%s~%s.%s.%s+g%s' "${base#v}" "$ymd" "$branch" "$n" "$sha"
|
||||
printf '%s~%s.%s.%s+g%s' "$(bump_patch "$base")" "$ymd" "$branch" "$n" "$sha"
|
||||
}
|
||||
|
||||
to_docker() {
|
||||
|
||||
Reference in New Issue
Block a user