[libvirt] [jenkins-ci PATCH] guests: Enable ccache

Andrea Bolognani posted 1 patch 6 years, 1 month ago
Failed in applying to current master (apply log)
guests/tasks/users.yml | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
[libvirt] [jenkins-ci PATCH] guests: Enable ccache
Posted by Andrea Bolognani 6 years, 1 month ago
We install ccache on all guests where it's available, but
Fedora is the only one actually using it at the moment,
because it enables it automatically.

Tweak the user's profile so that compilation will use ccache
if it's installed.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
 guests/tasks/users.yml | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/guests/tasks/users.yml b/guests/tasks/users.yml
index 87693e0..1ecacee 100644
--- a/guests/tasks/users.yml
+++ b/guests/tasks/users.yml
@@ -64,3 +64,21 @@
     dest: /home/{{ flavor }}/.ccache/ccache.conf
     owner: '{{ flavor }}'
     group: '{{ flavor }}'
+
+- name: '{{ flavor }}: Enable ccache'
+  lineinfile:
+    path: /home/{{ flavor }}/.profile
+    line: 'which ccache >/dev/null 2>&1 && export CC="ccache cc"'
+    state: present
+    owner: '{{ flavor }}'
+    group: '{{ flavor }}'
+    create: yes
+
+- name: '{{ flavor }}: Enable ccache'
+  lineinfile:
+    path: /home/{{ flavor }}/.bashrc
+    line: 'which ccache >/dev/null 2>&1 && export CC="ccache cc"'
+    state: present
+    owner: '{{ flavor }}'
+    group: '{{ flavor }}'
+    create: yes
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [jenkins-ci PATCH] guests: Enable ccache
Posted by Daniel P. Berrangé 6 years, 1 month ago
On Fri, Mar 23, 2018 at 10:41:55AM +0100, Andrea Bolognani wrote:
> We install ccache on all guests where it's available, but
> Fedora is the only one actually using it at the moment,
> because it enables it automatically.
> 
> Tweak the user's profile so that compilation will use ccache
> if it's installed.
> 
> Signed-off-by: Andrea Bolognani <abologna@redhat.com>
> ---
>  guests/tasks/users.yml | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/guests/tasks/users.yml b/guests/tasks/users.yml
> index 87693e0..1ecacee 100644
> --- a/guests/tasks/users.yml
> +++ b/guests/tasks/users.yml
> @@ -64,3 +64,21 @@
>      dest: /home/{{ flavor }}/.ccache/ccache.conf
>      owner: '{{ flavor }}'
>      group: '{{ flavor }}'
> +
> +- name: '{{ flavor }}: Enable ccache'
> +  lineinfile:
> +    path: /home/{{ flavor }}/.profile
> +    line: 'which ccache >/dev/null 2>&1 && export CC="ccache cc"'
> +    state: present
> +    owner: '{{ flavor }}'
> +    group: '{{ flavor }}'
> +    create: yes
> +
> +- name: '{{ flavor }}: Enable ccache'
> +  lineinfile:
> +    path: /home/{{ flavor }}/.bashrc
> +    line: 'which ccache >/dev/null 2>&1 && export CC="ccache cc"'
> +    state: present
> +    owner: '{{ flavor }}'
> +    group: '{{ flavor }}'
> +    create: yes

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


FWIW, Fedra achieves this by modifying PATH instead of setting CC. Don't
see a significant difference / benefit to that though.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [jenkins-ci PATCH] guests: Enable ccache
Posted by Andrea Bolognani 6 years, 1 month ago
On Tue, 2018-03-27 at 13:58 +0100, Daniel P. Berrangé wrote:
> On Fri, Mar 23, 2018 at 10:41:55AM +0100, Andrea Bolognani wrote:
> > We install ccache on all guests where it's available, but
> > Fedora is the only one actually using it at the moment,
> > because it enables it automatically.
> > 
> > Tweak the user's profile so that compilation will use ccache
> > if it's installed.
> 
> FWIW, Fedra achieves this by modifying PATH instead of setting CC. Don't
> see a significant difference / benefit to that though.

It works more transparently, I guess. However, it requires a link
farm to be created, which is fine when the ccache package itself
ships it (as is the case in Fedora), but I wouldn't necessarily
want to reimplement that here :)

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list