5 mirror=http://mirror.relativity.greenend.org.uk/mirror/ubuntu.good
11 administrator_email=ian@davenant.greenend.org.uk
12 maintainer_email_override="$administrator_email"
14 from="$salutation Jackson <ian@davenant.greenend.org.uk>"
19 arch=`dpkg --print-architecture`
21 for config in "$@"; do
23 *=*) eval "$config" ;;
29 echo >&2 'disabled because config inadequate (no disable=false)'
33 : ${destdirtail:=$distro-$target}
34 : ${destdirfin:="$destdircommon$destdirtail"}
43 descx="${target#binary-}"
46 echo >&2 'target must be source or binary-*'
51 printf >&3 "starting "
59 echo '(log diverted to stdout)' >>"$tmp"/_log
66 echo "++++++ $1 ++++++"
70 progress "fetching $1"
74 gurl "$mirror/dists/$distro/$suite/$target/$sources.gz" "$tmp"/_$sources.gz
75 zcat "$tmp"/_$sources.gz >"$tmp"/_$sources-in
77 lastinfo="$var"/lastinfo-$target
84 if [ "x$pkg" = x ]; then
89 $vre= "[-+.0-9a-zA-Z:~]+";
91 sub f1() { $fn=shift @ARGV; open F, $fn or die "$fn $!"; }
92 sub f2() { F->error and die "$fn $!"; close F or die "$fn $!"; }
96 die unless m/^($pre) ($vre) (\d+)( .*)?$/;
104 sub scorepackage () {
106 return if $score < $best_score
107 or ($score==$best_score and \
108 $package gt $best_package);
110 $best_package= $package;
113 return unless (defined $package
116 die unless defined $package;
117 die unless defined $version;
124 if (m/^Package: ($pre)$/) {
125 die if defined $package;
127 } elsif (m/^Version: ($vre)$/) {
128 die if defined $version;
130 $score= '$now' - $lasttime{$package};
131 $score= 1e7 if $score>1e7;
132 $score *= 5 if $lastver{$package} ne $version;
133 $score *= 10 unless $extras{$package} =~ m/ nt /;
134 } elsif (m/^Architecture:.*/ &&
143 die unless length $best_package;
144 open L, ">&4" or die $!;
145 printf L "selected %s (age %s, score %d)\n",
147 exists($lastime{$best_package})
148 ? '$now' - $lasttime{$best_package}
151 print "$best_package\n" or die $!;
152 ' "$lastinfo" "$tmp"/_$sources-in`"
154 printf >&4 "package forced: %s\n" "$pkg"
157 sed -n "/^Package: $pkg\$/,/^\$/p" \
158 <"$tmp"/_$sources-in >"$tmp"/_this-stanza
161 cat "$tmp"/_this-stanza
165 sed -n '\''s/^'$1': //p'\'' \
170 printf >&3 "selected \"%s\" " $pkg
173 mkdir "$tp" "$tp/src" "$tp/tmp" "$tp/out"
177 if test $target = source; then
180 sed -n '/^Files:/,/^([^ ].*)?$/{ /^ /{
181 s/^ [0-9a-z][0-9a-z]* *[0-9][0-9]* //; p
185 for leafname in $leafnames; do
186 df="$tp/src/$leafname"
188 */*|.*) echo >&2 "bad leafname: $leafname"; exit 1;;
191 gurl "$mirror/$pDirectory/$leafname" "$df"
196 : ${upload_if_ok:=true}
199 fot="$tp/src/$pkg.deb"
200 gurl "$mirror/$pFilename" "$fot"
201 testmode='--binaries=install --binary'
202 testmode2=--instantiate
204 : ${upload_if_ok:=false}
207 if [ "x$maintainer_email_override" = x ]; then
209 maintainer_email=pMaintainer
211 maintainer_email=maintainer_email_override
214 printf >&3 "adt-run "
216 progress "starting test"
226 echo 'fatal: adt-run did not start properly' >"$tmp"/_summary
228 xrc adt-run --tmp-dir "$tp"/tmp \
229 --output-dir "$tp"/out \
230 --log-file "$tp"/log \
231 --summary "$tmp"/_summary \
233 $testmode "$fot" $testmode2 \
236 $adtvirt_extra_opts \
248 0) summary='all OK'; email=''
249 upload=$upload_if_ok ;;
250 2) summary='OK (some skipped)'; email=''
251 upload=$upload_if_ok ;;
252 8) summary='package declares no tests'; email=''
253 upload=false; extras='nt' ;;
254 4|6) summary='test(s) failed!'; email="$maintainer_email" ;;
255 12) summary='erroneous package!'; email="$maintainer_email" ;;
256 16) summary='testbed failed!'; email="administrator_email" ;;
257 *) summary='unexpected failure!'; email="administrator_email"; ourx=20;;
260 progress "RESULTS $summary"
264 ln "$tmp"/_summary "$tp"/summary
266 for odir in tmp out; do
267 if test -d "$tp"/$odir; then
268 GZIP=-2 tar -f "$tp"/$odir.tar.gz -C "$tp" -zc $odir
274 printf >&3 "uploading"
275 $rsync -rltH --safe-links --delete "$tp" "$destrsynchead/$destdirfin/"
279 if [ "x$email" != x ]; then
280 progress "contacting $email"
281 eval "email_addr=\$$email"
282 printf >&3 "email \"%s\" " "$email_addr"
283 cat >"$tmp"/_email <<END
286 Subject: autopkgtest $distro $desc: $summary
288 Test executed for: $distro $target $pkg
291 sed -e 's/^/ /' "$tmp"/_summary >>"$tmp"/_email
292 cat >>"$tmp"/_email <<END
294 This message is automatically generated by the autopkgtest package
295 testing system. You are receiving it because:
299 cat >>"$tmp"/_email <<END
300 You are listed in the Maintainer field of the $pkg package in $distro
301 and the test results appear to indicate a problem with the package.
304 maintainer_email_override)
305 cat >>"$tmp"/_email <<END
306 The test results appear to indicate a problem with the package
307 and reports for package maintainers for $distro are being directed to
308 $maintainer_email_override
312 cat >>"$tmp"/_email <<END
313 You are the administrator for the autopkgtest installation.
317 echo >&2 "huh email $email is what why?"
321 cat >>"$tmp/_email" <<END
323 The test log, which is intended to be sufficient to diagnose most
324 failures, can be found below. However, in case this is not
325 sufficient, another copy can be found along with output files, saved
326 temporary files, and so on, at:
327 $desthttphead/$destdirfin/
329 If you have any questions about this service please contact me at:
339 printf >>"$var"/log "%s=%s rc=%s emailed='%s'\n" \
340 "$target" "$pkg" $rc "$email_addr"
342 if [ "x$ourx" = x0 ]; then
343 sed -e "/^$pkg /d" <"$lastinfo" >"$lastinfo".new
344 printf "%s %s %s %s\n" "$pkg" "$pVersion" "$now" "$extras" \
346 mv "$lastinfo".new "$lastinfo"
349 progress "fault ($ourx)."
352 if [ "x$email" = x ]; then
353 if $interactive; then
357 cat >>"$tmp"/_email 2>&1 "$tmp"/_log ||:
358 if $interactive; then
359 cat "$tmp"/_email >&2
361 sendmail -odi -oem -t -oi <"$tmp"/_email
365 printf >&3 "done %s.\n" $ourx