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