#! /bin/sh [ $# -ne 3 ] && echo "$0 " && exit 0 SRC="$1" DST="$2" GRP="$3" # FIXME: ensure this is not already existing in another task uuid_cmd="cat /proc/sys/kernel/random/uuid" awk -F, -v team="$GRP" -v dst="$DST" -v cmd="$uuid_cmd" ' BEGIN { status["noplan"] = status["plan"] = "New" status["public"] = status["prototype"] = "Active" status["merged"] = status["complete"] = "Done" date["v4.21"] = "2018-12-31" date["?"] = "" } /^[^#]/ { cmd | getline uuid; close(cmd); F=dst "/" uuid ".yaml" print "title: " $1 "; " $5 > F print "team: " team >> F print "key: " uuid >> F if ($4 != "?") print "assignee: " toupper(substr($4, 1, 1)) tolower(substr($4, 2)) >> F else print "assignee: TBD" >> F print "status: " status[$3] >> F if ($2 != "?") print "target-date: " ($2 in date ? date[$2] : $2) >> F print "" >> F print "relationships:\n" >> F print "bsp39x:\n" >> F print "upstream:\n" >> F print "comments:\n" >> F } ' $SRC