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"; sha256 = "18h9hvp95va0hyl268gnzciwy1dqmc57bpifbj885870rdfp0ffv";
}; };
postInstall = "rm $bin/bin/issue-template-gen"; excludedPackages = [ "issue-template-gen" ];
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "A utility for managing disaster recovery, specifically for your Kubernetes cluster resources and persistent volumes"; 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 { stdenv, lib, fetchFromGitHub, buildGoPackage, which, go-bindata, rsync, utillinux
, coreutils, kerberos, clang , coreutils, kerberos, clang, installShellFiles
, components ? [ , components ? [
"cmd/oc" "cmd/oc"
"cmd/openshift" "cmd/openshift"
@ -35,7 +35,7 @@ in buildGoPackage rec {
buildInputs = [ kerberos ]; buildInputs = [ kerberos ];
nativeBuildInputs = [ which rsync go-bindata clang ]; nativeBuildInputs = [ which rsync go-bindata clang installShellFiles ];
patchPhase = '' patchPhase = ''
patchShebangs ./hack patchShebangs ./hack
@ -74,8 +74,8 @@ in buildGoPackage rec {
installPhase = '' installPhase = ''
mkdir -p $bin/bin mkdir -p $bin/bin
cp -a "_output/local/bin/$(go env GOOS)/$(go env GOARCH)/"* "$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/* installShellCompletion --bash contrib/completions/bash/*
install -D -t "$bin/share/zsh/site-functions" contrib/completions/zsh/* installShellCompletion --zsh contrib/completions/zsh/*
''; '';
meta = with stdenv.lib; { meta = with stdenv.lib; {

View File

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

View File

@ -1,4 +1,4 @@
{ stdenv, buildGoPackage, fetchFromGitHub }: { stdenv, buildGoPackage, fetchFromGitHub, installShellFiles }:
buildGoPackage rec { buildGoPackage rec {
pname = "cloudfoundry-cli"; pname = "cloudfoundry-cli";
@ -15,6 +15,8 @@ buildGoPackage rec {
sha256 = "0dqrkimwhw016icgyf4cyipzy6vdz5jgickm33xxd9018dh3ibwq"; sha256 = "0dqrkimwhw016icgyf4cyipzy6vdz5jgickm33xxd9018dh3ibwq";
}; };
nativeBuildInputs = [ installShellFiles ];
makeTarget = let hps = stdenv.hostPlatform.system; in makeTarget = let hps = stdenv.hostPlatform.system; in
if hps == "x86_64-darwin" then if hps == "x86_64-darwin" then
"out/cf-cli_osx" "out/cf-cli_osx"
@ -33,7 +35,7 @@ buildGoPackage rec {
installPhase = '' installPhase = ''
install -Dm555 out/cf "$bin/bin/cf" 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; { meta = with stdenv.lib; {

View File

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

View File

@ -1,4 +1,4 @@
{ stdenv, go, buildGoPackage, fetchFromGitHub }: { stdenv, go, buildGoPackage, fetchFromGitHub, installShellFiles }:
buildGoPackage rec { buildGoPackage rec {
pname = "alertmanager"; pname = "alertmanager";
@ -24,9 +24,11 @@ buildGoPackage rec {
-X ${t}.GoVersion=${stdenv.lib.getVersion go} -X ${t}.GoVersion=${stdenv.lib.getVersion go}
''; '';
nativeBuildInputs = [ installShellFiles ];
postInstall = '' postInstall = ''
mkdir -p $bin/etc/bash_completion.d $bin/bin/amtool --completion-script-bash > amtool.bash
$NIX_BUILD_TOP/go/bin/amtool --completion-script-bash > $bin/etc/bash_completion.d/amtool_completion.sh installShellCompletion amtool.bash
''; '';
meta = with stdenv.lib; { 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 let
@ -29,11 +29,10 @@ buildGoPackage {
goPackagePath = "github.com/aptly-dev/aptly"; goPackagePath = "github.com/aptly-dev/aptly";
nativeBuildInputs = [ makeWrapper ]; nativeBuildInputs = [ installShellFiles makeWrapper ];
postInstall = '' postInstall = ''
mkdir -p $bin/share/bash-completion/completions installShellCompletion --bash ${aptlyCompletionSrc}/aptly
ln -s ${aptlyCompletionSrc}/aptly $bin/share/bash-completion/completions
wrapProgram "$bin/bin/aptly" \ wrapProgram "$bin/bin/aptly" \
--prefix PATH ":" "${stdenv.lib.makeBinPath [ gnupg bzip2 xz graphviz ]}" --prefix PATH ":" "${stdenv.lib.makeBinPath [ gnupg bzip2 xz graphviz ]}"
''; '';