path:
/minci.sh
16.98 KB | plain
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
#! /bin/sh
# Usage:
# minci.sh [-fnrv] [-H runhash] [repo[/job]...]
# minci.sh -k repo[/job]...
# -f: force updates
# -n: don't do anything, but show what would be done
# -r: run full check, but don't upload results
# -v: more data while running
# -H: append selected repo/job work to an existing run hash
# -k: stop selected running job, or all running jobs for repo
# Use ~/.minci or /etc/minci for configuration, whichever comes first.
MAKE="make"
API_SECRET=
DEP_BINS="openssl git curl"
# TODO: make sqlite3 be per-system.
NOOP=
NOREP=
VERBOSE=
MINCI_REPO="https://github.com/kristapsdz/minci"
AUTOUP=1
API_KEY=
SERVER=
JOBFILE=
TARGET=
STAGING="$HOME/.local/cache/minci"
CONFIG=
CONFIG_LOCAL="$HOME/.minci"
CONFIG_GLOBAL="/etc/minci"
PROGNAME="$0"
FORCE=
BRANCH="master"
RUN_HASH=
STOP=
RUNDIR=/var/lib/minci/run
msg()
{
echo "$PROGNAME: $(date +"%F %T"): $@"
}
fatal()
{
echo "$PROGNAME: fatal: $@" 1>&2
exit 1
}
debug()
{
[ -z "${VERBOSE}" ] || echo "$PROGNAME: $(date +"%F %T"): $@"
}
run()
{
debug "$1: $2"
if [ -z "$NOOP" ]
then
echo "$PROGNAME: $1: $2" 1>&3
set +e ;
eval "$1" 1>&3 2>&3 || { set -e ; return 1; }
set -e ;
fi
return 0
}
runjob()
{
debug "$1: $2"
if [ -z "$NOOP" ]
then
pidfile="$RUNDIR/$2.pid"
stopfile="$RUNDIR/$2.stop"
mkdir -p "${pidfile%/*}"
chmod 1777 "$RUNDIR" "${pidfile%/*}" 2>/dev/null || true
rm -f "$stopfile"
echo "$PROGNAME: $1: $2" 1>&3
set +e
( eval "$1" ) 1>&3 2>&3 &
pid=$!
echo "$pid" >"$pidfile"
while kill -0 "$pid" 2>/dev/null
do
if [ -f "$stopfile" ]
then
killtree "$pid"
wait "$pid" 2>/dev/null
rm -f "$pidfile"
set -e
return 143
fi
/bin/sleep 1
done
wait "$pid"
rc=$?
rm -f "$pidfile"
set -e
return "$rc"
fi
return 0
}
killtree()
{
pid=$1
for child in $(ps -o pid= --ppid "$pid" 2>/dev/null)
do
killtree "$child"
done
kill "$pid" 2>/dev/null
}
stopjob()
{
label=$1
pidfile="$RUNDIR/$label.pid"
stopfile="$RUNDIR/$label.stop"
if [ ! -r "$pidfile" ]
then
msg "not running: $label"
return 1
fi
read -r pid <"$pidfile"
if [ -z "$pid" ]
then
msg "empty pid file: $label"
return 1
fi
touch "$stopfile"
killtree "$pid"
msg "stopped: $label"
return 0
}
stoprepo()
{
repo=$1
found=
for pidfile in "$RUNDIR/$repo"/*.pid
do
[ -e "$pidfile" ] || continue
found=1
job=${pidfile%.pid}
stopjob "${job#$RUNDIR/}"
done
[ -n "$found" ] || msg "not running: $repo"
}
# Run $1, exiting on failure.
runnolog()
{
debug "$1"
if [ -z "$NOOP" ]
then
eval "$1" >/dev/null 2>&1 || exit 1
fi
}
md5file()
{
openssl dgst -md5 -hex "$1" | sed 's!^[^=]*= !!'
}
md5text()
{
openssl dgst -md5 -hex | sed 's!^[^=]*= !!'
}
postjob()
{
project=$1
job=$2
status=$3
start=$4
finish=$5
log=$6
[ -n "$NOOP" -o -n "$NOREP" ] && return 0
runhash="$RUN_HASH"
[ -n "$runhash" ] || runhash=$(printf '%s|%s|%s|%s|%s' "$project" "$FETCH_HEAD" "$BRANCH" "${TARGET:-$(uname -n)}" "$TIME_start" | md5text)
loghash=$(md5file "$log")
QUERY="artifact-name=${artifact_name:-}"
QUERY="$QUERY&artifact-sha256=${artifact_sha256:-}"
QUERY="$QUERY&artifact-url=${artifact_url:-}"
QUERY="$QUERY&job-finish=$finish"
QUERY="$QUERY&job-log=$loghash"
QUERY="$QUERY&job-name=$job"
QUERY="$QUERY&job-start=$start"
QUERY="$QUERY&job-status=$status"
QUERY="$QUERY&project-name=$project"
QUERY="$QUERY&run-runhash=$runhash"
QUERY="$QUERY&run-ref=refs/heads/$BRANCH"
QUERY="$QUERY&run-rev=$FETCH_HEAD"
QUERY="$QUERY&run-target=${TARGET:-$(uname -n)}"
QUERY="$QUERY&user-apisecret=$API_SECRET"
SIGNATURE=$(printf "%s" "$QUERY" | md5text)
curl -sS \
-F "artifact-name=${artifact_name:-}" \
-F "artifact-sha256=${artifact_sha256:-}" \
-F "artifact-url=${artifact_url:-}" \
-F "job-finish=$finish" \
-F "job-log=@$log" \
-F "job-name=$job" \
-F "job-start=$start" \
-F "job-status=$status" \
-F "project-name=$project" \
-F "run-runhash=$runhash" \
-F "run-ref=refs/heads/$BRANCH" \
-F "run-rev=$FETCH_HEAD" \
-F "run-target=${TARGET:-$(uname -n)}" \
-F "user-apikey=$API_KEY" \
-F "signature=$SIGNATURE" \
"$SERVER"
}
joblist()
{
printf '%s\n' "$triggers" | while IFS= read -r ln
do
case "$ln" in
"refs/heads/$BRANCH:"*) echo "${ln#*:}" ;;
esac
done
}
args=$(getopt H:fknrv $*)
if [ $? -ne 0 ]
then
echo "usage: $PROGNAME [-fnrv] [-H runhash] [repo[/job] ...]" 1>&2
exit 1
fi
set -- $args
while [ $# -ne 0 ]
do
case "$1"
in
-n)
NOOP=1 ; shift ;;
-r)
NOREP=1 ; shift ;;
-H)
RUN_HASH=$2 ; shift 2 ;;
-f)
FORCE=1 ; shift ;;
-k)
STOP=1 ; shift ;;
-v)
VERBOSE=1 ; shift ;;
--)
shift ; break ;;
esac
done
# Start with the local then global configuration.
# Require at least one of them.
if [ ! -r "$CONFIG_LOCAL" ]
then
if [ ! -r "$CONFIG_GLOBAL" ]
then
fatal "$PROGNAME: no config found"
fi
CONFIG="$CONFIG_GLOBAL"
else
CONFIG="$CONFIG_LOCAL"
fi
debug "using config: $CONFIG"
# Read the API secret from the configuration.
while read -r ln
do
bsdmake="$(echo "$ln" | sed -n 's!^[ ]*bsdmake[ ]*=[ ]*!!p')"
[ -z "$bsdmake" ] && continue
MAKE="$bsdmake"
done < "$CONFIG"
DEP_BINS="$DEP_BINS $MAKE"
# Read the API secret from the configuration.
while read -r ln
do
api_secret="$(echo "$ln" | sed -n 's!^[ ]*apisecret[ ]*=[ ]*!!p')"
[ -z "$api_secret" ] && continue
API_SECRET="$api_secret"
done < "$CONFIG"
if [ -z "$API_SECRET" ]
then
fatal "no API secret specified"
fi
# Read the API key from the configuration.
while read -r ln
do
api_key="$(echo "$ln" | sed -n 's!^[ ]*apikey[ ]*=[ ]*!!p')"
[ -z "$api_key" ] && continue
API_KEY="$api_key"
done < "$CONFIG"
if [ -z "$API_KEY" ]
then
fatal "no API key specified"
fi
# Read the server from the configuration.
while read -r ln
do
server="$(echo "$ln" | sed -n 's!^[ ]*server[ ]*=[ ]*!!p')"
[ -z "$server" ] && continue
SERVER="$server"
done < "$CONFIG"
if [ -z "$SERVER" ]
then
fatal "no server specified"
fi
# Read the auto-update setting from the configuration.
while read -r ln
do
autoup="$(echo "$ln" | sed -n 's!^[ ]*autoup[ ]*=[ ]*!!p')"
[ -z "$autoup" ] && continue
case "$autoup" in
0|no|false) AUTOUP= ;;
*) AUTOUP=1 ;;
esac
done < "$CONFIG"
# Read the minci repository from the configuration.
while read -r ln
do
mincirepo="$(echo "$ln" | sed -n 's!^[ ]*mincirepo[ ]*=[ ]*!!p')"
[ -z "$mincirepo" ] && continue
MINCI_REPO="$mincirepo"
done < "$CONFIG"
# Read the Jobfile path from the configuration.
while read -r ln
do
jobfile="$(echo "$ln" | sed -n 's!^[ ]*jobfile[ ]*=[ ]*!!p')"
[ -z "$jobfile" ] && continue
JOBFILE="$jobfile"
done < "$CONFIG"
# Read the target from the configuration.
while read -r ln
do
target="$(echo "$ln" | sed -n 's!^[ ]*target[ ]*=[ ]*!!p')"
[ -z "$target" ] && continue
TARGET="$target"
done < "$CONFIG"
# Read the branch from the configuration.
while read -r ln
do
branch="$(echo "$ln" | sed -n 's!^[ ]*branch[ ]*=[ ]*!!p')"
[ -z "$branch" ] && continue
BRANCH="$branch"
done < "$CONFIG"
debug "using API key: $API_KEY"
debug "using API secret: $API_SECRET"
debug "using server: $SERVER"
debug "using minci repo: $MINCI_REPO"
debug "using branch: $BRANCH"
debug "using Jobfile: $JOBFILE"
debug "using target: $TARGET"
for dep in $DEP_BINS
do
debug "check binary dependency: $dep"
which "$dep" 2>/dev/null 1>&2
if [ $? -ne 0 ]
then
fatal "binary dep not in PATH: $dep"
fi
done
# Check or create where we'll put our repositories.
if [ ! -d "$STAGING" ] && [ -z "$NOOP" ]
then
mkdir -p "$STAGING"
if [ $? -ne 0 ]
then
fatal "could not create: $STAGING"
fi
debug "created: $STAGING"
fi
if [ -n "$STOP" ]
then
if [ $# -eq 0 ]
then
fatal "no repo or repo/job specified"
fi
for prog in "$@"
do
case "$prog" in
*/*) stopjob "$prog" ;;
*) stoprepo "$prog" ;;
esac
done
exit 0
fi
# Auto-update feature.
# FIXME: NOT FOR PERMANENT USE.
# This will eventually be replaced by a real package manager, but for
# now I'm using this because it lets me update hosts without needing to
# do it manually for each one.
if [ -n "$AUTOUP" ]
then
# Same way as we'll use for repositories later on.
debug "checking auto-up status"
set -e
FETCH_HEAD=""
head=""
[ -n "$NOOP" ] || cd "$STAGING"
if [ -d "minci" ]
then
if [ -z "$NOOP" ]
then
cd "minci"
head="$(cut -f1 .git/FETCH_HEAD 2>/dev/null | head -1)"
fi
runnolog "git fetch origin"
runnolog "git reset --hard origin/master"
runnolog "git clean -fdx"
if [ -z "$NOOP" ]
then
FETCH_HEAD="$(cut -f1 .git/FETCH_HEAD | head -1)"
fi
else
runnolog "git clone $MINCI_REPO"
if [ -z "$NOOP" ]
then
cd "minci"
fi
# Grabs the newest .git/FETCH_HEAD.
runnolog "git fetch origin"
runnolog "git reset --hard origin/master"
if [ -z "$NOOP" ]
then
FETCH_HEAD="$(cut -f1 .git/FETCH_HEAD | head -1)"
fi
fi
# If up to date, fine.
# If not, install the new script then exit.
# We'll reinvoke later (we're probably being run from cron) with
# the new version.
if [ -n "$head" ] && [ "$head" = "$FETCH_HEAD" ]
then
debug "installation is fresh: minci"
else
debug "installation is not fresh: minci"
debug "previous: $head"
debug "current: $FETCH_HEAD"
debug "installing new script and exiting"
if [ -z "$NOOP" ]
then
runnolog "install -m 0755 minci.sh $HOME/bin"
fi
msg "updated binary: now at commit $FETCH_HEAD"
exit 0
fi
set +e
fi
# Process each repository line.
NPROC=0
while read -r ln
do
repo="$(echo "$ln" | sed -n 's!^[ ]*repo[ ]*=[ ]*!!p')"
[ -z "$repo" ] && continue
reponame="$(echo "$repo" | sed -e 's!.*/!!' -e 's!\.git$!!')"
if [ -z "$reponame" ]
then
fatal "malformed repo: $repo"
fi
# Iterate through the command-line arguments, only if specified,
# to see if we want to run this. Arguments may be repo or repo/job.
RUNJOBS=
if [ $# -gt 0 ]
then
found=
for prog in "$@"
do
case "$prog" in
"$reponame") found=1 ;;
"$reponame"/*) found=1 ; RUNJOBS="$RUNJOBS ${prog#*/}" ;;
esac
done
if [ -z "$found" ]
then
debug "ignoring: $reponame"
continue
fi
fi
# Get ready for actual processing.
# Now errors without || are fatal.
set -e
debug "$repo: $reponame"
[ -n "$NOOP" ] || exec 3>/tmp/minci.log
[ -n "$NOOP" ] || cd "$STAGING"
# Set all of our times to zero.
# If a time is non-zero when we send our report, that means that
# we've finished a phase.
TIME_start=0
TIME_env=0
TIME_depend=0
TIME_build=0
TIME_test=0
TIME_install=0
TIME_distcheck=0
JOBFILE_DONE=
JOBFILE_STATUS=
# Set our last-commit checksum to be empty as well.
FETCH_HEAD=""
# Begin processing.
# This is wrapped in an infinite loop so we can just use `break`
# to come out of error situations and still send the report.
TIME_start=$(date +%s)
while :
do
head=""
FETCH_HEAD=""
# If we have a repository already, update and clean it
# out; otherwise, clone it afresh.
# Keep track of the FETCH_HEAD last commit.
if [ -d "$reponame" ]
then
if [ -z "$NOOP" ]
then
cd "$reponame"
head="$(cut -f1 .git/FETCH_HEAD 2>/dev/null | head -1)"
fi
run "git fetch origin" "$reponame" || break
run "git reset --hard origin/$BRANCH" "$reponame" || break
run "git clean -fdx" "$reponame" || break
if [ -z "$NOOP" ]
then
FETCH_HEAD="$(cut -f1 .git/FETCH_HEAD | head -1)"
fi
else
run "git clone $repo" "$reponame" || break
if [ -z "$NOOP" ]
then
cd "$reponame"
fi
# Grabs the newest .git/FETCH_HEAD.
run "git fetch origin" "$reponame" || break
run "git reset --hard origin/$BRANCH" "$reponame" || break
if [ -z "$NOOP" ]
then
FETCH_HEAD="$(cut -f1 .git/FETCH_HEAD | head -1)"
fi
fi
# If the FETCH_HEAD commit doesn't change when we freshen the
# repository, then doing re-test it unless -f was passed.
if [ -z "$FORCE" ] && [ -z "$RUNJOBS" ] &&
[ -n "$head" ] && [ "$head" = "$FETCH_HEAD" ]
then
debug "repository is fresh: $reponame"
TIME_start=0
break
fi
TIME_env=$(date +%s)
# If a Jobfile exists, let the repository define its own jobs.
jf="$JOBFILE"
[ -z "$jf" ] && jf=".config/Jobfile"
if [ -r "$jf" ]
then
project="$reponame"
triggers=
srcdir=$(pwd)
workdir="$STAGING/work/$reponame"
pkgdir="$workdir/pkg"
destdir="$workdir/dest"
target="${TARGET:-$(uname -n)}"
export srcdir workdir pkgdir destdir target
. "$jf"
jobs=$(joblist)
[ -z "$RUNJOBS" ] || jobs="$RUNJOBS"
if [ -n "$jobs" ]
then
JOBFILE_DONE=1
JOBFILE_STATUS=success
mkdir -p "$workdir" "$pkgdir" "$destdir"
for job in $jobs
do
jobstart=$(date +%s)
artifact_name=
artifact_url=
artifact_sha256=
if [ -z "$NOOP" ]
then
printf '%s: %s: %s: started\n' \
"$PROGNAME" "$reponame/$job" \
"$(date +"%F %T")" >/tmp/minci.log
fi
postjob "$project" "$job" running "$jobstart" 0 /tmp/minci.log
[ -n "$NOOP" ] || exec 3>/tmp/minci.log
stopfile="$RUNDIR/$reponame/$job.stop"
if runjob "$job" "$reponame/$job"
then
postjob "$project" "$job" pass "$jobstart" "$(date +%s)" /tmp/minci.log
else
JOBFILE_STATUS=failure
if [ -f "$stopfile" ]
then
JOBFILE_STATUS=cancelled
rm -f "$stopfile"
postjob "$project" "$job" cancelled "$jobstart" "$(date +%s)" /tmp/minci.log
else
postjob "$project" "$job" fail "$jobstart" "$(date +%s)" /tmp/minci.log
fi
break
fi
done
break
fi
fi
# Run ./configure, make, make regress, make install,
# make distcheck. If any fail, then break out.
run "./configure PREFIX=build" "$reponame" || break
TIME_depend=$(date +%s)
run "${MAKE}" "$reponame" || break
TIME_build=$(date +%s)
run "${MAKE} regress" "$reponame" || break
TIME_test=$(date +%s)
run "${MAKE} install" "$reponame" || break
TIME_install=$(date +%s)
run "${MAKE} distcheck" "$reponame" || break
TIME_distcheck=$(date +%s)
# Success!
break
done
# Stop reporting to fd-3 and remask errors.
# Our house-keeping can now fail without killing us.
[ -n "$NOOP" ] || exec 3>&-
set +e
if [ -n "$JOBFILE_DONE" ]
then
NPROC=$(( $NPROC + 1 ))
msg "$JOBFILE_STATUS: $reponame"
[ -n "$NOOP" ] || rm -f /tmp/minci.log
continue
fi
if [ $TIME_start -eq 0 ]
then
[ -n "$NOOP" ] || rm -f /tmp/minci.log
continue
fi
NPROC=$(( $NPROC + 1 ))
if [ $TIME_distcheck -eq 0 ]
then
msg "failure: $reponame"
else
msg "success: $reponame"
fi
debug "computing signature"
UNAME_M=$(uname -m | sed -e 's!^[ ]*!!g' -e 's![ ]*$!!g')
UNAME_N=$(uname -n | sed -e 's!^[ ]*!!g' -e 's![ ]*$!!g')
UNAME_R=$(uname -r | sed -e 's!^[ ]*!!g' -e 's![ ]*$!!g')
UNAME_S=$(uname -s | sed -e 's!^[ ]*!!g' -e 's![ ]*$!!g')
UNAME_V=$(uname -v | sed -e 's!^[ ]*!!g' -e 's![ ]*$!!g')
# Create the signature for this entry.
# It consists of all the MD5 hash of all arguments in
# alphabetical order (by key), with the report-log (or /dev/null
# if there's no need to report) being replaced by its MD5 hash.
QUERY="project-name=${reponame}"
QUERY="${QUERY}&report-build=${TIME_build}"
QUERY="${QUERY}&report-distcheck=${TIME_distcheck}"
QUERY="${QUERY}&report-env=${TIME_env}"
QUERY="${QUERY}&report-fetchhead=${FETCH_HEAD}"
QUERY="${QUERY}&report-depend=${TIME_depend}"
QUERY="${QUERY}&report-install=${TIME_install}"
if [ $TIME_distcheck -eq 0 ]
then
hashfile="/tmp/minci.log"
else
hashfile="/dev/null"
fi
hash="$(openssl dgst -md5 -hex $hashfile | sed 's!^[^=]*= !!')"
QUERY="${QUERY}&report-log=$hash"
QUERY="${QUERY}&report-start=${TIME_start}"
QUERY="${QUERY}&report-test=${TIME_test}"
QUERY="${QUERY}&report-unamem=${UNAME_M}"
QUERY="${QUERY}&report-unamen=${UNAME_N}"
QUERY="${QUERY}&report-unamer=${UNAME_R}"
QUERY="${QUERY}&report-unames=${UNAME_S}"
QUERY="${QUERY}&report-unamev=${UNAME_V}"
QUERY="${QUERY}&user-apisecret=${API_SECRET}"
# Signature is the MD5 of ordered parameters and including our
# API secret.
# The server will perform the same steps.
SIGNATURE=$(printf "%s" "$QUERY" | openssl dgst -md5 -hex | sed 's!^[^=]*= !!')
# Now actually send the report.
# It includes the signature and optionally the build log (only
# if we didn't get to the end).
debug "sending report: $SERVER"
REPORT_LOG=
if [ $TIME_distcheck -eq 0 ]
then
REPORT_LOG="-F report-log=</tmp/minci.log"
else
REPORT_LOG="-F report-log="
fi
if [ -z "$NOOP" -a -z "$NOREP" ]
then
curl -sS ${REPORT_LOG} \
-F "project-name=${reponame}" \
-F "report-start=${TIME_start}" \
-F "report-env=${TIME_env}" \
-F "report-depend=${TIME_depend}" \
-F "report-build=${TIME_build}" \
-F "report-test=${TIME_test}" \
-F "report-install=${TIME_install}" \
-F "report-distcheck=${TIME_distcheck}" \
-F "report-unamem=${UNAME_M}" \
-F "report-unamen=${UNAME_N}" \
-F "report-unamer=${UNAME_R}" \
-F "report-unames=${UNAME_S}" \
-F "report-unamev=${UNAME_V}" \
-F "report-fetchhead=${FETCH_HEAD}" \
-F "user-apikey=${API_KEY}" \
-F "signature=${SIGNATURE}" \
"${SERVER}"
fi
if [ -z "$NOOP" ]
then
rm -f /tmp/minci.log
fi
done < "$CONFIG"
if [ $NPROC -eq 0 ]
then
msg "all repositories up to date"
fi
exit 0