Merge pull request #86121 from zowoq/more-go-fixes

buildGoPackage: use installShellFiles, {excluded,sub}Packages
This commit is contained in:
Jörg Thalheim 2020-04-27 13:08:50 +01:00 committed by GitHub
commit eeeba2a793
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 20 additions and 24 deletions

View File

@ -13,7 +13,7 @@ buildGoPackage rec {
sha256 = "18h9hvp95va0hyl268gnzciwy1dqmc57bpifbj885870rdfp0ffv";
};
postInstall = "rm $bin/bin/issue-template-gen";
excludedPackages = [ "issue-template-gen" ];
meta = with stdenv.lib; {
description = "A utility for managing disaster recovery, specifically for your Kubernetes cluster resources and persistent volumes";

View File

@ -1,5 +1,5 @@
{ stdenv, lib, fetchFromGitHub, buildGoPackage, which, go-bindata, rsync, utillinux
, coreutils, kerberos, clang
, coreutils, kerberos, clang, installShellFiles
, components ? [
"cmd/oc"
"cmd/openshift"
@ -35,7 +35,7 @@ in buildGoPackage rec {
buildInputs = [ kerberos ];
nativeBuildInputs = [ which rsync go-bindata clang ];
nativeBuildInputs = [ which rsync go-bindata clang installShellFiles ];
patchPhase = ''
patchShebangs ./hack
@ -74,8 +74,8 @@ in buildGoPackage rec {
installPhase = ''
mkdir -p $bin/bin
cp -a "_output/local/bin/$(go env GOOS)/$(go env GOARCH)/"* "$bin/bin/"
install -D -t "$bin/etc/bash_completion.d" contrib/completions/bash/*
install -D -t "$bin/share/zsh/site-functions" contrib/completions/zsh/*
installShellCompletion --bash contrib/completions/bash/*
installShellCompletion --zsh contrib/completions/zsh/*
'';
meta = with stdenv.lib; {

View File

@ -4,7 +4,7 @@ buildGoPackage rec {
pname = "git-lfs";
version = "1.5.6";
rev = "0d02fb7d9a1c599bbf8c55e146e2845a908e04e0";
goPackagePath = "github.com/git-lfs/git-lfs";
src = fetchFromGitHub {
@ -14,8 +14,7 @@ buildGoPackage rec {
sha256 = "0wddry1lqjccf4522fvhx6grx8h57xsz17lkaf5aybnrgw677w3d";
};
# Tests fail with 'lfstest-gitserver.go:46: main redeclared in this block'
excludedPackages = [ "test" ];
subPackages = [ "." ];
preBuild = ''
pushd go/src/github.com/git-lfs/git-lfs
@ -23,9 +22,6 @@ buildGoPackage rec {
popd
'';
postInstall = ''
rm -v $bin/bin/{man,script}
'';
meta = with stdenv.lib; {
description = "Git extension for versioning large files";
homepage = "https://git-lfs.github.com/";

View File

@ -1,4 +1,4 @@
{ stdenv, buildGoPackage, fetchFromGitHub }:
{ stdenv, buildGoPackage, fetchFromGitHub, installShellFiles }:
buildGoPackage rec {
pname = "cloudfoundry-cli";
@ -15,6 +15,8 @@ buildGoPackage rec {
sha256 = "0dqrkimwhw016icgyf4cyipzy6vdz5jgickm33xxd9018dh3ibwq";
};
nativeBuildInputs = [ installShellFiles ];
makeTarget = let hps = stdenv.hostPlatform.system; in
if hps == "x86_64-darwin" then
"out/cf-cli_osx"
@ -33,7 +35,7 @@ buildGoPackage rec {
installPhase = ''
install -Dm555 out/cf "$bin/bin/cf"
install -Dm444 -t "$bin/share/bash-completion/completions/" "$src/ci/installers/completion/cf"
installShellCompletion --bash "$src/ci/installers/completion/cf"
'';
meta = with stdenv.lib; {

View File

@ -39,9 +39,7 @@ buildGoPackage rec {
packr clean && packr
'';
postInstall = ''
rm $bin/bin/{scripts,templates,trezor-common}
'';
subPackages = [ "." ];
meta = with lib; {
description = "Trezor address/account balance backend";
@ -51,4 +49,3 @@ buildGoPackage rec {
platforms = platforms.all;
};
}

View File

@ -1,4 +1,4 @@
{ stdenv, go, buildGoPackage, fetchFromGitHub }:
{ stdenv, go, buildGoPackage, fetchFromGitHub, installShellFiles }:
buildGoPackage rec {
pname = "alertmanager";
@ -24,9 +24,11 @@ buildGoPackage rec {
-X ${t}.GoVersion=${stdenv.lib.getVersion go}
'';
nativeBuildInputs = [ installShellFiles ];
postInstall = ''
mkdir -p $bin/etc/bash_completion.d
$NIX_BUILD_TOP/go/bin/amtool --completion-script-bash > $bin/etc/bash_completion.d/amtool_completion.sh
$bin/bin/amtool --completion-script-bash > amtool.bash
installShellCompletion amtool.bash
'';
meta = with stdenv.lib; {

View File

@ -1,4 +1,4 @@
{ stdenv, buildGoPackage, fetchFromGitHub, makeWrapper, gnupg, bzip2, xz, graphviz }:
{ stdenv, buildGoPackage, fetchFromGitHub, installShellFiles, makeWrapper, gnupg, bzip2, xz, graphviz }:
let
@ -29,11 +29,10 @@ buildGoPackage {
goPackagePath = "github.com/aptly-dev/aptly";
nativeBuildInputs = [ makeWrapper ];
nativeBuildInputs = [ installShellFiles makeWrapper ];
postInstall = ''
mkdir -p $bin/share/bash-completion/completions
ln -s ${aptlyCompletionSrc}/aptly $bin/share/bash-completion/completions
installShellCompletion --bash ${aptlyCompletionSrc}/aptly
wrapProgram "$bin/bin/aptly" \
--prefix PATH ":" "${stdenv.lib.makeBinPath [ gnupg bzip2 xz graphviz ]}"
'';