v29.4-roots.3 · Commit 7: [PATCH 07/30] release: establish Roots maintenance and assurance
ci/release/create-patch-series.sh
Before: /dev/null · After: ci/release/create-patch-series.sh
File metadata
new file mode 100755 index 0000000000000000000000000000000000000000..cbae9c2f3b9e380daf958de44ce5d082a2eb2172
Download original patch · Release notes
Diff rows 1–63 of 63. Line numbers refer to the original before/after files.
+ Added− RemovedUnmarked lines are context.
Scroll the code area horizontally to read long lines. The two line-number columns refer to before and after.
ci/release/create-patch-series.sh
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
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 2 ]]; then
|
|
10
|
+
printf 'Usage: %s RELEASE_TAG OUTPUT_FILE\n' "$0" >&2
|
|
11
|
+
exit 2
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
release_tag=$1
|
|
15
|
+
output_file=$2
|
|
16
|
+
script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
|
|
17
|
+
"$script_dir/validate-release-source.sh" "$release_tag"
|
|
18
|
+
|
|
19
|
+
version=${release_tag#v}
|
|
20
|
+
core_version=${version%%-roots.*}
|
|
21
|
+
core_ref="${RELEASE_CORE_REF:-refs/tags/v${core_version}}"
|
|
22
|
+
core_commit="$(git rev-parse --verify "${core_ref}^{commit}")"
|
|
23
|
+
tag_commit="$(git rev-parse --verify "refs/tags/${release_tag}^{commit}")"
|
|
24
|
+
|
|
25
|
+
output_parent=${output_file%/*}
|
|
26
|
+
if [[ "$output_parent" == "$output_file" ]]; then
|
|
27
|
+
output_parent=.
|
|
28
|
+
fi
|
|
29
|
+
mkdir -p -- "$output_parent"
|
|
30
|
+
output_parent="$(cd -- "$output_parent" && pwd -P)"
|
|
31
|
+
output_path="$output_parent/${output_file##*/}"
|
|
32
|
+
patch_tmp="$(mktemp "$output_parent/.roots-patch.XXXXXX")"
|
|
33
|
+
replay_dir="$(mktemp -d)"
|
|
34
|
+
|
|
35
|
+
cleanup() {
|
|
36
|
+
rm -f -- "$patch_tmp"
|
|
37
|
+
rm -rf -- "$replay_dir"
|
|
38
|
+
}
|
|
39
|
+
trap cleanup EXIT
|
|
40
|
+
|
|
41
|
+
git format-patch --stdout --binary --full-index --base="$core_commit" \
|
|
42
|
+
"${core_commit}..${tag_commit}" > "$patch_tmp"
|
|
43
|
+
if [[ ! -s "$patch_tmp" ]]; then
|
|
44
|
+
printf 'Generated patch series is empty for %s\n' "$release_tag" >&2
|
|
45
|
+
exit 1
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
git clone --quiet --no-hardlinks --shared . "$replay_dir/repository"
|
|
49
|
+
git -C "$replay_dir/repository" checkout --quiet --detach "$core_commit"
|
|
50
|
+
git -C "$replay_dir/repository" \
|
|
51
|
+
-c user.name='Bitcoin Roots release verification' \
|
|
52
|
+
-c user.email='release-verification@invalid' \
|
|
53
|
+
am -3 "$patch_tmp" >/dev/null
|
|
54
|
+
|
|
55
|
+
expected_tree="$(git rev-parse --verify "${tag_commit}^{tree}")"
|
|
56
|
+
replayed_tree="$(git -C "$replay_dir/repository" rev-parse --verify 'HEAD^{tree}')"
|
|
57
|
+
if [[ "$replayed_tree" != "$expected_tree" ]]; then
|
|
58
|
+
printf 'Patch replay tree does not match release tag %s\n' "$release_tag" >&2
|
|
59
|
+
exit 1
|
|
60
|
+
fi
|
|
61
|
+
|
|
62
|
+
mv -f -- "$patch_tmp" "$output_path"
|
|
63
|
+
printf '%s\n' "$output_path"
|