Rob Landley | 37aa821 | 2012-07-21 00:29:27 -0500 | [diff] [blame] | 1 | #!/usr/bin/python |
| 2 | |
Rob Landley | 9a69a92 | 2013-02-23 18:32:08 -0600 | [diff] [blame] | 3 | # Create status.html |
| 4 | |
Rob Landley | 37aa821 | 2012-07-21 00:29:27 -0500 | [diff] [blame] | 5 | import subprocess,sys |
| 6 | |
Rob Landley | 7a78d92 | 2012-12-23 00:37:42 -0600 | [diff] [blame] | 7 | def readit(args): |
| 8 | ret={} |
| 9 | arr=[] |
| 10 | blob=subprocess.Popen(args, stdout=subprocess.PIPE, shell=False) |
| 11 | for i in blob.stdout.read().split("\n"): |
| 12 | if not i: continue |
| 13 | i=i.split() |
| 14 | ret[i[0]]=i[1:] |
| 15 | arr.extend(i) |
| 16 | return ret,arr |
Rob Landley | 37aa821 | 2012-07-21 00:29:27 -0500 | [diff] [blame] | 17 | |
Rob Landley | c166faf | 2013-09-01 07:25:37 -0500 | [diff] [blame] | 18 | # Run sed on roadmap and status pages to get command lists, and run toybox too |
| 19 | # This gives us a dictionary of types, each with a list of commands |
Rob Landley | 7a78d92 | 2012-12-23 00:37:42 -0600 | [diff] [blame] | 20 | |
Rob Landley | c166faf | 2013-09-01 07:25:37 -0500 | [diff] [blame] | 21 | 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"]) |
Rob Landley | 7a78d92 | 2012-12-23 00:37:42 -0600 | [diff] [blame] | 22 | blah,toystuff=readit(["./toybox"]) |
Rob Landley | 8f90d3a | 2012-07-21 23:58:40 -0500 | [diff] [blame] | 23 | |
Rob Landley | c166faf | 2013-09-01 07:25:37 -0500 | [diff] [blame] | 24 | # Create reverse mappings: command is in which |
| 25 | |
Rob Landley | 37aa821 | 2012-07-21 00:29:27 -0500 | [diff] [blame] | 26 | reverse={} |
| 27 | for i in stuff: |
| 28 | for j in stuff[i]: |
Rob Landley | 7a78d92 | 2012-12-23 00:37:42 -0600 | [diff] [blame] | 29 | try: reverse[j].append(i) |
| 30 | except: reverse[j]=[i] |
| 31 | |
| 32 | for i in toystuff: |
| 33 | try: |
Rob Landley | 3c99404 | 2015-01-01 17:37:57 -0600 | [diff] [blame^] | 34 | if ("ready" in reverse[i]) and ("pending" in reverse[i]): print "barf", i |
| 35 | except: pass |
| 36 | try: |
Rob Landley | 7a78d92 | 2012-12-23 00:37:42 -0600 | [diff] [blame] | 37 | if ("ready" in reverse[i]) or ("pending" in reverse[i]): continue |
| 38 | except: pass |
Rob Landley | 3c99404 | 2015-01-01 17:37:57 -0600 | [diff] [blame^] | 39 | print "Not ready or pending:", i |
Rob Landley | 37aa821 | 2012-07-21 00:29:27 -0500 | [diff] [blame] | 40 | |
| 41 | pending=[] |
| 42 | done=[] |
| 43 | |
Rob Landley | 9a69a92 | 2013-02-23 18:32:08 -0600 | [diff] [blame] | 44 | print "all commands=%s" % len(reverse) |
| 45 | |
Rob Landley | 37aa821 | 2012-07-21 00:29:27 -0500 | [diff] [blame] | 46 | outfile=open("www/status.gen", "w") |
Rob Landley | e0cc81e | 2012-12-01 18:27:37 -0600 | [diff] [blame] | 47 | outfile.write("<a name=all><h2><a href=#all>All commands</a></h2><blockquote><p>\n") |
Rob Landley | 37aa821 | 2012-07-21 00:29:27 -0500 | [diff] [blame] | 48 | |
Rob Landley | c166faf | 2013-09-01 07:25:37 -0500 | [diff] [blame] | 49 | conv = [("posix", '<a href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/%s.html">%%s</a>', "[%s]"), |
| 50 | ("lsb", '<a href="http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/%s.html">%%s</a>', '<%s>'), |
| 51 | ("development", '<a href="http://linux.die.net/man/1/%s">%%s</a>', '(%s)'), |
| 52 | ("toolbox", "", '{%s}'), ("klibc_cmd", "", '=%s='), |
| 53 | ("sash_cmd", "", '#%s#'), ("sbase_cmd", "", '@%s@'), |
Rob Landley | 3c99404 | 2015-01-01 17:37:57 -0600 | [diff] [blame^] | 54 | ("beastiebox_cmd", "", '*%s*'), ("tizen", "", '$%s$'), |
Rob Landley | c166faf | 2013-09-01 07:25:37 -0500 | [diff] [blame] | 55 | ("request", '<a href="http://linux.die.net/man/1/%s">%%s</a>', '+%s+')] |
| 56 | |
| 57 | |
| 58 | def categorize(reverse, i, skippy=""): |
| 59 | linky = "%s" |
| 60 | out = i |
| 61 | |
| 62 | if skippy: types = filter(lambda a: a != skippy, reverse[i]) |
| 63 | else: types = reverse[i] |
| 64 | |
| 65 | for j in conv: |
| 66 | if j[0] in types: |
| 67 | if j[1]: linky = j[1] % i |
| 68 | out = j[2] % out |
| 69 | if not skippy: break |
| 70 | if (not skippy) and out == i: |
| 71 | sys.stderr.write("unknown %s %s\n" % (i,reverse[i])) |
| 72 | |
| 73 | return linky % out |
| 74 | |
Rob Landley | 37aa821 | 2012-07-21 00:29:27 -0500 | [diff] [blame] | 75 | blah=list(reverse) |
| 76 | blah.sort() |
| 77 | for i in blah: |
Rob Landley | c166faf | 2013-09-01 07:25:37 -0500 | [diff] [blame] | 78 | out=categorize(reverse, i) |
Rob Landley | 37aa821 | 2012-07-21 00:29:27 -0500 | [diff] [blame] | 79 | if "ready" in reverse[i] or "pending" in reverse[i]: |
Rob Landley | 37aa821 | 2012-07-21 00:29:27 -0500 | [diff] [blame] | 80 | done.append(out) |
Rob Landley | 8f90d3a | 2012-07-21 23:58:40 -0500 | [diff] [blame] | 81 | out='<strike>%s</strike>' % out |
Rob Landley | 37aa821 | 2012-07-21 00:29:27 -0500 | [diff] [blame] | 82 | else: pending.append(out) |
| 83 | |
| 84 | outfile.write(out+"\n") |
| 85 | |
Rob Landley | 9a69a92 | 2013-02-23 18:32:08 -0600 | [diff] [blame] | 86 | print "done=%s" % len(done) |
Rob Landley | 37aa821 | 2012-07-21 00:29:27 -0500 | [diff] [blame] | 87 | outfile.write("</p></blockquote>\n") |
| 88 | |
Rob Landley | e0cc81e | 2012-12-01 18:27:37 -0600 | [diff] [blame] | 89 | outfile.write("<a name=todo><h2><a href=#todo>TODO</a></h2><blockquote><p>%s</p></blockquote>\n" % "\n".join(pending)) |
| 90 | outfile.write("<a name=done><h2><a href=#done>Done</a></h2><blockquote><p>%s</p></blockquote>\n" % "\n".join(done)) |
Rob Landley | c166faf | 2013-09-01 07:25:37 -0500 | [diff] [blame] | 91 | |
| 92 | outfile.write("<hr><h2>Categories of remaining todo items</h2>") |
| 93 | |
| 94 | for i in stuff: |
| 95 | todo = [] |
| 96 | |
| 97 | for j in stuff[i]: |
| 98 | if "ready" in reverse[j]: continue |
Rob Landley | 7dbb982 | 2014-02-21 22:24:02 -0600 | [diff] [blame] | 99 | elif "pending" in reverse[j]: todo.append('<strike>%s</strike>' % j) |
Rob Landley | c166faf | 2013-09-01 07:25:37 -0500 | [diff] [blame] | 100 | else: todo.append(categorize(reverse,j,i)) |
| 101 | |
| 102 | if todo: |
| 103 | k = i |
| 104 | for j in conv: |
| 105 | if j[0] == i: |
| 106 | k = j[2] % i |
| 107 | |
| 108 | outfile.write("<a name=%s><h2><a href=#%s>%s<a></h2><blockquote><p>" % (i,i,k)) |
| 109 | outfile.write(" ".join(todo)) |
| 110 | outfile.write("</p></blockquote>\n") |