On Thu, Jan 25, 2018 at 03:22:20PM +0100, Michal Privoznik wrote:
The bash-completion project documents that only those scripts
from $BASH_COMPLETIONS_DIR that share name with the current
command for which <TAB> was hit are loaded [1]. This means, that
vsh script we have there is not loaded. We have to create
symlinks for virsh and virt-admin.
Good to know, I recall that the completions had their own way how to say for
which commands they can complete, but probably my memory doesn't serve me well.
Also it's not ECC, so...
At the same time, we have to create new RPM package because
virt-admin and client packages are independent. That means we
cannot place the vsh script in either of them. What we can do is
to have a different package that contains the completion script
and then virt-admin and client packages contain only the symlink
and require the bash-completion package.
1:
https://github.com/scop/bash-completion#faq
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
libvirt.spec.in | 24 +++++++++++++++++++++++-
tools/Makefile.am | 7 ++++++-
2 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index f62d7d324..1879e1f8b 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1017,6 +1017,9 @@ Requires: gnutls-utils
# Needed for probing the power management features of the host.
Requires: pm-utils
%endif
+%if %{with_bash_completion}
+Requires: %{name}-bash-completion = %{version}-%{release}
+%endif
%description client
The client binaries needed to access the virtualization
@@ -1041,10 +1044,22 @@ Summary: Set of tools to control libvirt daemon
Group: Development/Libraries
Requires: %{name}-libs = %{version}-%{release}
Requires: readline
+%if %{with_bash_completion}
+Requires: %{name}-bash-completion = %{version}-%{release}
+%endif
%description admin
The client side utilities to control the libvirt daemon.
+%if %{with_bash_completion}
+%package bash-completion
+Summary: Bash completion script
I'd say "Bash completion script for libvirt clients"
+Group: Development/Libraries
+
+%description bash-completion
+Bash completion script stub.
Similarly here, add info that it's for libvirt cli or something.
Otherwise looks good, ACK with those two things fixed.