From d8acb2a5980b7e60087baba75344a7df37253122 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 12 Feb 2019 14:23:17 +0900 Subject: add PeriJect viewer Very simple 1st verstion Signed-off-by: Kuninori Morimoto --- scripts/base.py | 108 ++++++++++++++++++++++++++++++++++++++++++++++++ scripts/find.py | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ scripts/ject.py | 16 ++++++++ scripts/view.py | 122 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 370 insertions(+) create mode 100755 scripts/base.py create mode 100755 scripts/find.py create mode 100755 scripts/ject.py create mode 100755 scripts/view.py (limited to 'scripts') diff --git a/scripts/base.py b/scripts/base.py new file mode 100755 index 0000000..1a6396e --- /dev/null +++ b/scripts/base.py @@ -0,0 +1,108 @@ +#! /usr/bin/env python3 +#=============================== +# +# base +# +# 2019/02/07 Kuninori Morimoto +#=============================== +import os +import re +import subprocess + +#==================================== +# +# base +# +# it supports do/run/run1 for using external command +# +#==================================== +class base: + __top = os.path.abspath(__file__ + "/../../"); + __key = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}" + + #-------------------- + # chomp + #-------------------- + def chomp(self, text): + return re.sub(r"\n$", r"", text); + + #-------------------- + # top() + #-------------------- + def top(self): + return base.__top; + + #-------------------- + # is_key() + #-------------------- + def is_key(self, key): + return re.match(base.__key, key); + + #-------------------- + # color + #-------------------- + def color(self, color, text): + return "\033[{}m{}\033[0m".format(self.config(color), text) + + #-------------------- + # do() + # + # do command + #-------------------- + def do(self, command): + return subprocess.run(command, shell=True).returncode; + + #-------------------- + # tolist() + #-------------------- + def tolist(self, string): + if (len(string) > 0): + return string.split('\n'); + + return []; + + #-------------------- + # run() + # + # run command and get result as plane text + #-------------------- + def run(self, command): + + # Ughhhh + # I don't like python external command !! + # (ノ `Д´)ノ go away !! + return self.chomp(subprocess.Popen(command, shell=True, stdout=subprocess.PIPE).\ + communicate()[0].decode("utf-8")); + + #-------------------- + # run1() + # + # run command and get result as list + #-------------------- + def runl(self, command): + + # call run() and exchange result as array + # + # "xxxxxxx + # yyyyyyy + # zzzzzzz" + # -> + # ["xxxxxxx", + # "yyyyyyy", + # "zzzzzzz"] + return self.tolist(self.run(command)); + + #-------------------- + # config() + # + # read settings from config + #-------------------- + def config(self, item): + if (not os.path.exists("{}/.config".format(self.top()))): + print("\nplease copy .config.sample to .config\n" + + "and edit it for your environment\n"); + exit(); + + config = self.run("grep {} {}/.config | cut -d : -f2".\ + format(item, self.top())); + return self.chomp(config); diff --git a/scripts/find.py b/scripts/find.py new file mode 100755 index 0000000..3150475 --- /dev/null +++ b/scripts/find.py @@ -0,0 +1,124 @@ +#! /usr/bin/env python3 +#=============================== +# +# find +# +# 2019/02/07 Kuninori Morimoto +#=============================== +import sys +import os +import re + +import base + +#==================================== +# +# find +# +#==================================== +class find(base.base): + + #-------------------- + # default_arg + #-------------------- + def default_arg(self, arg): + # add "-ns Done" automatically + # if user doesn't specify "-s" or "-ns" + match = 0 + for cmd in arg: + if ((cmd == "-s") or (cmd == "-ns")): + match = 1 + + if (not match): + return ["-ns", "Done"] + + return [] + + #-------------------- + # parse_option + #-------------------- + def parse_option(self, arg, option, char, hit): + + op = "-l" # hit + if (not hit): + op = "-L" # not hit + + match = 0 + for cmd in arg: + if (cmd == option): + match = 1 + elif (match): + # Wolfram,Shimoda + # -> + # (Wolfram|Shimoda) + tgt = "({})".format(cmd.replace(",", "|")) + + self.files = self.run("echo \"{}\" | xargs egrep {} \"{}:\s+{}\"".\ + format(self.files, op, char, tgt)) + return + + #-------------------- + # parse_files + #-------------------- + def parse_files(self, arg): + + # find specified key files if exist + for key in arg: + if (not self.is_key(key)): + continue + + if (len(self.files) > 0): + self.files += "\n" + + self.files += self.run("egrep -l \"key:\s+{}\" -r {}/projects".\ + format(key, self.top())) + + # all project files if no files + if (len(self.files) == 0): + self.files = self.run("find {}/projects -type f | grep -v schema".\ + format(self.top())) + + #-------------------- + # __init__ + #-------------------- + def __init__(self, arg): + super().__init__() + + self.files = "" + + self.parse_files(arg) + + arg += self.default_arg(arg) + + # -s : matched status + # -ns : not matched status + # -a : matched assignee + # -na : not matched assignee + # -t : matched team + # -nt : not matched team + self.parse_option(arg, "-s", "status", 1) + self.parse_option(arg, "-ns", "status", 0) + self.parse_option(arg, "-a", "assignee", 1) + self.parse_option(arg, "-na", "assignee", 0) + self.parse_option(arg, "-t", "team", 1) + self.parse_option(arg, "-nt", "team", 0) + + #-------------------- + # get + #-------------------- + def get(self): + return self.tolist(self.files) + + #-------------------- + # show + #-------------------- + def show(self): + print(self.files) + +#==================================== +# +# As command +# +#==================================== +if __name__=='__main__': + find(sys.argv).show() diff --git a/scripts/ject.py b/scripts/ject.py new file mode 100755 index 0000000..b0b469f --- /dev/null +++ b/scripts/ject.py @@ -0,0 +1,16 @@ +#! /usr/bin/env python3 +#=============================== +# +# ject +# +# 2019/02/12 Kuninori Morimoto +#=============================== +import sys + +import find +import view + +param = sys.argv + +view.viewer(param + find.find(param).get()).show() + diff --git a/scripts/view.py b/scripts/view.py new file mode 100755 index 0000000..b73095c --- /dev/null +++ b/scripts/view.py @@ -0,0 +1,122 @@ +#! /usr/bin/env python3 +#=============================== +# +# viewer +# +# 2019/02/07 Kuninori Morimoto +#=============================== +import yaml +import sys +import os +import re + +import base + +#==================================== +# +# viewer +# +#==================================== +class viewer(base.base): + + #-------------------- + # parse + # + # -f : with file + # --oneline: one line + #-------------------- + def parse(self, arg): + for arg in arg: + if (arg == "-f"): + self.with_file = 1 + elif (arg == "--oneline"): + self.one_line = 1 + elif (os.path.exists(arg) and + re.match("{}/projects".format(self.top()), + os.path.abspath(arg))): + self.files += [arg] + + #-------------------- + # __init__ + #-------------------- + def __init__(self, arg): + + self.text = "" + self.files = [] + self.with_file = 0 + self.one_line = 0 + + self.parse(arg) + + #-------------------- + # make_one + # for --oneline + #-------------------- + def make_one(self, file, data): + + if (len(self.text) > 0): + self.text += "\n" + + # show "key" + self.text += "{}: {}".format( + self.color("key", data["key"]), + data["title"]) + + #-------------------- + # make_full + # for normal + #-------------------- + def make_full(self, file, data): + + if (len(self.text) > 0): + self.text += "\n" + + # show "key" + self.text += "{}, {}, {}\n".format( + self.color("key", data["key"]), + self.color("status", data["status"]), + self.color("team", data["team"])); + + # show title + self.text += "Title: {}\n".format(data["title"]) + + # show assignee + self.text += "Assignee: {}\n".format(data["assignee"]) + + if (self.with_file): + self.text += "File: {}\n".format( + os.path.abspath(file).replace("{}/".format(self.top()), "")) + + # show comments + comments = data["comments"] + if (comments): + for comment in comments: + self.text += "\n{}".format(comment) + + #-------------------- + # show + #-------------------- + def show(self): + for f in self.files: + F = open(f, "r+") + data = yaml.load(F) + F.close() + + if (self.one_line): + self.make_one(f, data) + else: + self.make_full(f, data) + + # escape " -> \" + # otherwise " will be disappeared + self.text = self.text.replace("\"", "\\\""); + self.do("echo \"{}\" | {}".format( + self.text, self.config("viewer"))) + +#==================================== +# +# As command +# +#==================================== +if __name__=='__main__': + viewer(sys.argv).show() -- cgit v1.2.3 From 5b3ba7911d0d2c64da59c5020f9307c1222edc58 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Wed, 13 Feb 2019 10:39:42 +0900 Subject: view: add get_data() To support relationships, directly getting Yaml data on each function is more useful. Let's add get_data() and do it. Signed-off-by: Kuninori Morimoto --- scripts/view.py | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'scripts') diff --git a/scripts/view.py b/scripts/view.py index b73095c..04928e1 100755 --- a/scripts/view.py +++ b/scripts/view.py @@ -48,11 +48,22 @@ class viewer(base.base): self.parse(arg) + #-------------------- + # get_data + #-------------------- + def get_data(self, file): + F = open(file, "r+") + data = yaml.load(F) + F.close() + return data + #-------------------- # make_one # for --oneline #-------------------- - def make_one(self, file, data): + def make_one(self, file): + + data = self.get_data(file) if (len(self.text) > 0): self.text += "\n" @@ -66,7 +77,9 @@ class viewer(base.base): # make_full # for normal #-------------------- - def make_full(self, file, data): + def make_full(self, file): + + data = self.get_data(file) if (len(self.text) > 0): self.text += "\n" @@ -98,14 +111,10 @@ class viewer(base.base): #-------------------- def show(self): for f in self.files: - F = open(f, "r+") - data = yaml.load(F) - F.close() - if (self.one_line): - self.make_one(f, data) + self.make_one(f) else: - self.make_full(f, data) + self.make_full(f) # escape " -> \" # otherwise " will be disappeared -- cgit v1.2.3 From f71c04567d20617cf10b3818903159a0744092d8 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Wed, 13 Feb 2019 11:46:32 +0900 Subject: view: add -r option to show relationships Signed-off-by: Kuninori Morimoto --- scripts/view.py | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 60 insertions(+), 8 deletions(-) (limited to 'scripts') diff --git a/scripts/view.py b/scripts/view.py index 04928e1..308d1db 100755 --- a/scripts/view.py +++ b/scripts/view.py @@ -23,12 +23,15 @@ class viewer(base.base): # parse # # -f : with file + # -r : with relationships # --oneline: one line #-------------------- def parse(self, arg): for arg in arg: if (arg == "-f"): self.with_file = 1 + elif (arg == "-r"): + self.with_rel = 1 elif (arg == "--oneline"): self.one_line = 1 elif (os.path.exists(arg) and @@ -44,10 +47,31 @@ class viewer(base.base): self.text = "" self.files = [] self.with_file = 0 + self.with_rel = 0 self.one_line = 0 self.parse(arg) + #-------------------- + # get_item + #-------------------- + def get_item(self, data): + # Ughhhh + # All Yaml data is "dictionary", and not simple to getting data !! + # ( `⌒´)d I hate you !! + return list(data)[0] + + #-------------------- + # get_related_file + #-------------------- + def get_related_file(self, data): + file = self.run("egrep -l \"key:\s+{}\" -r {}/projects".\ + format(data, self.top())) + if (file): + return file + else: + return data + #-------------------- # get_data #-------------------- @@ -61,29 +85,50 @@ class viewer(base.base): # make_one # for --oneline #-------------------- - def make_one(self, file): - - data = self.get_data(file) + def make_one(self, tag, file): if (len(self.text) > 0): self.text += "\n" + if (tag): + self.text += "{:<22}".format(self.color("tag", tag)) + + if (not os.path.exists(file)): + self.text += self.color("error", "No such task ({})".format(file)) + return + + data = self.get_data(file) + # show "key" self.text += "{}: {}".format( self.color("key", data["key"]), data["title"]) + # show relationships + relationships = data["relationships"] + if ((not tag) and self.with_rel and relationships): + for d in relationships: + self.make_one(self.get_item(d.keys()), + self.get_related_file(self.get_item(d.values()))) + #-------------------- # make_full # for normal #-------------------- - def make_full(self, file): - - data = self.get_data(file) + def make_full(self, tag, file): if (len(self.text) > 0): self.text += "\n" + if (tag): + self.text += "{:<22}".format(self.color("tag", tag)) + + if (not os.path.exists(file)): + self.text += self.color("error", "No such task ({})".format(file)) + return + + data = self.get_data(file) + # show "key" self.text += "{}, {}, {}\n".format( self.color("key", data["key"]), @@ -106,15 +151,22 @@ class viewer(base.base): for comment in comments: self.text += "\n{}".format(comment) + # show relationships + relationships = data["relationships"] + if ((not tag) and self.with_rel and relationships): + for d in relationships: + self.make_full(self.get_item(d.keys()), + self.get_related_file(self.get_item(d.values()))) + #-------------------- # show #-------------------- def show(self): for f in self.files: if (self.one_line): - self.make_one(f) + self.make_one(None, f) else: - self.make_full(f) + self.make_full(None, f) # escape " -> \" # otherwise " will be disappeared -- cgit v1.2.3 From 0e6e86197d40f5499c54f4288c38d63bfdcdb256 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 25 Feb 2019 15:43:41 +0900 Subject: find: find yaml file find yaml file, not -type f Signed-off-by: Kuninori Morimoto --- scripts/find.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/find.py b/scripts/find.py index 3150475..2023842 100755 --- a/scripts/find.py +++ b/scripts/find.py @@ -75,7 +75,7 @@ class find(base.base): # all project files if no files if (len(self.files) == 0): - self.files = self.run("find {}/projects -type f | grep -v schema".\ + self.files = self.run("find {}/projects -name \"*.yaml\" | grep -v schema".\ format(self.top())) #-------------------- -- cgit v1.2.3 From 27b01f2b9106a9f29bd142be0cca2736c862ef1e Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 25 Feb 2019 15:46:24 +0900 Subject: find: find from specified dir We want to find tasks from specified dir Signed-off-by: Kuninori Morimoto --- scripts/find.py | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'scripts') diff --git a/scripts/find.py b/scripts/find.py index 2023842..89c9cee 100755 --- a/scripts/find.py +++ b/scripts/find.py @@ -73,6 +73,17 @@ class find(base.base): self.files += self.run("egrep -l \"key:\s+{}\" -r {}/projects".\ format(key, self.top())) + # find specified folder files if exist + if (len(self.files) == 0): + did = 0 + for folder in arg: + if (os.path.isdir(folder)): + did = 1 + self.files += self.run("find {} -mindepth 1 -maxdepth 1 -name \"*.yaml\" | grep -v schema".\ + format(folder)) + if (did): + return + # all project files if no files if (len(self.files) == 0): self.files = self.run("find {}/projects -name \"*.yaml\" | grep -v schema".\ @@ -96,12 +107,13 @@ class find(base.base): # -na : not matched assignee # -t : matched team # -nt : not matched team - self.parse_option(arg, "-s", "status", 1) - self.parse_option(arg, "-ns", "status", 0) - self.parse_option(arg, "-a", "assignee", 1) - self.parse_option(arg, "-na", "assignee", 0) - self.parse_option(arg, "-t", "team", 1) - self.parse_option(arg, "-nt", "team", 0) + if (self.files): + self.parse_option(arg, "-s", "status", 1) + self.parse_option(arg, "-ns", "status", 0) + self.parse_option(arg, "-a", "assignee", 1) + self.parse_option(arg, "-na", "assignee", 0) + self.parse_option(arg, "-t", "team", 1) + self.parse_option(arg, "-nt", "team", 0) #-------------------- # get @@ -113,7 +125,8 @@ class find(base.base): # show #-------------------- def show(self): - print(self.files) + if (self.files): + print(self.files) #==================================== # -- cgit v1.2.3 From 7b826ee9948ade695d86a78f659494b40731067e Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 25 Feb 2019 15:48:37 +0900 Subject: find: add -a option default will ignore Done status, but we sometimes want to get all tasks. This patch adds -a option for it Signed-off-by: Kuninori Morimoto --- scripts/find.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'scripts') diff --git a/scripts/find.py b/scripts/find.py index 89c9cee..cbefcbe 100755 --- a/scripts/find.py +++ b/scripts/find.py @@ -26,6 +26,8 @@ class find(base.base): # if user doesn't specify "-s" or "-ns" match = 0 for cmd in arg: + if (cmd == "-a"): + return [] if ((cmd == "-s") or (cmd == "-ns")): match = 1 @@ -101,6 +103,7 @@ class find(base.base): arg += self.default_arg(arg) + # -a : all # -s : matched status # -ns : not matched status # -a : matched assignee -- cgit v1.2.3 From 39f25bf805115fabba4290328492aa23db0d7013 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 25 Feb 2019 15:53:37 +0900 Subject: view: add set_data/get_data To be more object, let's add set_data/get_data Signed-off-by: Kuninori Morimoto --- scripts/view.py | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) (limited to 'scripts') diff --git a/scripts/view.py b/scripts/view.py index 308d1db..9486e51 100755 --- a/scripts/view.py +++ b/scripts/view.py @@ -51,6 +51,8 @@ class viewer(base.base): self.one_line = 0 self.parse(arg) + self.data = {} + self.file = "" #-------------------- # get_item @@ -73,13 +75,21 @@ class viewer(base.base): return data #-------------------- + # set_data # get_data #-------------------- - def get_data(self, file): + def set_data(self, file): F = open(file, "r+") - data = yaml.load(F) + self.data = yaml.load(F) F.close() - return data + self.file = file + + def get_data(self, key): + data = self.data[key] + if (data): + return data + else: + return [] #-------------------- # make_one @@ -97,15 +107,15 @@ class viewer(base.base): self.text += self.color("error", "No such task ({})".format(file)) return - data = self.get_data(file) + self.set_data(file) # show "key" self.text += "{}: {}".format( - self.color("key", data["key"]), - data["title"]) + self.color("key", self.get_data("key")), + self.get_data("title")) # show relationships - relationships = data["relationships"] + relationships = self.get_data("relationships") if ((not tag) and self.with_rel and relationships): for d in relationships: self.make_one(self.get_item(d.keys()), @@ -127,32 +137,32 @@ class viewer(base.base): self.text += self.color("error", "No such task ({})".format(file)) return - data = self.get_data(file) + self.set_data(file) # show "key" self.text += "{}, {}, {}\n".format( - self.color("key", data["key"]), - self.color("status", data["status"]), - self.color("team", data["team"])); + self.color("key", self.get_data("key")), + self.color("status", self.get_data("status")), + self.color("team", self.get_data("team"))); # show title - self.text += "Title: {}\n".format(data["title"]) + self.text += "Title: {}\n".format(self.get_data("title")) # show assignee - self.text += "Assignee: {}\n".format(data["assignee"]) + self.text += "Assignee: {}\n".format(self.get_data("assignee")) if (self.with_file): self.text += "File: {}\n".format( os.path.abspath(file).replace("{}/".format(self.top()), "")) # show comments - comments = data["comments"] + comments = self.get_data("comments") if (comments): for comment in comments: self.text += "\n{}".format(comment) # show relationships - relationships = data["relationships"] + relationships = self.get_data("relationships") if ((not tag) and self.with_rel and relationships): for d in relationships: self.make_full(self.get_item(d.keys()), -- cgit v1.2.3 From 0ac23cddb502bdf9180e94623f42f20ae999a4c8 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 25 Feb 2019 15:58:53 +0900 Subject: Add html support Signed-off-by: Kuninori Morimoto --- scripts/html.py | 468 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 468 insertions(+) create mode 100755 scripts/html.py (limited to 'scripts') diff --git a/scripts/html.py b/scripts/html.py new file mode 100755 index 0000000..96c6108 --- /dev/null +++ b/scripts/html.py @@ -0,0 +1,468 @@ +#! /usr/bin/env python3 +#=============================== +# +# html +# +# 2019/02/18 Kuninori Morimoto +#=============================== +import sys +import os + +import base +import find +import view + +#==================================== +# +# html +# +#==================================== +class html(base.base): + + __head = 0 + __noclose = ["input", + "frame", + "link", + "br", + ] + + #-------------------- + # option + #-------------------- + def option(self, dic): + if (dic): + self.dic.update(dic) + + #-------------------- + # __init__ + #-------------------- + def __init__(self, mark, dic = None): + super().__init__() + + self.dic = {} + self.mark = mark + self.option(dic) + self.txt = "" + + #-------------------- + # open + #-------------------- + def open(self, ret = 0): + + self.txt = "" + + if (ret): + for i in range(html.__head): + self.txt += "\t" + + self.txt += "<{}".format(self.mark) + for d in self.dic: + self.txt += " {}=\"{}\"".format(d, self.dic[d]) + self.txt += ">" + html.__head += 1 + + #-------------------- + # close + #-------------------- + def close(self, ret = 0): + html.__head -= 1 + # no end-mark + if (self.mark in html.__noclose): + return + + if (ret): + for i in range(html.__head): + self.txt += "\t" + self.txt += "".format(self.mark) + + #-------------------- + # text + #-------------------- + def text(self, txt = ""): + self.open() + self.txt += txt + self.close() + return self.txt + + #-------------------- + # print + #-------------------- + def print(self, txt = ""): + + self.open(1) + self.txt += txt + self.close(0) + print(self.txt) + + #-------------------- + # for with + #-------------------- + def __enter__(self): + self.open(1) + print(self.txt) + self.txt = "" + return self + def __exit__(self, exception_type, exception_value, traceback): + self.close(1) + print(self.txt) + self.txt = "" + +#==================================== +# +# periject_html +# +#==================================== +class periject_html(base.base): + + def __init__(self): + super().__init__() + self.git = self.config("git-linux") + + def git_title(self, id): + return self.run("git -C {} log -1 {} --format=%s".format(self.git, id)) + + def bsp_url(self, id): + return "https://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas-bsp.git/commit/?id={}".format(id) + + def upstream_url(self, id): + return "https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id={}".format(id) + + #-------------------- + # index + #-------------------- + def index(self): + # | | | + # |menu|body| + # | | | + with html("frameset", {"cols":"200,*"}): + html("frame", {"src":"./html/menu.html", "name":"menu"}).print() + html("frame", {"src":"./html/subindex.html", "name":"body"}).print() + + #-------------------- + # summary + #-------------------- + def subindex(self): + # ------- + # summary + # ------- + # body + # ------- + with html("frameset", {"rows":"300,*"}): + html("frame", {"src":"./summary.html", "name":"summary"}).print() + html("frame", {"src":"./body.html", "name":"subbody"}).print() + + + #-------------------- + # summary + #-------------------- + def __summary(self, title, dir, files): + # ------- + # summary + # ------- + # + # ------- + html("h2").print(title) + with html("table", {"border":"1"}): + # | file-name | status | assignee | title | + for file in files: + v = view.viewer([file]) + v.set_data(file) + f = os.path.basename(file) + + subbody = html("a", {"target":"subbody"}) + summary = html("a", {"target":"summary"}) + with html("tr"): + subbody.option({"href":os.path.relpath(file.replace("yaml", "html").replace("projects", "html"), dir)}) + html("td").print(subbody.text(os.path.basename(file).replace(".yaml", ""))) + + status = v.get_data("status") + summary.option({"href":os.path.relpath("{}/html/{}.html".format(self.top(), status), dir)}) + html("td").print(summary.text(status)) + + assignee = v.get_data("assignee") + summary.option({"href":os.path.relpath("{}/html/{}.html".format(self.top(), assignee), dir)}) + html("td").print(summary.text(assignee)) + + html("td").print(v.get_data("title")) + + #-------------------- + # summary + #-------------------- + def summary(self, argv): + + dir = os.path.normpath(argv[0]) + + # ------- + # summary + # ------- + # + # ------- + self.__summary(dir, self.top() + "/" + dir, find.find([dir]).get()) + + #-------------------- + # menu_folder + #-------------------- + def menu_folder(self, current): + folders = self.runl("cd {}; ls -F | grep /".format(current)) + path = current.replace("./projects", ".") + link = html("a", {"target":"summary", + "href":"{}/summary.html".format(path)}) + + html("li").print(link.text(os.path.basename(current))) + + if (not folders): + return + + with html("ul"): + for folder in folders: + dir = os.path.basename(folder) + self.menu_folder("{}/{}".format(current, folder[:-1])) + + #-------------------- + # menu_assignee + #-------------------- + def menu_assignee(self): + # from project.schema.yaml + with html("ul"): + for assignee in ['BSP', 'Geert', 'Jacopo', 'Kaneko', 'Kieran', 'Laurent', 'Magnus', 'Marek', + 'Morimoto', 'Niklas', 'Shimoda', 'Simon', 'Ulrich', 'Wolfram']: + html("li").print(html("a", {"target":"summary", + "href":"./{}.html".format(assignee)}).text(assignee)) + + #-------------------- + # menu_status + #-------------------- + def menu_status(self): + # from project.schema.yaml + with html("ul"): + for status in ['New', 'Active', 'Blocked', 'Paused', 'Done', 'Abandoned']: + html("li").print(html("a", {"target":"summary", + "href":"./{}.html".format(status)}).text(status)) + + #-------------------- + # menu + #-------------------- + def menu(self): + + with html("body"): + html("h1").print("Folder") + with html("ul"): + self.menu_folder("./projects") + + html("h1").print("Assignee") + self.menu_assignee() + + html("h1").print("Status") + self.menu_status() + + #-------------------- + # body + #-------------------- + def body(self): + with html("body"): + html("div").print("select tasks from menu") + + #-------------------- + # task_status + #-------------------- + def task_status(self, v): + dir = os.path.dirname(v.file) + assignee = v.get_data("assignee") + status = v.get_data("status") + + with html("table", {"border":"1"}): + with html("tr"): + html("td").print("status") + html("td").print(html("a", {"target":"summary", + "href":os.path.relpath("{}/html/{}.html".format(self.top(), status), dir)}).text(status)) + with html("tr"): + html("td").print("assignee") + html("td").print(html("a", {"target":"summary", + "href":os.path.relpath("{}/html/{}.html".format(self.top(), assignee), dir)}).text(assignee)) + with html("tr"): + html("td").print("key") + html("td").print(v.get_data("key")) + + #-------------------- + # _task_relation + #-------------------- + def _task_relation(self, relationship, v, item): + + current_dir = os.path.dirname(v.file) + related_file = v.get_related_file(relationship[item]) + + if (not os.path.exists(related_file)): + with html("tr"): + html("td").print(item) + html("td").print("Unknown({})".format(related_file)) + return + + rv = view.viewer([related_file]) + rv.set_data(related_file) + with html("tr"): + html("td").print(item) + html("td").print(html("a", {"href": + os.path.relpath(related_file.replace("projects", "html").replace("yaml", "html"), current_dir)}).text(rv.get_data("title"))) + + #-------------------- + # task_relation + #-------------------- + def task_relation(self, v): + + relationships = v.get_data("relationships") + if (not relationships): + return + + current_dir = os.path.dirname(v.file) + + with html("table", {"border":"1"}): + for relationship in relationships: + if ("parent" in relationship): + self._task_relation(relationship, v, "parent") + if ("depends" in relationship): + self._task_relation(relationship, v, "depends") + if ("blocks" in relationship): + self._task_relation(relationship, v, "blocks") + + #-------------------- + # task_head + #-------------------- + def task_head(self, v): + + with html("table"): + with html("tr"): + with html("td"): + self.task_status(v) + with html("td"): + self.task_relation(v) + + #-------------------- + # task_commit_bsp + #-------------------- + def task_commit_bsp(self, v): + + with html("ul"): + for bsp in v.get_data("bsp-commits"): + html("li").print(html("a", {"href":self.bsp_url(bsp)}).text(self.git_title(bsp))) + + #-------------------- + # __task_commit_upstream + #-------------------- + def __task_commit_upstream(self, v, upstream, item): + if (not item in upstream): + return + + commit = upstream[item] + + with html("tr"): + html("td").print(item) + html("td").print(html("a", {"href":self.upstream_url(commit)}).text(self.git_title(commit))) + + #-------------------- + # task_commit_upstream + #-------------------- + def task_commit_upstream(self, v): + upstream = v.get_data("upstream") + + with html("table"): + for up in upstream: + self.__task_commit_upstream(v, up, "torvalds") + for up in upstream: + self.__task_commit_upstream(v, up, "next") + + #-------------------- + # task_commit + #-------------------- + def task_commit(self, v): + + bsp = v.get_data("bsp-commits") + if (not bsp): + return + + with html("table", {"border":"1"}): + with html("tr"): + html("th").print("BSP") + html("th").print("upstream") + with html("tr"): + with html("td"): + self.task_commit_bsp(v) + with html("td"): + self.task_commit_upstream(v) + + #-------------------- + # task_comment + #-------------------- + def task_comment(self, v): + comments = v.get_data("comments") + if (not comments): + return + + with html("ul"): + for comment in comments: + html("li").print(comment) + + #-------------------- + # task + #-------------------- + def task(self, argv): + v = view.viewer([argv[0]]) + v.set_data(argv[0]) + + with html("body"): + html("h1").print(v.get_data("title")) + self.task_head(v) + self.task_commit(v) + self.task_comment(v) + + #-------------------- + # member + #-------------------- + def member(self, argv): + + mem = argv.pop(0) + + with html("body"): + self.__summary(mem, "{}/html".format(self.top()), argv) + + #-------------------- + # print + #-------------------- + def print(self, argv): + + # remove this script + argv.pop(0) + + cmd = sys.argv.pop(0) + with html("html"): + if (cmd == "index"): + # html.py index + self.index() + elif(cmd == "subindex"): + # html.py subindex + self.subindex() + elif (cmd == "body"): + # html.py body + self.body() + elif (cmd == "summary"): + # html.py summary projects/linux/io + self.summary(sys.argv) + elif (cmd == "menu"): + # html.py menu + self.menu() + elif (cmd == "task"): + # html.py task projects/linux/io/xxx.yaml + self.task(sys.argv) + elif (cmd == "member"): + # ./script/find.py -a Wolfram | xargs ./script/html.py menber Wolfram + self.member(sys.argv) + elif (cmd == "status"): + # ./script/find.py -s Active | xargs ./script/html.py status Active + self.member(sys.argv) + +#==================================== +# +# As command +# +#==================================== +if __name__=='__main__': + periject_html().print(sys.argv) -- cgit v1.2.3 From 251b79bf79514c7a0c8826dee6c144684ae9c313 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 26 Feb 2019 11:19:41 +0900 Subject: html: tidyup table header use "th" header Signed-off-by: Kuninori Morimoto --- scripts/html.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/scripts/html.py b/scripts/html.py index 96c6108..724b1d8 100755 --- a/scripts/html.py +++ b/scripts/html.py @@ -163,7 +163,11 @@ class periject_html(base.base): # ------- html("h2").print(title) with html("table", {"border":"1"}): - # | file-name | status | assignee | title | + with html("tr"): + html("th").print("file") + html("th").print("status") + html("th").print("assignee") + html("th").print("title") for file in files: v = view.viewer([file]) v.set_data(file) @@ -272,15 +276,17 @@ class periject_html(base.base): with html("table", {"border":"1"}): with html("tr"): - html("td").print("status") + html("th").print("file") + html("th").print("status") + html("th").print("assignee") + html("th").print("key") + + with html("tr"): + html("td").print(os.path.relpath(v.file, self.top())) html("td").print(html("a", {"target":"summary", "href":os.path.relpath("{}/html/{}.html".format(self.top(), status), dir)}).text(status)) - with html("tr"): - html("td").print("assignee") html("td").print(html("a", {"target":"summary", "href":os.path.relpath("{}/html/{}.html".format(self.top(), assignee), dir)}).text(assignee)) - with html("tr"): - html("td").print("key") html("td").print(v.get_data("key")) #-------------------- -- cgit v1.2.3 From 90d3882d2c8b3c3a02b798ba9d5aaaff1186868a Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 26 Feb 2019 11:39:59 +0900 Subject: html: add relpath_y2h() more simply link path Signed-off-by: Kuninori Morimoto --- scripts/html.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/html.py b/scripts/html.py index 724b1d8..d7e4890 100755 --- a/scripts/html.py +++ b/scripts/html.py @@ -118,6 +118,9 @@ class periject_html(base.base): super().__init__() self.git = self.config("git-linux") + def relpath_y2h(self, file, frm): + return os.path.relpath(file.replace("yaml", "html").replace("projects", "html"), frm) + def git_title(self, id): return self.run("git -C {} log -1 {} --format=%s".format(self.git, id)) @@ -176,7 +179,7 @@ class periject_html(base.base): subbody = html("a", {"target":"subbody"}) summary = html("a", {"target":"summary"}) with html("tr"): - subbody.option({"href":os.path.relpath(file.replace("yaml", "html").replace("projects", "html"), dir)}) + subbody.option({"href":self.relpath_y2h(file, dir)}) html("td").print(subbody.text(os.path.basename(file).replace(".yaml", ""))) status = v.get_data("status") @@ -308,7 +311,7 @@ class periject_html(base.base): with html("tr"): html("td").print(item) html("td").print(html("a", {"href": - os.path.relpath(related_file.replace("projects", "html").replace("yaml", "html"), current_dir)}).text(rv.get_data("title"))) + self.relpath_y2h(related_file, current_dir)}).text(rv.get_data("title"))) #-------------------- # task_relation -- cgit v1.2.3 From 9311577116505151413708316982192fb1b2e875 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 26 Feb 2019 11:45:22 +0900 Subject: html: add relpath() more simply link path Signed-off-by: Kuninori Morimoto --- scripts/html.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/html.py b/scripts/html.py index d7e4890..80842cc 100755 --- a/scripts/html.py +++ b/scripts/html.py @@ -118,6 +118,9 @@ class periject_html(base.base): super().__init__() self.git = self.config("git-linux") + def relpath(self, path, frm): + return os.path.relpath("{}/{}".format(self.top(), path), frm) + def relpath_y2h(self, file, frm): return os.path.relpath(file.replace("yaml", "html").replace("projects", "html"), frm) @@ -183,11 +186,11 @@ class periject_html(base.base): html("td").print(subbody.text(os.path.basename(file).replace(".yaml", ""))) status = v.get_data("status") - summary.option({"href":os.path.relpath("{}/html/{}.html".format(self.top(), status), dir)}) + summary.option({"href":self.relpath("html/{}.html".format(status), dir)}) html("td").print(summary.text(status)) assignee = v.get_data("assignee") - summary.option({"href":os.path.relpath("{}/html/{}.html".format(self.top(), assignee), dir)}) + summary.option({"href":self.relpath("html/{}.html".format(assignee), dir)}) html("td").print(summary.text(assignee)) html("td").print(v.get_data("title")) @@ -287,9 +290,9 @@ class periject_html(base.base): with html("tr"): html("td").print(os.path.relpath(v.file, self.top())) html("td").print(html("a", {"target":"summary", - "href":os.path.relpath("{}/html/{}.html".format(self.top(), status), dir)}).text(status)) + "href":self.relpath("html/{}.html".format(status), dir)}).text(status)) html("td").print(html("a", {"target":"summary", - "href":os.path.relpath("{}/html/{}.html".format(self.top(), assignee), dir)}).text(assignee)) + "href":self.relpath("html/{}.html".format(assignee), dir)}).text(assignee)) html("td").print(v.get_data("key")) #-------------------- -- cgit v1.2.3 From 2d36f0eefb2f0bb61c2ed2b46d9043ec4564f90a Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 26 Feb 2019 11:37:24 +0900 Subject: Add BSP patch list on menu Signed-off-by: Kuninori Morimoto --- scripts/html.py | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 73 insertions(+), 8 deletions(-) (limited to 'scripts') diff --git a/scripts/html.py b/scripts/html.py index 80842cc..094a59b 100755 --- a/scripts/html.py +++ b/scripts/html.py @@ -249,6 +249,13 @@ class periject_html(base.base): html("li").print(html("a", {"target":"summary", "href":"./{}.html".format(status)}).text(status)) + #-------------------- + # menu_bsp + #-------------------- + def menu_bsp(self): + html("a", {"target":"summary", + "href":"./bsp.html"}).print("BSP patch list") + #-------------------- # menu #-------------------- @@ -265,6 +272,9 @@ class periject_html(base.base): html("h1").print("Status") self.menu_status() + html("h1").print("BSP") + self.menu_bsp() + #-------------------- # body #-------------------- @@ -351,36 +361,50 @@ class periject_html(base.base): #-------------------- # task_commit_bsp #-------------------- - def task_commit_bsp(self, v): + def task_commit_bsp(self, bsp_list): + + cnt = 0 with html("ul"): - for bsp in v.get_data("bsp-commits"): - html("li").print(html("a", {"href":self.bsp_url(bsp)}).text(self.git_title(bsp))) + for bsp in bsp_list: + cnt += 1 + html("li").print(html("a", {"href":self.bsp_url(bsp), + "target":"subbody"}).text(self.git_title(bsp))) + + return cnt #-------------------- # __task_commit_upstream #-------------------- def __task_commit_upstream(self, v, upstream, item): if (not item in upstream): - return + return 0 commit = upstream[item] with html("tr"): html("td").print(item) - html("td").print(html("a", {"href":self.upstream_url(commit)}).text(self.git_title(commit))) + html("td").print(html("a", {"href":self.upstream_url(commit), + "target":"subbody"}).text(self.git_title(commit))) + + return 1 #-------------------- # task_commit_upstream #-------------------- def task_commit_upstream(self, v): upstream = v.get_data("upstream") + if (not len(upstream)): + return 0 + cnt = 0 with html("table"): for up in upstream: - self.__task_commit_upstream(v, up, "torvalds") + cnt += self.__task_commit_upstream(v, up, "torvalds") for up in upstream: - self.__task_commit_upstream(v, up, "next") + cnt += self.__task_commit_upstream(v, up, "next") + + return cnt #-------------------- # task_commit @@ -397,7 +421,7 @@ class periject_html(base.base): html("th").print("upstream") with html("tr"): with html("td"): - self.task_commit_bsp(v) + self.task_commit_bsp(bsp) with html("td"): self.task_commit_upstream(v) @@ -436,6 +460,44 @@ class periject_html(base.base): with html("body"): self.__summary(mem, "{}/html".format(self.top()), argv) + #-------------------- + # bsp + #-------------------- + def bsp(self, argv): + + a = html("a", {"target":"subbody"}) + cnt_bsp = 0 + cnt_up = 0 + with html("body"): + html("h1").print("BSP patch list") + + with html("table", {"border":"1"}): + with html("tr"): + html("th").print("file") + html("th").print("BSP") + html("th").print("upstream") + + for file in argv: + v = view.viewer([file]) + v.set_data(file) + + bsp = v.get_data("bsp-commits") + if (not len(bsp)): + continue + + with html("tr"): + a.option({"href": + os.path.relpath(file.replace("yaml", "html").replace("projects", "html"), "{}/html".format(self.top()))}) + html("td").print(a.text(os.path.basename(file).replace(".yaml", ""))) + + with html("td"): + cnt_bsp += self.task_commit_bsp(bsp) + + with html("td"): + cnt_up += self.task_commit_upstream(v) + + html("p").print("bsp:{}/upstream:{} = {:.1f}% done".format(cnt_bsp, cnt_up, cnt_up * 100 /cnt_bsp)) + #-------------------- # print #-------------------- @@ -470,6 +532,9 @@ class periject_html(base.base): elif (cmd == "status"): # ./script/find.py -s Active | xargs ./script/html.py status Active self.member(sys.argv) + elif (cmd == "bsp"): + # ./script/html.py bsp xxx.yaml xxx.yaml ... + self.bsp(sys.argv) #==================================== # -- cgit v1.2.3 From 0562110e003c7db39382d790866bb5565604c8ea Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 26 Feb 2019 17:13:11 +0900 Subject: html: status based summary status based summary is easy to see Signed-off-by: Kuninori Morimoto --- scripts/html.py | 77 ++++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 63 insertions(+), 14 deletions(-) (limited to 'scripts') diff --git a/scripts/html.py b/scripts/html.py index 094a59b..cdc77c9 100755 --- a/scripts/html.py +++ b/scripts/html.py @@ -161,23 +161,22 @@ class periject_html(base.base): #-------------------- # summary #-------------------- - def __summary(self, title, dir, files): - # ------- - # summary - # ------- - # - # ------- - html("h2").print(title) + def ___summary(self, status, dir, files): + + if (not len(files)): + return + + html("h3").print(html("a", {"target":"summary", + "href":self.relpath("html/{}.html".format(status), dir)}).text(status)) + with html("table", {"border":"1"}): with html("tr"): html("th").print("file") - html("th").print("status") html("th").print("assignee") html("th").print("title") for file in files: v = view.viewer([file]) v.set_data(file) - f = os.path.basename(file) subbody = html("a", {"target":"subbody"}) summary = html("a", {"target":"summary"}) @@ -185,16 +184,56 @@ class periject_html(base.base): subbody.option({"href":self.relpath_y2h(file, dir)}) html("td").print(subbody.text(os.path.basename(file).replace(".yaml", ""))) - status = v.get_data("status") - summary.option({"href":self.relpath("html/{}.html".format(status), dir)}) - html("td").print(summary.text(status)) - assignee = v.get_data("assignee") summary.option({"href":self.relpath("html/{}.html".format(assignee), dir)}) html("td").print(summary.text(assignee)) html("td").print(v.get_data("title")) + #-------------------- + # summary + #-------------------- + def __summary(self, title, dir, files): + # ------- + # summary + # ------- + # + # ------- + if (title): + html("h2").print(title) + + new = [] + active = [] + blocked = [] + paused = [] + done = [] + abandoned = [] + + for file in files: + v = view.viewer([file]) + v.set_data(file) + + status = v.get_data("status") + if (status == "New"): + new.append(file) + elif (status == "Active"): + active.append(file) + elif (status == "Blocked"): + blocked.append(file) + elif (status == "Paused"): + paused.append(file) + elif (status == "Done"): + done.append(file) + else: + abandoned.append(file) + + self.___summary("New", dir, new) + self.___summary("Active", dir, active) + self.___summary("Blocked", dir, blocked) + self.___summary("Paused", dir, paused) + self.___summary("Done", dir, done) + self.___summary("Abandoned", dir, abandoned) + #-------------------- # summary #-------------------- @@ -460,6 +499,16 @@ class periject_html(base.base): with html("body"): self.__summary(mem, "{}/html".format(self.top()), argv) + #-------------------- + # status + #-------------------- + def status(self, argv): + + argv.pop(0) + + with html("body"): + self.__summary(None, "{}/html".format(self.top()), argv) + #-------------------- # bsp #-------------------- @@ -531,7 +580,7 @@ class periject_html(base.base): self.member(sys.argv) elif (cmd == "status"): # ./script/find.py -s Active | xargs ./script/html.py status Active - self.member(sys.argv) + self.status(sys.argv) elif (cmd == "bsp"): # ./script/html.py bsp xxx.yaml xxx.yaml ... self.bsp(sys.argv) -- cgit v1.2.3 From 52373e42e7b11961fcff298822d5ba025e0dedfd Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 26 Feb 2019 17:27:35 +0900 Subject: html: add team menu Signed-off-by: Kuninori Morimoto --- scripts/html.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'scripts') diff --git a/scripts/html.py b/scripts/html.py index cdc77c9..11f573f 100755 --- a/scripts/html.py +++ b/scripts/html.py @@ -172,6 +172,7 @@ class periject_html(base.base): with html("table", {"border":"1"}): with html("tr"): html("th").print("file") + html("th").print("team") html("th").print("assignee") html("th").print("title") for file in files: @@ -184,6 +185,10 @@ class periject_html(base.base): subbody.option({"href":self.relpath_y2h(file, dir)}) html("td").print(subbody.text(os.path.basename(file).replace(".yaml", ""))) + team = v.get_data("team") + summary.option({"href":self.relpath("html/{}.html".format(team), dir)}) + html("td").print(summary.text(team)) + assignee = v.get_data("assignee") summary.option({"href":self.relpath("html/{}.html".format(assignee), dir)}) html("td").print(summary.text(assignee)) @@ -288,6 +293,16 @@ class periject_html(base.base): html("li").print(html("a", {"target":"summary", "href":"./{}.html".format(status)}).text(status)) + #-------------------- + # menu_team + #-------------------- + def menu_team(self): + # from project.schema.yaml + with html("ul"): + for status in ['Core', 'IO', 'MM']: + html("li").print(html("a", {"target":"summary", + "href":"./{}.html".format(status)}).text(status)) + #-------------------- # menu_bsp #-------------------- @@ -311,6 +326,9 @@ class periject_html(base.base): html("h1").print("Status") self.menu_status() + html("h1").print("Team") + self.menu_team() + html("h1").print("BSP") self.menu_bsp() @@ -328,11 +346,13 @@ class periject_html(base.base): dir = os.path.dirname(v.file) assignee = v.get_data("assignee") status = v.get_data("status") + team = v.get_data("team") with html("table", {"border":"1"}): with html("tr"): html("th").print("file") html("th").print("status") + html("th").print("team") html("th").print("assignee") html("th").print("key") @@ -340,6 +360,8 @@ class periject_html(base.base): html("td").print(os.path.relpath(v.file, self.top())) html("td").print(html("a", {"target":"summary", "href":self.relpath("html/{}.html".format(status), dir)}).text(status)) + html("td").print(html("a", {"target":"summary", + "href":self.relpath("html/{}.html".format(team), dir)}).text(team)) html("td").print(html("a", {"target":"summary", "href":self.relpath("html/{}.html".format(assignee), dir)}).text(assignee)) html("td").print(v.get_data("key")) @@ -509,6 +531,16 @@ class periject_html(base.base): with html("body"): self.__summary(None, "{}/html".format(self.top()), argv) + #-------------------- + # team + #-------------------- + def team(self, argv): + + team = argv.pop(0) + + with html("body"): + self.__summary(team, "{}/html".format(self.top()), argv) + #-------------------- # bsp #-------------------- @@ -581,6 +613,9 @@ class periject_html(base.base): elif (cmd == "status"): # ./script/find.py -s Active | xargs ./script/html.py status Active self.status(sys.argv) + elif (cmd == "team"): + # ./script/find.py -t Core | xargs ./script/html.py status Core + self.team(sys.argv) elif (cmd == "bsp"): # ./script/html.py bsp xxx.yaml xxx.yaml ... self.bsp(sys.argv) -- cgit v1.2.3 From 8902d6580f4af54d003bfab3804a489313e3adc3 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Wed, 27 Feb 2019 17:47:14 +0900 Subject: html.py: tidyup parse command Signed-off-by: Kuninori Morimoto --- scripts/html.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/html.py b/scripts/html.py index 11f573f..9360974 100755 --- a/scripts/html.py +++ b/scripts/html.py @@ -157,7 +157,6 @@ class periject_html(base.base): html("frame", {"src":"./summary.html", "name":"summary"}).print() html("frame", {"src":"./body.html", "name":"subbody"}).print() - #-------------------- # summary #-------------------- @@ -598,12 +597,12 @@ class periject_html(base.base): elif (cmd == "body"): # html.py body self.body() - elif (cmd == "summary"): - # html.py summary projects/linux/io - self.summary(sys.argv) elif (cmd == "menu"): # html.py menu self.menu() + elif (cmd == "summary"): + # html.py summary projects/linux/io + self.summary(sys.argv) elif (cmd == "task"): # html.py task projects/linux/io/xxx.yaml self.task(sys.argv) @@ -617,7 +616,7 @@ class periject_html(base.base): # ./script/find.py -t Core | xargs ./script/html.py status Core self.team(sys.argv) elif (cmd == "bsp"): - # ./script/html.py bsp xxx.yaml xxx.yaml ... + # ./script/find.py -a | xargs ./script/html.py bsp self.bsp(sys.argv) #==================================== -- cgit v1.2.3 From fc079b6489240673348db06cee87b7babebf3b52 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Fri, 1 Mar 2019 10:34:29 +0900 Subject: html.py: enable to setup html default cols/rows For selfish boys & girls Signed-off-by: Kuninori Morimoto --- scripts/html.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/html.py b/scripts/html.py index 9360974..446c200 100755 --- a/scripts/html.py +++ b/scripts/html.py @@ -140,7 +140,7 @@ class periject_html(base.base): # | | | # |menu|body| # | | | - with html("frameset", {"cols":"200,*"}): + with html("frameset", {"cols":"{},*".format(self.config("html-default-cols"))}): html("frame", {"src":"./html/menu.html", "name":"menu"}).print() html("frame", {"src":"./html/subindex.html", "name":"body"}).print() @@ -153,7 +153,7 @@ class periject_html(base.base): # ------- # body # ------- - with html("frameset", {"rows":"300,*"}): + with html("frameset", {"rows":"{},*".format(self.config("html-default-rows"))}): html("frame", {"src":"./summary.html", "name":"summary"}).print() html("frame", {"src":"./body.html", "name":"subbody"}).print() -- cgit v1.2.3 From 6d6745d65a2597cf22525c5458eccbbdbafcef6e Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Wed, 6 Mar 2019 10:36:52 +0900 Subject: find: tidyup default_arg() It returned additional default args, but it will be issue for html. This patch exchange to retrun whole args Signed-off-by: Kuninori Morimoto --- scripts/find.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/find.py b/scripts/find.py index cbefcbe..9c02258 100755 --- a/scripts/find.py +++ b/scripts/find.py @@ -27,14 +27,14 @@ class find(base.base): match = 0 for cmd in arg: if (cmd == "-a"): - return [] + return arg if ((cmd == "-s") or (cmd == "-ns")): match = 1 if (not match): - return ["-ns", "Done"] + arg += ["-ns", "Done"] - return [] + return arg #-------------------- # parse_option @@ -101,7 +101,7 @@ class find(base.base): self.parse_files(arg) - arg += self.default_arg(arg) + arg = self.default_arg(arg) # -a : all # -s : matched status -- cgit v1.2.3 From 17a5ae0b96fd0517bbf4546f3d20ba3484f5df24 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Wed, 6 Mar 2019 10:39:27 +0900 Subject: view: tidyup get_data() Some key might not exist on yaml data. In such case, it will be error on get_data(). This patch return [] when no data or no key case Signed-off-by: Kuninori Morimoto --- scripts/view.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/view.py b/scripts/view.py index 9486e51..baad0f3 100755 --- a/scripts/view.py +++ b/scripts/view.py @@ -85,11 +85,11 @@ class viewer(base.base): self.file = file def get_data(self, key): - data = self.data[key] - if (data): - return data - else: - return [] + if (key in self.data): + data = self.data[key] + if (data): + return data + return [] #-------------------- # make_one -- cgit v1.2.3 From 7997deae1430017e0cae7ad5337ffdfff0dc0e71 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Wed, 6 Mar 2019 10:42:19 +0900 Subject: find: replace -a to -all commit fbd5adac3e9a0 ("find: add -a option") added -a option to indicate all tasks, but it was same as assignee member. This patch fixup it. Signed-off-by: Kuninori Morimoto --- scripts/find.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/find.py b/scripts/find.py index 9c02258..cf25e16 100755 --- a/scripts/find.py +++ b/scripts/find.py @@ -22,12 +22,14 @@ class find(base.base): # default_arg #-------------------- def default_arg(self, arg): + # return [] for -all + # # add "-ns Done" automatically # if user doesn't specify "-s" or "-ns" match = 0 for cmd in arg: - if (cmd == "-a"): - return arg + if (cmd == "-all"): + return [] if ((cmd == "-s") or (cmd == "-ns")): match = 1 @@ -103,7 +105,7 @@ class find(base.base): arg = self.default_arg(arg) - # -a : all + # -all: all # -s : matched status # -ns : not matched status # -a : matched assignee -- cgit v1.2.3 From 191eee1990dbe1b8e6bfcc98fdef7bde655f2538 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Wed, 6 Mar 2019 10:52:31 +0900 Subject: find: add -a NoAssignee support We can find No Assignee task as below, but not useful. find -na "" This patch support -a NoAssignee support for it. It might be replace if schema had required at assignee Signed-off-by: Kuninori Morimoto --- scripts/find.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/find.py b/scripts/find.py index cf25e16..e1e86ae 100755 --- a/scripts/find.py +++ b/scripts/find.py @@ -24,13 +24,19 @@ class find(base.base): def default_arg(self, arg): # return [] for -all # + # replace -a NoAssignee to -na "" + # # add "-ns Done" automatically # if user doesn't specify "-s" or "-ns" match = 0 - for cmd in arg: - if (cmd == "-all"): + for i in range(len(arg)): + if (arg[i] == "-all"): return [] - if ((cmd == "-s") or (cmd == "-ns")): + if ((arg[i] == "-a") and + (arg[i+1] == "NoAssignee")): + arg[i] = "-na" + arg[i+1] = "" + if ((arg[i] == "-s") or (arg[i] == "-ns")): match = 1 if (not match): -- cgit v1.2.3 From 0afee29de0672e7d8244d65c610aa0a009243c41 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Wed, 6 Mar 2019 10:55:10 +0900 Subject: html: add NoAssignee support There are no assignee tasks, and html.py will be error at such tasks. This patch care it. Signed-off-by: Kuninori Morimoto --- scripts/html.py | 7 ++++++- scripts/view.py | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/html.py b/scripts/html.py index 446c200..d9b181d 100755 --- a/scripts/html.py +++ b/scripts/html.py @@ -189,6 +189,8 @@ class periject_html(base.base): html("td").print(summary.text(team)) assignee = v.get_data("assignee") + if (not len(assignee)): + assignee = "NoAssignee" summary.option({"href":self.relpath("html/{}.html".format(assignee), dir)}) html("td").print(summary.text(assignee)) @@ -278,7 +280,7 @@ class periject_html(base.base): # from project.schema.yaml with html("ul"): for assignee in ['BSP', 'Geert', 'Jacopo', 'Kaneko', 'Kieran', 'Laurent', 'Magnus', 'Marek', - 'Morimoto', 'Niklas', 'Shimoda', 'Simon', 'Ulrich', 'Wolfram']: + 'Morimoto', 'Niklas', 'Shimoda', 'Simon', 'Ulrich', 'Wolfram', "NoAssignee"]: html("li").print(html("a", {"target":"summary", "href":"./{}.html".format(assignee)}).text(assignee)) @@ -347,6 +349,9 @@ class periject_html(base.base): status = v.get_data("status") team = v.get_data("team") + if (not len(assignee)): + assignee = "NoAssignee" + with html("table", {"border":"1"}): with html("tr"): html("th").print("file") diff --git a/scripts/view.py b/scripts/view.py index baad0f3..48c6f71 100755 --- a/scripts/view.py +++ b/scripts/view.py @@ -149,7 +149,9 @@ class viewer(base.base): self.text += "Title: {}\n".format(self.get_data("title")) # show assignee - self.text += "Assignee: {}\n".format(self.get_data("assignee")) + assignee = self.get_data("assignee") + if (len(assignee)): + self.text += "Assignee: {}\n".format(assignee) if (self.with_file): self.text += "File: {}\n".format( -- cgit v1.2.3 From 2ba51577aef4f4a808e292f2bfa9fd8e36e5c64f Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 11 Mar 2019 15:37:13 +0900 Subject: html: add http link for task comment If comment had http[s] links, this patch add link for it. It doesn't work correctly somehow if , so, it uses so far. Signed-off-by: Kuninori Morimoto --- scripts/html.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'scripts') diff --git a/scripts/html.py b/scripts/html.py index d9b181d..26f6804 100755 --- a/scripts/html.py +++ b/scripts/html.py @@ -7,6 +7,7 @@ #=============================== import sys import os +import re import base import find @@ -500,6 +501,12 @@ class periject_html(base.base): with html("ul"): for comment in comments: + str = re.search(r'(https?://[\w/:%#\$&\?\(\)~\.=\+\-]+)', comment) + if (str): + a = html("a", {"href":str.group(), + "target":"_blank"}) + comment = str.string[:str.start()] + a.text(str.group()) + str.string[str.end():] + html("li").print(comment) #-------------------- -- cgit v1.2.3 From 302793aeffd60226c521a5c3965692014aaddb85 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 19 Mar 2019 10:48:50 +0900 Subject: html: add task base done percent at bsp.html "BSP commit / upstreamed commit" is not 1:1. This means, max will be not 100%. This patch adds task base percent. Signed-off-by: Kuninori Morimoto --- scripts/html.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/html.py b/scripts/html.py index 26f6804..0eeaf16 100755 --- a/scripts/html.py +++ b/scripts/html.py @@ -560,6 +560,8 @@ class periject_html(base.base): a = html("a", {"target":"subbody"}) cnt_bsp = 0 cnt_up = 0 + cnt_all = 0 + cnt_done= 0 with html("body"): html("h1").print("BSP patch list") @@ -577,6 +579,7 @@ class periject_html(base.base): if (not len(bsp)): continue + cnt_all += 1 with html("tr"): a.option({"href": os.path.relpath(file.replace("yaml", "html").replace("projects", "html"), "{}/html".format(self.top()))}) @@ -586,9 +589,13 @@ class periject_html(base.base): cnt_bsp += self.task_commit_bsp(bsp) with html("td"): - cnt_up += self.task_commit_upstream(v) + up = self.task_commit_upstream(v) + if (up): + cnt_up += up + cnt_done += 1 - html("p").print("bsp:{}/upstream:{} = {:.1f}% done".format(cnt_bsp, cnt_up, cnt_up * 100 /cnt_bsp)) + html("p").print("bsp:{}/upstream:{} = {:.1f}%".format(cnt_bsp, cnt_up, cnt_up * 100 /cnt_bsp)) + html("p").print("task:{}/done:{} = {:.1f}%".format(cnt_all, cnt_done, cnt_done * 100 /cnt_all)) #-------------------- # print -- cgit v1.2.3 From fb3832fcf446c5e1e52322e254a1d01f77967c77 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Thu, 25 Apr 2019 13:58:25 +0900 Subject: script/html: count correct BSP patch number for statistics Current statistics is counting line number, but then, result will be strange if 1 line had multi patches. This patch counts correct BSP patch number. Signed-off-by: Kuninori Morimoto --- scripts/html.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/html.py b/scripts/html.py index 0eeaf16..537ee52 100755 --- a/scripts/html.py +++ b/scripts/html.py @@ -562,6 +562,7 @@ class periject_html(base.base): cnt_up = 0 cnt_all = 0 cnt_done= 0 + tmp = 0 with html("body"): html("h1").print("BSP patch list") @@ -586,12 +587,13 @@ class periject_html(base.base): html("td").print(a.text(os.path.basename(file).replace(".yaml", ""))) with html("td"): - cnt_bsp += self.task_commit_bsp(bsp) + tmp = self.task_commit_bsp(bsp) + cnt_bsp += tmp with html("td"): up = self.task_commit_upstream(v) if (up): - cnt_up += up + cnt_up += tmp cnt_done += 1 html("p").print("bsp:{}/upstream:{} = {:.1f}%".format(cnt_bsp, cnt_up, cnt_up * 100 /cnt_bsp)) -- cgit v1.2.3