From 0bd81ca4dd04b4eb9020b2e05976417f556349da Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sun, 31 May 2015 05:15:47 -0500 Subject: Redo mkstatus.py to grep pending for pending data and trust toybox defconfig output for ready command list, to reduce manual updating. --- scripts/mkstatus.py | 73 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 46 insertions(+), 27 deletions(-) (limited to 'scripts/mkstatus.py') diff --git a/scripts/mkstatus.py b/scripts/mkstatus.py index 82592c71..3b1bbc8b 100755 --- a/scripts/mkstatus.py +++ b/scripts/mkstatus.py @@ -4,10 +4,10 @@ import subprocess,sys -def readit(args): +def readit(args, shell=False): ret={} arr=[] - blob=subprocess.Popen(args, stdout=subprocess.PIPE, shell=False) + blob=subprocess.Popen(args, stdout=subprocess.PIPE, shell=shell) for i in blob.stdout.read().split("\n"): if not i: continue i=i.split() @@ -15,36 +15,37 @@ def readit(args): arr.extend(i) return ret,arr -# Run sed on roadmap and status pages to get command lists, and run toybox too +# Run sed on roadmap and source to get command lists, and run toybox too # This gives us a dictionary of types, each with a list of commands +print "Collecting data..." + stuff,blah=readit(["sed","-n", 's//\\1 /;t good;d;:good;h;:loop;n;s@@@;t out;H;b loop;:out;g;s/\\n/ /g;p', "www/roadmap.html", "www/status.html"]) blah,toystuff=readit(["./toybox"]) +blah,pending=readit(["sed -n 's/[^ \\t].*TOY(\\([^,]*\\),.*/\\1/p' toys/pending/*.c"], 1) +blah,version=readit(["git","describe","--tags"]) + +print "Analyzing..." -# Create reverse mappings: command is in which +# Create reverse mappings: reverse["command"] gives list of categories it's in reverse={} for i in stuff: for j in stuff[i]: try: reverse[j].append(i) except: reverse[j]=[i] +print "all commands=%s" % len(reverse) + +# Run a couple sanity checks on input for i in toystuff: - try: - if ("ready" in reverse[i]) and ("pending" in reverse[i]): print "barf", i - except: pass - try: - if ("ready" in reverse[i]) or ("pending" in reverse[i]): continue - except: pass - print "Not ready or pending:", i - -pending=[] -done=[] + if (i in pending): print "barf %s" % i -print "all commands=%s" % len(reverse) +unknowns=[] +for i in toystuff + pending: + if not i in reverse: unknowns.append(i) -outfile=open("www/status.gen", "w") -outfile.write("

All commands

\n") +if unknowns: print "uncategorized: %s" % " ".join(unknowns) conv = [("posix", '%%s', "[%s]"), ("lsb", '%%s', '<%s>'), @@ -72,22 +73,38 @@ def categorize(reverse, i, skippy=""): return linky % out +# Sort/annotate done, pending, and todo item lists + +allcmd=[] +done=[] +pend=[] +todo=[] blah=list(reverse) blah.sort() for i in blah: out=categorize(reverse, i) - if "ready" in reverse[i] or "pending" in reverse[i]: - done.append(out) + allcmd.append(out) + if i in toystuff or i in pending: + if i in toystuff: done.append(out) + else: pend.append(out) out='%s' % out - else: pending.append(out) + else: todo.append(out) + +print "implemented=%s" % len(toystuff) - outfile.write(out+"\n") +# Write data to output file -print "done=%s" % len(done) -outfile.write("

\n") +outfile=open("www/status.gen", "w") +outfile.write("

Status of toybox %s

\n" % version[0]); +outfile.write("

Legend: [posix] <lsb> (development) {android}\n") +outfile.write("=klibc= #sash# @sbase@ *beastiebox* $tizen$ +request+ other\n") +outfile.write("pending

\n"); + +outfile.write("

Completed

%s

\n" % "\n".join(done)) +outfile.write("

Partially implemented

%s

\n" % "\n".join(pend)) +outfile.write("

Not started yet

%s

\n" % "\n".join(todo)) -outfile.write("

TODO

%s

\n" % "\n".join(pending)) -outfile.write("

Done

%s

\n" % "\n".join(done)) +# Output unfinished commands by category outfile.write("

Categories of remaining todo items

") @@ -95,8 +112,8 @@ for i in stuff: todo = [] for j in stuff[i]: - if "ready" in reverse[j]: continue - elif "pending" in reverse[j]: todo.append('%s' % j) + if j in toystuff: continue + if j in pending: todo.append('%s' % j) else: todo.append(categorize(reverse,j,i)) if todo: @@ -108,3 +125,5 @@ for i in stuff: outfile.write("

%s

" % (i,i,k)) outfile.write(" ".join(todo)) outfile.write("

\n") + +outfile.write("

All commands together in one big list

%s

\n" % "\n".join(allcmd)) -- cgit v1.2.3