[cig-commits] r7548 - in cs/buildbot/trunk: bin buildbot/scripts

leif at geodynamics.org leif at geodynamics.org
Thu Jun 28 11:58:45 PDT 2007


Author: leif
Date: 2007-06-28 11:58:45 -0700 (Thu, 28 Jun 2007)
New Revision: 7548

Added:
   cs/buildbot/trunk/bin/rotate-shipping
   cs/buildbot/trunk/buildbot/scripts/rotation.py
Log:
Wrote a script to rotate the packages in the shipping area.


Added: cs/buildbot/trunk/bin/rotate-shipping
===================================================================
--- cs/buildbot/trunk/bin/rotate-shipping	2007-06-28 18:21:32 UTC (rev 7547)
+++ cs/buildbot/trunk/bin/rotate-shipping	2007-06-28 18:58:45 UTC (rev 7548)
@@ -0,0 +1,4 @@
+#!/usr/bin/python
+
+from buildbot.scripts.rotation import rotateShipping
+rotateShipping()


Property changes on: cs/buildbot/trunk/bin/rotate-shipping
___________________________________________________________________
Name: svn:executable
   + *

Added: cs/buildbot/trunk/buildbot/scripts/rotation.py
===================================================================
--- cs/buildbot/trunk/buildbot/scripts/rotation.py	2007-06-28 18:21:32 UTC (rev 7547)
+++ cs/buildbot/trunk/buildbot/scripts/rotation.py	2007-06-28 18:58:45 UTC (rev 7548)
@@ -0,0 +1,39 @@
+
+
+import os, sys
+from glob import glob
+
+
+def rotatePackages(packageSet, count):
+    if len(packageSet) <= count:
+        return
+    # sort by revision
+    packageSet.sort(key = lambda p: p[0])
+    old = packageSet[:-count]
+    for s in old:
+        for package in s[1]:
+            os.system("rm " + package)
+    return
+
+
+def rotateShipping():
+    
+    directory = sys.argv[1]
+    count = int(sys.argv[2])
+    
+    os.chdir(directory)
+    files = glob("r*-b*-*")
+
+    partition = {}
+    for f in files:
+        revision, build, code, rest = f.split('-', 3)
+        revision = int(revision[1:])
+        packageSet = partition.setdefault(code, {})
+        packages = packageSet.setdefault(revision, [])
+        packages.append(f)
+
+    for code, packageSet in partition.iteritems():
+        packageSet = packageSet.items()
+        rotatePackages(packageSet, count)
+
+    return



More information about the cig-commits mailing list