[libvirt] [jenkins-ci PATCH 12/10] guests: Enable bash completion by default

Andrea Bolognani posted 10 patches 7 years, 1 month ago
[libvirt] [jenkins-ci PATCH 12/10] guests: Enable bash completion by default
Posted by Andrea Bolognani 7 years, 1 month ago
In order for bash completion to be available right after login
we need to make sure the corresponding package is installed and,
for FreeBSD only, the enviroment script gets sourced.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
 guests/templates/bashrc          | 5 +++++
 guests/vars/projects/base.yml    | 1 +
 guests/vars/projects/libvirt.yml | 1 -
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/guests/templates/bashrc b/guests/templates/bashrc
index 639a961..e925cd9 100644
--- a/guests/templates/bashrc
+++ b/guests/templates/bashrc
@@ -14,3 +14,8 @@ export PYTHONPATH="{{ PYTHONPATH }}"
 which python3 >/dev/null 2>&1 && export PYTHON="python3" || export PYTHON="python2"
 which gmake >/dev/null 2>&1 && export MAKE="gmake" || export MAKE="make"
 which ccache >/dev/null 2>&1 && export CC="ccache cc"
+
+# Enable bash completion. Only needed on FreeBSD, the system-wide
+# shell profile will take care of it for us everywhere else
+bash_completion=/usr/local/share/bash-completion/bash_completion.sh
+test -f "$bash_completion" && . "$bash_completion"
diff --git a/guests/vars/projects/base.yml b/guests/vars/projects/base.yml
index a0483d8..49d4d2e 100644
--- a/guests/vars/projects/base.yml
+++ b/guests/vars/projects/base.yml
@@ -4,6 +4,7 @@ packages:
   - automake
   - autopoint
   - bash
+  - bash-completion
   - ccache
   - chrony
   - cppi
diff --git a/guests/vars/projects/libvirt.yml b/guests/vars/projects/libvirt.yml
index 9f027f8..598dfc4 100644
--- a/guests/vars/projects/libvirt.yml
+++ b/guests/vars/projects/libvirt.yml
@@ -3,7 +3,6 @@ packages:
   - apparmor
   - augeas
   - avahi
-  - bash-completion
   - cyrus-sasl
   - device-mapper
   - dnsmasq
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [jenkins-ci PATCH 12/10] guests: Enable bash completion by default
Posted by Pavel Hrdina 7 years, 1 month ago
On Fri, Apr 06, 2018 at 05:22:37PM +0200, Andrea Bolognani wrote:
> In order for bash completion to be available right after login
> we need to make sure the corresponding package is installed and,
> for FreeBSD only, the enviroment script gets sourced.
> 
> Signed-off-by: Andrea Bolognani <abologna@redhat.com>
> ---
>  guests/templates/bashrc          | 5 +++++
>  guests/vars/projects/base.yml    | 1 +
>  guests/vars/projects/libvirt.yml | 1 -
>  3 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/guests/templates/bashrc b/guests/templates/bashrc
> index 639a961..e925cd9 100644
> --- a/guests/templates/bashrc
> +++ b/guests/templates/bashrc
> @@ -14,3 +14,8 @@ export PYTHONPATH="{{ PYTHONPATH }}"
>  which python3 >/dev/null 2>&1 && export PYTHON="python3" || export PYTHON="python2"
>  which gmake >/dev/null 2>&1 && export MAKE="gmake" || export MAKE="make"
>  which ccache >/dev/null 2>&1 && export CC="ccache cc"
> +
> +# Enable bash completion. Only needed on FreeBSD, the system-wide
> +# shell profile will take care of it for us everywhere else
> +bash_completion=/usr/local/share/bash-completion/bash_completion.sh
> +test -f "$bash_completion" && . "$bash_completion"
> diff --git a/guests/vars/projects/base.yml b/guests/vars/projects/base.yml
> index a0483d8..49d4d2e 100644
> --- a/guests/vars/projects/base.yml
> +++ b/guests/vars/projects/base.yml
> @@ -4,6 +4,7 @@ packages:
>    - automake
>    - autopoint
>    - bash
> +  - bash-completion
>    - ccache
>    - chrony
>    - cppi
> diff --git a/guests/vars/projects/libvirt.yml b/guests/vars/projects/libvirt.yml
> index 9f027f8..598dfc4 100644
> --- a/guests/vars/projects/libvirt.yml
> +++ b/guests/vars/projects/libvirt.yml
> @@ -3,7 +3,6 @@ packages:
>    - apparmor
>    - augeas
>    - avahi
> -  - bash-completion

