]>
Commit | Line | Data |
---|---|---|
1344b6f1 MM |
1 | #!/bin/sh |
2 | ||
b4818b81 AM |
3 | # prevent "*" from being expanded in builders var |
4 | cd /usr/share/empty | |
5 | ||
864cdeb5 | 6 | builders= |
864cdeb5 MM |
7 | with= |
8 | without= | |
9 | flags= | |
10 | command= | |
11 | command_flags= | |
16b5ec37 | 12 | gpg_opts= |
e728b34c ER |
13 | default_branch='HEAD' |
14 | distro= | |
bcb3a8b8 | 15 | url= |
218a4c96 | 16 | no_depend=no |
bfa10c0d AM |
17 | |
18 | [ -x /usr/bin/python ] && send_mode="python" || send_mode="mail" | |
544ca060 | 19 | |
e29fbd39 AG |
20 | if [ -n "$HOME_ETC" ]; then |
21 | USER_CFG=$HOME_ETC/.requestrc | |
544ca060 | 22 | else |
e29fbd39 | 23 | USER_CFG=$HOME/.requestrc |
e728b34c | 24 | fi |
e29fbd39 | 25 | |
e728b34c | 26 | if [ ! -f "$USER_CFG" ]; then |
e29fbd39 | 27 | echo "Creating config file $USER_CFG. You *must* edit it." |
bcb3a8b8 | 28 | cat > $USER_CFG <<EOF |
1344b6f1 | 29 | priority=2 |
e728b34c | 30 | requester=deviloper@pld-linux.org |
544ca060 | 31 | default_key=deviloper@pld-linux.org |
bfa10c0d AM |
32 | send_mode="$send_mode" |
33 | url="$url" | |
1344b6f1 | 34 | mailer="/usr/sbin/sendmail -t" |
16b5ec37 | 35 | gpg_opts="" |
e728b34c | 36 | distro=th |
1cd123e3 | 37 | url="http://src.th.pld-linux.org:1234/" |
1344b6f1 | 38 | |
a757e911 | 39 | # defaults: |
771f742d | 40 | f_upgrade=yes |
544ca060 MM |
41 | EOF |
42 | exit | |
43 | fi | |
44 | ||
e728b34c | 45 | if [ -f "$USER_CFG" ]; then |
9cc9841b | 46 | . $USER_CFG |
e728b34c ER |
47 | fi |
48 | ||
45d8ed70 ER |
49 | # internal options, not to be overriden |
50 | specs= | |
51 | df_fetch=no | |
a166aeda | 52 | upgrade_macros=no |
45d8ed70 | 53 | |
c9f4704f ER |
54 | # Set colors |
55 | c_star=$(tput setaf 2) | |
56 | c_norm=$(tput op) | |
57 | msg() { | |
58 | echo >&2 "${c_star}*${c_norm} $*" | |
59 | } | |
60 | ||
45d8ed70 ER |
61 | die() { |
62 | echo >&2 "$0: $*" | |
63 | exit 1 | |
64 | } | |
65 | ||
bfa10c0d | 66 | send_request() { |
bcb3a8b8 ER |
67 | # switch to mail mode, if no url set |
68 | [ -z "$url" ] && send_mode="mail" | |
69 | ||
bcb3a8b8 ER |
70 | case "$send_mode" in |
71 | "mail") | |
c9f4704f | 72 | msg "Sending using mail mode" |
bcb3a8b8 ER |
73 | cat - | $mailer |
74 | ;; | |
75 | *) | |
c9f4704f | 76 | msg "Sending using http mode to $url" |
bcb3a8b8 | 77 | cat - | python -c ' |
e3a591a1 | 78 | import sys, socket, urllib2 |
bfa10c0d AM |
79 | |
80 | try: | |
81 | data = sys.stdin.read() | |
e6aa37ec | 82 | url = sys.argv[1] |
e3a591a1 | 83 | socket.setdefaulttimeout(10) |
e6aa37ec | 84 | req = urllib2.Request(url, data) |
e3a591a1 | 85 | f = urllib2.urlopen(req) |
bfa10c0d AM |
86 | f.close() |
87 | except Exception, e: | |
e6aa37ec | 88 | print >> sys.stderr, "Problem while sending request via HTTP: %s: %s" % (url, e) |
bfa10c0d | 89 | sys.exit(1) |
f04b3329 | 90 | print >> sys.stdout, "Request queued via HTTP." |
bfa10c0d | 91 | ' "$url" |
bcb3a8b8 ER |
92 | ;; |
93 | esac | |
bfa10c0d AM |
94 | } |
95 | ||
45d8ed70 ER |
96 | # simple df_fetcher, based on packages/fetchsrc_request |
97 | # TODO: tcp (smtp) mode | |
98 | # TODO: adjust for ~/.requestrc config | |
99 | df_fetch() { | |
100 | local specs="$@" | |
101 | ||
102 | # Sending by | |
103 | local MAILER='/usr/sbin/sendmail' | |
104 | # MAILER='/usr/bin/msmtp' | |
105 | # Sending via | |
106 | local VIA="SENDMAIL" | |
107 | #VIA="localhost" | |
108 | local VIA_ARGS="" | |
109 | #VIA_ARGS="some additional flags" | |
110 | # e.g. for msmtp: | |
111 | # VIA_ARGS='-a gmail' | |
112 | # | |
113 | # DISTFILES EMAIL | |
114 | local DMAIL="distfiles@pld-linux.org" | |
115 | ||
116 | local HOST=$(hostname -f) | |
117 | local LOGIN=${requester%@*} | |
118 | ||
119 | for spec in $specs; do | |
120 | local SPEC=$(echo "$spec" | sed -e 's|:.*||') | |
121 | local BRANCH=$(echo "$spec" | sed -e 's|.*:||') | |
122 | echo >&2 "Distfiles Request: $SPEC:$BRANCH via $MAILER ${VIA_ARGS:+ ($VIA_ARGS)}" | |
123 | cat <<-EOF | "$MAILER" -t -i $VIA_ARGS | |
124 | To: $DMAIL | |
125 | From: $LOGIN <$LOGIN@$HOST> | |
126 | Subject: fetchsrc_request notify | |
127 | X-CVS-Module: SPECS | |
128 | X-distfiles-request: yes | |
129 | X-Login: $LOGIN | |
130 | X-Spec: $SPEC | |
131 | X-Branch: $BRANCH | |
132 | X-Flags: force-reply | |
133 | ||
134 | . | |
135 | EOF | |
136 | done | |
a757e911 | 137 | } |
1344b6f1 | 138 | |
586a5f1f | 139 | usage() { |
23e1dcfb ER |
140 | cat <<EOF |
141 | Usage: make-request.sh [OPTION] ... [SPECFILE] .... | |
142 | ||
143 | Mandatory arguments to long options are mandatory for short options too. | |
144 | ||
bb30a063 ER |
145 | -C, --config-file /path/to/config/file |
146 | Source additional config file (after $USER_CFG), useful when | |
147 | when sending build requests to Ac/Th from the same account | |
148 | -b 'BUILDER BUILDER ...', --builder='BUILDER BUILDER ...' | |
23e1dcfb | 149 | Sends request to given builders (in 'version-arch' format) |
bb30a063 ER |
150 | --with VALUE, --without VALUE |
151 | Build package with(out) a given bcond | |
23e1dcfb | 152 | --kernel VALUE |
bb30a063 | 153 | set alt_kernel to VALUE |
23e1dcfb | 154 | --target VALUE |
bb30a063 | 155 | set --target to VALUE |
23e1dcfb | 156 | -s BUILD_ID, --skip BUILD_ID[,BUILD_ID][,BUILD_ID] |
bb30a063 | 157 | mark build ids on src builder to be skipped |
23e1dcfb | 158 | --branch VALUE |
bb30a063 ER |
159 | specify default branch for specs in request |
160 | -t, --test-build | |
0e59dd68 AM |
161 | Performs a 'test-build'. Package will be uploaded to hidden .test-builds/ |
162 | ftp tree and won't be upgraded on builders. | |
bb30a063 | 163 | -r, --ready-build |
0e59dd68 AM |
164 | Preforms a 'ready' build. Package will be built and uploaded to test/ ftp tree |
165 | (and later moved by release manager staff to ready/ and main ftp tree) | |
bb30a063 ER |
166 | -u, --upgrade |
167 | Forces package upgrade (for use with -c or -q, not -t) | |
168 | -n, --no-upgrade | |
169 | Disables package upgrade (for use with -r) | |
218a4c96 | 170 | -ni, --no-install-br |
bb30a063 | 171 | Do not install missing BuildRequires (--nodeps) |
218a4c96 ER |
172 | -nd, --no-depend |
173 | Do not add dependency of build jobs, each job in batch runs itself | |
bb30a063 ER |
174 | -j, --jobs |
175 | Number of parallel jobs for single build | |
176 | -f, --flag | |
177 | -d, --distro DISTRO | |
178 | Specify value for \$distro | |
179 | -df, --distfiles-fetch[-request] PACKAGE | |
180 | Send distfiles request to fetch sources for PACKAGE | |
181 | -cf, --command-flag | |
182 | Not yet documented | |
183 | -c, --command | |
184 | Executes a given command on builders | |
185 | --test-remove-pkg | |
186 | shortcut for --command poldek -evt ARGS | |
187 | --remove-pkg | |
188 | shortcut for --command poldek -ev --noask ARGS | |
189 | --upgrade-pkg | |
190 | shortcut for --command poldek --up -Uv ARGS | |
191 | --cvsup | |
192 | Updates builders infrastructure (outside chroot) | |
a166aeda ER |
193 | --update-macros |
194 | Updates rpm-build-macros on src builder | |
23e1dcfb | 195 | -q |
bb30a063 ER |
196 | shortcut for --command rpm -q ARGS |
197 | -g, --gpg-opts "opts" | |
198 | Pass additional options to gpg binary | |
199 | -p, --priority VALUE | |
200 | sets request priority (default 2) | |
201 | -h, --help | |
202 | Displays this help message | |
23e1dcfb ER |
203 | EOF |
204 | exit 0 | |
586a5f1f AG |
205 | } |
206 | ||
207 | ||
1344b6f1 | 208 | while [ $# -gt 0 ] ; do |
9cc9841b | 209 | case "$1" in |
bb30a063 | 210 | --distro | -d) |
9cc9841b ER |
211 | distro=$2 |
212 | shift | |
213 | ;; | |
214 | ||
bb30a063 | 215 | --config-file | -C) |
9cc9841b ER |
216 | [ -f $2 ] && . $2 || die "Config file not found" |
217 | shift | |
218 | ;; | |
219 | ||
bb30a063 | 220 | --builder | -b) |
9cc9841b ER |
221 | builders="$builders $2" |
222 | shift | |
223 | ;; | |
224 | ||
bb30a063 | 225 | --with) |
9cc9841b ER |
226 | with="$with $2" |
227 | shift | |
228 | ;; | |
229 | ||
bb30a063 | 230 | --without) |
9cc9841b ER |
231 | without="$without $2" |
232 | shift | |
233 | ;; | |
234 | ||
bb30a063 | 235 | --test-build | -t) |
9cc9841b ER |
236 | build_mode=test |
237 | f_upgrade=no | |
238 | ;; | |
239 | ||
bb30a063 | 240 | --kernel) |
9cc9841b ER |
241 | kernel=$2 |
242 | shift | |
243 | ;; | |
244 | ||
be264f26 ER |
245 | --target) |
246 | target=$2 | |
247 | shift | |
248 | ;; | |
249 | ||
db286098 | 250 | -s|--skip) |
897f56ee | 251 | skip="$2" |
db286098 ER |
252 | shift |
253 | ;; | |
254 | ||
11270534 ER |
255 | --branch) |
256 | branch=$2 | |
257 | shift | |
258 | ;; | |
259 | ||
bb30a063 | 260 | --priority | -p) |
9cc9841b ER |
261 | priority=$2 |
262 | shift | |
263 | ;; | |
264 | ||
bb30a063 | 265 | --ready-build | -r) |
9cc9841b ER |
266 | build_mode=ready |
267 | ;; | |
268 | ||
bb30a063 | 269 | --upgrade | -u) |
9cc9841b ER |
270 | f_upgrade=yes |
271 | ;; | |
272 | ||
bb30a063 | 273 | --no-upgrade | -n) |
9cc9841b ER |
274 | f_upgrade=no |
275 | ;; | |
276 | ||
218a4c96 ER |
277 | --no-depend | -nd) |
278 | no_depend=yes | |
279 | ;; | |
280 | ||
bb30a063 | 281 | --no-install-br | -ni) |
9cc9841b ER |
282 | flags="$flags no-install-br" |
283 | ;; | |
284 | ||
bb30a063 | 285 | -j | --jobs) |
d8f1c9c0 AM |
286 | jobs="$2" |
287 | shift | |
288 | ;; | |
289 | ||
bb30a063 | 290 | --flag | -f) |
9cc9841b ER |
291 | flags="$flags $2" |
292 | shift | |
293 | ;; | |
294 | ||
bb30a063 | 295 | --command-flags | -cf) |
9cc9841b ER |
296 | command_flags="$2" |
297 | shift | |
298 | ;; | |
299 | ||
bb30a063 | 300 | --command | -c) |
9cc9841b | 301 | command="$2" |
30ddd991 | 302 | if [ "$command" = - ]; then |
3f77765b ER |
303 | echo >&2 "Reading command from STDIN" |
304 | echo >&2 "---" | |
305 | command=$(cat) | |
306 | echo >&2 "---" | |
307 | fi | |
9cc9841b ER |
308 | f_upgrade=no |
309 | shift | |
310 | ;; | |
311 | --test-remove-pkg) | |
312 | command="poldek -evt $2" | |
313 | f_upgrade=no | |
314 | shift | |
315 | ;; | |
316 | --remove-pkg) | |
c4c115cc | 317 | command="for a in $2; do poldek -ev --noask \$a; done" |
9cc9841b ER |
318 | f_upgrade=no |
319 | shift | |
320 | ;; | |
b098536f | 321 | --upgrade-pkg|-Uhv) |
218a4c96 | 322 | command="poldek --up; poldek -uv $2" |
9cc9841b ER |
323 | f_upgrade=no |
324 | shift | |
325 | ;; | |
326 | -q) | |
327 | command="rpm -q $2" | |
328 | f_upgrade=no | |
329 | shift | |
330 | ;; | |
331 | ||
bb30a063 | 332 | --cvsup) |
9cc9841b ER |
333 | command_flags="no-chroot" |
334 | command="cvs up" | |
49a8a604 | 335 | f_upgrade=no |
9cc9841b ER |
336 | ;; |
337 | ||
a166aeda ER |
338 | --update-macros) |
339 | upgrade_macros="yes" | |
340 | ;; | |
341 | ||
45d8ed70 ER |
342 | -df | --distfiles-fetch | --distfiles-fetch-request) |
343 | df_fetch=yes | |
344 | ;; | |
345 | ||
bb30a063 | 346 | --gpg-opts | -g) |
1bf4c407 TP |
347 | gpg_opts="$2" |
348 | shift | |
349 | ;; | |
9cc9841b | 350 | |
bb30a063 | 351 | --help | -h) |
9cc9841b ER |
352 | usage |
353 | ;; | |
354 | ||
bb30a063 | 355 | -*) |
9cc9841b ER |
356 | die "unknown knob: $1" |
357 | ;; | |
358 | ||
bb30a063 | 359 | *:* | *) |
9cc9841b ER |
360 | specs="$specs $1" |
361 | ;; | |
362 | esac | |
363 | shift | |
1344b6f1 MM |
364 | done |
365 | ||
e728b34c ER |
366 | case "$distro" in |
367 | ac) | |
9cc9841b ER |
368 | builder_email="builder-ac@pld-linux.org" |
369 | default_builders="ac-*" | |
370 | default_branch="AC-branch" | |
8503c5d2 | 371 | url="http://ep09.pld-linux.org:1289/" |
a3387055 | 372 | control_url="http://ep09.pld-linux.org/~buildsrc" |
9cc9841b | 373 | ;; |
3e991c55 | 374 | ac-java) # fake "distro" for java available ac architectures |
e4047e17 | 375 | builder_email="builder-ac@pld-linux.org" |
9cc9841b ER |
376 | default_builders="ac-i586 ac-i686 ac-athlon ac-amd64" |
377 | default_branch="AC-branch" | |
8503c5d2 | 378 | url="http://ep09.pld-linux.org:1289/" |
9cc9841b | 379 | ;; |
70d46bca | 380 | ac-xen) # fake "distro" for xen-enabled architectures |
e4047e17 ER |
381 | builder_email="builder-ac@pld-linux.org" |
382 | default_builders="ac-i686 ac-athlon ac-amd64" | |
383 | default_branch="AC-branch" | |
70d46bca | 384 | ;; |
e728b34c | 385 | ti) |
9cc9841b ER |
386 | builder_email="builderti@ep09.pld-linux.org" |
387 | default_builders="ti-*" | |
5ed6b10a AM |
388 | url="http://ep09.pld-linux.org:1231/" |
389 | control_url="http://ep09.pld-linux.org/~builderti" | |
9cc9841b | 390 | ;; |
3274da14 | 391 | ti-dev) |
392 | builder_email="buildertidev@ep09.pld-linux.org" | |
393 | default_builders="ti-dev-*" | |
394 | url="http://ep09.pld-linux.org:1232/" | |
395 | control_url="http://ep09.pld-linux.org/~buildertidev" | |
396 | ;; | |
e728b34c | 397 | th) |
f0cfd110 | 398 | builder_email="builderth@pld-linux.org" |
9cc9841b | 399 | default_builders="th-*" |
1cd123e3 | 400 | url="http://src.th.pld-linux.org:1234/" |
f0cfd110 | 401 | control_url="http://src.th.pld-linux.org" |
9cc9841b | 402 | ;; |
3e991c55 | 403 | th-java) # fake "distro" for java available th architectures |
f0cfd110 | 404 | builder_email="builderth@pld-linux.org" |
976435cb | 405 | default_builders="th-x86_64 th-athlon th-i686" |
1cd123e3 | 406 | url="http://src.th.pld-linux.org:1234/" |
e219518b | 407 | ;; |
32384897 | 408 | aidath) |
409 | builder_email="builderaidath@ep09.pld-linux.org" | |
410 | default_builders="aidath-*" | |
411 | ;; | |
14b580de ER |
412 | *) |
413 | die "distro \`$distro' not known" | |
414 | ;; | |
e728b34c ER |
415 | esac |
416 | ||
897f56ee ER |
417 | # need to do this after distro selection |
418 | if [ "$skip" ]; then | |
9b86ba23 ER |
419 | skip=$(skip="$skip" control_url="$control_url" python -c ' |
420 | import urllib2 | |
421 | import sys | |
422 | import StringIO | |
423 | import gzip | |
424 | import re | |
425 | import os | |
426 | import string | |
427 | from xml.dom import minidom | |
428 | ||
429 | skip = os.environ.get("skip").split(","); | |
430 | control_url = os.environ.get("control_url") | |
431 | ||
432 | print >> sys.stderr, "* Check queue_id-s against %s" % control_url | |
433 | ||
434 | try: | |
435 | headers = { "Cache-Control": "no-cache", "Pragma": "no-cache" } | |
436 | req = urllib2.Request(url=control_url + "/queue.gz", headers=headers) | |
437 | f = urllib2.urlopen(req) | |
438 | except Exception, e: | |
439 | print >> sys.stderr, "Fetch error %s: %s" % (control_url + "/queue.gz", e) | |
440 | sys.exit(1) | |
441 | ||
442 | sio = StringIO.StringIO() | |
443 | sio.write(f.read()) | |
444 | f.close() | |
445 | sio.seek(0) | |
446 | f = gzip.GzipFile(fileobj = sio) | |
447 | ||
448 | xml = re.compile("(<queue>.*?</queue>)", re.DOTALL).match(f.read()).group(1) | |
449 | d = minidom.parseString(xml) | |
450 | ||
451 | q = [] | |
452 | for c in d.documentElement.childNodes: | |
453 | if c.nodeName != "group": | |
454 | continue | |
455 | q.append(c.attributes["id"].value) | |
456 | ||
457 | err = 0 | |
458 | for s in skip: | |
459 | if s not in q: | |
460 | print >> sys.stderr, "- Check %s: ERROR: Not valid queue-id" % s | |
461 | err = 1 | |
462 | else: | |
463 | print >> sys.stderr, "- Check %s: OK" % s | |
464 | if err == 1: | |
465 | sys.exit(1) | |
466 | print string.join(skip, ",") | |
467 | ') || exit $? | |
897f56ee ER |
468 | f_upgrade=no |
469 | build_mode=test | |
470 | priority=-1 | |
471 | command="skip:$skip" | |
472 | command_flags="no-chroot" | |
473 | builders="$distro-src" | |
474 | fi | |
475 | ||
11270534 ER |
476 | branch=${branch:-$default_branch} |
477 | ||
e728b34c | 478 | specs=`for s in $specs; do |
9cc9841b | 479 | case "$s" in |
218a4c96 ER |
480 | ^) |
481 | # skip marker | |
482 | echo $s | |
483 | ;; | |
9cc9841b | 484 | *.spec:*) # spec with branch |
b3d9fd17 | 485 | basename $s |
9cc9841b ER |
486 | ;; |
487 | *.spec) # spec without branch | |
b3d9fd17 | 488 | echo $(basename $s):$branch |
9cc9841b ER |
489 | ;; |
490 | *:*) # package name with branch | |
b3d9fd17 | 491 | basename $s | sed -e 's/:/.spec:/' |
9cc9841b ER |
492 | ;; |
493 | *) # just package name | |
b3d9fd17 | 494 | echo $(basename $s).spec:$branch |
9cc9841b ER |
495 | ;; |
496 | esac | |
878677a8 | 497 | done` |
1344b6f1 | 498 | |
45d8ed70 ER |
499 | if [ "$df_fetch" = "yes" ]; then |
500 | df_fetch $specs | |
501 | exit 0 | |
502 | fi | |
503 | ||
a166aeda | 504 | if [ "$upgrade_macros" = "yes" ]; then |
218a4c96 | 505 | command="poldek --up; poldek -uv rpm-build-macros" |
a166aeda ER |
506 | builders="$distro-src" |
507 | f_upgrade=no | |
508 | build_mode=test | |
509 | fi | |
510 | ||
2f470d17 | 511 | if [[ "$requester" != *@* ]] ; then |
b3d9fd17 | 512 | requester="$requester@pld-linux.org" |
2f470d17 MK |
513 | fi |
514 | ||
14b580de | 515 | if [ -z "$builders" ] ; then |
9cc9841b | 516 | builders="$default_builders" |
a757e911 MM |
517 | fi |
518 | ||
544ca060 | 519 | if [ "$f_upgrade" = "yes" ] ; then |
9cc9841b | 520 | flags="$flags upgrade" |
a757e911 MM |
521 | fi |
522 | ||
e936beda | 523 | if [ "$build_mode" = "test" ] ; then |
9cc9841b ER |
524 | if [ "$f_upgrade" = "yes" ] ; then |
525 | die "--upgrade and --test-build are mutually exclusive" | |
526 | fi | |
527 | flags="$flags test-build" | |
e936beda MM |
528 | fi |
529 | ||
e728b34c ER |
530 | if [ -z "$build_mode" ] ; then |
531 | # missing build mode, builders go crazy when you proceed" | |
532 | die "please specify build mode" | |
533 | fi | |
534 | ||
535 | ||
280b1afd | 536 | ok= |
e728b34c ER |
537 | for s in $specs; do |
538 | ok=1 | |
280b1afd MM |
539 | done |
540 | ||
d80e53cf ER |
541 | if [ -z "$specs" -a -z "$command" ]; then |
542 | die "no packages to build or command to invoke specified" | |
280b1afd MM |
543 | fi |
544 | ||
1344b6f1 MM |
545 | id=$(uuidgen) |
546 | ||
547 | gen_req() { | |
9cc9841b ER |
548 | echo "<group id='$id' no='0' flags='$flags'>" |
549 | echo " <time>$(date +%s)</time>" | |
c9f4704f | 550 | msg "Using priority $priority" |
9cc9841b | 551 | echo " <priority>$priority</priority>" |
d8f1c9c0 | 552 | if [ -n "$jobs" ]; then |
c9f4704f | 553 | msg "Using jobs $jobs" |
d8f1c9c0 AM |
554 | echo " <maxjobs>$jobs</maxjobs>" |
555 | fi | |
c9f4704f | 556 | msg "Build mode: $build_mode" |
fe7aaa44 | 557 | if [ -z "$url" ]; then |
c9f4704f | 558 | msg "Using email $builder_email" |
fe7aaa44 | 559 | else |
c9f4704f | 560 | msg "Using URL $url" |
fe7aaa44 | 561 | fi |
c9f4704f | 562 | msg "Queue-ID: $id" |
9cc9841b ER |
563 | echo |
564 | ||
d80e53cf ER |
565 | # job to depend on |
566 | local depend= | |
567 | local b i=1 | |
568 | local name branch builders_xml | |
569 | ||
570 | for b in $builders; do | |
c9f4704f | 571 | msg "Builder: $b" |
d80e53cf ER |
572 | builders_xml="$builders_xml <builder>$b</builder>" |
573 | done | |
574 | ||
575 | if [ "$command" ]; then | |
9cc9841b | 576 | bid=$(uuidgen) |
e6aa37ec | 577 | echo -E >&2 "* Command: $command" |
9cc9841b | 578 | echo " <batch id='$bid' depends-on=''>" |
30ddd991 ER |
579 | echo " <command flags='$command_flags'>" |
580 | echo -E "$command" | sed -e 's,&,\&,g;s,<,\<,g;s,>,\>,g' | |
581 | echo "</command>" | |
9cc9841b | 582 | echo " <info></info>" |
d80e53cf | 583 | echo "$builders_xml" |
9cc9841b | 584 | echo " </batch>" |
d80e53cf ER |
585 | depend=$bid |
586 | fi | |
9cc9841b | 587 | |
f147040c | 588 | if [ "$f_upgrade" = "yes" ] ; then |
c9f4704f | 589 | msg "Upgrade mode: $f_upgrade" |
f147040c | 590 | fi |
e728b34c | 591 | |
f147040c | 592 | for s in $specs; do |
218a4c96 | 593 | # skip marker |
d80e53cf | 594 | if [ "$s" = "^" ]; then |
218a4c96 ER |
595 | depend= |
596 | continue | |
597 | fi | |
d80e53cf ER |
598 | if [ "$no_depend" = yes ]; then |
599 | depend= | |
600 | fi | |
f147040c | 601 | bid=$(uuidgen) |
218a4c96 ER |
602 | echo " <batch id='$bid' depends-on='$depend'>" |
603 | ||
f147040c AM |
604 | name=$(echo "$s" | sed -e 's|:.*||') |
605 | branch=$(echo "$s" | sed -e 's|.*:||') | |
c9f4704f | 606 | msg "Adding #$i $name:$branch${kernel:+ alt_kernel=$kernel}${target:+ target=$target}${depend:+ depends on $depend}" |
f147040c AM |
607 | echo " <spec>$name</spec>" |
608 | echo " <branch>$branch</branch>" | |
609 | echo " ${kernel:+<kernel>$kernel</kernel>}" | |
610 | echo " ${target:+<target>$target</target>}" | |
611 | echo " <info></info>" | |
612 | echo | |
613 | for b in $with; do | |
614 | echo " <with>$b</with>" | |
615 | done | |
616 | for b in $without; do | |
617 | echo " <without>$b</without>" | |
618 | done | |
619 | echo | |
d80e53cf | 620 | echo "$builders_xml" |
f147040c AM |
621 | echo " </batch>" |
622 | i=$((i+1)) | |
c4aa0539 | 623 | |
218a4c96 ER |
624 | # let next job depend on previous |
625 | depend=$bid | |
626 | done | |
e728b34c | 627 | |
9cc9841b | 628 | echo "</group>" |
1344b6f1 MM |
629 | } |
630 | ||
631 | gen_email () { | |
e728b34c ER |
632 | # make request first, so the STDERR/STDOUT streams won't be mixed |
633 | local req=$(gen_req) | |
634 | ||
1344b6f1 | 635 | cat <<EOF |
2f470d17 | 636 | From: $requester |
1344b6f1 MM |
637 | To: $builder_email |
638 | Subject: build request | |
639 | Message-Id: <$id@$(hostname)> | |
640 | X-New-PLD-Builder: request | |
2d28916b | 641 | X-Requester-Version: \$Id$ |
1344b6f1 | 642 | |
30ddd991 | 643 | $(echo -E "$req" | gpg --clearsign --default-key $default_key $gpg_opts) |
1344b6f1 MM |
644 | EOF |
645 | } | |
646 | ||
bfa10c0d | 647 | gen_email | send_request |