aboutsummaryrefslogtreecommitdiff
path: root/util/docker/coreboot.org-status/board-status.html/bucketize.sh
diff options
context:
space:
mode:
authorPatrick Georgi <pgeorgi@chromium.org>2018-06-08 18:10:58 +0200
committerPatrick Georgi <pgeorgi@google.com>2018-06-14 08:45:24 +0000
commit79d26c7a83fd2b14cc9a787e7820824931336d85 (patch)
treece9a6d941787f4f52e8b4110a4b077e357938a32 /util/docker/coreboot.org-status/board-status.html/bucketize.sh
parent31e0d42a1de4605b5c5e89310643a5e8bbee4be5 (diff)
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 <pgeorgi@chromium.org> Reviewed-on: https://review.coreboot.org/26977 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martinroth@google.com>
Diffstat (limited to 'util/docker/coreboot.org-status/board-status.html/bucketize.sh')
-rwxr-xr-xutil/docker/coreboot.org-status/board-status.html/bucketize.sh45
1 files changed, 45 insertions, 0 deletions
diff --git a/util/docker/coreboot.org-status/board-status.html/bucketize.sh b/util/docker/coreboot.org-status/board-status.html/bucketize.sh
new file mode 100755
index 0000000000..cb643e73bc
--- /dev/null
+++ b/util/docker/coreboot.org-status/board-status.html/bucketize.sh
@@ -0,0 +1,45 @@
+#!/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" +%GW%V 2>/dev/null
+ return $?
+}
+
+monthly() {
+ date --date="$1" +%Y-%m 2>/dev/null
+ return $?
+}
+
+quarterly() {
+ date --date="$1" "+%Y %m" 2>/dev/null | awk '{ q=int(($2-1)/3+1); print $1 "Q" q}'
+ return $?
+}
+
+# Restrict $1 to allowed values
+if [ "$1" != "weekly" ] && [ "$1" != "monthly" ] && [ "$1" != "quarterly" ]; then
+ exit 1
+fi
+
+curr=""
+sort -r -k4 -t/ | while read file; do
+ # Exclude 'oem' directories
+ if echo "$file" | grep -q '/oem/'; then continue; fi
+ timestamp=$(printf "%s" "$file" | cut -d/ -f4 | tr _ :)
+
+ # If the directory is not a date, skip it.
+ new=$($1 "$timestamp");retval=$?
+ if [ "$retval" != "0" ]; then continue; fi
+
+ if [ "$new" != "$curr" ]; then
+ if [ "$curr" != "" ]; then
+ printf "\n"
+ fi
+ printf "%s:" "$new"
+ curr=$new
+ fi
+ printf "%s " "$file"
+done
+printf "\n"