7 def readit(args, shell=False):
10 blob=subprocess.Popen(args, stdout=subprocess.PIPE, shell=shell)
11 for i in blob.stdout.read().split("\n"):
14 try: ret[i[0]].extend(i[1:])
15 except: ret[i[0]]=i[1:]
19 # Run sed on roadmap and source to get command lists, and run toybox too
20 # This gives us a dictionary of types, each with a list of commands
22 print "Collecting data..."
24 stuff,blah=readit(["sed","-n", 's/<span id=\\([a-z_]*\\)>/\\1 /;t good;d;:good;h;:loop;n;s@</span>@@;t out;H;b loop;:out;g;s/\\n/ /g;p', "www/roadmap.html", "www/status.html"])
25 blah,toystuff=readit(["./toybox"])
26 blah,pending=readit(["sed -n 's/[^ \\t].*TOY(\\([^,]*\\),.*/\\1/p' toys/pending/*.c"], 1)
27 blah,version=readit(["git","describe","--tags"])
31 # Create reverse mappings: reverse["command"] gives list of categories it's in
36 try: reverse[j].append(i)
37 except: reverse[j]=[i]
38 print "all commands=%s" % len(reverse)
40 # Run a couple sanity checks on input
43 if (i in pending): print "barf %s" % i
46 for i in toystuff + pending:
47 if not i in reverse: unknowns.append(i)
49 if unknowns: print "uncategorized: %s" % " ".join(unknowns)
51 conv = [("posix", '<a href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/%s.html">%%s</a>', "[%s]"),
52 ("lsb", '<a href="http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/%s.html">%%s</a>', '<%s>'),
53 ("development", '<a href="http://linux.die.net/man/1/%s">%%s</a>', '(%s)'),
54 ("toolbox", "", '{%s}'), ("klibc_cmd", "", '=%s='),
55 ("sash_cmd", "", '#%s#'), ("sbase_cmd", "", '@%s@'),
56 ("beastiebox_cmd", "", '*%s*'), ("tizen", "", '$%s$'),
57 ("shell", "", "%%%s%%"),
58 ("request", '<a href="http://linux.die.net/man/1/%s">%%s</a>', '+%s+')]
61 def categorize(reverse, i, skippy=""):
65 if skippy: types = filter(lambda a: a != skippy, reverse[i])
66 else: types = reverse[i]
70 if j[1]: linky = j[1] % i
73 if (not skippy) and out == i:
74 sys.stderr.write("unknown %s %s\n" % (i,reverse[i]))
78 # Sort/annotate done, pending, and todo item lists
87 out=categorize(reverse, i)
89 if i in toystuff or i in pending:
90 if i in toystuff: done.append(out)
91 else: pend.append(out)
92 out='<strike>%s</strike>' % out
93 else: todo.append(out)
95 print "implemented=%s" % len(toystuff)
97 # Write data to output file
99 outfile=open("www/status.gen", "w")
100 outfile.write("<h1>Status of toybox %s</h1>\n" % version[0]);
101 outfile.write("<h3>Legend: [posix] <lsb> (development) {android}\n")
102 outfile.write("=klibc= #sash# @sbase@ *beastiebox* $tizen$ %shell% +request+ other\n")
103 outfile.write("<strike>pending</strike></h3>\n");
105 outfile.write("<a name=done><h2><a href=#done>Completed</a></h2><blockquote><p>%s</p></blockquote>\n" % "\n".join(done))
106 outfile.write("<a name=part><h2><a href=#part>Partially implemented</a></h2><blockquote><p>%s</p></blockquote>\n" % "\n".join(pend))
107 outfile.write("<a name=todo><h2><a href=#todo>Not started yet</a></h2><blockquote><p>%s</p></blockquote>\n" % "\n".join(todo))
109 # Output unfinished commands by category
111 outfile.write("<hr><h2>Categories of remaining todo items</h2>")
117 if j in toystuff: continue
118 if j in pending: todo.append('<strike>%s</strike>' % j)
119 else: todo.append(categorize(reverse,j,i))
127 outfile.write("<a name=%s><h2><a href=#%s>%s<a></h2><blockquote><p>" % (i,i,k))
128 outfile.write(" ".join(todo))
129 outfile.write("</p></blockquote>\n")
131 outfile.write("<hr><a name=all><h2><a href=#all>All commands together in one big list</a></h2><blockquote><p>%s</p></blockquote>\n" % "\n".join(allcmd))