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
|
#!/usr/pkg/bin/perl
# $NetBSD: post-build,v 1.28 2004/01/26 21:10:32 heinz Exp $
#
# Collect stuff after a pkg bulk build
#
# (c) 2000 Hubert Feyrer, All Rights Reserved.
#
use File::Basename;
# Where config vars are stored (/bin/sh syntax)
if (-f $ENV{"BULK_BUILD_CONF"}) {
$BULK_BUILD_CONF=$ENV{"BULK_BUILD_CONF"};
} else {
$BULK_BUILD_CONF=dirname("$0")."/build.conf";
}
# Dig given variable out of config file, and set it
sub getconf
{
local($var)=@_;
local($val);
chomp($val=`. ./$BULK_BUILD_CONF ; echo \$$var`);
eval "\$$var=\"$val\";";
}
getconf("ADMINSIG"); # "-Your Name"
getconf("FTPURL"); # "pub/NetBSD/pkgstat/`date +%Y%m%d.%H%M`"
getconf("FTP"); # "/disk1/ftp/${FTPURL}"
getconf("FTPHOST"); # ftp://ftp.machi.ne/
getconf("REPORT"); # "broken.html"
getconf("USR_PKGSRC"); # "/usr/pkgsrc"
getconf("osrev"); # `uname -r`
getconf("arch"); # `uname -m`
chomp($date=`date`);
$reportf=basename($REPORT);
chomp($os=`uname -s`);
# extract the name of the files used for the build log and broken build log.
# these have defaults set by bsd.bulk-pkg.mk and may be overridden in /etc/mk.conf
chomp($BROKENFILE=`( cd $USR_PKGSRC/pkgtools/pkglint ; $ENV{"BMAKE"} show-var VARNAME=BROKENFILE )`);
# also extract the names of the cache files used during the bulk build. We'll save a copy of
# those to help debug if the build messed up.
chomp($DEPENDSTREEFILE=`( cd $USR_PKGSRC/pkgtools/pkglint ; $ENV{"BMAKE"} show-var VARNAME=DEPENDSTREEFILE )`);
chomp($DEPENDSFILE=`( cd $USR_PKGSRC/pkgtools/pkglint ; $ENV{"BMAKE"} show-var VARNAME=DEPENDSFILE )`);
chomp($SUPPORTSFILE=`( cd $USR_PKGSRC/pkgtools/pkglint ; $ENV{"BMAKE"} show-var VARNAME=SUPPORTSFILE )`);
chomp($INDEXFILE=`( cd $USR_PKGSRC/pkgtools/pkglint ; $ENV{"BMAKE"} show-var VARNAME=INDEXFILE )`);
chomp($ORDERFILE=`( cd $USR_PKGSRC/pkgtools/pkglint ; $ENV{"BMAKE"} show-var VARNAME=ORDERFILE )`);
chomp($STARTFILE=`( cd $USR_PKGSRC/pkgtools/pkglint ; $ENV{"BMAKE"} show-var VARNAME=STARTFILE )`);
chomp($LOCALBASE=`( cd $USR_PKGSRC/pkgtools/pkglint ; $ENV{"BMAKE"} show-var VARNAME=LOCALBASE )`);
chomp($X11BASE=`( cd $USR_PKGSRC/pkgtools/pkglint ; $ENV{"BMAKE"} show-var VARNAME=X11BASE )`);
chomp($FIND=`( cd $USR_PKGSRC/pkgtools/pkglint ; $ENV{"BMAKE"} show-var VARNAME=FIND )`);
$dtfile=basename($DEPENDSTREEFILE);
$depfile=basename($DEPENDSFILE);
$supfile=basename($SUPPORTSFILE);
$indfile=basename($INDEXFILE);
$ordfile=basename($ORDERFILE);
$startfile=basename($STARTFILE);
$verbose=1;
if ($verbose) {
print "\n";
print "*** $os $osrev/$arch\n";
print "*** Result of bulk pkgsrc build as of $date:\n";
print "\n";
printf ("%-23s State \tBreaks\t(last modified, maintainer)\n","Pkg");
}
system("mkdir -p ${FTP}");
# Copy over the output from the build process
chdir("$USR_PKGSRC");
system("tar plcf - $BROKENFILE */*/$BROKENFILE | ( cd ${FTP} ; tar plxf - )");
# Copy over the cache files used during the build
if (-f $DEPENDSTREEFILE ) {system("cp $DEPENDSTREEFILE ${FTP}");}
if (-f $DEPENDSFILE ) {system("cp $DEPENDSFILE ${FTP}");}
if (-f $SUPPORTSFILE ) {system("cp $SUPPORTSFILE ${FTP}");}
if (-f $INDEXFILE ) {system("cp $INDEXFILE ${FTP}");}
if (-f $ORDERFILE ) {system("cp $ORDERFILE ${FTP}");}
open(HTML,">$REPORT") or die "Can't write $REPORT: $!\n";
print HTML <<EOHTML
<HTML>
<HEAD>
<TITLE>$os-$osrev/$arch bulk package build</TITLE>
</HEAD>
<BODY BGCOLOR=#cccccc>
<H1> $os $osrev/$arch </H1>
<H2>Output of the pkgsrc bulk build<BR>
as of $date</H2>
Packages not listed here resulted in a <A
HREF="../../packages/">binary package</A>. To see the output of
the (failed) build, select the package below.
<P>
Files not listed in PLISTs can be found in <A HREF="leftovers-${arch}.html">this list</A>.
<P>
<TABLE>
<TR><TH> Package <TH> State <TH> Pkgs Broken by <TH> Last touched by <TH> File touched last <TH> Maintainer
EOHTML
;
# some nifty postprocessing of $FTP/.broken* -> HTML here
$nunpackaged = $nbroken = $nbrokendep = 0;
chdir("$FTP");
open(BF,"sort +1 $BROKENFILE |") or die "can't open .broken-file '$BROKENFILE'";
while (<BF>) {
($nerrors, $bf, $nbrokenby) = split;
$pkg = $bf;
$pkg =~ s,/$BROKENFILE,,;
# next
# if $pkg!~/^a/; # DEBUG! HF
if ($nerrors > 0) {
$color = "red";
$state = "build broken";
$nbroken++;
} elsif ($nerrors == -1) {
$color = "orange";
$state = "broken depends";
$nbrokendep++;
} else {
$color = "yellow";
$state = "not packaged";
$nunpackaged++;
}
@idents = `${FIND} ${USR_PKGSRC}/${pkg} -type f -print | xargs grep \\\$NetBSD`;
$datetime = "";
$who = "nobody";
$file = "";
$ver = "";
foreach $ident (@idents) {
$ident =~ /\$[N]etBSD: ([^ ]*),v ([^ ]*) ([^ ]*) ([^ ]*) ([^ ]*) Exp \$/;
if ("$3 $4" gt $datetime) {
$datetime = "$3 $4";
$who = $5;
$file = $1;
$ver = $1;
}
}
$maintainer=`grep ^MAINTAINER $USR_PKGSRC/$pkg/Makefile`;
$maintainer =~ s/MAINTAINER=[ \t]*//;
$maintainer =~ s/</</g;
$maintainer =~ s/>/>/g;
chomp($maintainer);
print HTML "<TR><TD><A HREF=\"$bf\">$pkg</A>";
print HTML " <TD><FONT COLOR=$color>$state</FONT>";
if ($nbrokenby > 0){
print HTML " <TD ALIGN=\"right\"><FONT COLOR=$color>$nbrokenby</FONT>";
}
else {
print HTML " <TD> ";
}
print HTML " <TD> $who <TD> $file";
print HTML " <TD> $maintainer\n";
($category, $dbfeed_pkg) = split('/', $pkg);
if ($nerrors != 0) {
if ($nbrokenby > 0){
printf("%-23s $state\t%-5d\t($who, $maintainer)\n", "$pkg:",$nbrokenby)
if $verbose;
}
else {
printf("%-23s $state\t%-5s\t($who, $maintainer)\n", "$pkg:","")
if $verbose;
}
}
}
close(BF);
$nbrokentot=$nbroken+$nbrokendep;
$ntotal=$nunpackaged+$nbroken+$nbrokendep;
print HTML <<EOHTML
</TABLE>
<HR>
<P>
The following cache files were used during the build:
<UL>
<LI>The <a href=$dtfile>depends tree file</a>.
<LI>The <a href=$depfile>depends file</a>.
<LI>The <a href=$supfile>supports file</a>.
<LI>The <a href=$indfile>index file</a>.
<LI>The <a href=$ordfile>build order file</a>.
</UL>
<P>
<HR>
<TABLE>
<TR><TD> Packages not packaged: <TD ALIGHT=RIGHT> <FONT COLOR=yellow>$nunpackaged</FONT>
<TR><TD> Packages really broken: <TD ALIGHT=RIGHT> <FONT COLOR=red>$nbroken</FONT>
<TR><TD> Pkgs broken due to them: <TD ALIGHT=RIGHT> <FONT COLOR=blue>$nbrokendep</FONT>
<TR><TD> Total broken: <TD ALIGHT=RIGHT> $nbrokentot
<TR><TD> Total: <TD ALIGHT=RIGHT> $ntotal
</TABLE>
<HR>
<P>
<UL>
<!-- <LI>View the <A HREF="$PROG">progress</A> of the build. -->
<!-- <LI>See the list of <A HREF="../index.html">all log files</A>. -->
<LI>Visit the <A HREF="http://www.netbsd.org">NetBSD Homepage</A>.
<LI>Learn about the
<A HREF="http://www.netbsd.org/Documentation/software/packages.html">
NetBSD Package System</A>.
</UL>
</P>
<HR>
Hubert Feyrer, 1999-2000.
</BODY>
</HTML>
EOHTML
;
close(HTML);
#
# Adjust "last" symlink
#
{
local($base, $dir) = $FTP=~m|^(.*)/([^/]*)$|;
unlink("$base/last");
symlink($dir, "$base/last");
}
#
# Generate leftovers-${arch}.html: files not deleted
# Leftover files are copied to leftovers-${arch} dir, and linked from
# leftovers-${arch}.html
#
{
chdir("${FTP}");
system("mkdir -p leftovers-${arch}");
# Find files since last build:
$leftovers_txt = "leftovers-${arch}.txt";
$leftovers_html = "leftovers-${arch}.html";
system("${FIND} ${LOCALBASE} -newer ${USR_PKGSRC}/${startfile} -type f -print >>$leftovers_txt");
system("${FIND} ${X11BASE} -newer ${USR_PKGSRC}/${startfile} -type f -print >>$leftovers_txt");
# Strip perl-files:
{
local $/;
undef $/;
$perlfiles = `pkg_info -qL perl`;
}
($perlfiles_pattern = $perlfiles) =~ s/\n/|/g;
$perlfiles_pattern =~ s/|$//;
open (LEFT, $leftovers_txt) or die "can't read $leftovers_txt: $!";
@left = <LEFT>;
close (LEFT);
@leftovers = grep(!/^(${perlfiles_pattern})$/, @left);
open (LEFT, ">$leftovers_txt") or die "can't write $leftovers_txt: $!";
print LEFT @leftovers;
close (LEFT);
if (scalar(@leftovers)) {
# Store leftovers, for easier identification:
system("tar plcf - `cat $leftovers_txt` | ( cd leftovers-${arch} ; tar plxf - )");
}
# Add links to leftover list:
open (OUT, "> $leftovers_html")
or die "can't write $leftovers_html";
print OUT <<EOOUT
<HTML>
<BODY>
<PRE>
EOOUT
;
foreach (@leftovers) {
print OUT "<A HREF=\"${FTPHOST}/${FTPURL}/leftovers-${arch}$_\">$_</A>\n";
}
print OUT <<EOOUT2
</PRE>
</BODY>
</HTML>
EOOUT2
;
close(OUT);
}
if ($verbose) {
print "\n";
print "Packages not packaged: $nunpackaged\n";
print "Packages really broken: $nbroken\n";
print "Pkgs broken due to them: $nbrokendep\n";
print "Total broken: $nbrokentot\n";
print "Total: $ntotal\n";
print "\n";
print "See $FTPHOST/$FTPURL/$reportf\n";
print "for logs of builds broken or not resulting in a binary pkg.\n";
print "\n";
print "\n";
print "$ADMINSIG\n";
print "\n";
print "[* This message was created automatically! *]\n";
print "\n";
}
|