def uploadArtifacts(f, rootdir="clang-install"): # phase_id is required to make sure that path to archives are deterministic. setProperty(f, "phase_id", WithProperties("%(get_phase_id)s", get_phase_id=determine_phase_id)) # we always create/name a compiler archive based on the same criteria archive_path = WithProperties("%(builddir)s/%(getname)s", getname=_determine_archive_name) if rootdir.endswith("install"): cit_path = "clang-build/**/bin/c-index-test" copy_command = "cp %s %s/bin/" % (cit_path, rootdir) f.addStep( buildbot.steps.shell.ShellCommand( name="add.cit", haltOnFailure=True, command=["sh", "-c", copy_command], description=["add c-index-test to root"], workdir=WithProperties("%(builddir)s"), ) ) f.addStep( buildbot.steps.shell.ShellCommand( name="tar.and.zip", haltOnFailure=True, command=["tar", "czvf", archive_path, "./"], description=["tar", "&", "zip"], workdir=rootdir, ) ) # Upload the archive. archive_dest = WithProperties(base_rsync_path + "/%(getpath)s/", getpath=_determine_compiler_path) f.addStep( buildbot.steps.shell.ShellCommand( name="upload.artifacts", haltOnFailure=True, command=["rsync", "-pave", "ssh", archive_path, archive_dest], description=["upload build artifacts"], workdir=WithProperties("%(builddir)s"), ) ) # Set the artifact URL in a property for easy access from the build log. download_str = base_download_url + "/%(getpath)s/%(getname)s" artifactsURL = WithProperties(download_str, getpath=_determine_compiler_path, getname=_determine_archive_name) setProperty(f, "artifactsURL", artifactsURL) return f
def GetCompilerRoot(f): # The following steps are used to retrieve a compiler archive # clean out any existing archives 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, ), ) # curl down the archive f.addStep( buildbot.steps.shell.ShellCommand( name="download.artifacts", command=["curl", curl_flags, "host-compiler.tar.gz", WithProperties("%(rootURL)s")], haltOnFailure=True, description=["download build artifacts"], workdir=WithProperties("%(builddir)s"), ) ) # extract the compiler root from the archive f.addStep( buildbot.steps.shell.ShellCommand( name="unzip", command=["tar", "-zxvf", "../host-compiler.tar.gz"], haltOnFailure=True, description=["extract", "host-compiler"], workdir="host-compiler", ) ) return f