summaryrefslogtreecommitdiff
path: root/scripts/peripelist_conv
blob: 0c83b85d70a9f35cb7900f78d7e458a9a405524c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#! /bin/sh

[ $# -ne 3 ] && echo "$0 <source todo> <dest path> <groupname>" && 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