v29.4-roots.4 · Commit 7: [PATCH 07/37] release: establish Roots maintenance and assurance
contrib/guix/libexec/make_release_tarball.sh
Before: /dev/null · After: contrib/guix/libexec/make_release_tarball.sh
File metadata
new file mode 100755 index 0000000000000000000000000000000000000000..4f111897b759a05a3aacb68ee226864bef82ceda
Download original patch · Release notes
Diff rows 1–51 of 51. 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.
contrib/guix/libexec/make_release_tarball.sh
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Copyright (c) 2020 The Bitcoin Core 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
|
+
# Generate a reproducible source archive from the checked-out Git revision.
|
|
7
|
+
# The generated build-info header preserves the reviewed tag in a source tree
|
|
8
|
+
# that intentionally no longer carries Git metadata.
|
|
9
|
+
export LC_ALL=C
|
|
10
|
+
set -Eeuo pipefail
|
|
11
|
+
|
|
12
|
+
if [[ "$#" -ne 2 || -z "${REFERENCE_DATETIME:-}" ]]; then
|
|
13
|
+
printf 'Usage: REFERENCE_DATETIME=@epoch %s OUTPUT_ARCHIVE DISTNAME\n' "$0" >&2
|
|
14
|
+
exit 2
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
git_archive=$1
|
|
18
|
+
distname=$2
|
|
19
|
+
work_dir="$(mktemp -d)"
|
|
20
|
+
trap 'rm -rf -- "$work_dir"' EXIT
|
|
21
|
+
|
|
22
|
+
git archive --prefix="${distname}/" HEAD |
|
|
23
|
+
tar -C "$work_dir" -xp \
|
|
24
|
+
--exclude .cirrus.yml \
|
|
25
|
+
--exclude '.git*' \
|
|
26
|
+
--exclude ci \
|
|
27
|
+
--exclude '*minisketch*' \
|
|
28
|
+
--exclude 'doc/release-notes'
|
|
29
|
+
|
|
30
|
+
git_build_info="$(cmake -P cmake/script/GenerateBuildInfo.cmake)"
|
|
31
|
+
GIT_BUILD_INFO="$git_build_info" python3 - \
|
|
32
|
+
"$work_dir/${distname}/cmake/script/GenerateBuildInfo.cmake" <<'PYTHON'
|
|
33
|
+
import os
|
|
34
|
+
from pathlib import Path
|
|
35
|
+
import sys
|
|
36
|
+
|
|
37
|
+
path = Path(sys.argv[1])
|
|
38
|
+
marker = "// No build information available"
|
|
39
|
+
contents = path.read_text(encoding="utf-8")
|
|
40
|
+
if contents.count(marker) != 1:
|
|
41
|
+
raise SystemExit("missing generated build-info marker")
|
|
42
|
+
path.write_text(contents.replace(marker, os.environ["GIT_BUILD_INFO"]), encoding="utf-8")
|
|
43
|
+
PYTHON
|
|
44
|
+
|
|
45
|
+
mkdir -p "$(dirname -- "$git_archive")"
|
|
46
|
+
tar -C "$work_dir" \
|
|
47
|
+
--format=ustar \
|
|
48
|
+
--sort=name \
|
|
49
|
+
--mode='u+rw,go+r-w,a+X' --owner=0 --group=0 \
|
|
50
|
+
--mtime="$REFERENCE_DATETIME" \
|
|
51
|
+
-c "$distname" | gzip -9n > "$git_archive"
|