1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-26 23:52:33 +00:00

Merge pull request #37882 from jensbin/openshift

openshift: 3.6.0 -> 3.9.0
This commit is contained in:
Matthew Justin Bauer 2018-03-31 19:28:18 -05:00 committed by GitHub
commit 0f4b34caeb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,12 +1,24 @@
{ stdenv, fetchFromGitHub, which, buildGoPackage, utillinux, coreutils }:
{ stdenv, lib, fetchFromGitHub, fetchpatch, removeReferencesTo, which, go_1_9, go-bindata, makeWrapper, rsync
, iptables, coreutils, kerberos, clang
, components ? [
"cmd/oc"
"cmd/openshift"
]
}:
with lib;
let
version = "3.6.0";
version = "3.9.0";
ver = stdenv.lib.elemAt (stdenv.lib.splitString "." version);
versionMajor = ver 0;
versionMinor = ver 1;
versionPatch = ver 2;
in buildGoPackage rec {
gitCommit = "191fece";
# version is in vendor/k8s.io/kubernetes/pkg/version/base.go
k8sversion = "v1.9.1";
k8sgitcommit = "a0ce1bc657";
in stdenv.mkDerivation rec {
name = "openshift-origin-${version}";
inherit version;
@ -14,40 +26,41 @@ in buildGoPackage rec {
owner = "openshift";
repo = "origin";
rev = "v${version}";
sha256 = "08bdqvsjl6c7dmllyz8n4akb7gyn91znvbph5cgmmk1bhskycy1r";
};
sha256 = "06k0zilfyvll7z34yirraslgpwgah9k6y5i6wgi7f00a79k76k78";
};
buildInputs = [ which ];
# go > 1.10
# [FATAL] [14:44:02+0000] Please install Go version go1.9 or use PERMISSIVE_GO=y to bypass this check.
buildInputs = [ removeReferencesTo makeWrapper which go_1_9 rsync go-bindata kerberos clang ];
outputs = [ "out" ];
goPackagePath = null;
patchPhase = ''
patchShebangs ./hack
substituteInPlace pkg/bootstrap/docker/host/host.go \
--replace 'nsenter --mount=/rootfs/proc/1/ns/mnt findmnt' \
'nsenter --mount=/rootfs/proc/1/ns/mnt ${utillinux}/bin/findmnt'
substituteInPlace pkg/bootstrap/docker/host/host.go \
--replace 'nsenter --mount=/rootfs/proc/1/ns/mnt mount' \
'nsenter --mount=/rootfs/proc/1/ns/mnt ${utillinux}/bin/mount'
substituteInPlace pkg/bootstrap/docker/host/host.go \
--replace 'nsenter --mount=/rootfs/proc/1/ns/mnt mkdir' \
'nsenter --mount=/rootfs/proc/1/ns/mnt ${utillinux}/bin/mount'
'';
buildPhase = ''
cd go/src/origin-v${version}-src
# Openshift build require this variables to be set
# unless there is a .git folder which is not the case with fetchFromGitHub
export OS_GIT_VERSION=v${version}
export OS_GIT_MAJOR=${versionMajor}
export OS_GIT_MINOR=${versionMinor}
make build
echo "OS_GIT_VERSION=v${version}" >> os-version-defs
echo "OS_GIT_MAJOR=${versionMajor}" >> os-version-defs
echo "OS_GIT_MINOR=${versionMinor}" >> os-version-defs
echo "OS_GIT_PATCH=${versionPatch}" >> os-version-defs
echo "OS_GIT_COMMIT=${gitCommit}" >> os-version-defs
echo "KUBE_GIT_VERSION=${k8sversion}" >> os-version-defs
echo "KUBE_GIT_COMMIT=${k8sgitcommit}" >> os-version-defs
export OS_VERSION_FILE="os-version-defs"
export CC=clang
make all WHAT='${concatStringsSep " " components}'
'';
installPhase = ''
mkdir -p "$bin/bin"
cp -a "_output/local/bin/$(go env GOOS)/$(go env GOARCH)/"* "$bin/bin/"
mkdir -p "$out/bin"
cp -a "_output/local/bin/$(go env GOOS)/$(go env GOARCH)/"* "$out/bin/"
'';
preFixup = ''
find $out/bin -type f -exec remove-references-to -t ${go_1_9} '{}' +
'';
meta = with stdenv.lib; {