minikube: 1.2.0 -> 1.3.1

This commit is contained in:
Atkins 2019-08-14 02:02:34 +08:00 committed by Atkins
parent 3d266ccdb7
commit 37aab73f56
2 changed files with 40 additions and 45 deletions

View file

@ -1,32 +1,22 @@
{ stdenv, buildGoModule, libvirt, pkgconfig, minikube }: { lib, buildGoModule, minikube }:
buildGoModule rec { buildGoModule rec {
pname = "docker-machine-kvm2"; inherit (minikube) version src nativeBuildInputs buildInputs goPackagePath postPatch preBuild;
version = minikube.version;
goPackagePath = "k8s.io/minikube"; pname = "docker-machine-kvm2";
subPackages = [ "cmd/drivers/kvm" ]; subPackages = [ "cmd/drivers/kvm" ];
src = minikube.src; modSha256 = minikube.go-modules.outputHash;
modSha256 = minikube.go-modules.outputHash;
nativeBuildInputs = [ pkgconfig ];
buildInputs = [ libvirt ];
preBuild = ''
export buildFlagsArray=(-ldflags="-X k8s.io/minikube/pkg/drivers/kvm/version.VERSION=v${version}")
'';
postInstall = '' postInstall = ''
mv $out/bin/kvm $out/bin/docker-machine-driver-kvm2 mv $out/bin/kvm $out/bin/docker-machine-driver-kvm2
''; '';
meta = with stdenv.lib; { meta = with lib; {
homepage = https://github.com/kubernetes/minikube/blob/master/docs/drivers.md; homepage = https://github.com/kubernetes/minikube/blob/master/docs/drivers.md;
description = "KVM2 driver for docker-machine."; description = "KVM2 driver for docker-machine.";
license = licenses.asl20; license = licenses.asl20;
maintainers = with maintainers; [ tadfisher ]; maintainers = with maintainers; [ tadfisher atkinschang ];
platforms = platforms.unix; platforms = platforms.unix;
}; };
} }

View file

