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()
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/<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"])
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("<a name=all><h2><a href=#all>All commands</a></h2><blockquote><p>\n")
+if unknowns: print "uncategorized: %s" % " ".join(unknowns)
conv = [("posix", '<a href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/%s.html">%%s</a>', "[%s]"),
("lsb", '<a href="http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/%s.html">%%s</a>', '<%s>'),
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='<strike>%s</strike>' % 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("</p></blockquote>\n")
+outfile=open("www/status.gen", "w")
+outfile.write("<h1>Status of toybox %s</h1>\n" % version[0]);
+outfile.write("<h3>Legend: [posix] <lsb> (development) {android}\n")
+outfile.write("=klibc= #sash# @sbase@ *beastiebox* $tizen$ +request+ other\n")
+outfile.write("<strike>pending</strike></h3>\n");
+
+outfile.write("<a name=done><h2><a href=#done>Completed</a></h2><blockquote><p>%s</p></blockquote>\n" % "\n".join(done))
+outfile.write("<a name=part><h2><a href=#part>Partially implemented</a></h2><blockquote><p>%s</p></blockquote>\n" % "\n".join(pend))
+outfile.write("<a name=todo><h2><a href=#todo>Not started yet</a></h2><blockquote><p>%s</p></blockquote>\n" % "\n".join(todo))
-outfile.write("<a name=todo><h2><a href=#todo>TODO</a></h2><blockquote><p>%s</p></blockquote>\n" % "\n".join(pending))
-outfile.write("<a name=done><h2><a href=#done>Done</a></h2><blockquote><p>%s</p></blockquote>\n" % "\n".join(done))
+# Output unfinished commands by category
outfile.write("<hr><h2>Categories of remaining todo items</h2>")
todo = []
for j in stuff[i]:
- if "ready" in reverse[j]: continue
- elif "pending" in reverse[j]: todo.append('<strike>%s</strike>' % j)
+ if j in toystuff: continue
+ if j in pending: todo.append('<strike>%s</strike>' % j)
else: todo.append(categorize(reverse,j,i))
if todo:
outfile.write("<a name=%s><h2><a href=#%s>%s<a></h2><blockquote><p>" % (i,i,k))
outfile.write(" ".join(todo))
outfile.write("</p></blockquote>\n")
+
+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))
<!--#include file="header.html" -->
<title>Toybox Status</title>
-<h1>How are we doing on implementing stuff so far?</h1>
-
-<p>Legend: [posix] <lsb> (development) {android} =klibc= #sash# @sbase@
-*beastiebox* $tizen$ +request+ other <strike>implemented</strike></p>
-
<!--#include file="status.gen" -->
-<h1>The current status of toybox (as of 0.5.2 release):</h1>
-
-<h3><u>These commands are reasonably finished (in defconfig)</u>:</h3>
-<blockquote><b>
-<span id=ready>
-acpi basename blkid blockdev bzcat cal cat catv chattr chgrp chmod
-chown chvt cksum clear cmp comm count cp cpio date df dirname
-dmesg dos2unix echo egrep eject env factor fallocate false
-fgrep find free freeramdisk fsfreeze fstype grep groups halt head
-help hostname id ifconfig inotifyd insmod install kill killall killall5
-link ln logname losetup ls lsattr lsmod lspci lsusb makedevs
-md5sum mkdir mkfifo mknod mkpasswd mkswap mktemp mount
-mv nbd-client nc netcat nice nl nohup od oneit partprobe passwd paste
-patch pidof pivot_root pmap poweroff printenv pwd pwdx readahead readlink
-realpath reboot renice rev rfkill rm rmdir rmmod seq setsid sha1sum
-sleep sort split stat strings su swapoff swapon switch_root sync sysctl
-tac tail taskset tee time timeout true truncate tty umount uname
-uniq unix2dos unlink unshare uptime usleep uudecode uuencode
-w wc which who whoami yes sed mix base64
-</span>
-</b></blockquote>
-
-<h3><u>These commands are at least partially implemented (in toys/pending)
-but have todo items remaining:</u></h3>
-<blockquote><b>
-<span id=pending>
-ar arp arping bc bootchartd brctl compress crond dhcp dhcpd diff dumpleases
-expr fdisk fold fsck ftpget getty groupadd groupdel host iconv init ip ipcs
-kexec klogd last logger mdev mix mke2fs modprobe more netstat openvt p9d pgrep
-ping printf ps reset route sh sulogin syslogd tar tcpsvd telnet telnetd test
-tftpd top traceroute tr useradd userdel watch xzcat
-</span>
-</b></blockquote>
-
-<h3><u>These commands predate the pending directory but also have unfinished
-todo items:</u></h3>
-
-<blockquote><b>
-<span id=pending>
-vmstat login du vconfig mountpoint chroot cut touch modinfo expand xargs
-</span>
-</b></blockquote>
-
<p>There is also <a href="todo.txt">a todo list</a>, but development's moved
on a bit since it was written.</p>