summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfram Sang <wsa+renesas@sang-engineering.com>2018-12-14 01:45:09 +0100
committerWolfram Sang <wsa+renesas@sang-engineering.com>2018-12-14 01:45:09 +0100
commit253e9c14839c93ed961ec20c36ae42e76f4281ca (patch)
treed2918a7f009d51356fb86d5944fd4d968a72ae3b
parentd780432aaacb92ccc98b5c690200071551fd4ecb (diff)
scripts: add import tool for periupport ticket files
Usage: periupport_conv <ticket text output> <dest path> Example usage for converting the bsp370 text output file: $ scripts/periupport_conv ../periupport/out/bsp370.txt /tmp/bsp370/ Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
-rwxr-xr-xscripts/periupport_conv68
1 files changed, 68 insertions, 0 deletions
diff --git a/scripts/periupport_conv b/scripts/periupport_conv
new file mode 100755
index 0000000..02688e5
--- /dev/null
+++ b/scripts/periupport_conv
@@ -0,0 +1,68 @@
+#! /bin/sh
+
+[ $# -ne 2 ] && echo "$0 <ticket text output> <dest path>" && exit 0
+
+SRC="$1"
+DST="$2"
+
+# FIXME: ensure this is not already existing in another task
+uuid_cmd="cat /proc/sys/kernel/random/uuid"
+
+gawk -F: -v dst="$DST" -v cmd="$uuid_cmd" '
+ $1 == "B" {
+ bsp_id = $2
+ desc = substr($0, 46)
+ bsp_desc[bsp_id] = desc
+ match(desc, /.*:/)
+ task_key = substr(desc, RSTART, RLENGTH)
+ gsub(/"/, "´", task_key)
+ tasks[task_key][bsp_id] = bsp_id
+ }
+
+ $1 == "U" {
+ upstream[bsp_id] = $2
+ upstream_desc[bsp_id] = substr($0, 46)
+ }
+
+ $1 == "*" { $1 = ""; gsub(/"/, "´"); comment[bsp_id] = $0 }
+
+ /^Priority: N/ { exit }
+
+ END {
+ FS = " "
+ for (task in tasks) {
+
+ nam = task
+ gsub(/[: /]/, "_", nam)
+ cmd | getline uuid; close(cmd);
+ F=dst "/" nam ".yaml"
+
+ print "title: \"Upport " task "\"" > F
+ print "team: MM" >> F
+ print "key: " uuid >> F
+ print "status: Active" >> F
+ print "" >> F
+ print "relationships:\n" >> F
+
+ print "bsp-commits:\n" >> F
+ for (commit in tasks[task]) {
+ print " -" commit >> F
+ print " # " bsp_desc[commit] >> F
+ }
+ print "" >> F
+
+ print "upstream:" >> F
+ for (commit in tasks[task]) {
+ if (upstream[commit])
+ print " - torvalds:" upstream[commit] " # " upstream_desc[commit] >> F
+ }
+ print "" >> F
+
+ print "comments:" >> F
+ for (commit in tasks[task]) {
+ if (comment[commit])
+ print " - \"" substr(commit, 2) ":" substr(comment[commit], 2) "\"" >> F
+ }
+ }
+ }
+' $SRC