summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorPatrick Georgi <patrick@georgi-clan.de>2013-12-05 18:11:33 +0100
committerPatrick Georgi <patrick@georgi-clan.de>2013-12-05 18:40:25 +0100
commit274c6c2177979ba471f61f03d2ea76df673ff925 (patch)
treecaf296bd0453f0edee9db03be014664a65e629f8 /util
parent08c4150ec4f9fde303205802d646f96a54fd5a59 (diff)
downloadcoreboot-274c6c2177979ba471f61f03d2ea76df673ff925.tar.xz
Add scripts to export board status data to wiki
It's a start... Change-Id: Ibdb0b64ab0349df58bcad5ce553bf0dbec636925 Signed-off-by: Patrick Georgi <patrick@georgi-clan.de> Reviewed-on: http://review.coreboot.org/4483 Tested-by: build bot (Jenkins)
Diffstat (limited to 'util')
-rwxr-xr-xutil/board_status/to-wiki/bucketize.sh34
-rw-r--r--util/board_status/to-wiki/foreword.wiki9
-rwxr-xr-xutil/board_status/to-wiki/push-to-wiki.sh82
-rwxr-xr-xutil/board_status/to-wiki/status-to-wiki.sh2
-rwxr-xr-xutil/board_status/to-wiki/towiki.sh27
5 files changed, 154 insertions, 0 deletions
diff --git a/util/board_status/to-wiki/bucketize.sh b/util/board_status/to-wiki/bucketize.sh
new file mode 100755
index 0000000000..19a7c77c5e
--- /dev/null
+++ b/util/board_status/to-wiki/bucketize.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+# usage: $0 [weekly|monthly|quarterly] < filenames
+# sorts files of the form VENDOR/BOARD/COMMIT/DATE/revision.txt
+# into buckets of the given granularity
+
+weekly() {
+ date --date="$1" +%YW%V
+}
+
+monthly() {
+ date --date="$1" +%Y-%m
+}
+
+quarterly() {
+ date --date="$1" "+%Y %m" | awk '{ q=int(($2-1)/3+1); print $1 "Q" q}'
+}
+
+# TODO: restrict $1 to allowed values
+
+curr=""
+sort -r -k4 -t/ | while read file; do
+ timestamp=`printf $file | cut -d/ -f4`
+ new=`$1 $timestamp`
+ if [ "$new" != "$curr" ]; then
+ if [ "$curr" != "" ]; then
+ printf "\n"
+ fi
+ printf "$new:"
+ curr=$new
+ fi
+ printf "$file "
+done
+printf "\n"
+
diff --git a/util/board_status/to-wiki/foreword.wiki b/util/board_status/to-wiki/foreword.wiki
new file mode 100644
index 0000000000..a06d18de79
--- /dev/null
+++ b/util/board_status/to-wiki/foreword.wiki
@@ -0,0 +1,9 @@
+= coreboot status by mainboard =
+
+This list contains reports of successful coreboot execution, ordered by date. It's shows which boards can actually run with current coreboot versions.
+
+By sorting it by date, we encourage developers and users to keep ports current and well-tested.
+
+Status data comes from the [http://review.coreboot.org/gitweb?p=board-status.git board status repository], which also contains the parser.
+The coreboot tree [http://review.coreboot.org/gitweb?p=coreboot.git;a=tree;f=util/board_status;hb=HEAD contains a tool] to generate and push suitable data.
+An account on review.coreboot.org is required for sending data.
diff --git a/util/board_status/to-wiki/push-to-wiki.sh b/util/board_status/to-wiki/push-to-wiki.sh
new file mode 100755
index 0000000000..1f90745702
--- /dev/null
+++ b/util/board_status/to-wiki/push-to-wiki.sh
@@ -0,0 +1,82 @@
+#!/bin/bash
+# $1: file containing text
+
+. ~/.wikiaccount
+WIKIAPI="http://www.coreboot.org/api.php"
+TITLE="Supported_Motherboards"
+cookie_jar="/tmp/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=txt")
+
+CR2=($CR)
+if [ "${CR2[9]}" = "[token]" ]; then
+ TOKEN=${CR2[11]}
+else
+ 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=txt")
+
+###############
+#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=tokens&format=txt")
+
+CR2=($CR)
+EDITTOKEN=${CR2[8]}
+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/board_status/to-wiki/status-to-wiki.sh b/util/board_status/to-wiki/status-to-wiki.sh
new file mode 100755
index 0000000000..8d3d2a4a70
--- /dev/null
+++ b/util/board_status/to-wiki/status-to-wiki.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+ls -d */*/*/*/ | `dirname $0`/bucketize.sh weekly | `dirname $0`/towiki.sh
diff --git a/util/board_status/to-wiki/towiki.sh b/util/board_status/to-wiki/towiki.sh
new file mode 100755
index 0000000000..49c17f08e5
--- /dev/null
+++ b/util/board_status/to-wiki/towiki.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+export GIT_DIR=../coreboot/.git
+CODE_GITWEB="http://review.coreboot.org/gitweb?p=coreboot.git;a=commitdiff;h="
+STATUS_GITWEB="http://review.coreboot.org/gitweb?p=board-status.git;a=blob;hb=HEAD;f="
+if [ -f `dirname $0`/foreword.wiki ]; then
+ cat `dirname $0`/foreword.wiki
+fi
+while read line; do
+ timeframe=`echo $line | cut -d: -f1`
+ rest=`echo $line | cut -d: -f2-`
+ echo "= $timeframe ="
+ for i in $rest; do
+ vendor_board=`echo $i | cut -d/ -f1-2`
+ commit=`echo $i | cut -d/ -f3`
+ datetime=`echo $i | cut -d/ -f4`
+ datetime_human=`LC_ALL=C TZ=UTC date --date="$datetime"`
+ upstream=`grep "^Upstream revision:" $vendor_board/$commit/$datetime/revision.txt |cut -d: -f2-`
+ upstream=`git log -1 --format=%H $upstream`
+ echo $vendor_board at $datetime_human
+ echo "[$CODE_GITWEB$upstream upstream tree]"
+ ls $vendor_board/$commit/$datetime/* |grep -v '/revision.txt$' | while read file; do
+ echo "* [$STATUS_GITWEB$file `basename $file`]"
+ done
+ echo
+ done
+done
+