Bug 522525: update the build script that cleans up old builds to produce a warning if it fails, do not delete buildsdir for FRR builder (p=jsudduth,r=brbaker+)
authorBrent Baker <brbaker@adobe.com>
Wed, 05 May 2010 06:14:29 -0400
changeset 4610 60796e1b0ca1a647c9375a77586a2ae303c29a80
parent 4609 e2c36618c62c61f7302d2b2fb03d246111ff22a1
child 4611 f31e5392fa03b8e0e75bb8da524f637fc1ac315b
push id2414
push userbrbaker@adobe.com
push dateWed, 05 May 2010 10:17:23 +0000
reviewersbrbaker
bugs522525
Bug 522525: update the build script that cleans up old builds to produce a warning if it fails, do not delete buildsdir for FRR builder (p=jsudduth,r=brbaker+)
build/buildbot/master/argo.py
build/buildbot/master/commonsteps.py
build/buildbot/master/tamarinredux.py
build/buildbot/slaves/all/util-clean-buildsdir.py
--- a/build/buildbot/master/argo.py
+++ b/build/buildbot/master/argo.py
@@ -1694,17 +1694,16 @@ class argo:
                 command=['./run-frunit.sh', WithProperties('%s','revision')],
                 env={'branch': WithProperties('%s','branch')},
                 description='running frunit...',
                 descriptionDone='finished running frunit.',
                 name="RunFrunit",
                 workdir="../scripts",
                 timeout=3600)
     )
-    windows_frr_factory.addStep(util_clean_buildsdir)
 
     windows_frr_builder = {
                 'name': "windows-frr-argo",
                 'slavename': "asteamwin12",
                 'factory': windows_frr_factory,
                 'builddir': './argo-windows-frr',
     }
 
--- a/build/buildbot/master/commonsteps.py
+++ b/build/buildbot/master/commonsteps.py
@@ -310,18 +310,18 @@ util_process_clean = BuildShellCommand(
             command=['../all/util-process-clean.sh', WithProperties('%s','revision')],
             env={'branch': WithProperties('%s','branch'), 'silent':WithProperties('%s','silent')},
             description='Zombie hunting...',
             descriptionDone='Zombie hunt completed',
             name='Util_ZombieKiller',
             workdir="../repo/build/buildbot/slaves/scripts",
             alwaysRun="True" )
 
-util_clean_buildsdir = ShellCommand(
-            command=['../all/util-clean-buildsdir.sh'],
+util_clean_buildsdir = BuildShellCommand(
+            command=['../all/util-clean-buildsdir.sh', WithProperties('%s','revision')],
             env={'branch': WithProperties('%s','branch'), 'silent':WithProperties('%s','silent')},
             description='Remove build folders older than one week...',
             descriptionDone='Finished removing build folders',
             name="Clean_Build_Dir",            
             workdir="../repo/build/buildbot/slaves/scripts",
             alwaysRun="True" )
 
 perf_prepare = BuildShellCommand(
--- a/build/buildbot/master/tamarinredux.py
+++ b/build/buildbot/master/tamarinredux.py
@@ -636,17 +636,17 @@ class tamarinredux:
                 'factory': solaris_sparc_compile_factory,
                 'builddir': './solaris-sparc-compile',
     }
 
     ###########################################
     #### builder for android on mac        ####
     ###########################################
 
-    android_compile_factory = factory.BuildFactory();
+    android_compile_factory = factory.BuildFactory()
     android_compile_factory.addStep(sync_clean)
     android_compile_factory.addStep(sync_clone(url=HG_URL))
     android_compile_factory.addStep(sync_update)
     android_compile_factory.addStep(bb_slaveupdate(slave="mac-intel-server"))
     android_compile_factory.addStep(compile_builtin)
     android_compile_factory.addStep(BuildShellCommand(
                 command=['./build-debug-shell-android.sh', WithProperties('%s','revision')],
                 env={'branch': WithProperties('%s','branch')},
@@ -1805,17 +1805,16 @@ class tamarinredux:
                 command=['./run-frunit.sh', WithProperties('%s','revision')],
                 env={'branch': WithProperties('%s','branch')},
                 description='running frunit...',
                 descriptionDone='finished running frunit.',
                 name="RunFrunit",
                 workdir="../scripts",
                 timeout=3600)
     )
-    windows_frr_factory.addStep(util_clean_buildsdir)
 
     windows_frr_builder = {
                 'name': "windows-frr",
                 'slavename': "asteamwin12",
                 'factory': windows_frr_factory,
                 'builddir': './windows-frr',
     }
 
--- a/build/buildbot/slaves/all/util-clean-buildsdir.py
+++ b/build/buildbot/slaves/all/util-clean-buildsdir.py
@@ -37,27 +37,29 @@
 #
 # ***** END LICENSE BLOCK *****
 
 import os
 import sys
 import time
 import shutil
 from optparse import OptionParser
+from datetime import date
 
 @staticmethod
 def _onerror(func, path, exc_info): 
 
      import stat
      if not os.access(path, os.W_OK):
         try:
             os.chmod(path, stat.S_IWUSR)
             func(path)
         except Exception,e:
             print e
+            print "buildbot_status: WARNINGS"
             pass
 
 def main():
     usage = "usage: %prog [options] arg"
     parser = OptionParser(usage)
     parser.add_option("-p", "--path", type="string", dest="directory",
                       help="path to tree to delete")
     parser.add_option("-i", "--interval", type="int", dest="interval",
@@ -71,16 +73,17 @@ def main():
     numdays = options.interval * 86400 # 86400 = number of seconds in a day
     now = time.time()
     
     for r,d,f in os.walk(path):
         for dir in d:
              timestamp = os.path.getmtime(os.path.join(r,dir))
              if now-timestamp > numdays:
                  try:
-                      print "removing ",os.path.join(r,dir)
+                      print "Removing: %s -- Date: %s" % (os.path.join(r,dir), date.fromtimestamp(timestamp))
                       shutil.rmtree(os.path.join(r,dir), onerror=_onerror)  # comment to test
                  except Exception,e:
                       print e
+                      print "buildbot_status: WARNINGS"
                       pass
                       
 if __name__ == "__main__":
     main()