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
|
#!/usr/pkg/bin/perl
# $Id: post-build,v 1.1 2000/09/15 22:05:47 hubertf 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("FTPURL"); # "pub/NetBSD/pkgstat/`date +%Y%m%d.%H%M`"
getconf("FTP"); # "/disk1/ftp/${FTPURL}"
getconf("REPORT"); # "broken.html"
getconf("USR_PKGSRC"); # "/usr/pkgsrc"
getconf("osrev"); # `uname -r`
getconf("arch"); # `uname -m`
chomp($date=`date`);
$verbose=1;
if ($verbose) {
print "\n";
print "*** NetBSD $osrev/$arch\n";
print "*** Result of bulk pkgsrc build as of $date:\n";
print "\n";
}
system("mkdir -p ${FTP}");
# Copy over the output from the build process
chdir("$USR_PKGSRC");
system("tar plcf - .broken* */*/.broken* | ( cd ${FTP} ; tar plxf - )");
open(HTML,">$REPORT") or die;
print HTML <<EOHTML
<HTML>
<HEAD>
<TITLE>NetBSD-$osrev/$arch bulk package build</TITLE>
</HEAD>
<BODY BGCOLOR=#cccccc>
<H1> NetBSD $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> Last touched by <TH> File touched last <TH> Maintainer
EOHTML
;
# some nifty postprocessing of $FTP/.broken* -> HTML here
$nunpackaged = $nbroken = 0;
chdir("$FTP");
$bf=".broken.$arch";
open(BF,"sort +1 $bf |") or die "can't open .broken-file '$bf'";
while (<BF>) {
($nerrors, $bf) = split;
( $pkg = $bf ) =~ s,/.broken.*$,,;
# next
# if $pkg!~/^a/; # DEBUG! HF
if ($nerrors > 0) {
$color = "red";
$state = "build broken";
$nbroken++;
} else {
$color = "yellow";
$state = "not packaged";
$nunpackaged++;
}
# The idea of this is stolen from bsd.pkg.mk's
# show-pkgtools-version target - thanks Al! :-)
$whofile = `find ${USR_PKGSRC}/${pkg} -type f -print | xargs ident 2>/dev/null | awk '\$1 ~ /\\\$NetBSD/ { gsub("/", "", \$4); print \$4 " " \$6 " " \$2 }' | sort -n | tail -n 1 | awk '{ print \$2 " " \$3 }' `;
$whofile=~s/,v$//;
chomp($whofile);
($who,$file) = split(/\s+/, $whofile);
# $maintainer=`( cd $USR_PKGSRC/$pkg ; ( echo '.include "Makefile"' ; echo 'bla: ; \@echo ${MAINTAINER}' ) | make -f - bla )`;
$maintainer=`grep ^MAINTAINER $USR_PKGSRC/$pkg/Makefile | awk '{ print \$2\$3\$4\$5\$6}' | sed -e 's/\</</g' -e 's/\>/>/g'`;
chomp($maintainer);
print HTML "<TR><TD><A HREF=\"$bf\">$pkg</A>";
print HTML " <TD><FONT COLOR=$color>$state</FONT>";
print HTML " <TD> $who <TD> $file";
print HTML " <TD> $maintainer\n";
($category, $dbfeed_pkg) = split('/', $pkg);
if ($nerrors > 0) {
printf("%-23s $state\t($who, $maintainer)\n", "$pkg:")
if $verbose;
}
}
close(BF);
$ntotal=$nunpackaged+$nbroken;
print HTML <<EOHTML
</TABLE>
<HR>
<TABLE>
<TR><TD> Packages not packaged: <TD ALIGHT=RIGHT> <FONT COLOR=yellow>$nunpackaged</FONT>
<TR><TD> Packages broken: <TD ALIGHT=RIGHT> <FONT COLOR=red>$nbroken</FONT>
<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:
system("find /usr/pkg -newer ${USR_PKGSRC}/.start.${arch} -type f >>leftovers-${arch}.txt");
system("find /usr/X11R6 -newer ${USR_PKGSRC}/.start.${arch} -type f >>leftovers-${arch}.txt");
# Strip perl-files:
system("pkg_info -qL perl-base > .p.${arch}");
system("fgrep -v -x -f .p.${arch} leftovers-${arch}.txt >leftovers-${arch}.txt.new");
rename("leftovers-${arch}.txt.new", "leftovers-${arch}.txt");
unlink(".p.${arch}");
# Store leftovers, for easier identification:
system("tar plcf - `cat leftovers-${arch}.txt` | ( cd leftovers-${arch} ; tar plxf - )");
# Add links to leftover list:
open (IN, "< leftovers-${arch}.txt")
or die "can't read leftovers-${arch}.txt";
open (OUT, "> leftovers-${arch}.html")
or die "can't write leftovers-${arch}.html";
print OUT <<EOOUT
<HTML>
<BODY>
<PRE>
EOOUT
;
while (<IN>) {
print OUT "<A HREF=\"/${FTPURL}/leftovers-${arch}$_\">$_</A>\n";
}
print OUT <<EOOUT2
</PRE>
</BODY>
</HTML>
EOOUT2
;
close(IN);
close(OUT);
}
if ($verbose) {
print "\n";
print "Packages not packaged: $nunpackaged\n";
print "Packages broken: $nbroken\n";
print "Total: $ntotal\n";
print "\n";
print "See $FTPHOST/$FTPURL/broken.html\n";
print "for logs of builds broken or not resulting in a binary pkg.\n";
print "\n";
print "\n";
print " - Hubert\n";
print "\n";
print "[* This message was created automatically! *]\n";
print "\n";
}
|