From nobody Wed May 14 16:49:00 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524065136035197.86665989056144; Wed, 18 Apr 2018 08:25:36 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7C3F628203; Wed, 18 Apr 2018 15:25:34 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3C66B805F6; Wed, 18 Apr 2018 15:25:34 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id D54AC4CA99; Wed, 18 Apr 2018 15:25:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3IFPVuM006939 for ; Wed, 18 Apr 2018 11:25:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id 89E447C26; Wed, 18 Apr 2018 15:25:31 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2C8DF1C727 for ; Wed, 18 Apr 2018 15:25:31 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 18 Apr 2018 17:25:21 +0200 Message-Id: <20180418152522.17923-5-abologna@redhat.com> In-Reply-To: <20180418152522.17923-1-abologna@redhat.com> References: <20180418152522.17923-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 4/5] guests: Create ccache symlink farm X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 18 Apr 2018 15:25:35 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" ccache can detect the name it's been called with and transparently invoke the compiler if it matches. The Fedora package uses this trick to enable ccache out of the box, but other operating systems and distributions leave the task up to the user. Replicate the setup in the user's ~/.ccache directory so that it works across all guests. With the linke farm in place, setting $CC in the user's shell profile is no longer necessary. Signed-off-by: Andrea Bolognani --- guests/group_vars/all/main.yml | 2 +- guests/tasks/users.yml | 33 ++++++++++++++++++++++++++++++++- guests/templates/bashrc | 3 --- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/guests/group_vars/all/main.yml b/guests/group_vars/all/main.yml index b364acf..cd8ef25 100644 --- a/guests/group_vars/all/main.yml +++ b/guests/group_vars/all/main.yml @@ -9,7 +9,7 @@ jenkins_url: https://ci.centos.org/computer/{{ inventory_ho= stname }}/slave-agent # Environment variables and paths to commands/files that might be # OS-dependent. Can be overridden on a per-host basis VIRT_PREFIX: $HOME/build/libvirt -PATH: $VIRT_PREFIX/bin:$PATH +PATH: $VIRT_PREFIX/bin:$HOME/.ccache/bin:$PATH C_INCLUDE_PATH: $VIRT_PREFIX/include LD_LIBRARY_PATH: $VIRT_PREFIX/lib PKG_CONFIG_PATH: $VIRT_PREFIX/lib/pkgconfig diff --git a/guests/tasks/users.yml b/guests/tasks/users.yml index e691b32..033ca2a 100644 --- a/guests/tasks/users.yml +++ b/guests/tasks/users.yml @@ -53,10 +53,13 @@ =20 - name: '{{ flavor }}: Configure ccache' file: - path: /home/{{ flavor }}/.ccache + path: /home/{{ flavor }}/.{{ item }} state: directory owner: '{{ flavor }}' group: '{{ flavor }}' + with_items: + - ccache + - ccache/bin =20 - name: '{{ flavor }}: Configure ccache' copy: @@ -65,6 +68,34 @@ owner: '{{ flavor }}' group: '{{ flavor }}' =20 +- name: '{{ flavor }}: Create ccache wrappers' + file: + src: '{{ ccache }}' + dest: /home/{{ flavor }}/.ccache/bin/{{ item }} + state: link + owner: '{{ flavor }}' + group: '{{ flavor }}' + with_items: + - cc + - clang + when: + - ccache !=3D '' + - os_name =3D=3D 'FreeBSD' + +- name: '{{ flavor }}: Create ccache wrappers' + file: + src: '{{ ccache }}' + dest: /home/{{ flavor }}/.ccache/bin/{{ item }} + state: link + owner: '{{ flavor }}' + group: '{{ flavor }}' + with_items: + - cc + - gcc + when: + - ccache !=3D '' + - os_name !=3D 'FreeBSD' + - name: '{{ flavor }}: Create shell profile' template: src: templates/{{ item }} diff --git a/guests/templates/bashrc b/guests/templates/bashrc index 65c82cd..866087e 100644 --- a/guests/templates/bashrc +++ b/guests/templates/bashrc @@ -11,12 +11,9 @@ export OSINFO_SYSTEM_DIR=3D"{{ OSINFO_SYSTEM_DIR }}" export PERL5LIB=3D"{{ PERL5LIB }}" export PYTHONPATH=3D"{{ PYTHONPATH }}" =20 -export CCACHE=3D"{{ ccache }}" export MAKE=3D"{{ make }}" export PYTHON=3D"{{ python }}" =20 -test "$CCACHE" && export CC=3D"$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=3D/usr/local/share/bash-completion/bash_completion.sh --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list