1 |
commit: a8e70e197696b8feee4dd8aa2c785770113bb5c3 |
2 |
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Jan 16 01:17:43 2018 +0000 |
4 |
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Jan 16 01:17:43 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/releng.git/commit/?id=a8e70e19 |
7 |
|
8 |
catalyst-auto: move git update into main script |
9 |
|
10 |
All of our config files are doing this already, so move it into the |
11 |
common code. |
12 |
|
13 |
tools/catalyst-auto | 31 +++++++++++++++++++++++++++-- |
14 |
tools/catalyst-auto-alpha.conf | 3 --- |
15 |
tools/catalyst-auto-amd64-experimental.conf | 3 --- |
16 |
tools/catalyst-auto-amd64.conf | 3 --- |
17 |
tools/catalyst-auto-arm64.conf | 3 --- |
18 |
tools/catalyst-auto-armv4tl.conf | 3 --- |
19 |
tools/catalyst-auto-armv5tel.conf | 3 --- |
20 |
tools/catalyst-auto-armv6j.conf | 3 --- |
21 |
tools/catalyst-auto-armv6j_hardfp.conf | 3 --- |
22 |
tools/catalyst-auto-armv7a.conf | 3 --- |
23 |
tools/catalyst-auto-armv7a_hardfp.conf | 3 --- |
24 |
tools/catalyst-auto-hppa.conf | 3 --- |
25 |
tools/catalyst-auto-ia64.conf | 3 --- |
26 |
tools/catalyst-auto-ppc.conf | 3 --- |
27 |
tools/catalyst-auto-ppc64.conf | 3 --- |
28 |
tools/catalyst-auto-s390.conf | 3 --- |
29 |
tools/catalyst-auto-s390x.conf | 3 --- |
30 |
tools/catalyst-auto-sparc64.conf | 3 --- |
31 |
tools/catalyst-auto-x86-experimental.conf | 4 ---- |
32 |
tools/catalyst-auto-x86.conf | 4 ---- |
33 |
20 files changed, 29 insertions(+), 61 deletions(-) |
34 |
|
35 |
diff --git a/tools/catalyst-auto b/tools/catalyst-auto |
36 |
index c06a42bf..cd23d159 100755 |
37 |
--- a/tools/catalyst-auto |
38 |
+++ b/tools/catalyst-auto |
39 |
@@ -93,8 +93,7 @@ update_symlinks() { |
40 |
|
41 |
pre_build() { |
42 |
# This is a skeleton function that you can override from the config file. |
43 |
- # It will be executed before the build is started. You can use this to |
44 |
- # update the checkout of the releng repo |
45 |
+ # It will be executed before the build is started. |
46 |
: |
47 |
} |
48 |
|
49 |
@@ -184,6 +183,31 @@ containerize() { |
50 |
fi |
51 |
} |
52 |
|
53 |
+# Update the git repo if possible. It might modify this script which will probably |
54 |
+# make bash fail (since bash parses as it executes). So we have to safely re-exec |
55 |
+# the script whenever there's an update. |
56 |
+git_update() { |
57 |
+ # If we've already relaunched, nothing to do. |
58 |
+ if [[ ${GIT_UPDATE} == "true" ]] ; then |
59 |
+ return |
60 |
+ fi |
61 |
+ |
62 |
+ pushd "${REPO_DIR}" >/dev/null |
63 |
+ git fetch -q |
64 |
+ revs=$(git rev-list HEAD..FETCH_HEAD) |
65 |
+ popd >/dev/null |
66 |
+ if [[ -n ${revs} ]] ; then |
67 |
+ GIT_UPDATE=true exec bash -c ' |
68 |
+ repo_dir=$1 script=$2 |
69 |
+ shift 2 |
70 |
+ pushd "${repo_dir}" >/dev/null |
71 |
+ git merge FETCH_HEAD || echo "${script}: WARNING: git repo is dirty" |
72 |
+ popd >/dev/null |
73 |
+ exec "${script}" "$@" |
74 |
+ ' -- "${REPO_DIR}" "$0" "$@" |
75 |
+ fi |
76 |
+} |
77 |
+ |
78 |
run_catalyst_commands() { |
79 |
doneconfig=0 |
80 |
for config_file in "${config_files[@]}"; do |
81 |
@@ -393,6 +417,9 @@ main() { |
82 |
# Parse user arguments before we try doing container logic. |
83 |
parse_args "$@" |
84 |
|
85 |
+ # Update the release git dir if possible. |
86 |
+ git_update "$@" |
87 |
+ |
88 |
# Try to isolate ourselves from the rest of the system. |
89 |
containerize "$@" |
90 |
|
91 |
|
92 |
diff --git a/tools/catalyst-auto-alpha.conf b/tools/catalyst-auto-alpha.conf |
93 |
index 8edbaf5d..f72747ab 100644 |
94 |
--- a/tools/catalyst-auto-alpha.conf |
95 |
+++ b/tools/catalyst-auto-alpha.conf |
96 |
@@ -24,9 +24,6 @@ give_latest_from_dates() { |
97 |
|
98 |
|
99 |
pre_build() { |
100 |
- cd ${REPO_DIR} |
101 |
- git pull |
102 |
- |
103 |
# Symlink the latest stages3 to build from |
104 |
for d in ${BUILD_SRCDIR_BASE}/builds/default ; do |
105 |
pushd $d >/dev/null |
106 |
|
107 |
diff --git a/tools/catalyst-auto-amd64-experimental.conf b/tools/catalyst-auto-amd64-experimental.conf |
108 |
index 535f4fb5..e4766949 100644 |
109 |
--- a/tools/catalyst-auto-amd64-experimental.conf |
110 |
+++ b/tools/catalyst-auto-amd64-experimental.conf |
111 |
@@ -72,9 +72,6 @@ update_symlinks() { |
112 |
} |
113 |
|
114 |
pre_build() { |
115 |
- pushd ${REPO_DIR} >/dev/null |
116 |
- git pull |
117 |
- popd >/dev/null |
118 |
update_symlinks |
119 |
} |
120 |
|
121 |
|
122 |
diff --git a/tools/catalyst-auto-amd64.conf b/tools/catalyst-auto-amd64.conf |
123 |
index b92f8314..a2a0abdc 100644 |
124 |
--- a/tools/catalyst-auto-amd64.conf |
125 |
+++ b/tools/catalyst-auto-amd64.conf |
126 |
@@ -76,9 +76,6 @@ update_symlinks() { |
127 |
} |
128 |
|
129 |
pre_build() { |
130 |
- pushd ${REPO_DIR} >/dev/null |
131 |
- git pull |
132 |
- popd >/dev/null |
133 |
update_symlinks |
134 |
} |
135 |
|
136 |
|
137 |
diff --git a/tools/catalyst-auto-arm64.conf b/tools/catalyst-auto-arm64.conf |
138 |
index bede1247..f987eb9f 100644 |
139 |
--- a/tools/catalyst-auto-arm64.conf |
140 |
+++ b/tools/catalyst-auto-arm64.conf |
141 |
@@ -27,9 +27,6 @@ give_latest_from_dates() { |
142 |
|
143 |
|
144 |
pre_build() { |
145 |
- cd ${REPO_DIR} |
146 |
- git pull |
147 |
- |
148 |
# Symlink the latest stages3 to build from |
149 |
for d in ${BUILD_SRCDIR_BASE}/builds/default ; do |
150 |
pushd $d |
151 |
|
152 |
diff --git a/tools/catalyst-auto-armv4tl.conf b/tools/catalyst-auto-armv4tl.conf |
153 |
index 75fda247..dfa65886 100644 |
154 |
--- a/tools/catalyst-auto-armv4tl.conf |
155 |
+++ b/tools/catalyst-auto-armv4tl.conf |
156 |
@@ -27,9 +27,6 @@ give_latest_from_dates() { |
157 |
|
158 |
|
159 |
pre_build() { |
160 |
- cd ${REPO_DIR} |
161 |
- git pull |
162 |
- |
163 |
# Symlink the latest stages3 to build from |
164 |
for d in ${BUILD_SRCDIR_BASE}/builds/default ; do |
165 |
pushd $d >/dev/null |
166 |
|
167 |
diff --git a/tools/catalyst-auto-armv5tel.conf b/tools/catalyst-auto-armv5tel.conf |
168 |
index 2a02f117..7ae17c0e 100644 |
169 |
--- a/tools/catalyst-auto-armv5tel.conf |
170 |
+++ b/tools/catalyst-auto-armv5tel.conf |
171 |
@@ -27,9 +27,6 @@ give_latest_from_dates() { |
172 |
|
173 |
|
174 |
pre_build() { |
175 |
- cd ${REPO_DIR} |
176 |
- git pull |
177 |
- |
178 |
# Symlink the latest stages3 to build from |
179 |
for d in ${BUILD_SRCDIR_BASE}/builds/default ; do |
180 |
pushd $d >/dev/null |
181 |
|
182 |
diff --git a/tools/catalyst-auto-armv6j.conf b/tools/catalyst-auto-armv6j.conf |
183 |
index bf5c3aa0..950b7f03 100644 |
184 |
--- a/tools/catalyst-auto-armv6j.conf |
185 |
+++ b/tools/catalyst-auto-armv6j.conf |
186 |
@@ -27,9 +27,6 @@ give_latest_from_dates() { |
187 |
|
188 |
|
189 |
pre_build() { |
190 |
- cd ${REPO_DIR} |
191 |
- git pull |
192 |
- |
193 |
# Symlink the latest stages3 to build from |
194 |
for d in ${BUILD_SRCDIR_BASE}/builds/default ; do |
195 |
pushd $d >/dev/null |
196 |
|
197 |
diff --git a/tools/catalyst-auto-armv6j_hardfp.conf b/tools/catalyst-auto-armv6j_hardfp.conf |
198 |
index 771f4454..86ae9ddb 100644 |
199 |
--- a/tools/catalyst-auto-armv6j_hardfp.conf |
200 |
+++ b/tools/catalyst-auto-armv6j_hardfp.conf |
201 |
@@ -27,9 +27,6 @@ give_latest_from_dates() { |
202 |
|
203 |
|
204 |
pre_build() { |
205 |
- cd ${REPO_DIR} |
206 |
- git pull |
207 |
- |
208 |
# Symlink the latest stages3 to build from |
209 |
for d in ${BUILD_SRCDIR_BASE}/builds/default ; do |
210 |
pushd $d >/dev/null |
211 |
|
212 |
diff --git a/tools/catalyst-auto-armv7a.conf b/tools/catalyst-auto-armv7a.conf |
213 |
index 363188b3..33138ce6 100644 |
214 |
--- a/tools/catalyst-auto-armv7a.conf |
215 |
+++ b/tools/catalyst-auto-armv7a.conf |
216 |
@@ -27,9 +27,6 @@ give_latest_from_dates() { |
217 |
|
218 |
|
219 |
pre_build() { |
220 |
- cd ${REPO_DIR} |
221 |
- git pull |
222 |
- |
223 |
# Symlink the latest stages3 to build from |
224 |
for d in ${BUILD_SRCDIR_BASE}/builds/default ; do |
225 |
pushd $d >/dev/null |
226 |
|
227 |
diff --git a/tools/catalyst-auto-armv7a_hardfp.conf b/tools/catalyst-auto-armv7a_hardfp.conf |
228 |
index e85ca6c0..55dae2e1 100644 |
229 |
--- a/tools/catalyst-auto-armv7a_hardfp.conf |
230 |
+++ b/tools/catalyst-auto-armv7a_hardfp.conf |
231 |
@@ -27,9 +27,6 @@ give_latest_from_dates() { |
232 |
|
233 |
|
234 |
pre_build() { |
235 |
- cd ${REPO_DIR} |
236 |
- git pull |
237 |
- |
238 |
# Symlink the latest stages3 to build from |
239 |
for d in ${BUILD_SRCDIR_BASE}/builds/default ; do |
240 |
pushd $d >/dev/null |
241 |
|
242 |
diff --git a/tools/catalyst-auto-hppa.conf b/tools/catalyst-auto-hppa.conf |
243 |
index aa5fdde2..18ca85ff 100644 |
244 |
--- a/tools/catalyst-auto-hppa.conf |
245 |
+++ b/tools/catalyst-auto-hppa.conf |
246 |
@@ -29,9 +29,6 @@ give_latest_from_dates() { |
247 |
|
248 |
|
249 |
pre_build() { |
250 |
- cd ${REPO_DIR} |
251 |
- git pull |
252 |
- |
253 |
# Symlink the latest stages3 to build from |
254 |
for d in ${BUILD_SRCDIR_BASE}/builds/default ; do |
255 |
pushd $d >/dev/null |
256 |
|
257 |
diff --git a/tools/catalyst-auto-ia64.conf b/tools/catalyst-auto-ia64.conf |
258 |
index fc53d33e..9f059ee3 100644 |
259 |
--- a/tools/catalyst-auto-ia64.conf |
260 |
+++ b/tools/catalyst-auto-ia64.conf |
261 |
@@ -24,9 +24,6 @@ give_latest_from_dates() { |
262 |
|
263 |
|
264 |
pre_build() { |
265 |
- cd ${REPO_DIR} |
266 |
- git pull |
267 |
- |
268 |
# Symlink the latest stages3 to build from |
269 |
for d in ${BUILD_SRCDIR_BASE}/builds/default ; do |
270 |
pushd $d >/dev/null |
271 |
|
272 |
diff --git a/tools/catalyst-auto-ppc.conf b/tools/catalyst-auto-ppc.conf |
273 |
index 2a20e4c1..43d9809f 100644 |
274 |
--- a/tools/catalyst-auto-ppc.conf |
275 |
+++ b/tools/catalyst-auto-ppc.conf |
276 |
@@ -25,9 +25,6 @@ give_latest_from_dates() { |
277 |
} |
278 |
|
279 |
pre_build() { |
280 |
- cd ${REPO_DIR} |
281 |
- git pull |
282 |
- |
283 |
# Symlink the latest stages3 to build from |
284 |
for d in ${BUILD_SRCDIR_BASE}/builds/default ; do |
285 |
pushd $d >/dev/null |
286 |
|
287 |
diff --git a/tools/catalyst-auto-ppc64.conf b/tools/catalyst-auto-ppc64.conf |
288 |
index fd169306..1dfe64a9 100644 |
289 |
--- a/tools/catalyst-auto-ppc64.conf |
290 |
+++ b/tools/catalyst-auto-ppc64.conf |
291 |
@@ -27,9 +27,6 @@ give_latest_from_dates() { |
292 |
|
293 |
|
294 |
pre_build() { |
295 |
- cd ${REPO_DIR} |
296 |
- git pull |
297 |
- |
298 |
# Symlink the latest stages3 to build from |
299 |
for d in ${BUILD_SRCDIR_BASE}/builds/default ; do |
300 |
pushd $d >/dev/null |
301 |
|
302 |
diff --git a/tools/catalyst-auto-s390.conf b/tools/catalyst-auto-s390.conf |
303 |
index 1f766eeb..e580032a 100644 |
304 |
--- a/tools/catalyst-auto-s390.conf |
305 |
+++ b/tools/catalyst-auto-s390.conf |
306 |
@@ -24,9 +24,6 @@ give_latest_from_dates() { |
307 |
|
308 |
|
309 |
pre_build() { |
310 |
- cd ${REPO_DIR} |
311 |
- git pull |
312 |
- |
313 |
# Symlink the latest stages3 to build from |
314 |
for d in ${BUILD_SRCDIR_BASE}/builds/default ; do |
315 |
pushd $d >/dev/null |
316 |
|
317 |
diff --git a/tools/catalyst-auto-s390x.conf b/tools/catalyst-auto-s390x.conf |
318 |
index a97a3f79..37e543f5 100644 |
319 |
--- a/tools/catalyst-auto-s390x.conf |
320 |
+++ b/tools/catalyst-auto-s390x.conf |
321 |
@@ -24,9 +24,6 @@ give_latest_from_dates() { |
322 |
|
323 |
|
324 |
pre_build() { |
325 |
- cd ${REPO_DIR} |
326 |
- git pull |
327 |
- |
328 |
# Symlink the latest stages3 to build from |
329 |
for d in ${BUILD_SRCDIR_BASE}/builds/default ; do |
330 |
pushd $d >/dev/null |
331 |
|
332 |
diff --git a/tools/catalyst-auto-sparc64.conf b/tools/catalyst-auto-sparc64.conf |
333 |
index f93796f0..cca8dd58 100644 |
334 |
--- a/tools/catalyst-auto-sparc64.conf |
335 |
+++ b/tools/catalyst-auto-sparc64.conf |
336 |
@@ -24,9 +24,6 @@ give_latest_from_dates() { |
337 |
|
338 |
|
339 |
pre_build() { |
340 |
- cd ${REPO_DIR} |
341 |
- git pull |
342 |
- |
343 |
# Symlink the latest stages3 to build from |
344 |
for d in ${BUILD_SRCDIR_BASE}/builds/{default,multilib} ; do |
345 |
pushd $d >/dev/null |
346 |
|
347 |
diff --git a/tools/catalyst-auto-x86-experimental.conf b/tools/catalyst-auto-x86-experimental.conf |
348 |
index dd0c180d..e2c19761 100644 |
349 |
--- a/tools/catalyst-auto-x86-experimental.conf |
350 |
+++ b/tools/catalyst-auto-x86-experimental.conf |
351 |
@@ -38,10 +38,6 @@ give_latest_from_dates() { |
352 |
} |
353 |
|
354 |
pre_build() { |
355 |
- pushd ${REPO_DIR} >/dev/null |
356 |
- git pull |
357 |
- popd >/dev/null |
358 |
- |
359 |
# Symlink the latest stages3 to build from |
360 |
for d in ${BUILD_SRCDIR_BASE}/{default,hardened} ; do |
361 |
pushd $d >/dev/null |
362 |
|
363 |
diff --git a/tools/catalyst-auto-x86.conf b/tools/catalyst-auto-x86.conf |
364 |
index deca9d07..286a9304 100644 |
365 |
--- a/tools/catalyst-auto-x86.conf |
366 |
+++ b/tools/catalyst-auto-x86.conf |
367 |
@@ -38,10 +38,6 @@ give_latest_from_dates() { |
368 |
} |
369 |
|
370 |
pre_build() { |
371 |
- pushd ${REPO_DIR} >/dev/null |
372 |
- git pull |
373 |
- popd >/dev/null |
374 |
- |
375 |
# Symlink the latest stages3 to build from |
376 |
for d in ${BUILD_SRCDIR_BASE}/{default,hardened} ; do |
377 |
pushd $d >/dev/null |