2018-07-21 01:44:44 +01:00
|
|
|
{ stdenv, lib, fetchFromGitHub, removeReferencesTo, which, go_1_9, go-bindata, makeWrapper, rsync, utillinux
|
|
|
|
, coreutils, kerberos, clang
|
2018-03-31 16:22:27 +01:00
|
|
|
, components ? [
|
|
|
|
"cmd/oc"
|
|
|
|
"cmd/openshift"
|
|
|
|
]
|
|
|
|
}:
|
|
|
|
|
|
|
|
with lib;
|
2015-07-07 10:54:45 +01:00
|
|
|
|
2016-09-25 00:57:35 +01:00
|
|
|
let
|
2018-03-31 16:22:27 +01:00
|
|
|
version = "3.9.0";
|
2016-12-16 22:33:23 +00:00
|
|
|
ver = stdenv.lib.elemAt (stdenv.lib.splitString "." version);
|
|
|
|
versionMajor = ver 0;
|
|
|
|
versionMinor = ver 1;
|
|
|
|
versionPatch = ver 2;
|
2018-03-31 16:22:27 +01:00
|
|
|
gitCommit = "191fece";
|
|
|
|
# version is in vendor/k8s.io/kubernetes/pkg/version/base.go
|
|
|
|
k8sversion = "v1.9.1";
|
|
|
|
k8sgitcommit = "a0ce1bc657";
|
|
|
|
in stdenv.mkDerivation rec {
|
2015-07-07 10:54:45 +01:00
|
|
|
name = "openshift-origin-${version}";
|
2016-09-25 00:57:35 +01:00
|
|
|
inherit version;
|
2015-07-07 10:54:45 +01:00
|
|
|
|
2016-09-25 00:57:35 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "openshift";
|
|
|
|
repo = "origin";
|
|
|
|
rev = "v${version}";
|
2018-03-31 16:22:27 +01:00
|
|
|
sha256 = "06k0zilfyvll7z34yirraslgpwgah9k6y5i6wgi7f00a79k76k78";
|
|
|
|
};
|
2015-07-07 10:54:45 +01:00
|
|
|
|
2018-03-31 16:22:27 +01:00
|
|
|
# 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" ];
|
2015-07-07 10:54:45 +01:00
|
|
|
|
2016-09-25 00:57:35 +01:00
|
|
|
patchPhase = ''
|
|
|
|
patchShebangs ./hack
|
2018-04-02 10:25:54 +01:00
|
|
|
|
|
|
|
substituteInPlace pkg/oc/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/oc/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/oc/bootstrap/docker/host/host.go \
|
|
|
|
--replace 'nsenter --mount=/rootfs/proc/1/ns/mnt mkdir' \
|
2018-05-31 08:04:17 +01:00
|
|
|
'nsenter --mount=/rootfs/proc/1/ns/mnt ${coreutils}/bin/mkdir'
|
2016-09-25 00:57:35 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
# Openshift build require this variables to be set
|
|
|
|
# unless there is a .git folder which is not the case with fetchFromGitHub
|
2018-03-31 16:22:27 +01:00
|
|
|
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}'
|
2016-09-25 00:57:35 +01:00
|
|
|
'';
|
2015-07-07 10:54:45 +01:00
|
|
|
|
|
|
|
installPhase = ''
|
2018-03-31 16:22:27 +01:00
|
|
|
mkdir -p "$out/bin"
|
|
|
|
cp -a "_output/local/bin/$(go env GOOS)/$(go env GOARCH)/"* "$out/bin/"
|
2018-05-19 11:47:39 +01:00
|
|
|
install -D -t "$out/etc/bash_completion.d" contrib/completions/bash/*
|
|
|
|
install -D -t "$out/share/zsh/site-functions" contrib/completions/zsh/*
|
2018-03-31 16:22:27 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
preFixup = ''
|
|
|
|
find $out/bin -type f -exec remove-references-to -t ${go_1_9} '{}' +
|
2017-04-30 22:16:33 +01:00
|
|
|
'';
|
|
|
|
|
2015-07-07 10:54:45 +01:00
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Build, deploy, and manage your applications with Docker and Kubernetes";
|
|
|
|
license = licenses.asl20;
|
|
|
|
homepage = http://www.openshift.org;
|
2017-08-17 15:57:43 +01:00
|
|
|
maintainers = with maintainers; [offline bachp moretea];
|
2016-11-09 18:54:09 +00:00
|
|
|
platforms = platforms.linux;
|
2015-07-07 10:54:45 +01:00
|
|
|
};
|
|
|
|
}
|