aboutsummaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorlinimon <linimon@FreeBSD.org>2006-07-08 11:33:06 +0800
committerlinimon <linimon@FreeBSD.org>2006-07-08 11:33:06 +0800
commit46adf870adc75053d487404c85858d610c191227 (patch)
tree2fe961aeab2192903ce65788089d6efd66130bea /Tools
parentd32807e2f1645a8aeb16248abd39454d5a00d8e9 (diff)
downloadfreebsd-ports-gnome-46adf870adc75053d487404c85858d610c191227.tar.gz
freebsd-ports-gnome-46adf870adc75053d487404c85858d610c191227.tar.zst
freebsd-ports-gnome-46adf870adc75053d487404c85858d610c191227.zip
Refactor. No code change (yet).
Diffstat (limited to 'Tools')
-rwxr-xr-xTools/portbuild/scripts/dopackagestats42
1 files changed, 31 insertions, 11 deletions
diff --git a/Tools/portbuild/scripts/dopackagestats b/Tools/portbuild/scripts/dopackagestats
index 88ba1e26ef55..7aab8e26415a 100755
--- a/Tools/portbuild/scripts/dopackagestats
+++ b/Tools/portbuild/scripts/dopackagestats
@@ -18,6 +18,9 @@ THCOLOR="#E0E0FF"
TDCOLOR_DONE="lightgreen"
TDCOLOR_NOT_DONE="lightyellow"
+# subroutines
+
+write_header () {
echo "<html>" > ${TMPFILE}
echo "<head>" >> ${TMPFILE}
echo "<title>FreeBSD package building statistics</title>" >> ${TMPFILE}
@@ -26,10 +29,9 @@ echo "</head>" >> ${TMPFILE}
echo "<body>" >> ${TMPFILE}
echo "<h1>FreeBSD package building statistics</h1>" >> ${TMPFILE}
echo "<p>as of `date`</p>" >> ${TMPFILE}
+}
-for arch in ${SUPPORTED_ARCHS}; do
-
- # begin table
+write_table_begin () {
echo "<table border='1' cellpadding='4' cellspacing='1' bgcolor='$TABLEBGCOLOR'>" >> ${TMPFILE}
echo "<tr>" >> ${TMPFILE}
echo "<td align='left' width='80' bgcolor='$TABLEBGCOLOR'>&nbsp;</td>" >> ${TMPFILE}
@@ -41,13 +43,13 @@ for arch in ${SUPPORTED_ARCHS}; do
echo "<th bgcolor='$THCOLOR'>missing</th>" >> ${TMPFILE}
echo "<th bgcolor='$THCOLOR'>done?</th>" >> ${TMPFILE}
echo "</tr>" >> ${TMPFILE}
+}
- # begin row
- branches=`ls ${ROOT_DIRECTORY}/${arch} | grep '^[1-9]$' | sort`
- for branch in ${branches}; do
-
+write_row () {
# first, gather data
+ arch=$1
+ branch=$2
directory=${ROOT_DIRECTORY}/${arch}/${branch}
if [ "$branch" = "4" ]; then
indexfile=$directory/ports/INDEX
@@ -130,14 +132,14 @@ for arch in ${SUPPORTED_ARCHS}; do
echo "<td align='right' bgcolor='$cellcolor'>$n_missing</td>" >> ${TMPFILE}
echo "<td align='center' bgcolor='$cellcolor'>$done_flag</td>" >> ${TMPFILE}
echo "</tr>" >> ${TMPFILE}
+}
- done
-
+write_table_end () {
echo "</table>" >> ${TMPFILE}
echo "<br>" >> ${TMPFILE}
+}
-done
-
+write_footer () {
echo "<p>explanation of columns:</p>" >> ${TMPFILE}
echo "<ul>" >> ${TMPFILE}
echo "<li><b>as of</b> is the date of the latest logfile.</li>" >> ${TMPFILE}
@@ -151,5 +153,23 @@ echo "</ul>" >> ${TMPFILE}
echo "</body>" >> ${TMPFILE}
echo "</html>" >> ${TMPFILE}
+}
+
+# main
+
+write_header
+
+for arch in ${SUPPORTED_ARCHS}; do
+ write_table_begin
+
+ branches=`ls ${ROOT_DIRECTORY}/${arch} | grep '^[1-9]$' | sort`
+ for branch in ${branches}; do
+ write_row ${arch} ${branch}
+ done
+
+ write_table_end
+done
+
+write_footer
mv -f ${TMPFILE} ${OUTFILE}