@ -1,68 +1,73 @@
{ stdenv, buildGoModule, fetchFromGitHub, go-bindata, libvirt, qemu { stdenv
, gpgme, makeWrapper, vmnet , buildGoModule
, docker-machine-kvm, docker-machine-kvm2 , fetchFromGitHub
, extraDrivers ? [] , pkgconfig
, makeWrapper
, go-bindata
, bash
, libvirt
, vmnet
}: }:
let buildGoModule rec {
drivers = stdenv.lib.filter (d: d != null) (extraDrivers
++ stdenv.lib.optionals stdenv.isLinux [ docker-machine-kvm docker-machine-kvm2 ]);
binPath = drivers
++ stdenv.lib.optionals stdenv.isLinux ([ libvirt qemu ]);
in buildGoModule rec {
pname = "minikube"; pname = "minikube";
version = "1.2.0"; version = "1.3.1";
# for -ldflags
kubernetesVersion = "1.15.0"; commit = "ca60a424ce69a4d79f502650199ca2b52f29e631";
goPackagePath = "k8s.io/minikube"; goPackagePath = "k8s.io/minikube";
subPackages = [ "cmd/minikube" ];
modSha256 = "0ajzkc3xs7ql0v5762d3rh6idk04nhglfph3ldl25mnafwb7qd9l";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "kubernetes"; owner = "kubernetes";
repo = "minikube"; repo = "minikube";
rev = "v${version}"; rev = "v${version}";
sha256 = "0l9znrp49877cp1bkwx84c8lv282ga5a946rjbxi8gznkf3kwaw7"; sha256 = "0kfd7041y6fayz8jl7zlw2lccnrx4d9qramx99j8mcw5syc2mwsd";
}; };
modSha256 = "1cp63n0x2lgbqvvymx9byx48r42qw6w224x5x4iiarc2nryfdhn0"; nativeBuildInputs = [ pkgconfig go-bindata makeWrapper ];
buildInputs = stdenv.lib.optionals stdenv.isLinux [ libvirt ]
++ stdenv.lib.optionals stdenv.isDarwin [ vmnet ];
buildInputs = [ go-bindata makeWrapper gpgme ] ++ stdenv.lib.optional stdenv.hostPlatform.isDarwin vmnet; postPatch = ''
subPackages = [ "cmd/minikube" ] ++ stdenv.lib.optional stdenv.hostPlatform.isDarwin "cmd/drivers/hyperkit"; substituteInPlace pkg/minikube/command/exec_runner.go \
--replace "/bin/bash" ${bash}/bin/bash
'';
preBuild = '' preBuild = ''
go-bindata -nomemcopy -o pkg/minikube/assets/assets.go -pkg assets deploy/addons/... go-bindata -nomemcopy -o pkg/minikube/assets/assets.go -pkg assets deploy/addons/...
go-bindata -nomemcopy -o pkg/minikube/translate/translations.go -pkg translate translations/...
VERSION_MAJOR=$(grep "^VERSION_MAJOR" Makefile | sed "s/^.*\s//") VERSION_MAJOR=$(grep "^VERSION_MAJOR" Makefile | sed "s/^.*\s//")
VERSION_MINOR=$(grep "^VERSION_MINOR" Makefile | sed "s/^.*\s//") VERSION_MINOR=$(grep "^VERSION_MINOR" Makefile | sed "s/^.*\s//")
ISO_VERSION=v$VERSION_MAJOR.$VERSION_MINOR.0 ISO_VERSION=v$VERSION_MAJOR.$VERSION_MINOR.0
ISO_BUCKET=$(grep "^ISO_BUCKET" Makefile | sed "s/^.*\s//") ISO_BUCKET=$(grep "^ISO_BUCKET" Makefile | sed "s/^.*\s//")
KUBERNETES_VERSION=${kubernetesVersion}
export buildFlagsArray="-ldflags=\ export buildFlagsArray="-ldflags=\
-X k8s.io/minikube/pkg/version.version=v${version} \ -X ${goPackagePath}/pkg/version.version=v${version} \
-X k8s.io/minikube/pkg/version.isoVersion=$ISO_VERSION \ -X ${goPackagePath}/pkg/version.isoVersion=$ISO_VERSION \
-X k8s.io/minikube/pkg/version.isoPath=$ISO_BUCKET \ -X ${goPackagePath}/pkg/version.isoPath=$ISO_BUCKET \
-X k8s.io/minikube/vendor/k8s.io/client-go/pkg/version.gitVersion=$KUBERNETES_VERSION \ -X ${goPackagePath}/pkg/version.gitCommitID=${commit} \
-X k8s.io/minikube/vendor/k8s.io/kubernetes/pkg/version.gitVersion=$KUBERNETES_VERSION" -X ${goPackagePath}/pkg/drivers/kvm.version=v${version} \
-X ${goPackagePath}/pkg/drivers/kvm.gitCommitID=${commit} \
-X ${goPackagePath}/pkg/drivers/hyperkit.version=v${version} \
-X ${goPackagePath}/pkg/drivers/hyperkit.gitCommitID=${commit}"
''; '';
postInstall = '' postInstall = ''
wrapProgram $out/bin/${pname} --prefix PATH : $out/bin:${stdenv.lib.makeBinPath binPath}
mkdir -p $out/share/bash-completion/completions/ mkdir -p $out/share/bash-completion/completions/
MINIKUBE_WANTUPDATENOTIFICATION=false MINIKUBE_WANTKUBECTLDOWNLOADMSG=false HOME=$PWD $out/bin/minikube completion bash > $out/share/bash-completion/completions/minikube MINIKUBE_WANTUPDATENOTIFICATION=false MINIKUBE_WANTKUBECTLDOWNLOADMSG=false HOME=$PWD $out/bin/minikube completion bash > $out/share/bash-completion/completions/minikube
mkdir -p $out/share/zsh/site-functions/ mkdir -p $out/share/zsh/site-functions/
MINIKUBE_WANTUPDATENOTIFICATION=false MINIKUBE_WANTKUBECTLDOWNLOADMSG=false HOME=$PWD $out/bin/minikube completion zsh > $out/share/zsh/site-functions/_minikube MINIKUBE_WANTUPDATENOTIFICATION=false MINIKUBE_WANTKUBECTLDOWNLOADMSG=false HOME=$PWD $out/bin/minikube completion zsh > $out/share/zsh/site-functions/_minikube
''+ stdenv.lib.optionalString stdenv.hostPlatform.isDarwin ''
mv $out/bin/hyperkit $out/bin/docker-machine-driver-hyperkit
''; '';
meta = with stdenv.lib; { meta = with stdenv.lib; {
homepage = https://github.com/kubernetes/minikube; homepage = https://github.com/kubernetes/minikube;
description = "A tool that makes it easy to run Kubernetes locally"; description = "A tool that makes it easy to run Kubernetes locally";
license = licenses.asl20; license = licenses.asl20;
maintainers = with maintainers; [ ebzzry copumpkin vdemeester ]; maintainers = with maintainers; [ ebzzry copumpkin vdemeester atkinschang ];
platforms = with platforms; unix; platforms = with platforms; unix;
}; };
} }