[zorg] r178441 - [LibCXXBuilder] Added in some more already written machinery to make the LibCXXBuilder find the artifacts it needs.

Michael Gottesman mgottesman at apple.com
Sat Mar 30 19:47:38 PDT 2013


Author: mgottesman
Date: Sat Mar 30 21:47:38 2013
New Revision: 178441

URL: http://llvm.org/viewvc/llvm-project?rev=178441&view=rev
Log:
[LibCXXBuilder] Added in some more already written machinery to make the LibCXXBuilder find the artifacts it needs.

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

Modified: zorg/trunk/zorg/buildbot/Artifacts.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/Artifacts.py?rev=178441&r1=178440&r2=178441&view=diff
==============================================================================
--- zorg/trunk/zorg/buildbot/Artifacts.py (original)
+++ zorg/trunk/zorg/buildbot/Artifacts.py Sat Mar 30 21:47:38 2013
@@ -179,16 +179,55 @@ def determine_url(props):
         curl += props['buildername'] + '.tar.gz'
     return curl
 
+# This method is used in determining the name of a given compiler archive
+def _determine_compiler_kind(props):
+    buildName = props['buildername']
+    kind = buildName
+    subname = buildName
+    if '_' in buildName:
+        kind,subname = buildName.split('_', 1)    
+    if 'clang' in subname:
+      return 'clang'
+    raise ValueError, "unknown compiler"
+
+# compiler_path and archive_name should be completely deterministic. Any 
+# methods acting on an archive should use the following two methods to
+# calculate the path and/or name for an archive
+def _determine_archive_name(props):
+    # phase_id must be set upstream. Usually by a phase builder
+    archive_name = _determine_compiler_kind(props)
+    if props.has_key('phase_id') and props['phase_id']:
+        archive_name += '-' + props['phase_id'] + '.tar.gz'
+    else:
+        raise ValueError, "phase_id doesn't exist"
+    return archive_name
+
+def _determine_compiler_path(props):
+    # We need to segregate compiler builds based on both branch and builder
+    # TODO: better solution when branch is None
+    compiler_path = props['buildername']
+    if props.has_key('default_branch') and props['default_branch']:
+        compiler_path = props['default_branch']
+    elif props.has_key('branch') and props['branch']:
+        compiler_path = props['branch']
+    elif props.has_key('use_builder') and props['use_builder']:
+        compiler_path = props['use_builder']        
+    return compiler_path
+
 def GetCompilerArtifacts(f):
     f.addStep(buildbot.steps.shell.ShellCommand(
             name='rm.host-compiler',
             command=['rm', '-rfv', 'host-compiler', 'host-compiler.tar.gz'],
             haltOnFailure=False, description=['rm', 'host-compiler'],
             workdir=WithProperties('%(builddir)s')))
+    setProperty(f, 'rootURL',
+                WithProperties(base_download_url + '/%(getpath)s/%(getname)s',
+                               getpath=_determine_compiler_path,
+                               getname=_determine_archive_name))    
     f.addStep(buildbot.steps.shell.ShellCommand(
               name='download.artifacts',
               command=['curl', '-svo', 'host-compiler.tar.gz',
-                       WithProperties('%(get_curl)s', get_curl=determine_url)],
+                       WithProperties('%(rootURL)s')],
               haltOnFailure=True, description=['download build artifacts'],
               workdir=WithProperties('%(builddir)s')))
     f.addStep(buildbot.steps.shell.ShellCommand(





More information about the llvm-commits mailing list