Merge pull request #87794 from zowoq/gomodules

podman, etc packages: switch to buildGoModule
This commit is contained in:
lewo 2020-05-14 11:46:28 +02:00 committed by GitHub
commit a33eb1a0e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 59 deletions

View File

@ -1,6 +1,6 @@
{ lib, fetchFromGitHub, buildGoPackage }:
{ lib, fetchFromGitHub, buildGoModule }:
buildGoPackage rec {
buildGoModule rec {
pname = "cni-plugins";
version = "0.8.6";
@ -11,10 +11,10 @@ buildGoPackage rec {
sha256 = "0f1cqxjf26sy1c4aw6y7pyd9lrz0vknby4q5j6xj77a1pab9073m";
};
goPackagePath = "github.com/containernetworking/plugins";
vendorSha256 = null;
buildFlagsArray = [
"-ldflags=-X ${goPackagePath}/pkg/utils/buildversion.BuildVersion=${version}"
"-ldflags=-X github.com/containernetworking/plugins/pkg/utils/buildversion.BuildVersion=${version}"
];
subPackages = [

View File

@ -2,7 +2,7 @@
, fetchFromGitHub
, pkg-config
, installShellFiles
, buildGoPackage
, buildGoModule
, gpgme
, lvm2
, btrfs-progs
@ -12,7 +12,7 @@
, nixosTests
}:
buildGoPackage rec {
buildGoModule rec {
pname = "podman";
version = "1.9.2";
@ -23,7 +23,7 @@ buildGoPackage rec {
sha256 = "0jvqzn1q52z6aka98d2i3dyn2i8xld7xvmi2zfxgm9g53wdgi2g2";
};
goPackagePath = "github.com/containers/libpod";
vendorSha256 = null;
outputs = [ "out" "man" ];
@ -32,7 +32,6 @@ buildGoPackage rec {
buildInputs = stdenv.lib.optionals stdenv.isLinux [ btrfs-progs libseccomp gpgme lvm2 systemd ];
buildPhase = ''
pushd go/src/${goPackagePath}
patchShebangs .
${if stdenv.isDarwin
then "make CGO_ENABLED=0 BUILDTAGS='remoteclient containers_image_openpgp exclude_graphdriver_devicemapper' varlink_generate all"

View File

@ -1,5 +1,5 @@
{ stdenv
, buildGoPackage
, buildGoModule
, fetchFromGitHub
, installShellFiles
, pkg-config
@ -11,7 +11,7 @@
, libseccomp
}:
buildGoPackage rec {
buildGoModule rec {
pname = "buildah";
version = "1.14.9";
@ -24,15 +24,12 @@ buildGoPackage rec {
outputs = [ "out" "man" ];
goPackagePath = "github.com/containers/buildah";
vendorSha256 = null;
nativeBuildInputs = [ installShellFiles pkg-config ];
buildInputs = [ gpgme libgpgerror lvm2 btrfs-progs libselinux libseccomp ];
patches = [ ./disable-go-module-mode.patch ];
buildPhase = ''
pushd go/src/${goPackagePath}
make GIT_COMMIT="unknown"
make -C docs
'';

View File

@ -1,32 +0,0 @@
From e2d12e52b3638a320a8d69ea4b392b60f44ea57f Mon Sep 17 00:00:00 2001
From: Mario Rodas <marsam@users.noreply.github.com>
Date: Wed, 4 Dec 2019 21:07:33 -0500
Subject: [PATCH] Do not check Go module-mode availability
Since buildah vendorizes its dependencies we use buildGoPackage which
does not uses Go module-mode. The module-mode check will be true
because nixpkgs uses Go 1.13 by default, and building go modules with
buildGoPackage may lead to inconsistencies.
---
Makefile | 5 -----
1 file changed, 5 deletions(-)
diff --git a/Makefile b/Makefile
index 07724ce4..6383646e 100644
--- a/Makefile
+++ b/Makefile
@@ -15,14 +15,8 @@ BUILDAH := buildah
GO := go
GO110 := 1.10
GOVERSION := $(findstring $(GO110),$(shell go version))
-# test for go module support
-ifeq ($(shell go help mod >/dev/null 2>&1 && echo true), true)
-export GO_BUILD=GO111MODULE=on $(GO) build -mod=vendor
-export GO_TEST=GO111MODULE=on $(GO) test -mod=vendor
-else
export GO_BUILD=$(GO) build
export GO_TEST=$(GO) test
-endif
GIT_COMMIT ?= $(if $(shell git rev-parse --short HEAD),$(shell git rev-parse --short HEAD),$(error "git failed"))
SOURCE_DATE_EPOCH ?= $(if $(shell date +%s),$(shell date +%s),$(error "date failed"))

View File

@ -1,5 +1,5 @@
{ stdenv
, buildGoPackage
, buildGoModule
, fetchFromGitHub
, runCommand
, gpgme
@ -26,18 +26,18 @@ let
defaultPolicyFile = runCommand "skopeo-default-policy.json" {} "cp ${src}/default-policy.json $out";
goPackagePath = "github.com/containers/skopeo";
vendorPath = "${goPackagePath}/vendor/github.com/containers/image/v5";
vendorPath = "github.com/containers/skopeo/vendor/github.com/containers/image/v5";
in
buildGoPackage {
buildGoModule {
pname = "skopeo";
inherit version;
inherit src goPackagePath;
inherit src;
outputs = [ "out" "man" ];
vendorSha256 = null;
excludedPackages = [ "integration" ];
nativeBuildInputs = [ pkg-config go-md2man installShellFiles makeWrapper ];
@ -51,11 +51,8 @@ buildGoPackage {
'';
postBuild = ''
# depends on buildGoPackage not changing …
pushd ./go/src/${goPackagePath}
make install-docs MANINSTALLDIR="$man/share/man"
installShellCompletion --bash completions/bash/skopeo
popd
'';
postInstall = stdenv.lib.optionals stdenv.isLinux ''

View File

@ -1,10 +1,10 @@
{ lib
, buildGoPackage
, buildGoModule
, fetchFromGitHub
, installShellFiles
}:
buildGoPackage rec {
buildGoModule rec {
pname = "cri-tools";
version = "1.18.0";
@ -15,12 +15,11 @@ buildGoPackage rec {
sha256 = "06sxjhjpd893fn945c1s4adri2bf7s50ddvcw5pnwb6qndzfljw6";
};
goPackagePath = "github.com/kubernetes-sigs/cri-tools";
vendorSha256 = null;
nativeBuildInputs = [ installShellFiles ];
buildPhase = ''
pushd go/src/${goPackagePath}
make binaries VERSION=${version}
'';