[commit: ghc] wip/jenkins: Fix test (10d08f0)

git at git.haskell.org git at git.haskell.org
Sun Jun 4 05:08:58 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/jenkins
Link       : http://ghc.haskell.org/trac/ghc/changeset/10d08f0e8b256b3d7d40a55d9c47019ca4780502/ghc

>---------------------------------------------------------------

commit 10d08f0e8b256b3d7d40a55d9c47019ca4780502
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Tue May 30 13:57:23 2017 -0400

    Fix test


>---------------------------------------------------------------

10d08f0e8b256b3d7d40a55d9c47019ca4780502
 Jenkinsfile | 39 ++++++++++++++++++++++++++++-----------
 1 file changed, 28 insertions(+), 11 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 2e18d93..45aae0c 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -146,22 +146,35 @@ def buildGhc(params) {
 
   stage('Prepare binary distribution') {
     sh "${makeCmd} binary-dist"
-    def tarName = sh(script: "${makeCmd} -s echo VALUE=BIN_DIST_PREP_TAR_COMP",
-                     returnStdout: true)
-    def ghcVersion = sh(script: "${makeCmd} -s echo VALUE=ProjectVersion",
-                        returnStdout: true)
-    writeFile(file: "ghc-version", text: ghcVersion)
-    archiveArtifacts "../${tarName}"
+    writeJSON(file: 'bindist.json', json: {
+                commit: resolveCommitSha('HEAD')
+                tarName: getMakeValue(makeCmd, 'BIN_DIST_PREP_TAR_COMP')
+                dirName: getMakeValue(makeCmd, 'BIN_DIST_NAME')
+                ghcVersion: getMakeValue(makeCmd, 'ProjectVersion')
+                targetPlatform: getMakeValue(makeCmd, 'TARGETPLATFORM')
+              })
+    sh 'pwd; ls'
     // Write a file so we can easily file the tarball and bindist directory later
-    stash(name: "bindist-${targetTriple}", includes: "ghc-version,../${tarName}")
+    stash(name: "bindist-${targetTriple}", includes: "bindist.json,${tarName}")
+    archiveArtifacts "${tarName}"
   }
 }
 
+def getMakeValue(String makeCmd, String value) {
+  return sh(script: "${makeCmd} -s echo VALUE=${value}", returnStdout: true)
+}
+
 def withGhcBinDist(String targetTriple, Closure f) {
   unstash "bindist-${targetTriple}"
-  def ghcVersion = readFile "ghc-version"
-  sh "tar -xf ${ghcVersion}-${targetTriple}.tar.xz"
-  dir("ghc-${ghcVersion}") { f }
+  def metadata = readJSON "bindist.json"
+  sh "tar -xf ${metadata.tarName}"
+  dir("${metadata.bindistName}") {
+    try {
+      f
+    } finally {
+      deleteDir()
+    }
+  }
 }
 
 def testGhc(params) {
@@ -202,11 +215,15 @@ def testGhc(params) {
   }
 }
 
+def resolveCommitSha(String ref) {
+  return sh(script: "git rev-parse ${ref}", returnStdout: true)
+}
+
 // Push update to ghc.readthedocs.org.
 // Expects to be sitting in a build source tree.
 def updateReadTheDocs() {
   git clone 'git at github.com:bgamari/ghc-users-guide'
-  def commit = sh(script: "git rev-parse HEAD", returnStdout: true)
+  def commit = resolveCommitSha('HEAD')
   sh """
      export GHC_TREE=\$(pwd)
      cd ghc-users-guide



More information about the ghc-commits mailing list