Commit 27cf6fc8 authored by Georg Koppen's avatar Georg Koppen
Browse files

Bug 20758: Make the gb build directory deterministic

The build directory `gb` uses is created with `ioutil.TempDir()` which
results in a different one for every started build with high
probability. We make it deterministic with this commit.
parent 522cee6c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ files:
- "go-linux32-utils.zip"
- "go-linux64-utils.zip"
- "dzip.sh"
- "gb-build-dir.patch"
script: |
  INSTDIR="$HOME/install"
  mkdir $INSTDIR/sandbox
@@ -59,6 +60,7 @@ script: |

  # Building gb
  cd gb
  patch -p1 < ../gb-build-dir.patch
  find -type f -print0 | xargs -0 touch --date="$REFERENCE_DATETIME"
  mkdir -p "$GOPATH/src/github.com/constabulary/"
  ln -sf "$PWD" "$GOPATH/src/github.com/constabulary/gb"
+31 −0
Original line number Diff line number Diff line
From a7b198e3a32509197150d7c2767262a7319ff339 Mon Sep 17 00:00:00 2001
From: Georg Koppen <gk@torproject.org>
Date: Tue, 6 Dec 2016 21:34:16 +0000
Subject: [PATCH] Make the gb build directory deterministic


diff --git a/context.go b/context.go
index 53c00da..d040082 100644
--- a/context.go
+++ b/context.go
@@ -3,7 +3,6 @@ package gb
 import (
 	"fmt"
 	"io"
-	"io/ioutil"
 	"os"
 	"os/exec"
 	"path/filepath"
@@ -136,7 +135,8 @@ func NewContext(p Project, opts ...func(*Context) error) (*Context, error) {
 		},
 		GcToolchain(),
 	}
-	workdir, err := ioutil.TempDir("", "gb")
+	workdir := filepath.Join(os.TempDir(), "gb")
+	err := os.Mkdir(workdir, 0777)
 	if err != nil {
 		return nil, err
 	}
-- 
2.10.2
+2 −2
Original line number Diff line number Diff line
@@ -48,8 +48,8 @@ GO_X_CRYPTO_TAG=master
GO_X_NET_TAG=master
OBFS4_TAG=master
NOTOFONTS_TAG=720e34851382ee3c1ef024d8dffb68ffbfb234c2
ERRORS_TAG=master
GB_TAG=master
ERRORS_TAG=248dadf4e9068a0b3e79f02ed0a610d935de5302
GB_TAG=06cc925cce6592e922dcc4839a8b44feb384e71e
SANDBOX_TAG=master

GITIAN_TAG=tor-browser-builder-4