lol

go_1_11: init at 1.11

+294
+194
pkgs/development/compilers/go/1.11.nix
··· 1 + { stdenv, fetchFromGitHub, tzdata, iana-etc, go_bootstrap, runCommand, writeScriptBin 2 + , perl, which, pkgconfig, patch, procps 3 + , pcre, cacert, llvm 4 + , Security, Foundation 5 + , makeWrapper, git, subversion, mercurial, bazaar }: 6 + 7 + let 8 + 9 + inherit (stdenv.lib) optionals optionalString; 10 + 11 + clangHack = writeScriptBin "clang" '' 12 + #!${stdenv.shell} 13 + exec ${stdenv.cc}/bin/clang "$@" 2> >(sed '/ld: warning:.*ignoring unexpected dylib file/ d' 1>&2) 14 + ''; 15 + 16 + goBootstrap = runCommand "go-bootstrap" {} '' 17 + mkdir $out 18 + cp -rf ${go_bootstrap}/* $out/ 19 + chmod -R u+w $out 20 + find $out -name "*.c" -delete 21 + cp -rf $out/bin/* $out/share/go/bin/ 22 + ''; 23 + 24 + in 25 + 26 + stdenv.mkDerivation rec { 27 + name = "go-${version}"; 28 + version = "1.11"; 29 + 30 + src = fetchFromGitHub { 31 + owner = "golang"; 32 + repo = "go"; 33 + rev = "go${version}"; 34 + sha256 = "1k18d6rkijlgzn1zw4wphzcv6a6w9hb1msgrsh1102jb18644f2q"; 35 + }; 36 + 37 + GOCACHE = "off"; 38 + 39 + # perl is used for testing go vet 40 + nativeBuildInputs = [ perl which pkgconfig patch makeWrapper procps ]; 41 + buildInputs = [ cacert pcre ] 42 + ++ optionals stdenv.isLinux [ stdenv.cc.libc.out ] 43 + ++ optionals (stdenv.hostPlatform.libc == "glibc") [ stdenv.cc.libc.static ]; 44 + propagatedBuildInputs = optionals stdenv.isDarwin [ Security Foundation ]; 45 + 46 + hardeningDisable = [ "all" ]; 47 + 48 + prePatch = '' 49 + patchShebangs ./ # replace /bin/bash 50 + 51 + # This source produces shell script at run time, 52 + # and thus it is not corrected by patchShebangs. 53 + substituteInPlace misc/cgo/testcarchive/carchive_test.go \ 54 + --replace '#!/usr/bin/env bash' '#!${stdenv.shell}' 55 + 56 + # Disabling the 'os/http/net' tests (they want files not available in 57 + # chroot builds) 58 + rm src/net/{listen,parse}_test.go 59 + rm src/syscall/exec_linux_test.go 60 + 61 + # !!! substituteInPlace does not seems to be effective. 62 + # The os test wants to read files in an existing path. Just don't let it be /usr/bin. 63 + sed -i 's,/usr/bin,'"`pwd`", src/os/os_test.go 64 + sed -i 's,/bin/pwd,'"`type -P pwd`", src/os/os_test.go 65 + # Disable the unix socket test 66 + sed -i '/TestShutdownUnix/areturn' src/net/net_test.go 67 + # Disable the hostname test 68 + sed -i '/TestHostname/areturn' src/os/os_test.go 69 + # ParseInLocation fails the test 70 + sed -i '/TestParseInSydney/areturn' src/time/format_test.go 71 + # Remove the api check as it never worked 72 + sed -i '/src\/cmd\/api\/run.go/ireturn nil' src/cmd/dist/test.go 73 + # Remove the coverage test as we have removed this utility 74 + sed -i '/TestCoverageWithCgo/areturn' src/cmd/go/go_test.go 75 + # Remove the timezone naming test 76 + sed -i '/TestLoadFixed/areturn' src/time/time_test.go 77 + # Remove disable setgid test 78 + sed -i '/TestRespectSetgidDir/areturn' src/cmd/go/internal/work/build_test.go 79 + # Remove cert tests that conflict with NixOS's cert resolution 80 + sed -i '/TestEnvVars/areturn' src/crypto/x509/root_unix_test.go 81 + # TestWritevError hangs sometimes 82 + sed -i '/TestWritevError/areturn' src/net/writev_test.go 83 + # TestVariousDeadlines fails sometimes 84 + sed -i '/TestVariousDeadlines/areturn' src/net/timeout_test.go 85 + 86 + sed -i 's,/etc/protocols,${iana-etc}/etc/protocols,' src/net/lookup_unix.go 87 + sed -i 's,/etc/services,${iana-etc}/etc/services,' src/net/port_unix.go 88 + 89 + # Disable cgo lookup tests not works, they depend on resolver 90 + rm src/net/cgo_unix_test.go 91 + 92 + '' + optionalString stdenv.isLinux '' 93 + sed -i 's,/usr/share/zoneinfo/,${tzdata}/share/zoneinfo/,' src/time/zoneinfo_unix.go 94 + '' + optionalString stdenv.isAarch32 '' 95 + echo '#!${stdenv.shell}' > misc/cgo/testplugin/test.bash 96 + '' + optionalString stdenv.isDarwin '' 97 + substituteInPlace src/race.bash --replace \ 98 + "sysctl machdep.cpu.extfeatures | grep -qv EM64T" true 99 + sed -i 's,strings.Contains(.*sysctl.*,true {,' src/cmd/dist/util.go 100 + sed -i 's,"/etc","'"$TMPDIR"'",' src/os/os_test.go 101 + sed -i 's,/_go_os_test,'"$TMPDIR"'/_go_os_test,' src/os/path_test.go 102 + 103 + sed -i '/TestChdirAndGetwd/areturn' src/os/os_test.go 104 + sed -i '/TestCredentialNoSetGroups/areturn' src/os/exec/exec_posix_test.go 105 + sed -i '/TestRead0/areturn' src/os/os_test.go 106 + sed -i '/TestSystemRoots/areturn' src/crypto/x509/root_darwin_test.go 107 + 108 + sed -i '/TestGoInstallRebuildsStalePackagesInOtherGOPATH/areturn' src/cmd/go/go_test.go 109 + sed -i '/TestBuildDashIInstallsDependencies/areturn' src/cmd/go/go_test.go 110 + 111 + sed -i '/TestDisasmExtld/areturn' src/cmd/objdump/objdump_test.go 112 + 113 + sed -i 's/unrecognized/unknown/' src/cmd/link/internal/ld/lib.go 114 + 115 + touch $TMPDIR/group $TMPDIR/hosts $TMPDIR/passwd 116 + ''; 117 + 118 + patches = [ 119 + ./remove-tools-1.11.patch 120 + ./ssl-cert-file-1.9.patch 121 + ./remove-test-pie.patch 122 + ./creds-test.patch 123 + ./go-1.9-skip-flaky-19608.patch 124 + ./go-1.9-skip-flaky-20072.patch 125 + ./remove-fhs-test-references.patch 126 + ./skip-external-network-tests.patch 127 + ./skip-nohup-tests.patch 128 + ]; 129 + 130 + postPatch = optionalString stdenv.isDarwin '' 131 + echo "substitute hardcoded dsymutil with ${llvm}/bin/llvm-dsymutil" 132 + substituteInPlace "src/cmd/link/internal/ld/lib.go" --replace dsymutil ${llvm}/bin/llvm-dsymutil 133 + ''; 134 + 135 + GOOS = if stdenv.isDarwin then "darwin" else "linux"; 136 + GOARCH = if stdenv.isDarwin then "amd64" 137 + else if stdenv.system == "i686-linux" then "386" 138 + else if stdenv.system == "x86_64-linux" then "amd64" 139 + else if stdenv.isAarch32 then "arm" 140 + else if stdenv.isAarch64 then "arm64" 141 + else throw "Unsupported system"; 142 + GOARM = optionalString (stdenv.system == "armv5tel-linux") "5"; 143 + GO386 = 387; # from Arch: don't assume sse2 on i686 144 + CGO_ENABLED = 1; 145 + GOROOT_BOOTSTRAP = "${goBootstrap}/share/go"; 146 + # Hopefully avoids test timeouts on Hydra 147 + GO_TEST_TIMEOUT_SCALE = 3; 148 + 149 + # The go build actually checks for CC=*/clang and does something different, so we don't 150 + # just want the generic `cc` here. 151 + CC = if stdenv.isDarwin then "clang" else "cc"; 152 + 153 + configurePhase = '' 154 + # Indicate that we are running on build infrastructure 155 + # Some tests assume things like home directories and users exists 156 + export GO_BUILDER_NAME=nix 157 + 158 + mkdir -p $out/share/go/bin 159 + export GOROOT=$out/share/go 160 + export GOBIN=$GOROOT/bin 161 + export PATH=$GOBIN:$PATH 162 + ulimit -a 163 + ''; 164 + 165 + postConfigure = optionalString stdenv.isDarwin '' 166 + export PATH=${clangHack}/bin:$PATH 167 + ''; 168 + 169 + installPhase = '' 170 + cp -r . $GOROOT 171 + ( cd $GOROOT/src && ./all.bash ) 172 + 173 + # (https://github.com/golang/go/wiki/GoGetTools) 174 + wrapProgram $out/share/go/bin/go --prefix PATH ":" "${stdenv.lib.makeBinPath [ git subversion mercurial bazaar ]}" 175 + ''; 176 + 177 + preFixup = '' 178 + rm -r $out/share/go/pkg/bootstrap 179 + ln -s $out/share/go/bin $out/bin 180 + ''; 181 + 182 + setupHook = ./setup-hook.sh; 183 + 184 + disallowedReferences = [ go_bootstrap ]; 185 + 186 + meta = with stdenv.lib; { 187 + branch = "1.9"; 188 + homepage = http://golang.org/; 189 + description = "The Go Programming language"; 190 + license = licenses.bsd3; 191 + maintainers = with maintainers; [ cstrahan orivej velovix mic92 ]; 192 + platforms = platforms.linux ++ platforms.darwin; 193 + }; 194 + }
+13
pkgs/development/compilers/go/remove-fhs-test-references.patch
··· 1 + diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_unix_test.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_unix_test.go 2 + index d694990..87fa259 100644 3 + --- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_unix_test.go 4 + +++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_unix_test.go 5 + @@ -452,7 +452,7 @@ func TestGetwd(t *testing.T) { 6 + defer fd.Close() 7 + // These are chosen carefully not to be symlinks on a Mac 8 + // (unlike, say, /var, /etc) 9 + - dirs := []string{"/", "/usr/bin"} 10 + + dirs := []string{"/"} 11 + switch runtime.GOOS { 12 + case "android": 13 + dirs = []string{"/", "/system/bin"}
+35
pkgs/development/compilers/go/remove-tools-1.11.patch
··· 1 + diff --git a/src/go/build/build.go b/src/go/build/build.go 2 + index b68a712..b60bf19 100644 3 + --- a/src/go/build/build.go 4 + +++ b/src/go/build/build.go 5 + @@ -1708,7 +1708,7 @@ func init() { 6 + } 7 + 8 + // ToolDir is the directory containing build tools. 9 + -var ToolDir = getToolDir() 10 + +var ToolDir = runtime.GOTOOLDIR() 11 + 12 + // IsLocalImport reports whether the import path is 13 + // a local import path, like ".", "..", "./foo", or "../foo". 14 + diff --git a/src/runtime/extern.go b/src/runtime/extern.go 15 + index 7171b13..18a942c 100644 16 + --- a/src/runtime/extern.go 17 + +++ b/src/runtime/extern.go 18 + @@ -229,6 +229,17 @@ func GOROOT() string { 19 + return sys.DefaultGoroot 20 + } 21 + 22 + +// GOTOOLDIR returns the root of the Go tree. 23 + +// It uses the GOTOOLDIR environment variable, if set, 24 + +// or else the root used during the Go build. 25 + +func GOTOOLDIR() string { 26 + + s := gogetenv("GOTOOLDIR") 27 + + if s != "" { 28 + + return s 29 + + } 30 + + return GOROOT() + "/pkg/tool/" + GOOS + "_" + GOARCH 31 + +} 32 + + 33 + // Version returns the Go tree's version string. 34 + // It is either the commit hash and date at the time of the build or, 35 + // when possible, a release tag like "go1.3".
+26
pkgs/development/compilers/go/skip-external-network-tests.patch
··· 1 + diff --git a/src/cmd/go/go_test.go b/src/cmd/go/go_test.go 2 + index 85cae90..94b4edd 100644 3 + --- a/src/cmd/go/go_test.go 4 + +++ b/src/cmd/go/go_test.go 5 + @@ -4946,6 +4946,8 @@ func TestBuildmodePIE(t *testing.T) { 6 + } 7 + 8 + func TestExecBuildX(t *testing.T) { 9 + + t.Skipf("skipping, test requires networking") 10 + + 11 + tooSlow(t) 12 + if !canCgo { 13 + t.Skip("skipping because cgo not enabled") 14 + diff --git a/src/net/dial_test.go b/src/net/dial_test.go 15 + index 00a84d1..27f9ec9 100644 16 + --- a/src/net/dial_test.go 17 + +++ b/src/net/dial_test.go 18 + @@ -968,6 +968,8 @@ func TestDialerControl(t *testing.T) { 19 + // mustHaveExternalNetwork is like testenv.MustHaveExternalNetwork 20 + // except that it won't skip testing on non-iOS builders. 21 + func mustHaveExternalNetwork(t *testing.T) { 22 + + t.Skipf("Nix sandbox does not have networking") 23 + + 24 + t.Helper() 25 + ios := runtime.GOOS == "darwin" && (runtime.GOARCH == "arm" || runtime.GOARCH == "arm64") 26 + if testenv.Builder() == "" || ios {
+22
pkgs/development/compilers/go/skip-nohup-tests.patch
··· 1 + diff --git a/src/os/signal/signal_test.go b/src/os/signal/signal_test.go 2 + index 3d79c7a..6e0f7b4 100644 3 + --- a/src/os/signal/signal_test.go 4 + +++ b/src/os/signal/signal_test.go 5 + @@ -217,6 +217,8 @@ var checkSighupIgnored = flag.Bool("check_sighup_ignored", false, "if true, Test 6 + 7 + // Test that Ignored(SIGHUP) correctly detects whether it is being run under nohup. 8 + func TestDetectNohup(t *testing.T) { 9 + + t.Skip("Fails in nix build environment") 10 + + 11 + if *checkSighupIgnored { 12 + if !Ignored(syscall.SIGHUP) { 13 + t.Fatal("SIGHUP is not ignored.") 14 + @@ -306,6 +308,8 @@ func TestStop(t *testing.T) { 15 + // Test that when run under nohup, an uncaught SIGHUP does not kill the program, 16 + // but a 17 + func TestNohup(t *testing.T) { 18 + + t.Skip("Fails in nix build environment") 19 + + 20 + // Ugly: ask for SIGHUP so that child will not have no-hup set 21 + // even if test is running under nohup environment. 22 + // We have no intention of reading from c.
+4
pkgs/top-level/all-packages.nix
··· 6748 6748 inherit (darwin.apple_sdk.frameworks) Security Foundation; 6749 6749 }; 6750 6750 6751 + go_1_11 = callPackage ../development/compilers/go/1.11.nix { 6752 + inherit (darwin.apple_sdk.frameworks) Security Foundation; 6753 + }; 6754 + 6751 6755 go = go_1_10; 6752 6756 6753 6757 go-repo-root = callPackage ../development/tools/go-repo-root { };