Skip to content

Commit

Permalink
openshift: 3.6.0 -> 3.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jensbin committed Mar 31, 2018
1 parent 8fe59b5 commit fbf29e5
Showing 1 changed file with 38 additions and 25 deletions.
63 changes: 38 additions & 25 deletions pkgs/applications/networking/cluster/openshift/default.nix
Original file line number Diff line number Diff line change
@@ -1,53 +1,66 @@
{ 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;

src = fetchFromGitHub {
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; {
Expand Down

0 comments on commit fbf29e5

Please sign in to comment.