app-emulation/libvirt: add bashcompletion support
authorMatthias Maier <tamiko@gentoo.org>
Tue, 30 Jan 2018 17:39:01 +0000 (11:39 -0600)
committerMatthias Maier <tamiko@gentoo.org>
Tue, 30 Jan 2018 17:54:56 +0000 (11:54 -0600)
 - also apply two minor bugfixes for version 4.0.0 (hopefully fixed in
   the live version soon.)

Closes: https://bugs.gentoo.org/644632
Package-Manager: Portage-2.3.20, Repoman-2.3.6

app-emulation/libvirt/files/libvirt-4.0.0-bash_completion_bugfixes.patch [new file with mode: 0644]
app-emulation/libvirt/libvirt-4.0.0.ebuild
app-emulation/libvirt/libvirt-9999.ebuild

diff --git a/app-emulation/libvirt/files/libvirt-4.0.0-bash_completion_bugfixes.patch b/app-emulation/libvirt/files/libvirt-4.0.0-bash_completion_bugfixes.patch
new file mode 100644 (file)
index 0000000..65894ed
--- /dev/null
@@ -0,0 +1,42 @@
+https://www.redhat.com/archives/libvir-list/2018-January/msg00903.html
+https://www.redhat.com/archives/libvir-list/2018-January/msg00904.html
+
+diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c
+index e216d9076..e3b8234b4 100644
+--- a/tools/virsh-completer.c
++++ b/tools/virsh-completer.c
+@@ -45,18 +45,11 @@ virshDomainNameCompleter(vshControl *ctl,
+     virCheckFlags(VIR_CONNECT_LIST_DOMAINS_ACTIVE |
+                   VIR_CONNECT_LIST_DOMAINS_INACTIVE |
++                  VIR_CONNECT_LIST_DOMAINS_OTHER |
++                  VIR_CONNECT_LIST_DOMAINS_PAUSED |
+                   VIR_CONNECT_LIST_DOMAINS_PERSISTENT |
+-                  VIR_CONNECT_LIST_DOMAINS_TRANSIENT |
+                   VIR_CONNECT_LIST_DOMAINS_RUNNING |
+-                  VIR_CONNECT_LIST_DOMAINS_PAUSED |
+-                  VIR_CONNECT_LIST_DOMAINS_SHUTOFF |
+-                  VIR_CONNECT_LIST_DOMAINS_OTHER |
+-                  VIR_CONNECT_LIST_DOMAINS_MANAGEDSAVE |
+-                  VIR_CONNECT_LIST_DOMAINS_NO_MANAGEDSAVE |
+-                  VIR_CONNECT_LIST_DOMAINS_AUTOSTART |
+-                  VIR_CONNECT_LIST_DOMAINS_NO_AUTOSTART |
+-                  VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT |
+-                  VIR_CONNECT_LIST_DOMAINS_NO_SNAPSHOT,
++                  VIR_CONNECT_LIST_DOMAINS_SHUTOFF,
+                   NULL);
+     if (!priv->conn || virConnectIsAlive(priv->conn) <= 0)
+diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
+index 0f329d6d7..5a0e0c1b2 100644
+--- a/tools/virsh-domain.c
++++ b/tools/virsh-domain.c
+@@ -1037,7 +1037,7 @@ static const vshCmdInfo info_autostart[] = {
+ };
+ static const vshCmdOptDef opts_autostart[] = {
+-    VIRSH_COMMON_OPT_DOMAIN_FULL(0),
++    VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_PERSISTENT),
+     {.name = "disable",
+      .type = VSH_OT_BOOL,
+      .help = N_("disable autostarting")
index 487691cdac378e035438937fca872687d9c9ed14..1107c986520c8d32cbdd1f3ba5ebf5cd52b0cd14 100644 (file)
@@ -3,7 +3,7 @@
 
 EAPI=6
 
-inherit autotools eutils user linux-info systemd readme.gentoo-r1
+inherit autotools eutils user linux-info systemd readme.gentoo-r1 bash-completion-r1
 
 if [[ ${PV} = *9999* ]]; then
        inherit git-r3
@@ -127,6 +127,7 @@ PATCHES=(
        "${FILESDIR}"/${PN}-3.10.0-r2-fix_paths_for_apparmor.patch
        "${FILESDIR}"/${PN}-1.3.4-glibc-2.23.patch
        "${FILESDIR}"/${PN}-3.1.0-musl-fix-includes.patch          # bug #609488
+       "${FILESDIR}"/${PN}-4.0.0-bash_completion_bugfixes.patch   # bug #644632
 )
 
 pkg_setup() {
@@ -358,6 +359,9 @@ src_install() {
        newconfd "${FILESDIR}/libvirtd.confd-r5" libvirtd || die
        newconfd "${FILESDIR}/libvirt-guests.confd" libvirt-guests || die
 
+       newbashcomp "${S}/tools/bash-completion/vsh" vsh
+       bashcomp_alias vsh virsh virt-admin
+
        DOC_CONTENTS=$(<"${FILESDIR}/README.gentoo-r2")
        DISABLE_AUTOFORMATTING=true
        readme.gentoo_create_doc
index 3716e896837bd2466dfb640065bee8719b4467b6..84ae6b580a782c556e9a58e889e65bfb5d63adf9 100644 (file)
@@ -1,9 +1,9 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
 
-inherit autotools eutils user linux-info systemd readme.gentoo-r1
+inherit autotools eutils user linux-info systemd readme.gentoo-r1 bash-completion-r1
 
 if [[ ${PV} = *9999* ]]; then
        inherit git-r3
@@ -355,6 +355,9 @@ src_install() {
        newconfd "${FILESDIR}/libvirtd.confd-r5" libvirtd || die
        newconfd "${FILESDIR}/libvirt-guests.confd" libvirt-guests || die
 
+       newbashcomp "${S}/tools/bash-completion/vsh" vsh
+       bashcomp_alias vsh virsh virt-admin
+
        DOC_CONTENTS=$(<"${FILESDIR}/README.gentoo-r2")
        DISABLE_AUTOFORMATTING=true
        readme.gentoo_create_doc