[zorg] r188634 - [llvmlab] Change PublishGoodBuild() to use artifacts_path from the config file instead of ~/artifacts.

Michael Gottesman mgottesman at apple.com
Sun Aug 18 02:14:15 PDT 2013


Author: mgottesman
Date: Sun Aug 18 04:14:15 2013
New Revision: 188634

URL: http://llvm.org/viewvc/llvm-project?rev=188634&view=rev
Log:
[llvmlab] Change PublishGoodBuild() to use artifacts_path from the config file instead of ~/artifacts.

By default the value of artifacts_path is ~/artifacts.

I also performed some minor refactorings.

Modified:
    zorg/trunk/zorg/buildbot/PhasedBuilderUtils.py

Modified: zorg/trunk/zorg/buildbot/PhasedBuilderUtils.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/PhasedBuilderUtils.py?rev=188634&r1=188633&r2=188634&view=diff
==============================================================================
--- zorg/trunk/zorg/buildbot/PhasedBuilderUtils.py (original)
+++ zorg/trunk/zorg/buildbot/PhasedBuilderUtils.py Sun Aug 18 04:14:15 2013
@@ -12,7 +12,9 @@ from datetime import datetime, date, tim
 import zorg
 
 import config
+import config.phase_config
 reload(config)
+reload(config.phase_config)
 
 class NamedTrigger(Trigger):
     """Trigger subclass which allows overriding the trigger name, and also
@@ -246,23 +248,33 @@ def getPhaseBuilderFactory(config, phase
         descriptionDone = ['Clear changelist']))
     return f
 
+def set_config_option(section, option, default=False):
+    import warnings
+    if config.options.has_option(section, option):
+        return config.options.get(section, option)
+    else:
+        warn_str = 'Please add the "%s" option to the ' % option
+        warn_str += '"%s" section of your local.cfg file' % section
+        warnings.warn(warn_str) 
+        return default
+
 def PublishGoodBuild():
-    artifacts_dir = os.path.expanduser('~/artifacts/')
+    artifacts_dir = set_config_option('Master Options', 'artifacts_path',
+                                      os.path.expanduser('~/artifacts/'))
     f = buildbot.process.factory.BuildFactory()
     # TODO: Add steps to prepare a release and announce a good build.
-    from config.phase_config import phases
     # Buildbot uses got_revision instead of revision to identify builds.
     # We set it below so that the revision shows up in the html status pages.
     setProperty(f, 'got_revision', WithProperties('%(revision)s'))
-    for phase in phases:
+    for phase in config.phase_config.phases:
         for build in phase['builders']:
             buildname = build['name']
             project = _project_from_name(buildname)
             if project in ('clang', 'llvm-gcc', 'apple-clang'):
-                link_str = artifacts_dir + buildname + '/' + project
-                link_str += '-%(get_phase_id)s' + '.tar.gz'
-                artifacts_str = artifacts_dir + 'latest_validated/' + buildname 
-                artifacts_str += '.tar.gz'
+                link_str = os.path.join(artifacts_dir, buildname,
+                                        project + '-%(get_phase_id)s.tar.gz')
+                artifacts_str = os.path.join(artifacts_dir, 'latest_validated',
+                                             buildname + '.tar.gz')
                 f.addStep(MasterShellCommand(
                     name='Publish.'+ buildname, haltOnFailure = True,
                     command = ['ln', '-sfv',
@@ -272,16 +284,6 @@ def PublishGoodBuild():
                     description = ['publish', buildname]))
     return f
 
-def set_config_option(section, option, default=False):
-    import warnings
-    if config.options.has_option(section, option):
-        return config.options.get(section, option)
-    else:
-        warn_str = 'Please add the "%s" option to the ' % option
-        warn_str += '"%s" section of your local.cfg file' % section
-        warnings.warn(warn_str) 
-        return default
-
 
 def SVNCleanupStep(f, name):
   f.addStep(buildbot.steps.shell.ShellCommand(





More information about the llvm-commits mailing list