jx: use buildGoModule instead of buildGoPackage

This commit is contained in:
Wael M. Nasreddine 2019-03-08 11:10:50 -08:00
parent 28435e47b1
commit a51627585f
No known key found for this signature in database
GPG Key ID: FD437548E0BF0F5F
3 changed files with 51 additions and 3413 deletions

View File

@ -0,0 +1,36 @@
From 40b8eaacb3a24c466c17c8a65938330d5805b112 Mon Sep 17 00:00:00 2001
From: "Wael M. Nasreddine" <wael.nasreddine@gmail.com>
Date: Fri, 8 Mar 2019 14:10:11 -0800
Subject: [PATCH] chore: fix the location of thrift
Thrift is no longer available at the git.apache.org and it's now
distributed on GitHub at github.com/apache/thrift.
fixes #3320
---
go.mod | 2 ++
go.sum | 1 +
2 files changed, 3 insertions(+)
diff --git a/go.mod b/go.mod
index 04bcc84cc..e26c4cf1d 100644
--- a/go.mod
+++ b/go.mod
@@ -184,3 +184,5 @@ replace k8s.io/metrics => k8s.io/metrics v0.0.0-20181128195641-3954d62a524d
replace k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20190122181752-bebe27e40fb7
replace k8s.io/client-go => k8s.io/client-go v2.0.0-alpha.0.0.20190115164855-701b91367003+incompatible
+
+replace git.apache.org/thrift.git => github.com/apache/thrift v0.0.0-20180902110319-2566ecd5d999
diff --git a/go.sum b/go.sum
index c9fdf8768..6ed69e69d 100644
--- a/go.sum
+++ b/go.sum
@@ -87,6 +87,7 @@ github.com/antham/chyle v1.4.0/go.mod h1:D94Z4aE/ECudyNoTHwkhqu77mjGPZtfPG8dNoeI
github.com/antham/envh v1.2.0/go.mod h1:ocIRPHuwwjyBVBtuUJOJc2TYzGg+d23xSAZexl4y9hQ=
github.com/antham/strumt v0.0.0-20171215230529-6776189777d3/go.mod h1:sE7EYIUE0nQzPiv5zQAmw2aVkei0j2xmb4gTIIqSFSI=
github.com/aokoli/goutils v1.0.1/go.mod h1:SijmP0QR8LtwsmDs8Yii5Z/S4trXFGFC2oO5g9DP+DQ=
+github.com/apache/thrift v0.0.0-20180902110319-2566ecd5d999/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da h1:8GUt8eRujhVEGZFFEjBj46YV4rDjvGrNxb0KMWYkL2I=

View File

@ -1,57 +1,39 @@
{ buildGoPackage, fetchFromGitHub, lib }:
{ buildGoModule, fetchFromGitHub, lib }:
let
removeVendoredPackages = goDeps:
''
echo "Removing any vendored duplicate of direct dependency... "
for dir in $(find $NIX_BUILD_TOP/go/src -type d -name vendor); do
${builtins.concatStringsSep "\n" (map (goDep: ''
if test -d $dir/${goDep.goPackagePath}; then
echo "Removing duplicate directory at $dir/${goDep.goPackagePath}"
rm -rf $dir/${goDep.goPackagePath}
fi
'') goDeps)}
done
echo "Done"
'';
in
buildGoPackage rec {
buildGoModule rec {
name = "jx";
version = "1.3.955";
goPackagePath = "github.com/jenkins-x/jx";
subPackages = [ "cmd/jx" ];
version = "1.3.967";
src = fetchFromGitHub {
owner = "jenkins-x";
repo = "jx";
rev = "v${version}";
sha256 = "0h4ck1a8rlyg10gaxbnwvlabwjlhdrigrina84x4m2gsqr3lnp9a";
sha256 = "0a25m7sz134kch21bg6l86kvwl4cg6babqf57kqidq6kid1zgdaq";
};
# Some of the dependencies have their own checked in vendor directory that
# vendor their dependencies. However, some of those dependencies are also
# directly pulled down through the vgo modules. Removing these dependencies
# as they confuse the go compiler and causes the build to fail.
# Removing all the vendor directories also breaks the build.
preBuild = removeVendoredPackages (import goDeps);
patches = [
# https://github.com/jenkins-x/jx/pull/3321
./3321-fix-location-of-thrift.patch
];
modSha256 = "0l6ccxzfxl918hzbky5ivlw413hiwagwc2cbp3f05i21qdi5mw5p";
subPackages = [ "cmd/jx" ];
buildFlagsArray = ''
-ldflags=
-X ${goPackagePath}/pkg/version.Version=${version}
-X ${goPackagePath}/pkg/version.Revision=${version}
-X github.com/jenkins-x/jx/pkg/version.Version=${version}
-X github.com/jenkins-x/jx/pkg/version.Revision=${version}
'';
goDeps = ./deps.nix;
meta = with lib; {
description = "JX is a command line tool for installing and using Jenkins X.";
homepage = https://jenkins-x.io;
longDescription = ''
Jenkins X provides automated CI+CD for Kubernetes with Preview
Environments on Pull Requests using Jenkins, Knative Build, Prow,
Skaffold and Helm.
'';
homepage = https://github.com/jenkins-x/jx;
license = licenses.asl20 ;
maintainers = with maintainers; [ kalbasit ];
platforms = platforms.linux ++ platforms.darwin;

File diff suppressed because it is too large Load Diff