Skip to content
Bitcoin Roots

v29.4-roots.4 · Commit 7: [PATCH 07/37] release: establish Roots maintenance and assurance

ci/release/validate-release-source.sh

Before: /dev/null · After: ci/release/validate-release-source.sh

File metadata
new file mode 100755
index 0000000000000000000000000000000000000000..bfa4fb8830e7bf000770d4dd28d27ff6693bb24e

Download original patch · Release notes

Diff rows 1–57 of 57. Line numbers refer to the original before/after files.

+ Added− RemovedUnmarked lines are context.

Scroll the code area horizontally to read long lines. Before is on the left; after is on the right. Unified view fits narrow screens more easily.

ci/release/validate-release-source.sh ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # Copyright (c) 2026-present The Bitcoin Roots developers
3
+ # Distributed under the MIT software license, see the accompanying
4
+ # file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
+
6
+ export LC_ALL=C
7
+ set -Eeuo pipefail
8
+
9
+ if [[ "$#" -ne 1 ]]; then
10
+ printf 'Usage: %s RELEASE_TAG\n' "$0" >&2
11
+ exit 2
12
+ fi
13
+
14
+ release_tag=$1
15
+ script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
16
+ "$script_dir/validate-release-tag.sh" "$release_tag"
17
+
18
+ if ! tag_object="$(git rev-parse --verify --quiet "refs/tags/${release_tag}^{tag}")"; then
19
+ printf 'Release tag must be annotated: %s\n' "$release_tag" >&2
20
+ exit 1
21
+ fi
22
+ tag_commit="$(git rev-parse --verify "${tag_object}^{commit}")"
23
+ head_commit="$(git rev-parse --verify 'HEAD^{commit}')"
24
+ if [[ "$head_commit" != "$tag_commit" ]]; then
25
+ printf 'Checked-out commit does not match release tag %s\n' "$release_tag" >&2
26
+ exit 1
27
+ fi
28
+
29
+ version=${release_tag#v}
30
+ core_version=${version%%-roots.*}
31
+ canonical_ref="${RELEASE_CANONICAL_REF:-origin/roots/${core_version}}"
32
+ core_ref="${RELEASE_CORE_REF:-refs/tags/v${core_version}}"
33
+
34
+ if ! canonical_commit="$(git rev-parse --verify --quiet "${canonical_ref}^{commit}")"; then
35
+ printf 'Canonical release branch reference is unavailable: %s\n' "$canonical_ref" >&2
36
+ exit 1
37
+ fi
38
+ if [[ "$tag_commit" != "$canonical_commit" ]]; then
39
+ printf 'Release tag %s does not match canonical branch tip %s\n' "$release_tag" "$canonical_ref" >&2
40
+ exit 1
41
+ fi
42
+ if ! core_commit="$(git rev-parse --verify --quiet "${core_ref}^{commit}")"; then
43
+ printf 'Bitcoin Core base reference is unavailable: %s\n' "$core_ref" >&2
44
+ exit 1
45
+ fi
46
+ if ! git merge-base --is-ancestor "$core_commit" "$tag_commit"; then
47
+ printf 'Release tag %s is not based on %s\n' "$release_tag" "$core_ref" >&2
48
+ exit 1
49
+ fi
50
+ if [[ "$core_commit" == "$tag_commit" ]]; then
51
+ printf 'Release tag %s has no Roots commits after %s\n' "$release_tag" "$core_ref" >&2
52
+ exit 1
53
+ fi
54
+ if git rev-list --min-parents=2 "${core_commit}..${tag_commit}" | grep -q .; then
55
+ printf 'Release patch stack must be linear between %s and %s\n' "$core_ref" "$release_tag" >&2
56
+ exit 1
57
+ fi