<commit_before>#!/bin/sh
# This file is in the public domain
# $FreeBSD$

rm -rf HTML
mkdir -p HTML

ref_blk=`awk 'NR == 2 {print $3}' Tmp/Ref/_.df`

echo $ref_blk

H=HTML/index.html
echo "<HTML>" > ${H}

echo "<TABLE border=2>" >> ${H}
echo '

<TR>
<TH COLSPAN=13>Build option survey</TH>
</TR>

<TR>
<TH ROWSPAN=2>make.conf</TH>
<TH COLSPAN=4>InstallWorld</TH>
<TH COLSPAN=4>BuildWorld</TH>
<TH COLSPAN=4>Build + InstallWorld</TH>
</TR>

<TR>
<TH>Blocks</TH>
<TH>Delta</TH>
<TH COLSPAN=2>Files</TH>
<TH>Blocks</TH>
<TH>Delta</TH>
<TH COLSPAN=2>Files</TH>
<TH>Blocks</TH>
<TH>Delta</TH>
<TH COLSPAN=2>Files</TH>
</TR>
' >> $H
echo '<TR><TD><I>[empty]</I></TD>' >> $H
echo "<TD align=right>$ref_blk</TD>" >> $H
echo "<TD></TD><TD></TD><TD></TD>" >> $H
echo "<TD align=right>$ref_blk</TD>" >> $H
echo "<TD></TD><TD></TD><TD></TD>" >> $H
echo "<TD align=right>$ref_blk</TD>" >> $H
echo "<TD></TD><TD></TD><TD></TD>" >> $H
echo "</TR>" >> $H

cat no_list | while read o
do
	m=`echo "$o=YES" | md5`
	echo "<TR>" >> $H
	echo "<TD>" >> $H
	cat Tmp/$m/iw/make.conf >> $H
	echo "</TD>" >> $H
	for d in iw bw w
	do
		if [ ! -d Tmp/$m/$d ] ; then
			echo "<TD>-</TD><TD>-</TD><TD>-</TD><TD>-</TD>" >> $H
			continue
		fi
		if [ ! -f Tmp/$m/$d/_.df ] ; then
			echo "<TD>-</TD><TD>-</TD><TD>-</TD><TD>-</TD>" >> $H
			continue
		fi
		blk=`awk 'NR == 2 {print $3}' Tmp/$m/$d/_.df`
		echo "<TD align=right>$blk</TD>" >> $H
		echo "<TD align=right>`expr $blk - $ref_blk`</TD>" >> $H
		mtree -f Tmp/Ref/_.mtree -f Tmp/$m/$d/_.mtree | 
		     sed  '/^		/d' > HTML/$m.$d.mtree.txt

		sub=`grep -cv '^	' < HTML/$m.$d.mtree.txt`
		add=`grep -c '^	' < HTML/$m.$d.mtree.txt`
		echo "<TD align=right><A href=\"$m.$d.mtree.txt\">+$add</A></TD>" >> $H
		echo "<TD align=right><A href=\"$m.$d.mtree.txt\">-$sub</A></TD>" >> $H

	done
	echo "</TR>" >> $H
done
echo "</TABLE>" >> ${H}
echo "</HTML>" >> ${H}

scp -r HTML phk@critter:/tmp
#scp -r HTML phk@phk:www/misc/kernel_options<commit_msg>Add stuff to HTML output.<commit_after>#!/bin/sh
# This file is in the public domain
# $FreeBSD$

rm -rf HTML
mkdir -p HTML

ref_blk=`awk 'NR == 2 {print $3}' Tmp/Ref/_.df`

echo $ref_blk

H=HTML/index.html
echo '<HTML>
<H1>FreeBSD Build Option Survey</H1>
<P>
This table shows the effect on various build options NO_* build
options in FreeBSD.
<P>
For each option is shown the effect of applying it to buildworld
alone, installworld alone or to both.
<P>
For each case is shown the size of the installworld image, the
delta compared to the full installworld and the number of file
system entries added, deleted or changed by the option.
<P>
The add/delete/change fields link to "mtree(1) -f -f" output
for the relevant files.
For the "changed" data, the first line is the reference copy
and the second line is the result of the applied option.
<H2>Technical notes</H2>
<P>
This table is generated by software that can be found in
src/tools/tools/build_option_survey.
<P>
The installworld is made onto a 200MB UFS1 filesystem with
4k blocksize and 512 bytes fragmentsize.  This matches
use nanoBSDs filesystem creation usage.
<P>
For reasons of randomness, the "usr/share/man/whatis" file varies
in size from installworld to installworld, and this generally
dithers the results by a few blocks in one or the other direction.
' > ${H}

