Gentoo Archives: gentoo-commits

From: Mike Frysinger <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/releng:master commit in: tools/
Date: Sun, 31 May 2020 16:32:48
Message-Id: 1590942722.cfc55d171282a7eeb38a6e33744fd747dddb88d1.vapier@gentoo
1 commit: cfc55d171282a7eeb38a6e33744fd747dddb88d1
2 Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
3 AuthorDate: Sun May 31 16:32:02 2020 +0000
4 Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
5 CommitDate: Sun May 31 16:32:02 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/releng.git/commit/?id=cfc55d17
7
8 catalyst-auto: standardize indentation
9
10 This file uses tabs in most of it, so migrate the few funcs using
11 spaces over to tabs.
12
13 Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
14
15 tools/catalyst-auto | 112 ++++++++++++++++++++++++++--------------------------
16 1 file changed, 56 insertions(+), 56 deletions(-)
17
18 diff --git a/tools/catalyst-auto b/tools/catalyst-auto
19 index e6d32244..a1e1d7f2 100755
20 --- a/tools/catalyst-auto
21 +++ b/tools/catalyst-auto
22 @@ -25,13 +25,13 @@ lastrun=0
23 lock_file=
24
25 usage() {
26 - local msg=$1
27 + local msg=$1
28
29 - if [ -n "${msg}" ]; then
30 - printf "%b\n\n" "${msg}"
31 - fi
32 + if [ -n "${msg}" ]; then
33 + printf "%b\n\n" "${msg}"
34 + fi
35
36 - cat <<EOH
37 + cat <<EOH
38 Usage:
39 catalyst-auto [-c|--config <config>] [-v|--verbose] [-h|--help]
40
41 @@ -49,66 +49,66 @@ EOH
42 }
43
44 send_email() {
45 - local subject="${EMAIL_SUBJECT_PREPEND} $1"
46 - local message=$2
47 - local logfile=$3
48 - local body
49 -
50 - if [ -n "${logfile}" ]; then
51 - body=$(printf '%b\n\n\n' "${message}"; tail -n 200 "${logfile}"; printf '\n\n\nFull build log at %s\n' "${logfile}")
52 - else
53 - body=${message}
54 - fi
55 -
56 - printf 'From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n%b' \
57 - "${EMAIL_FROM}" "${EMAIL_TO}" "${subject}" "${body}" | \
58 - /usr/sbin/sendmail -f "${EMAIL_FROM}" ${EMAIL_TO//,/ }
59 + local subject="${EMAIL_SUBJECT_PREPEND} $1"
60 + local message=$2
61 + local logfile=$3
62 + local body
63 +
64 + if [ -n "${logfile}" ]; then
65 + body=$(printf '%b\n\n\n' "${message}"; tail -n 200 "${logfile}"; printf '\n\n\nFull build log at %s\n' "${logfile}")
66 + else
67 + body=${message}
68 + fi
69 +
70 + printf 'From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n%b' \
71 + "${EMAIL_FROM}" "${EMAIL_TO}" "${subject}" "${body}" | \
72 + /usr/sbin/sendmail -f "${EMAIL_FROM}" ${EMAIL_TO//,/ }
73 }
74
75 # Usage: run_cmd <logfile> <command to run>
76 run_cmd() {
77 - local logfile="$1"
78 - shift
79 -
80 - echo "*** Running command: $*" &>> "${logfile}"
81 - if [ $verbose = 2 ]; then
82 - echo "*** Running command: $*"
83 - "$@" 2>&1 | tee -a "${logfile}"
84 - elif [ $verbose = 1 ]; then
85 - echo "*** Running command: $*"
86 - "$@" &>> "${logfile}"
87 - else
88 - "$@" &>> "${logfile}"
89 - fi
90 -
91 - # If we used tee above, make sure we pass back up the command's error.
92 - return ${PIPESTATUS[0]}
93 + local logfile="$1"
94 + shift
95 +
96 + echo "*** Running command: $*" &>> "${logfile}"
97 + if [[ ${verbose} == 2 ]]; then
98 + echo "*** Running command: $*"
99 + "$@" 2>&1 | tee -a "${logfile}"
100 + elif [[ ${verbose} == 1 ]]; then
101 + echo "*** Running command: $*"
102 + "$@" &>> "${logfile}"
103 + else
104 + "$@" &>> "${logfile}"
105 + fi
106 +
107 + # If we used tee above, make sure we pass back up the command's error.
108 + return ${PIPESTATUS[0]}
109 }
110
111 update_symlinks() {
112 - # This is a skeleton function that you can override from the config file.
113 - # It will be called by pre_build and after completing the build of a set
114 - # to ensure the symlinks point to the latest built stages.
115 - :
116 + # This is a skeleton function that you can override from the config file.
117 + # It will be called by pre_build and after completing the build of a set
118 + # to ensure the symlinks point to the latest built stages.
119 + :
120 }
121
122 pre_build() {
123 - # This is a skeleton function that you can override from the config file.
124 - # It will be executed before the build is started.
125 - update_symlinks
126 + # This is a skeleton function that you can override from the config file.
127 + # It will be executed before the build is started.
128 + update_symlinks
129 }
130
131 post_build() {
132 - # This is a skeleton function that you can override from the config file.
133 - # It will be executed after the build is successfully completed. You can
134 - # use this to rsync the builds to another box
135 - :
136 + # This is a skeleton function that you can override from the config file.
137 + # It will be executed after the build is successfully completed. You can
138 + # use this to rsync the builds to another box
139 + :
140 }
141
142 catalyst_var() {
143 - # Extract a setting from the catalyst.conf.
144 - local var=$1
145 - (. "${CATALYST_CONFIG}"; echo "${!var}")
146 + # Extract a setting from the catalyst.conf.
147 + local var=$1
148 + (. "${CATALYST_CONFIG}"; echo "${!var}")
149 }
150
151 trigger_post_build() {
152 @@ -166,13 +166,13 @@ parse_args() {
153 }
154
155 give_latest_from_dates() {
156 - sed 's,-20,~20,g' | \
157 - sort -k +1 -n -t '~' |\
158 - awk -F\~ \
159 - 'BEGIN{i=$1; o=$0};
160 - { if($1 != i && i != "") { print o; }; i=$1; o=$0; }
161 - END { print o; };' | \
162 - tr '~' '-'
163 + sed 's,-20,~20,g' | \
164 + sort -k +1 -n -t '~' | \
165 + awk -F'~' \
166 + 'BEGIN{i=$1; o=$0};
167 + { if($1 != i && i != "") { print o; }; i=$1; o=$0; }
168 + END { print o; };' | \
169 + tr '~' '-'
170 }
171
172 # Replace the date/time stamp in the filename to "latest".