From 79d26c7a83fd2b14cc9a787e7820824931336d85 Mon Sep 17 00:00:00 2001
From: Patrick Georgi
Date: Fri, 8 Jun 2018 18:10:58 +0200
Subject: [PATCH] util/docker/coreboot.org-status: collect report generators
Move generators for the board status report and the kconfig options
report into a common directory and wrap them in a docker container.
Also rework to emit HTML not wiki syntax.
Change-Id: If42e1dd312c5fa4e32f519865e3b551bc471bc72
Signed-off-by: Patrick Georgi
Reviewed-on: https://review.coreboot.org/26977
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth
---
util/board_status/to-wiki/foreword.wiki | 38 ----
util/board_status/to-wiki/push-to-wiki.sh | 80 --------
util/docker/coreboot.org-status/Dockerfile | 7 +
util/docker/coreboot.org-status/README.md | 4 +
.../board-status.html}/README | 0
.../board-status.html}/bucketize.sh | 0
.../board-status.html/foreword.html | 37 ++++
.../board-status.html/status-to-html.sh} | 2 +-
.../board-status.html/tohtml.sh} | 172 ++++++++++--------
.../coreboot.org-status}/kconfig2html | 0
util/docker/coreboot.org-status/run.sh | 28 +++
util/optionlist/Makefile | 20 --
util/optionlist/README | 1 -
13 files changed, 170 insertions(+), 219 deletions(-)
delete mode 100644 util/board_status/to-wiki/foreword.wiki
delete mode 100755 util/board_status/to-wiki/push-to-wiki.sh
create mode 100644 util/docker/coreboot.org-status/Dockerfile
create mode 100644 util/docker/coreboot.org-status/README.md
rename util/{board_status/to-wiki => docker/coreboot.org-status/board-status.html}/README (100%)
rename util/{board_status/to-wiki => docker/coreboot.org-status/board-status.html}/bucketize.sh (100%)
create mode 100644 util/docker/coreboot.org-status/board-status.html/foreword.html
rename util/{board_status/to-wiki/status-to-wiki.sh => docker/coreboot.org-status/board-status.html/status-to-html.sh} (87%)
rename util/{board_status/to-wiki/towiki.sh => docker/coreboot.org-status/board-status.html/tohtml.sh} (79%)
rename util/{optionlist => docker/coreboot.org-status}/kconfig2html (100%)
create mode 100755 util/docker/coreboot.org-status/run.sh
delete mode 100644 util/optionlist/Makefile
delete mode 100644 util/optionlist/README
diff --git a/util/board_status/to-wiki/foreword.wiki b/util/board_status/to-wiki/foreword.wiki
deleted file mode 100644
index 6b2af63aaf..0000000000
--- a/util/board_status/to-wiki/foreword.wiki
+++ /dev/null
@@ -1,38 +0,0 @@
-__NOTOC__
-This page was automatically generated. Please do not edit, any edits will be overwritten by an
-automatic utility.
-
-= Mainboards supported by coreboot =
-
-This page shows two representations of the same data:
-
-First a list of all mainboards supported by coreboot (current within
-one hour) ordered by category. For each mainboard the table shows the
-latest user-contributed report of a successful boot on the device.
-
-After that, the page provides a time-ordered list of these contributed
-reports, with the newest report first.
-
-Boards without such reports may boot or there may be some maintenance
-required. The reports contain the coreboot configuration and precise commit
-id, so it is possible to reproduce the build.
-
-We encourage developers and users to contribute reports so we know which
-devices are well-tested. We have
-[https://review.coreboot.org/gitweb/cgit/coreboot.git/tree/util/board_status a tool in the coreboot repository]
-to make contributing easy. The data resides in the
-[https://review.coreboot.org/gitweb/cgit/board-status.git/ board status repository].
-Contributing requires an account on review.coreboot.org
-
-Sometimes the same board is sold under different names, we've tried to
-list all known names but some names might be missing.
-
-If the board is not found in the coreboot's source code, there might
-be some form of support that is not ready yet for inclusion in coreboot,
-usually people willing to send their patches to coreboot goes through
-[https://review.coreboot.org gerrit], so looking there could find some
-code for boards that are not yet merged.
-
-= Vendor trees =
-Some vendors have their own coreboot trees/fork, like for instance:
-* [http://git.chromium.org/gitweb/?p=chromiumos/third_party/coreboot.git;a=summary chrome/chromium's tree]
diff --git a/util/board_status/to-wiki/push-to-wiki.sh b/util/board_status/to-wiki/push-to-wiki.sh
deleted file mode 100755
index 6ad3c4a3f8..0000000000
--- a/util/board_status/to-wiki/push-to-wiki.sh
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/bin/bash
-# $1: file containing text
-# $2: wiki page to update
-
-. ~/.wikiaccount
-WIKIAPI="https://www.coreboot.org/api.php"
-TITLE="$2"
-cookie_jar="$HOME/.wikicookiejar"
-#Will store file in wikifile
-
-#################login
-#Login part 1
-CR=$(curl -sS \
- --location \
- --retry 2 \
- --retry-delay 5\
- --cookie $cookie_jar \
- --cookie-jar $cookie_jar \
- --user-agent "Curl Shell Script" \
- --keepalive-time 60 \
- --header "Accept-Language: en-us" \
- --header "Connection: keep-alive" \
- --compressed \
- --data-urlencode "lgname=${USERNAME}" \
- --data-urlencode "lgpassword=${USERPASS}" \
- --request "POST" "${WIKIAPI}?action=login&format=json")
-
-TOKEN=`echo $CR| sed -e 's,^.*"token":"\([^"]*\)".*$,\1,'`
-if [ -z "$TOKEN" ]; then
- exit
-fi
-
-#Login part 2
-CR=$(curl -sS \
- --location \
- --cookie $cookie_jar \
- --cookie-jar $cookie_jar \
- --user-agent "Curl Shell Script" \
- --keepalive-time 60 \
- --header "Accept-Language: en-us" \
- --header "Connection: keep-alive" \
- --compressed \
- --data-urlencode "lgname=${USERNAME}" \
- --data-urlencode "lgpassword=${USERPASS}" \
- --data-urlencode "lgtoken=${TOKEN}" \
- --request "POST" "${WIKIAPI}?action=login&format=json")
-
-###############
-#Get edit token
-CR=$(curl -sS \
- --location \
- --cookie $cookie_jar \
- --cookie-jar $cookie_jar \
- --user-agent "Curl Shell Script" \
- --keepalive-time 60 \
- --header "Accept-Language: en-us" \
- --header "Connection: keep-alive" \
- --compressed \
- --request "POST" "${WIKIAPI}?action=query&meta=tokens&format=json")
-
-EDITTOKEN=`echo $CR| sed -e 's,^.*"csrftoken":"\([^"]*\)".*$,\1,'`
-EDITTOKEN=`printf "$EDITTOKEN"`
-if [ ${#EDITTOKEN} != 34 ]; then
- exit
-fi
-#########################
-
-CR=$(curl -sS \
- --location \
- --cookie $cookie_jar \
- --cookie-jar $cookie_jar \
- --user-agent "Curl Shell Script" \
- --keepalive-time 60 \
- --header "Accept-Language: en-us" \
- --header "Connection: keep-alive" \
- --header "Expect:" \
- --form "token=${EDITTOKEN}" \
- --form "title=${TITLE}" \
- --form "text=<$1" \
- --request "POST" "${WIKIAPI}?action=edit&")
diff --git a/util/docker/coreboot.org-status/Dockerfile b/util/docker/coreboot.org-status/Dockerfile
new file mode 100644
index 0000000000..910f8e75cc
--- /dev/null
+++ b/util/docker/coreboot.org-status/Dockerfile
@@ -0,0 +1,7 @@
+FROM debian:sid
+
+RUN apt-get update && apt-get install -y python git bc && apt-get clean
+
+ADD board-status.html kconfig2html run.sh /opt/tools/
+
+ENTRYPOINT /opt/tools/run.sh
diff --git a/util/docker/coreboot.org-status/README.md b/util/docker/coreboot.org-status/README.md
new file mode 100644
index 0000000000..f35cf55223
--- /dev/null
+++ b/util/docker/coreboot.org-status/README.md
@@ -0,0 +1,4 @@
+# Docker container to create coreboot status reports
+
+This container expects input in `/data-in/{coreboot,board-status}.git` and
+emits two files `/data-out/{board-status.html,kconfig-options.html}`.
diff --git a/util/board_status/to-wiki/README b/util/docker/coreboot.org-status/board-status.html/README
similarity index 100%
rename from util/board_status/to-wiki/README
rename to util/docker/coreboot.org-status/board-status.html/README
diff --git a/util/board_status/to-wiki/bucketize.sh b/util/docker/coreboot.org-status/board-status.html/bucketize.sh
similarity index 100%
rename from util/board_status/to-wiki/bucketize.sh
rename to util/docker/coreboot.org-status/board-status.html/bucketize.sh
diff --git a/util/docker/coreboot.org-status/board-status.html/foreword.html b/util/docker/coreboot.org-status/board-status.html/foreword.html
new file mode 100644
index 0000000000..4d77c3f66e
--- /dev/null
+++ b/util/docker/coreboot.org-status/board-status.html/foreword.html
@@ -0,0 +1,37 @@
+Mainboards supported by coreboot
+
+This page shows two representations of the same data:
+
+First a list of all mainboards supported by coreboot (current within
+one hour) ordered by category. For each mainboard the table shows the
+latest user-contributed report of a successful boot on the device.
+
+After that, the page provides a time-ordered list of these contributed
+reports, with the newest report first.
+
+Boards without such reports may boot or there may be some maintenance
+required. The reports contain the coreboot configuration and precise commit
+id, so it is possible to reproduce the build.
+
+We encourage developers and users to contribute reports so we know which
+devices are well-tested. We have
+a tool in the coreboot repository
+to make contributing easy. The data resides in the
+board status repository.
+Contributing requires an account on review.coreboot.org
+
+Sometimes the same board is sold under different names, we've tried to
+list all known names but some names might be missing.
+
+If the board is not found in the coreboot's source code, there might
+be some form of support that is not ready yet for inclusion in coreboot,
+usually people willing to send their patches to coreboot goes through
+gerrit, so looking there could find some
+code for boards that are not yet merged.
+
+Vendor trees
+Some vendors have their own coreboot trees/fork, for instance:
+
+
diff --git a/util/board_status/to-wiki/status-to-wiki.sh b/util/docker/coreboot.org-status/board-status.html/status-to-html.sh
similarity index 87%
rename from util/board_status/to-wiki/status-to-wiki.sh
rename to util/docker/coreboot.org-status/board-status.html/status-to-html.sh
index 8d3d2a4a70..6630b30c1f 100755
--- a/util/board_status/to-wiki/status-to-wiki.sh
+++ b/util/docker/coreboot.org-status/board-status.html/status-to-html.sh
@@ -1,2 +1,2 @@
#!/bin/sh
-ls -d */*/*/*/ | `dirname $0`/bucketize.sh weekly | `dirname $0`/towiki.sh
+ls -d */*/*/*/ | `dirname $0`/bucketize.sh weekly | `dirname $0`/tohtml.sh
diff --git a/util/board_status/to-wiki/towiki.sh b/util/docker/coreboot.org-status/board-status.html/tohtml.sh
similarity index 79%
rename from util/board_status/to-wiki/towiki.sh
rename to util/docker/coreboot.org-status/board-status.html/tohtml.sh
index e8d2fb22fd..b1a7ccdc9a 100755
--- a/util/board_status/to-wiki/towiki.sh
+++ b/util/docker/coreboot.org-status/board-status.html/tohtml.sh
@@ -1,10 +1,10 @@
#!/bin/sh
-export COREBOOT_DIR="../coreboot"
+export COREBOOT_DIR="../coreboot.git"
export GIT_DIR="$COREBOOT_DIR/.git"
CODE_GITWEB="https://review.coreboot.org/gitweb/cgit/coreboot.git/commit/?id="
STATUS_GITWEB="https://review.coreboot.org/gitweb/cgit/board-status.git/tree/"
-if [ -f `dirname $0`/foreword.wiki ]; then
- cat `dirname $0`/foreword.wiki
+if [ -f `dirname $0`/foreword.html ]; then
+ cat `dirname $0`/foreword.html
fi
detailed=
nl="
@@ -13,7 +13,7 @@ have=
while read line; do
timeframe=`echo $line | cut -d: -f1`
rest=`echo $line | cut -d: -f2-`
- detailed="$detailed= $timeframe =$nl"
+ detailed="$detailed$timeframe
$nl"
for i in $rest; do
vendor_board=`echo $i | cut -d/ -f1-2`
commit=`echo $i | cut -d/ -f3`
@@ -27,36 +27,37 @@ while read line; do
have="$have$vendor_board:$datetime$nl"
fi
- detailed="$detailed[[Board:$vendor_board|$vendor_board]] at $datetime_human$nl"
- detailed="$detailed[$CODE_GITWEB$upstream upstream tree] ($nl"
+ detailed="$detailed$vendor_board at $datetime_human$nl"
+ detailed="$detailedupstream tree ($nl"
for file in "$vendor_board/$commit/$datetime_path/"*; do
if [ "$file" = "$vendor_board/$commit/$datetime_path/revision.txt" ]; then
continue
fi
- detailed="$detailed[$STATUS_GITWEB$file `basename $file`] $nl"
+ detailed="$detailed`basename $file` $nl"
done
- detailed="$detailed)$nl$nl"
+ detailed="$detailed)
"
done
done
cat <Motherboards supported in coreboot
-{| border="0" style="font-size: smaller"
-|- bgcolor="#6699ff"
-! align="left" | Vendor
-! align="left" | Mainboard
-! align="left" | Latest known good
-! align="left" | Northbridge
-! align="left" | Southbridge
-! align="left" | Super I/O
-! align="left" | CPU
-! align="left" | Socket
-! align="left" | ROM 1
-! align="left" | P 2
-! align="left" | S 3
-! align="left" | F 4
-! align="left" | VCS5
+
+
+Vendor |
+Mainboard |
+Latest known good |
+Northbridge |
+Southbridge |
+Super I/O |
+CPU |
+Socket |
+ROM 1 |
+P 2 |
+S 3 |
+F 4 |
+VCS5 |
+
EOF
for category in laptop server desktop half mini settop "eval" sbc emulation misc unclass; do
@@ -65,78 +66,89 @@ for category in laptop server desktop half mini settop "eval" sbc emulation misc
case "$category" in
desktop)
cat <Desktops / Workstations
+
+Desktops / Workstations |
+
EOF
;;
server)
cat <Servers
+
+Servers |
+
EOF
;;
laptop)
cat <Laptops
+
+Laptops |
+
EOF
;;
half)
cat <Embedded / PC/104 / Half-size boards
+
+Embedded / PC/104 / Half-size boards |
+
EOF
;;
mini)
cat <Mini-ITX / Micro-ITX / Nano-ITX
+
+Mini-ITX / Micro-ITX / Nano-ITX |
+
EOF
;;
settop)
cat <Set-top-boxes / Thin clients
+
+Set-top-boxes / Thin clients |
+
EOF
;;
"eval")
cat <Devel/Eval Boards
+
+Devel/Eval Boards |
+
EOF
;;
sbc)
cat <Single-Board computer
+
+Single-Board computer |
+
EOF
;;
emulation)
cat <Emulation
+
+Emulation |
+
EOF
;;
misc)
cat <Miscellaneous
+
+Miscellaneous |
+
EOF
;;
unclass)
cat <Unclassified
+
+Unclassified |
+
EOF
;;
@@ -399,21 +411,21 @@ EOF
socket_nice="$cpu";;
esac
- echo "|- bgcolor=\"#$color\""
+ echo ""
if [ -z "$board_url" ]; then
- echo "| $vendor_nice"
+ echo "$vendor_nice"
else
- echo "| [$board_url $vendor_nice]"
+ echo " | $vendor_nice"
fi
if ! [ -z "$vendor_2nd" ]; then
- echo "( $vendor_2nd )"
+ echo " ($vendor_2nd)"
fi
- echo "| [[Board:$vendor/$board|$board_nice]]"
+ echo " | $board_nice | "
if [ -z "$lastgood" ]; then
- echo "| style=\"background:red\" | Unknown"
+ echo "Unknown | "
else
lastgood_diff=0
lastgood_ts=$(date -d "$lastgood" "+%s")
@@ -434,62 +446,64 @@ EOF
lastgood_diff_hex="0${lastgood_diff_hex}"
fi
cell_bgcolor="#${lastgood_diff_hex}ff00"
- echo "| style=\"background:${cell_bgcolor}\" | [[#$venboard|$lastgood]]"
+ echo "$lastgood | "
fi
- echo "| $northbridge_nice"
- echo "| $southbridge_nice"
- echo "| $superio_nice"
- echo "| $cpu_nice"
- echo "| $socket_nice"
+ echo "$northbridge_nice | "
+ echo "$southbridge_nice | "
+ echo "$superio_nice | "
+ echo "$cpu_nice | "
+ echo "$socket_nice | "
if [ "$rom_package" = "" ]; then
- echo "| ?"
+ echo "? | "
else
- echo "| $rom_package"
+ echo "$rom_package | "
fi
if [ "$rom_protocol" = "" ]; then
- echo "| ?"
+ echo "? | "
else
- echo "| $rom_protocol"
+ echo "$rom_protocol | "
fi
if [ "$rom_socketed" = "y" ]; then
- echo "| style=\"background:lime\" | Y"
+ echo "Y | "
elif [ "$rom_socketed" = "n" ]; then
- echo "| style=\"background:red\" | N"
+ echo "N | "
elif [ "$flashrom_support" = "variable" ]; then
- echo "| ...7"
+ echo "...7 | "
elif [ "$rom_socketed" = "" ]; then
- echo "| ?"
+ echo "? | "
else
- echo "| $rom_socketed"
+ echo "$rom_socketed | "
fi
if [ "$flashrom_support" = "y" ]; then
- echo "| style=\"background:lime\" | Y"
+ echo "Y | "
elif [ "$flashrom_support" = "n" ]; then
- echo "| style=\"background:red\" | N"
+ echo "N | "
elif [ "$flashrom_support" = "coreboot-only" ]; then
- echo "| style=\"background:yellow\" | ...6"
+ echo "...6 | "
elif [ "$flashrom_support" = "" ]; then
- echo "| ?"
+ echo "? | "
else
- echo "| $flashrom_support"
+ echo "$flashrom_support | "
fi
if [ "$vendor_cooperation_score" = "4" ]; then
- echo -n "| style=\"background:lime\""
+ echo -n ""
elif [ "$vendor_cooperatio_scoren" = "3" ]; then
- echo -n "| style=\"background:yellow\""
+ echo -n " | "
+ else
+ echo -n " | "
fi
if [ "$vendor_cooperation_page" != "" ]; then
- echo "| [[$vendor_cooperation_page|$vendor_cooperation_score]]"
+ echo "$vendor_cooperation_score"
elif [ "$vendor_cooperation_score" = "" ]; then
- echo "| —"
+ echo "—"
else
- echo "| $vendor_cooperation_score"
+ echo "$vendor_cooperation_score"
fi
- echo
+ echo " |
"
done
done
-echo "|}"
+echo "
"
cat <
diff --git a/util/optionlist/kconfig2html b/util/docker/coreboot.org-status/kconfig2html
similarity index 100%
rename from util/optionlist/kconfig2html
rename to util/docker/coreboot.org-status/kconfig2html
diff --git a/util/docker/coreboot.org-status/run.sh b/util/docker/coreboot.org-status/run.sh
new file mode 100755
index 0000000000..08732e7372
--- /dev/null
+++ b/util/docker/coreboot.org-status/run.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+# This file is part of the coreboot project.
+#
+# Copyright (C) 2018 Google Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+set -e
+
+# This script is the entry point for this container and expects two git
+# repositories in /data-in, board-status.git and coreboot.git (with the
+# content of the repos of the same name found at https://review.coreboot.org/
+# and creates two files, board-status.html and kconfig-options.html in
+# /data-out.
+
+cd /data-in/board-status.git
+/opt/tools/status-to-html.sh > /tmp/board-status.html
+mv /tmp/board-status.html /data-out/
+
+cd /data-in/coreboot.git
+/opt/tools/kconfig2html src/Kconfig $(git describe) > /tmp/kconfig-options.html
+mv /tmp/kconfig-options.html /data-out/
diff --git a/util/optionlist/Makefile b/util/optionlist/Makefile
deleted file mode 100644
index 05f720cedc..0000000000
--- a/util/optionlist/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# Copyright (C) 2010 coresystems GmbH
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-
-VERSION := $(shell git describe --dirty --always || git describe)
-
-all:
- cd ../..; util/optionlist/kconfig2wiki src/Kconfig $(VERSION) > util/optionlist/Options.wiki
-
-clean:
- rm -rf Options.wiki
diff --git a/util/optionlist/README b/util/optionlist/README
deleted file mode 100644
index da3efb33b2..0000000000
--- a/util/optionlist/README
+++ /dev/null
@@ -1 +0,0 @@
-This script creates the page https://www.coreboot.org/coreboot_Options