summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Graaff <hans@degraaff.org>2013-10-15 17:56:37 +0200
committerHans de Graaff <hans@degraaff.org>2013-10-15 17:56:37 +0200
commitb4d42468637cc48a7bd0c3026e2f75f9dd77ae71 (patch)
treeebae17529fd2497da2b479abca0f8566a750e11a
parentUpdate supported versions: add 4.0, remove 2.2. (diff)
downloadruby-scripts-b4d42468637cc48a7bd0c3026e2f75f9dd77ae71.tar.gz
ruby-scripts-b4d42468637cc48a7bd0c3026e2f75f9dd77ae71.tar.bz2
ruby-scripts-b4d42468637cc48a7bd0c3026e2f75f9dd77ae71.zip
Add ruby-stats script.
Originally written by flameeyes. I've added new ruby targets.
-rwxr-xr-xruby-stats/ruby_stats.py54
1 files changed, 54 insertions, 0 deletions
diff --git a/ruby-stats/ruby_stats.py b/ruby-stats/ruby_stats.py
new file mode 100755
index 0000000..23176bd
--- /dev/null
+++ b/ruby-stats/ruby_stats.py
@@ -0,0 +1,54 @@
+#!/usr/bin/python
+# date ruby.eclass ruby-ng.eclass ruby18 ruby19 jruby
+# 2010-01-20 181 143 141 68 51
+# 2010-01-21 180 144 142 68 52
+
+date_fmt = "%Y-%m-%d"
+bins = ('ruby', 'ruby-ng', 'ruby_targets_ruby18', 'ruby_targets_ruby19', 'ruby_targets_ruby20', 'ruby_targets_jruby', 'ruby_targets_ree18', 'ruby_targets_rbx')
+
+import sys
+import time
+import os
+import portage
+
+def main():
+ stats = {}
+ for k in bins:
+ stats[k] = set()
+
+ portdb = portage.portdb
+ portdb.porttrees = [portdb.porttree_root] # exclude overlays
+ for cp in portdb.cp_all():
+ slot_dict = {}
+ for cpv in portdb.cp_list(cp):
+ slot, iuse, inherited = portdb.aux_get(cpv, ['SLOT', 'IUSE', 'INHERITED'])
+ slot_dict.setdefault(slot, {})[cpv] = (iuse, inherited)
+ for slot, cpv_dict in slot_dict.items():
+ cpv = portage.best(list(cpv_dict))
+ if cpv:
+ iuse, inherited = cpv_dict[cpv]
+ iuse = set(iuse.split())
+ inherited = set(inherited.split())
+ if 'ruby' in inherited:
+ stats['ruby'].add(cpv)
+ if 'ruby-ng' in inherited:
+ stats['ruby-ng'].add(cpv)
+ if 'ruby_targets_ruby18' in iuse:
+ stats['ruby_targets_ruby18'].add(cpv)
+ if 'ruby_targets_ruby19' in iuse:
+ stats['ruby_targets_ruby19'].add(cpv)
+ if 'ruby_targets_ruby20' in iuse:
+ stats['ruby_targets_ruby20'].add(cpv)
+ if 'ruby_targets_jruby' in iuse:
+ stats['ruby_targets_jruby'].add(cpv)
+ if 'ruby_targets_ree18' in iuse:
+ stats['ruby_targets_ree18'].add(cpv)
+ if 'ruby_targets_rbx' in iuse:
+ stats['ruby_targets_rbx'].add(cpv)
+
+ date_stamp = time.strftime(date_fmt, time.gmtime())
+ counts = [str(len(stats[x])) for x in bins]
+ sys.stdout.write("%s\t%s\n" % (date_stamp, "\t".join(counts)))
+
+if __name__ == '__main__':
+ main()