[libvirt] [jenkins-ci PATCH 04/10] guests: Move ccache configuration to shell profile

Andrea Bolognani posted 10 patches 7 years, 8 months ago
[libvirt] [jenkins-ci PATCH 04/10] guests: Move ccache configuration to shell profile
Posted by Andrea Bolognani 7 years, 8 months ago
Now that we have our custom shell profile, making sure ccache
is used is way simpler.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
 guests/tasks/users.yml  | 18 ------------------
 guests/templates/bashrc |  2 ++
 2 files changed, 2 insertions(+), 18 deletions(-)

diff --git a/guests/tasks/users.yml b/guests/tasks/users.yml
index 8e59fa9..e691b32 100644
--- a/guests/tasks/users.yml
+++ b/guests/tasks/users.yml
@@ -65,24 +65,6 @@
     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
-
 - name: '{{ flavor }}: Create shell profile'
   template:
     src: templates/{{ item }}
diff --git a/guests/templates/bashrc b/guests/templates/bashrc
index 6640da6..51d0e64 100644
--- a/guests/templates/bashrc
+++ b/guests/templates/bashrc
@@ -1 +1,3 @@
 export PS1="[\u@\h \w]\$ "
+
+which ccache >/dev/null 2>&1 && export CC="ccache cc"
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [jenkins-ci PATCH 04/10] guests: Move ccache configuration to shell profile
Posted by Daniel P. Berrangé 7 years, 8 months ago
On Thu, Apr 05, 2018 at 02:22:14PM +0200, Andrea Bolognani wrote:
> Now that we have our custom shell profile, making sure ccache
> is used is way simpler.
> 
> Signed-off-by: Andrea Bolognani <abologna@redhat.com>
> ---
>  guests/tasks/users.yml  | 18 ------------------
>  guests/templates/bashrc |  2 ++
>  2 files changed, 2 insertions(+), 18 deletions(-)
> 
> diff --git a/guests/tasks/users.yml b/guests/tasks/users.yml
> index 8e59fa9..e691b32 100644
> --- a/guests/tasks/users.yml
> +++ b/guests/tasks/users.yml
> @@ -65,24 +65,6 @@
>      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
> -
>  - name: '{{ flavor }}: Create shell profile'
>    template:
>      src: templates/{{ item }}
> diff --git a/guests/templates/bashrc b/guests/templates/bashrc
> index 6640da6..51d0e64 100644
> --- a/guests/templates/bashrc
> +++ b/guests/templates/bashrc
> @@ -1 +1,3 @@
>  export PS1="[\u@\h \w]\$ "
> +
> +which ccache >/dev/null 2>&1 && export CC="ccache cc"

IIUC, this appears to have broken the Go compiler. Unsetting 'CC' makes
it work again. IIUC this wasn't a problem with normal Fedora setup for
ccache, because that doesn't set 'CC', it just puts the ccache 'gcc'
binary into $PATH.

It looks like its a limitation of "Go" - it doesn't like it when
"CC" contains multiple words - it drops everything except the first
word. So when we set CC="ccache cc", go just runs "ccache $args"
instead of "ccache cc $args"


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 04/10] guests: Move ccache configuration to shell profile
Posted by Andrea Bolognani 7 years, 8 months ago
On Thu, 2018-04-12 at 13:09 +0100, Daniel P. Berrangé wrote:
> IIUC, this appears to have broken the Go compiler. Unsetting 'CC' makes
> it work again. IIUC this wasn't a problem with normal Fedora setup for
> ccache, because that doesn't set 'CC', it just puts the ccache 'gcc'
> binary into $PATH.
> 
> It looks like its a limitation of "Go" - it doesn't like it when
> "CC" contains multiple words - it drops everything except the first
> word. So when we set CC="ccache cc", go just runs "ccache $args"
> instead of "ccache cc $args"

MinGW (or at least the way we do MinGW builds) has a similar issue.

I've posted a workaround:

  https://www.redhat.com/archives/libvir-list/2018-April/msg01000.html

-- 
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 04/10] guests: Move ccache configuration to shell profile
Posted by Pavel Hrdina 7 years, 8 months ago
On Thu, Apr 05, 2018 at 02:22:14PM +0200, Andrea Bolognani wrote:
> Now that we have our custom shell profile, making sure ccache
> is used is way simpler.
> 
> Signed-off-by: Andrea Bolognani <abologna@redhat.com>
> ---
>  guests/tasks/users.yml  | 18 ------------------
>  guests/templates/bashrc |  2 ++
>  2 files changed, 2 insertions(+), 18 deletions(-)

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