I'm not sure about removing it from libvirt dependencies.  I think we
should keep it in both places since it's an extension that improves
testing environment and also it's a dependency of libvirt.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [jenkins-ci PATCH 12/10] guests: Enable bash completion by default
Posted by Andrea Bolognani 7 years, 1 month ago
On Mon, 2018-04-09 at 09:22 +0200, Pavel Hrdina wrote:
[...]
> > diff --git a/guests/vars/projects/base.yml b/guests/vars/projects/base.yml
> > index a0483d8..49d4d2e 100644
> > --- a/guests/vars/projects/base.yml
> > +++ b/guests/vars/projects/base.yml
> > @@ -4,6 +4,7 @@ packages:
> >    - automake
> >    - autopoint
> >    - bash
> > +  - bash-completion
> >    - ccache
> >    - chrony
> >    - cppi
> > diff --git a/guests/vars/projects/libvirt.yml b/guests/vars/projects/libvirt.yml
> > index 9f027f8..598dfc4 100644
> > --- a/guests/vars/projects/libvirt.yml
> > +++ b/guests/vars/projects/libvirt.yml
> > @@ -3,7 +3,6 @@ packages:
> >    - apparmor
> >    - augeas
> >    - avahi
> > -  - bash-completion
> 
> I'm not sure about removing it from libvirt dependencies.  I think we
> should keep it in both places since it's an extension that improves
> testing environment and also it's a dependency of libvirt.

The whole point of 'base' is not having to list packages more than
once: if someone wants to get the full list of dependencies for
building a project, they're going to have to take both those specific
to the project itself and those in base anyway, which is exactly what
I do every time I sync the Travis CI configuration with the CentOS CI
configuration. I don't see any reason to treat bash-completion
differently.

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [jenkins-ci PATCH 12/10] guests: Enable bash completion by default
Posted by Pavel Hrdina 7 years, 1 month ago
On Mon, Apr 09, 2018 at 10:11:23AM +0200, Andrea Bolognani wrote:
> On Mon, 2018-04-09 at 09:22 +0200, Pavel Hrdina wrote:
> [...]
> > > diff --git a/guests/vars/projects/base.yml b/guests/vars/projects/base.yml
> > > index a0483d8..49d4d2e 100644
> > > --- a/guests/vars/projects/base.yml
> > > +++ b/guests/vars/projects/base.yml
> > > @@ -4,6 +4,7 @@ packages:
> > >    - automake
> > >    - autopoint
> > >    - bash
> > > +  - bash-completion
> > >    - ccache
> > >    - chrony
> > >    - cppi
> > > diff --git a/guests/vars/projects/libvirt.yml b/guests/vars/projects/libvirt.yml
> > > index 9f027f8..598dfc4 100644
> > > --- a/guests/vars/projects/libvirt.yml
> > > +++ b/guests/vars/projects/libvirt.yml
> > > @@ -3,7 +3,6 @@ packages:
> > >    - apparmor
> > >    - augeas
> > >    - avahi
> > > -  - bash-completion
> > 
> > I'm not sure about removing it from libvirt dependencies.  I think we
> > should keep it in both places since it's an extension that improves
> > testing environment and also it's a dependency of libvirt.
> 
> The whole point of 'base' is not having to list packages more than
> once: if someone wants to get the full list of dependencies for
> building a project, they're going to have to take both those specific
> to the project itself and those in base anyway, which is exactly what
> I do every time I sync the Travis CI configuration with the CentOS CI
> configuration. I don't see any reason to treat bash-completion
> differently.

OK, good enough :)

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list