tree-wide: unify Bash completions outputs (#103421)

Use $out/share/bash-completion/completions to store the Bash completions
This commit is contained in:
Jonas Chevalier 2020-11-12 22:22:18 +01:00 committed by GitHub
parent 3fceafce1e
commit a7cb88c3de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 46 additions and 41 deletions

View File

@ -5,7 +5,7 @@
macro_optional_find_package (BashCompletion)
if (NOT BASH_COMPLETION_FOUND)
- set (BASH_COMPLETION_COMPLETIONSDIR "/etc/bash_completion.d" CACHE PATH "Location of bash_completion.d")
+ set (BASH_COMPLETION_COMPLETIONSDIR "${CMAKE_INSTALL_PREFIX}/etc/bash_completion.d" CACHE PATH "Location of bash_completion.d")
+ set (BASH_COMPLETION_COMPLETIONSDIR "${CMAKE_INSTALL_PREFIX}/share/bash-completion/completions" CACHE PATH "Location of bash_completion.d")
endif (NOT BASH_COMPLETION_FOUND)
install (
FILES bash-completion/gammu

View File

@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
buildInputs = [ glib expat ];
postInstall = ''
installShellCompletion --bash $out/etc/bash_completion.d/prevo-completion
installShellCompletion --bash src/prevo-completion
'';
meta = with stdenv.lib; {

View File

@ -13,8 +13,8 @@ in stdenv.mkDerivation {
installPhase = ''
install -vd $out/bin
install -vm 755 todo.sh $out/bin
install -vd $out/etc/bash_completion.d
install -vm 644 todo_completion $out/etc/bash_completion.d/todo
install -vd $out/share/bash-completion/completions
install -vm 644 todo_completion $out/share/bash-completion/completions/todo
install -vd $out/etc/todo
install -vm 644 todo.cfg $out/etc/todo/config
'';

View File

@ -24,7 +24,7 @@ buildGoModule rec {
'';
postInstall = ''
install -D -m 0644 misc/bash_completion/git-bug "$out/etc/bash_completion.d/git-bug"
install -D -m 0644 misc/bash_completion/git-bug "$out/share/bash-completion/completions/git-bug"
install -D -m 0644 misc/zsh_completion/git-bug "$out/share/zsh/site-functions/git-bug"
install -D -m 0644 -t "$out/share/man/man1" doc/man/*
'';

View File

@ -12,9 +12,9 @@ stdenv.mkDerivation {
};
installPhase = ''
mkdir -p $out/bin $out/etc/bash_completion.d
mkdir -p $out/bin $out/share/bash-completion/completions
install -m 0755 git-stree $out/bin/
install -m 0644 git-stree-completion.bash $out/etc/bash_completion.d/
install -m 0644 git-stree-completion.bash $out/share/bash-completion/completions/
'';
meta = with lib; {

View File

@ -153,8 +153,8 @@ stdenv.mkDerivation {
cp -a contrib $out/share/git/
mkdir -p $out/share/bash-completion/completions
ln -s $out/share/git/contrib/completion/git-completion.bash $out/share/bash-completion/completions/git
mkdir -p $out/etc/bash_completion.d
ln -s $out/share/git/contrib/completion/git-prompt.sh $out/etc/bash_completion.d/
mkdir -p $out/share/bash-completion/completions
ln -s $out/share/git/contrib/completion/git-prompt.sh $out/share/bash-completion/completions/
# grep is a runtime dependency, need to patch so that it's found
substituteInPlace $out/libexec/git-core/git-sh-setup \

View File

@ -16,8 +16,8 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ perl git ];
postInstall = ''
install -Dm644 README -t"$out/share/doc/${pname}-${version}/"
install -Dm755 contrib/tg-completion.bash -t "$out/etc/bash_completion.d/"
install -Dm644 README -t "$out/share/doc/${pname}-${version}/"
install -Dm755 contrib/tg-completion.bash -t "$out/share/bash-completion/completions/"
'';
meta = with stdenv.lib; {

View File

@ -47,8 +47,8 @@ in stdenv.mkDerivation rec {
install -D -m555 -T purs $PURS
${patchelf libPath}
mkdir -p $out/etc/bash_completion.d/
$PURS --bash-completion-script $PURS > $out/etc/bash_completion.d/purs-completion.bash
mkdir -p $out/share/bash-completion/completions
$PURS --bash-completion-script $PURS > $out/share/bash-completion/completions/purs-completion.bash
'';
passthru.tests = {

View File

@ -35,8 +35,8 @@ python3Packages.buildPythonApplication rec {
sed 's/b2/backblaze-b2/' -i contrib/bash_completion/b2
mkdir -p "$out/etc/bash_completion.d"
cp contrib/bash_completion/b2 "$out/etc/bash_completion.d/backblaze-b2"
mkdir -p "$out/share/bash-completion/completions"
cp contrib/bash_completion/b2 "$out/share/bash-completion/completions/backblaze-b2"
'';
meta = with lib; {

View File

@ -23,7 +23,7 @@ stdenv.mkDerivation {
"man_dir=${placeholder "man"}/share/man"
"libdir=${placeholder "lib"}/lib"
"includedir=${placeholder "dev"}/include"
"BASH_COMPLETE_DIR=${placeholder "out"}/etc/bash_completion.d"
"BASH_COMPLETE_DIR=${placeholder "out"}/share/bash-completion/completions"
];
meta = with stdenv.lib; {

View File

@ -47,10 +47,12 @@ in with py.pkgs; buildPythonApplication rec {
];
postInstall = ''
mkdir -p $out/etc/bash_completion.d
echo "complete -C $out/bin/aws_completer aws" > $out/etc/bash_completion.d/awscli
mkdir -p $out/share/bash-completion/completions
echo "complete -C $out/bin/aws_completer aws" > $out/share/bash-completion/completions/awscli
mkdir -p $out/share/zsh/site-functions
mv $out/bin/aws_zsh_completer.sh $out/share/zsh/site-functions
rm $out/bin/aws.cmd
'';

View File

@ -67,10 +67,12 @@ with py.pkgs; buildPythonApplication rec {
];
postInstall = ''
mkdir -p $out/etc/bash_completion.d
echo "complete -C $out/bin/aws_completer aws" > $out/etc/bash_completion.d/awscli
mkdir -p $out/share/bash-completion/completions
echo "complete -C $out/bin/aws_completer aws" > $out/share/bash-completion/completions/awscli
mkdir -p $out/share/zsh/site-functions
mv $out/bin/aws_zsh_completer.sh $out/share/zsh/site-functions
rm $out/bin/aws.cmd
'';

View File

@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
install -m755 -D -t $out/bin/cfcli bin/cfcli/cf
ln -sv $out/bin/ibmcloud $out/bin/bx
ln -sv $out/bin/ibmcloud $out/bin/bluemix
install -D -t "$out/etc/bash_completion.d" bx/bash_autocomplete
install -D -t "$out/share/bash-completion/completions" bx/bash_autocomplete
install -D -t "$out/share/zsh/site-functions" bx/zsh_autocomplete
'';

View File

@ -74,8 +74,8 @@ in stdenv.mkDerivation rec {
disable_update_check = true" >> $out/google-cloud-sdk/properties
# setup bash completion
mkdir -p $out/etc/bash_completion.d
mv $out/google-cloud-sdk/completion.bash.inc $out/etc/bash_completion.d/gcloud.inc
mkdir -p $out/share/bash-completion/completions
mv $out/google-cloud-sdk/completion.bash.inc $out/share/bash-completion/completions/gcloud.inc
# This directory contains compiled mac binaries. We used crcmod from
# nixpkgs instead.

View File

@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
};
preConfigure = ''
configureFlags="--with-bash-completion-dir=$out/etc/bash_completion.d"
configureFlags="--with-bash-completion-dir=$out/share/bash-completion/completions"
'';
patchPhase = ''

View File

@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
postPatch = "sed -i s/-O1/-O2/ configure";
postInstall = ''
install -v -m 444 -D btrfs-completion $out/etc/bash_completion.d/btrfs
install -v -m 444 -D btrfs-completion $out/share/bash-completion/completions/btrfs
'';
configureFlags = stdenv.lib.optional stdenv.hostPlatform.isMusl "--disable-backtrace";

View File

@ -208,12 +208,12 @@ in rec {
ceph-client = runCommand "ceph-client-${version}" {
meta = getMeta "Tools needed to mount Ceph's RADOS Block Devices";
} ''
mkdir -p $out/{bin,etc,${sitePackages}}
mkdir -p $out/{bin,etc,${sitePackages},share/bash-completion/completions}
cp -r ${ceph}/bin/{ceph,.ceph-wrapped,rados,rbd,rbdmap} $out/bin
cp -r ${ceph}/bin/ceph-{authtool,conf,dencoder,rbdnamer,syn} $out/bin
cp -r ${ceph}/bin/rbd-replay* $out/bin
cp -r ${ceph}/${sitePackages} $out/${sitePackages}
cp -r ${ceph}/etc/bash_completion.d $out/etc
cp -r ${ceph}/etc/bash_completion.d $out/share/bash-completion/completions
# wrapPythonPrograms modifies .ceph-wrapped, so lets just update its paths
substituteInPlace $out/bin/ceph --replace ${ceph} $out
substituteInPlace $out/bin/.ceph-wrapped --replace ${ceph} $out

View File

@ -32,12 +32,13 @@ stdenv.mkDerivation rec {
cd unpacked
${rpmextract}/bin/rpmextract $src
mkdir -p $out/share/bash-completion/completions
cp -r -t $out/bin usr/bin/*
cp -r -t $out/share usr/share/*
cp -r -t $out/etc etc/*
cp -r -t $out/share/bash-completion/completions etc/bash_completion.d/*
sed -i 's@have@${which}/bin/which >/dev/null 2>\&1@' \
$out/etc/bash_completion.d/yandex-disk-completion.bash
$out/share/bash-completion/completions/yandex-disk-completion.bash
${patchelf}/bin/patchelf \
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \

View File

@ -14,15 +14,15 @@ stdenv.mkDerivation rec {
phases = [ "unpackPhase" "installPhase" "fixupPhase" ];
installPhase = ''
mkdir -p $out/bin $out/etc/bash_completion.d
mkdir -p $out/bin $out/share/bash-completion/completions
cp gibo $out/bin
cp gibo-completion.bash $out/etc/bash_completion.d
cp gibo-completion.bash $out/share/bash-completion/completions
sed -e 's|\<git |${git}/bin/git |g' \
-e 's|\<basename |${coreutils}/bin/basename |g' \
-i "$out/bin/gibo"
sed -e 's|\<find |${findutils}/bin/find |g' \
-i "$out/etc/bash_completion.d/gibo-completion.bash"
-i "$out/share/bash-completion/completions/gibo-completion.bash"
'';
meta = {

View File

@ -19,7 +19,7 @@ rustPlatform.buildRustPackage rec {
COMPLETION_OUT = "out";
postInstall = ''
install -Dm 755 "${COMPLETION_OUT}/${pname}.bash" "$out/etc/bash_completion.d/${pname}"
install -Dm 755 "${COMPLETION_OUT}/${pname}.bash" "$out/share/bash-completion/completions/${pname}"
install -Dm 755 "${COMPLETION_OUT}/${pname}.fish" "$out/share/fish/vendor_completions.d/${pname}"
'';

View File

@ -38,7 +38,7 @@ in stdenv.mkDerivation rec {
installFlags = [
"PREFIX=$(out)"
"BASHCOMPDIR=$(out)/etc/bash_completion.d"
"BASHCOMPDIR=$(out)/share/bash-completion/completions"
];
postFixup = ''

View File

@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
postPatch = ''
substituteInPlace Makefile \
--replace "BASHCOMPDIR ?= /etc/bash_completion.d" "BASHCOMPDIR ?= $out/etc/bash_completion.d"
--replace "BASHCOMPDIR ?= /etc/bash_completion.d" "BASHCOMPDIR ?= $out/share/bash-completion/completions"
'';
dontBuild = true;

View File

@ -83,8 +83,8 @@ in with localPython.pkgs; buildPythonApplication rec {
];
postInstall = ''
mkdir -p $out/etc/bash_completion.d
mv $out/bin/eb_completion.bash $out/etc/bash_completion.d
mkdir -p $out/share/bash-completion/completions
mv $out/bin/eb_completion.bash $out/share/bash-completion/completions/
'';
meta = with stdenv.lib; {

View File

@ -10,7 +10,7 @@ substituteAll {
inherit utillinux;
postInstall = ''
t=$out/etc/bash_completion.d
t=$out/share/bash-completion/completions
mkdir -p $t
cp ${./nixos-container-completion.sh} $t/nixos-container
'';

View File

@ -511,10 +511,10 @@ let
buildInputs = [ DataDump FileWhich Readonly TestDifferences TestTrap ];
preCheck = "rm t/30cluster.t"; # do not run failing tests
postInstall = ''
mkdir -p $out/etc/bash_completion.d
mkdir -p $out/share/bash-completion/completions
mv $out/bin/clusterssh_bash_completion.dist \
$out/etc/bash_completion.d/clusterssh_bash_completion
substituteInPlace $out/etc/bash_completion.d/clusterssh_bash_completion \
$out/share/bash-completion/completions/clusterssh_bash_completion
substituteInPlace $out/share/bash-completion/completions/clusterssh_bash_completion \
--replace '/bin/true' '${pkgs.coreutils}/bin/true' \
--replace 'grep' '${pkgs.gnugrep}/bin/grep' \
--replace 'sed' '${pkgs.gnused}/bin/sed'