echo "<P>This table was created on `uname -rm` at `date`" >> ${H}
echo "<HR>" >> ${H}
echo "<TABLE border=2>" >> ${H}
echo '

<TR>
<TH COLSPAN=16>Build option survey</TH>
</TR>

<TR>
<TH ROWSPAN=2>make.conf</TH>
<TH COLSPAN=5>BuildWorld</TH>
<TH COLSPAN=5>InstallWorld</TH>
<TH COLSPAN=5>Build + InstallWorld</TH>
</TR>

<TR>
<TH>Blocks</TH>
<TH>Delta</TH>
<TH COLSPAN=3>Files</TH>
<TH>Blocks</TH>
<TH>Delta</TH>
<TH COLSPAN=3>Files</TH>
<TH>Blocks</TH>
<TH>Delta</TH>
<TH COLSPAN=3>Files</TH>
</TR>
' >> $H
echo '<TR><TD><I>[empty]</I></TD>' >> $H
echo "<TD align=right>$ref_blk</TD>" >> $H
echo "<TD></TD><TD></TD><TD></TD><TD></TD>" >> $H
echo "<TD align=right>$ref_blk</TD>" >> $H
echo "<TD></TD><TD></TD><TD></TD><TD></TD>" >> $H
echo "<TD align=right>$ref_blk</TD>" >> $H
echo "<TD></TD><TD></TD><TD></TD><TD></TD>" >> $H
echo "</TR>" >> $H

grep -v '#' no_list | while read o
do
	echo "# $o"
	m=`echo "$o=YES" | md5`
	echo "<TR>" >> $H
	echo "<TD>" >> $H
	cat Tmp/$m/iw/make.conf >> $H
	echo "</TD>" >> $H
	for d in bw iw w
	do
		if [ ! -d Tmp/$m/$d ] ; then
			echo "<TD>-</TD><TD>-</TD><TD>-</TD><TD>-</TD><TD>-</TD>" >> $H
			continue
		fi
		if [ ! -f Tmp/$m/$d/_.df ] ; then
			echo "<TD>-</TD><TD>-</TD><TD>-</TD><TD>-</TD><TD>-</TD>" >> $H
			continue
		fi
		blk=`awk 'NR == 2 {print $3}' Tmp/$m/$d/_.df`
		echo "<TD align=right>$blk</TD>" >> $H
		echo "<TD align=right>`expr $blk - $ref_blk`</TD>" >> $H
		mtree -f Tmp/Ref/_.mtree -f Tmp/$m/$d/_.mtree \
		    > HTML/$m.$d.mtree.txt

		grep '^[^	]' \
			HTML/$m.$d.mtree.txt > HTML/$m.$d.sub.txt
		grep '^	[^	]' \
			HTML/$m.$d.mtree.txt > HTML/$m.$d.add.txt
		sed '
		/^	[^	]/d
		/^[^	]/d
		/ file$/d
		/ dir$/d
		/ link$/d
		' HTML/$m.$d.mtree.txt > HTML/$m.$d.chg.txt 

		rm -f HTML/$m.$d.mtree.txt

		sub=`wc -l < HTML/$m.$d.sub.txt`
		add=`wc -l < HTML/$m.$d.add.txt`
		chg=`wc -l < HTML/$m.$d.chg.txt`
		chg=`expr $chg / 2`
		if [ $add -eq 0 ] ; then
			echo "<TD align=right>+$add</TD>" >> $H
			rm -f HTML/$m.$d.add.txt
		else
			echo "<TD align=right><A href=\"$m.$d.add.txt\">+$add</A></TD>" >> $H
		fi
		if [ $sub -eq 0 ] ; then
			echo "<TD align=right>-$sub</TD>" >> $H
			rm -f HTML/$m.$d.sub.txt
		else
			echo "<TD align=right><A href=\"$m.$d.sub.txt\">-$sub</A></TD>" >> $H
		fi
		if [ $chg -eq 0 ] ; then
			echo "<TD align=right>*$chg</TD>" >> $H
			rm -f HTML/$m.$d.chg.txt
		else
			echo "<TD align=right><A href=\"$m.$d.chg.txt\">*$chg</A></TD>" >> $H
		fi

	done
	echo "</TR>" >> $H
done
echo "</TABLE>" >> ${H}
echo "</HTML>" >> ${H}

#scp -r HTML phk@critter:/tmp
#scp -r HTML phk@phk:www/misc/kernel_options
{'fraction_non_alphanumeric': 0.2483471774877098, 'fraction_numerical': 0.007967452110527209, 'mean_word_length': 3.3510324483775813, 'pattern_counts': {'":': 0, '<': 241, '<?xml version=': 0, '>': 347, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2967101', 'n_tokens_mistral': 2700, 'n_tokens_neox': 2534, 'n_words': 657}