Gentoo Archives: gentoo-commits

From: Matt Turner <mattst88@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/releng:master commit in: tools/
Date: Thu, 30 Apr 2020 22:54:18
Message-Id: 1588226699.943e1a71819f93c595bbfe5583d4a92baa25dd34.mattst88@gentoo
1 commit: 943e1a71819f93c595bbfe5583d4a92baa25dd34
2 Author: Matt Turner <mattst88 <AT> gentoo <DOT> org>
3 AuthorDate: Thu Apr 30 04:49:10 2020 +0000
4 Commit: Matt Turner <mattst88 <AT> gentoo <DOT> org>
5 CommitDate: Thu Apr 30 06:04:59 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/releng.git/commit/?id=943e1a71
7
8 catalyst-auto: Support sqfs snapshots
9
10 Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>
11
12 tools/catalyst-auto | 31 ++++++++++++++++++++++++-------
13 1 file changed, 24 insertions(+), 7 deletions(-)
14
15 diff --git a/tools/catalyst-auto b/tools/catalyst-auto
16 index 66ff5ecc..f8258545 100755
17 --- a/tools/catalyst-auto
18 +++ b/tools/catalyst-auto
19 @@ -279,7 +279,24 @@ run_catalyst_commands() {
20 fi
21 fi
22
23 - TIMESTAMP=$(date -u +%Y%m%dT%H%M%SZ)
24 + if catalyst --help | grep -q "git-treeish"; then
25 + snapshot_log=$(mktemp --tmpdir="${TMP_PATH:-/tmp}")
26 + if ! run_cmd "${snapshot_log}" catalyst -c "${CATALYST_CONFIG}" -s stable; then
27 + send_email "Catalyst build error - snapshot" "" "${snapshot_log}"
28 + exit 1
29 + fi
30 +
31 + read TREEISH gitdir <<<$(egrep -o 'Creating .* tree snapshot [0-9a-f]{40} from .*' "${snapshot_log}" | cut -d' ' -f5,7)
32 + TIMESTAMP=$(git -C "${gitdir}" show --no-patch --format=%cd --date=format:%Y%m%dT%H%M%SZ "${TREEISH}")
33 + else
34 + TIMESTAMP=$(date -u +%Y%m%dT%H%M%SZ)
35 +
36 + snapshot_log=$(mktemp --tmpdir="${TMP_PATH:-/tmp}")
37 + if ! run_cmd "${snapshot_log}" catalyst -c "${CATALYST_CONFIG}" -s "${TIMESTAMP}"; then
38 + send_email "Catalyst build error - snapshot" "" "${snapshot_log}"
39 + exit 1
40 + fi
41 + fi
42 TMPDIR=$(mktemp -d --tmpdir="${TMP_PATH:-/tmp}" "catalyst-auto.${TIMESTAMP}.XXXXXX")
43
44 # Nuke any previous tmpdirs to keep them from accumulating.
45 @@ -297,6 +314,7 @@ run_catalyst_commands() {
46 echo "Couldn't create tempdirs!"
47 exit 1
48 fi
49 + mv "${snapshot_log}" "${TMPDIR}/log/snapshot.log"
50
51 if ! run_cmd "${TMPDIR}/log/pre_build.log" pre_build; then
52 send_email "Catalyst build error - pre_build" "The pre_build function failed" "${TMPDIR}/log/pre_build.log"
53 @@ -334,10 +352,15 @@ run_catalyst_commands() {
54 done
55 fi
56
57 + if [[ -n ${TREEISH} ]]; then
58 + sed -i -e "s|snapshot:.*|snapshot_treeish: ${TREEISH}|g" "${i}"
59 + fi
60 +
61 # Expand vars that the spec expects us to.
62 sed -i \
63 -e "s:@TIMESTAMP@:${TIMESTAMP}:g" \
64 -e "s:@REPO_DIR@:${REPO_DIR}:g" \
65 + -e "s:@TREEISH@:${TREEISH}:g" \
66 "${i}"
67 done
68
69 @@ -358,12 +381,6 @@ run_catalyst_commands() {
70 popd >/dev/null
71 fi
72
73 - # Create snapshot
74 - if ! run_cmd "${TMPDIR}/log/snapshot.log" catalyst -c "${CATALYST_CONFIG}" -s "${TIMESTAMP}"; then
75 - send_email "Catalyst build error - snapshot" "" "${TMPDIR}/log/snapshot.log"
76 - exit 1
77 - fi
78 -
79 build_failure=0
80
81 timeprefix=()