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 for config in "$@"; do
21 *=*) eval "$config" ;;
27 echo >&2 'disabled because config inadequate (no disable=false)'
32 printf >&3 "starting "
40 echo '(log diverted to stdout)' >>"$tmp"/_log
47 echo "++++++ $1 ++++++"
51 progress "fetching $1"
55 gurl "$mirror/dists/$distro/$suite/source/Sources.gz" "$tmp"/_sources.gz
56 zcat "$tmp"/_sources.gz >"$tmp"/_sources-in
63 if [ "x$pkg" = x ]; then
68 $vre= "[-+.0-9a-zA-Z:~]+";
70 sub f1() { $fn=shift @ARGV; open F, $fn or die "$fn $!"; }
71 sub f2() { F->error and die "$fn $!"; close F or die "$fn $!"; }
75 die unless m/^($pre) ($vre) (\d+)( .*)?$/;
84 if (m/^Package: ($pre)$/) {
85 die if length $package or length $version;
87 } elsif (m/^Version: ($vre)$/) {
88 die unless length $package;
89 die if length $version;
91 $score= '$now' - $lasttime{$package};
92 $score= 1e7 if $score>1e7;
93 $score *= 5 if $lastver{$package} ne $version;
94 $score *= 10 unless $extras{$package} =~ m/ nt /;
95 next if $score < $best_score
96 or ($score==$best_score and \
97 $package gt $best_package);
99 $best_package= $package;
101 die if length $package and !length $version;
102 $package= $version= "";
106 die unless length $best_package;
107 open L, ">&4" or die $!;
108 printf L "selected %s (age %s, score %d)\n",
110 exists($lastime{$best_package})
111 ? '$now' - $lasttime{$best_package}
114 print "$best_package\n" or die $!;
115 ' "$var"/last-info "$tmp"/_sources-in`"
117 printf >&4 "package forced: %s\n" "$pkg"
120 sed -n "/^Package: $pkg\$/,/^\$/p" \
121 <"$tmp"/_sources-in >"$tmp"/_this-stanza
124 cat "$tmp"/_this-stanza
128 sed -n '\''s/^'$1': //p'\'' \
137 sed -n '/^Files:/,/^([^ ].*)?$/{ /^ /{
138 s/^ [0-9a-z][0-9a-z]* *[0-9][0-9]* //; p
143 printf >&3 "selected \"%s\" " $pkg
146 mkdir "$tp" "$tp/src" "$tp/tmp" "$tp/out"
148 for leafname in $leafnames; do
149 df="$tp/src/$leafname"
151 */*|.*) echo >&2 "bad leafname: $leafname"; exit 1;;
154 gurl "$mirror/$pDirectory/$leafname" "$df"
157 if [ "x$maintainer_email_override" = x ]; then
159 maintainer_email=pMaintainer
161 maintainer_email=maintainer_email_override
164 printf >&3 "adt-run "
166 progress "starting test"
176 echo 'fatal: adt-run did not start properly' >"$tmp"/_summary
178 xrc adt-run --tmp-dir "$tp"/tmp \
179 --output-dir "$tp"/out \
180 --log-file "$tp"/log \
181 --summary "$tmp"/_summary \
186 $adtvirt_extra_opts \
198 0) summary='all OK'; email='' ;;
199 2) summary='OK (some skipped)'; email='' ;;
200 8) summary='package declares no tests'; email=''
201 upload=false; extras='nt' ;;
202 4|6) summary='test(s) failed!'; email="$maintainer_email" ;;
203 12) summary='erroneous package!'; email="$maintainer_email" ;;
204 16) summary='testbed failed!'; email="administrator_email" ;;
205 *) summary='unexpected failure!'; email="administrator_email"; ourx=20;;
208 progress "RESULTS $summary"
212 ln "$tmp"/_summary "$tp"/summary
214 for odir in tmp out; do
215 if test -d "$tp"/$odir; then
216 GZIP=-2 tar -f "$tp"/$odir.tar.gz -C "$tp" -zc $odir
222 printf >&3 "uploading"
223 $rsync -rltH --safe-links --delete "$tp" "$destrsynchead/$destdirtail/"
227 if [ "x$email" != x ]; then
228 progress "contacting $email"
229 eval "email_addr=\$$email"
230 printf >&3 "email \"%s\" " "$email_addr"
231 cat >"$tmp"/_email <<END
234 Subject: autopkgtest $distro $pkg: $summary
236 Test executed for: $distro $pkg
239 sed -e 's/^/ /' "$tmp"/_summary >>"$tmp"/_email
240 cat >>"$tmp"/_email <<END
242 This message is automatically generated by the autopkgtest package
243 testing system. You are receiving it because:
247 cat >>"$tmp"/_email <<END
248 You are listed in the Maintainer field of the $pkg package in $distro
249 and the test results appear to indicate a problem with the package.
252 maintainer_email_override)
253 cat >>"$tmp"/_email <<END
254 The test results appear to indicate a problem with the package
255 and reports for package maintainers for $distro are being directed to
256 $maintainer_email_override
260 cat >>"$tmp"/_email <<END
261 You are the administrator for the autopkgtest installation.
265 echo >&2 "huh email $email is what why?"
269 cat >>"$tmp/_email" <<END
271 The test log, which is intended to be sufficient to diagnose most
272 failures, can be found below. However, in case this is not
273 sufficient, another copy can be found along with output files, saved
274 temporary files, and so on, at:
275 $desthttphead/$destdirtail/
277 If you have any questions about this service please contact me at:
287 printf >>"$var"/log "package=%s rc=%s emailed='%s'\n" \
288 "$pkg" $rc "$email_addr"
290 if [ "x$ourx" = x0 ]; then
291 sed -e "/^$pkg /d" <"$var"/last-info >"$var"/last-info.new
292 printf "%s %s %s %s\n" "$pkg" "$pVersion" "$now" "$extras" \
293 >>"$var"/last-info.new
294 mv "$var"/last-info.new "$var"/last-info
297 progress "fault ($ourx)."
300 if [ "x$email" = x ]; then
301 if $interactive; then
305 cat >>"$tmp"/_email 2>&1 "$tmp"/_log ||:
306 if $interactive; then
307 cat "$tmp"/_email >&2
309 sendmail -odq -oem -t -oi <"$tmp"/_email
313 printf >&3 "done %s.\n" $ourx