]> git.decadent.org.uk Git - dak.git/blobdiff - dak/graph.py
generate-releases
[dak.git] / dak / graph.py
index 06deaef1d638e5f962b0c6dd20d759cfe1ac6d5a..d6c290e40f0c0fc68ae8f71152a4a8aedd053308 100755 (executable)
@@ -1,7 +1,10 @@
 #!/usr/bin/env python
 
-""" Produces a set of graphs of NEW/BYHAND/DEFERRED"""
-# Copyright 2011 Paul Wise <pabs@debian.org>
+""" Produces a set of graphs of NEW/BYHAND/DEFERRED
+
+@contact: Debian FTPMaster <ftpmaster@debian.org>
+@copyright: 2011 Paul Wise <pabs@debian.org>
+"""
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -32,7 +35,7 @@ default_names = ["byhand", "new", "deferred"]
 ################################################################################
 
 def usage(exit_code=0):
-    print """Usage: dak queue-graph
+    print """Usage: dak graph
 Graphs the number of packages in queue directories (usually new and byhand).
 
   -h, --help                show this help and exit.
@@ -60,40 +63,43 @@ now
 --vertical-label
 packages
 --title
-Package count: %s
+%s package count for the last %s
 --lower-limit
 0
 -E
-""" % title).strip().split("\n")
+""" % (name.upper(), title) ).strip().split("\n")
 
     if year_lines:
         rrd_args += ["--x-grid", "MONTH:1:YEAR:1:YEAR:1:31536000:%Y"]
 
     rrd_args += ("""
 DEF:ds1=%s:ds1:AVERAGE
-LINE2:ds1#D9382B:Total package count:
+LINE2:ds1#D9382B:changes count
 VDEF:lds1=ds1,LAST
 VDEF:minds1=ds1,MINIMUM
 VDEF:maxds1=ds1,MAXIMUM
 VDEF:avgds1=ds1,AVERAGE
-GPRINT:lds1:%%3.0lf
-GPRINT:minds1:\tMin\\: %%3.0lf
-GPRINT:maxds1:\tMax\\: %%3.0lf
-GPRINT:avgds1:\tAvg\\: %%3.0lf\\j
+GPRINT:lds1:cur\\: %%.0lf
+GPRINT:minds1:min\\: %%.0lf
+GPRINT:maxds1:max\\: %%.0lf
+GPRINT:avgds1:avg\\: %%.0lf\\j
 DEF:ds0=%s:ds0:AVERAGE
 VDEF:lds0=ds0,LAST
 VDEF:minds0=ds0,MINIMUM
 VDEF:maxds0=ds0,MAXIMUM
 VDEF:avgds0=ds0,AVERAGE
-LINE2:ds0#3069DA:Package count in %s:
-GPRINT:lds0:%%3.0lf
-GPRINT:minds0:\tMin\\: %%3.0lf
-GPRINT:maxds0:\tMax\\: %%3.0lf
-GPRINT:avgds0:\tAvg\\: %%3.0lf\\j
-""" % (rrd_file, rrd_file, name.upper())).strip().split("\n")
+LINE2:ds0#3069DA:src pkg count
+GPRINT:lds0:cur\\: %%.0lf
+GPRINT:minds0:min\\: %%.0lf
+GPRINT:maxds0:max\\: %%.0lf
+GPRINT:avgds0:avg\\: %%.0lf\\j
+""" % (rrd_file, rrd_file)).strip().split("\n")
 
     rrd_args += extra_args
-    rrdtool.graph(*rrd_args)
+    try:
+        ret = rrdtool.graph(*rrd_args)
+    except rrdtool.error, e:
+        print('warning: graph: rrdtool error, skipping %s-%s.png: %s' % (name, graph, e))
 
 ################################################################################