[libvirt-jenkins-ci PATCH 0/7] lcitool: Create and expose ccache wrappers

This series makes ccache work out of the box for container-based builds. Most of it is refactoring. Applies on top of https://www.redhat.com/archives/libvir-list/2020-March/msg01263.html Andrea Bolognani (7): lcitool: Improve ccache symlinks creation lcitool: Configure ccache using environment variables lcitool: Create ccache wrappers outside of $HOME lcitool: Refactor cross_arch handling a bit lcitool: Use commands[] for deb-based distros lcitool: Use cross_commands[] for all distros lcitool: Create and expose ccache wrappers guests/host_vars/libvirt-centos-7/main.yml | 1 + guests/host_vars/libvirt-centos-8/main.yml | 1 + guests/host_vars/libvirt-debian-10/main.yml | 1 + guests/host_vars/libvirt-debian-9/main.yml | 1 + guests/host_vars/libvirt-debian-sid/main.yml | 1 + guests/host_vars/libvirt-fedora-30/main.yml | 1 + guests/host_vars/libvirt-fedora-31/main.yml | 1 + .../host_vars/libvirt-fedora-rawhide/main.yml | 1 + guests/host_vars/libvirt-freebsd-11/main.yml | 1 + guests/host_vars/libvirt-freebsd-12/main.yml | 1 + .../libvirt-freebsd-current/main.yml | 1 + .../host_vars/libvirt-opensuse-151/main.yml | 1 + guests/host_vars/libvirt-ubuntu-1604/main.yml | 1 + guests/host_vars/libvirt-ubuntu-1804/main.yml | 1 + guests/lcitool | 92 +++++++++++-------- guests/playbooks/update/main.yml | 1 + guests/playbooks/update/tasks/global.yml | 14 +++ guests/playbooks/update/tasks/users.yml | 45 --------- guests/playbooks/update/templates/bashrc.j2 | 3 +- .../playbooks/update/templates/ccache.conf.j2 | 1 - 20 files changed, 87 insertions(+), 83 deletions(-) create mode 100644 guests/playbooks/update/tasks/global.yml delete mode 100644 guests/playbooks/update/templates/ccache.conf.j2 -- 2.25.1

Instead of having the same code snippet twice, once for Linux and once for FreeBSD, the only actual difference being the name of the compiler, include the compiler's path in the inventory among other paths and then figure out the correct name for the symlink based on that information. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- guests/host_vars/libvirt-centos-7/main.yml | 1 + guests/host_vars/libvirt-centos-8/main.yml | 1 + guests/host_vars/libvirt-debian-10/main.yml | 1 + guests/host_vars/libvirt-debian-9/main.yml | 1 + guests/host_vars/libvirt-debian-sid/main.yml | 1 + guests/host_vars/libvirt-fedora-30/main.yml | 1 + guests/host_vars/libvirt-fedora-31/main.yml | 1 + .../host_vars/libvirt-fedora-rawhide/main.yml | 1 + guests/host_vars/libvirt-freebsd-11/main.yml | 1 + guests/host_vars/libvirt-freebsd-12/main.yml | 1 + .../libvirt-freebsd-current/main.yml | 1 + .../host_vars/libvirt-opensuse-151/main.yml | 1 + guests/host_vars/libvirt-ubuntu-1604/main.yml | 1 + guests/host_vars/libvirt-ubuntu-1804/main.yml | 1 + guests/playbooks/update/tasks/users.yml | 19 +------------------ 15 files changed, 15 insertions(+), 18 deletions(-) diff --git a/guests/host_vars/libvirt-centos-7/main.yml b/guests/host_vars/libvirt-centos-7/main.yml index 7f22d9d..f1fef44 100644 --- a/guests/host_vars/libvirt-centos-7/main.yml +++ b/guests/host_vars/libvirt-centos-7/main.yml @@ -21,6 +21,7 @@ os_name: 'CentOS' os_version: '7' bash: /bin/bash +cc: /usr/bin/gcc ccache: /usr/bin/ccache java: /usr/bin/java make: /usr/bin/make diff --git a/guests/host_vars/libvirt-centos-8/main.yml b/guests/host_vars/libvirt-centos-8/main.yml index bcf4224..48edb78 100644 --- a/guests/host_vars/libvirt-centos-8/main.yml +++ b/guests/host_vars/libvirt-centos-8/main.yml @@ -21,6 +21,7 @@ os_name: 'CentOS' os_version: '8' bash: /bin/bash +cc: /usr/bin/gcc ccache: /usr/bin/ccache java: /usr/bin/java make: /usr/bin/make diff --git a/guests/host_vars/libvirt-debian-10/main.yml b/guests/host_vars/libvirt-debian-10/main.yml index 88e1634..37036e6 100644 --- a/guests/host_vars/libvirt-debian-10/main.yml +++ b/guests/host_vars/libvirt-debian-10/main.yml @@ -23,6 +23,7 @@ os_name: 'Debian' os_version: '10' bash: /bin/bash +cc: /usr/bin/gcc ccache: /usr/bin/ccache java: /usr/bin/java make: /usr/bin/make diff --git a/guests/host_vars/libvirt-debian-9/main.yml b/guests/host_vars/libvirt-debian-9/main.yml index a6f1a56..b46efd1 100644 --- a/guests/host_vars/libvirt-debian-9/main.yml +++ b/guests/host_vars/libvirt-debian-9/main.yml @@ -23,6 +23,7 @@ os_name: 'Debian' os_version: '9' bash: /bin/bash +cc: /usr/bin/gcc ccache: /usr/bin/ccache java: /usr/bin/java make: /usr/bin/make diff --git a/guests/host_vars/libvirt-debian-sid/main.yml b/guests/host_vars/libvirt-debian-sid/main.yml index 5dd51ff..36045cd 100644 --- a/guests/host_vars/libvirt-debian-sid/main.yml +++ b/guests/host_vars/libvirt-debian-sid/main.yml @@ -23,6 +23,7 @@ os_name: 'Debian' os_version: 'Sid' bash: /bin/bash +cc: /usr/bin/gcc ccache: /usr/bin/ccache java: /usr/bin/java make: /usr/bin/make diff --git a/guests/host_vars/libvirt-fedora-30/main.yml b/guests/host_vars/libvirt-fedora-30/main.yml index a15aff2..71b8e7b 100644 --- a/guests/host_vars/libvirt-fedora-30/main.yml +++ b/guests/host_vars/libvirt-fedora-30/main.yml @@ -36,6 +36,7 @@ os_name: 'Fedora' os_version: '30' bash: /bin/bash +cc: /usr/bin/gcc ccache: /usr/bin/ccache java: /usr/bin/java make: /usr/bin/make diff --git a/guests/host_vars/libvirt-fedora-31/main.yml b/guests/host_vars/libvirt-fedora-31/main.yml index 4be1a19..c692715 100644 --- a/guests/host_vars/libvirt-fedora-31/main.yml +++ b/guests/host_vars/libvirt-fedora-31/main.yml @@ -24,6 +24,7 @@ os_name: 'Fedora' os_version: '31' bash: /bin/bash +cc: /usr/bin/gcc ccache: /usr/bin/ccache java: /usr/bin/java make: /usr/bin/make diff --git a/guests/host_vars/libvirt-fedora-rawhide/main.yml b/guests/host_vars/libvirt-fedora-rawhide/main.yml index 3a79a3a..bea4ad1 100644 --- a/guests/host_vars/libvirt-fedora-rawhide/main.yml +++ b/guests/host_vars/libvirt-fedora-rawhide/main.yml @@ -24,6 +24,7 @@ os_name: 'Fedora' os_version: 'Rawhide' bash: /bin/bash +cc: /usr/bin/gcc ccache: /usr/bin/ccache java: /usr/bin/java make: /usr/bin/make diff --git a/guests/host_vars/libvirt-freebsd-11/main.yml b/guests/host_vars/libvirt-freebsd-11/main.yml index 6234e8a..7fbab39 100644 --- a/guests/host_vars/libvirt-freebsd-11/main.yml +++ b/guests/host_vars/libvirt-freebsd-11/main.yml @@ -22,6 +22,7 @@ os_name: 'FreeBSD' os_version: '11' bash: /usr/local/bin/bash +cc: /usr/bin/clang ccache: /usr/local/bin/ccache java: /usr/local/bin/java make: /usr/local/bin/gmake diff --git a/guests/host_vars/libvirt-freebsd-12/main.yml b/guests/host_vars/libvirt-freebsd-12/main.yml index 22a3697..abedd95 100644 --- a/guests/host_vars/libvirt-freebsd-12/main.yml +++ b/guests/host_vars/libvirt-freebsd-12/main.yml @@ -22,6 +22,7 @@ os_name: 'FreeBSD' os_version: '12' bash: /usr/local/bin/bash +cc: /usr/bin/clang ccache: /usr/local/bin/ccache java: /usr/local/bin/java make: /usr/local/bin/gmake diff --git a/guests/host_vars/libvirt-freebsd-current/main.yml b/guests/host_vars/libvirt-freebsd-current/main.yml index fdc7e9b..9b0ba1f 100644 --- a/guests/host_vars/libvirt-freebsd-current/main.yml +++ b/guests/host_vars/libvirt-freebsd-current/main.yml @@ -22,6 +22,7 @@ os_name: 'FreeBSD' os_version: 'Current' bash: /usr/local/bin/bash +cc: /usr/bin/clang ccache: /usr/local/bin/ccache java: /usr/local/bin/java make: /usr/local/bin/gmake diff --git a/guests/host_vars/libvirt-opensuse-151/main.yml b/guests/host_vars/libvirt-opensuse-151/main.yml index bcc5ca3..3e674cc 100644 --- a/guests/host_vars/libvirt-opensuse-151/main.yml +++ b/guests/host_vars/libvirt-opensuse-151/main.yml @@ -22,6 +22,7 @@ os_name: 'OpenSUSE' os_version: '151' bash: /bin/bash +cc: /usr/bin/gcc ccache: /usr/bin/ccache java: /usr/bin/java make: /usr/bin/make diff --git a/guests/host_vars/libvirt-ubuntu-1604/main.yml b/guests/host_vars/libvirt-ubuntu-1604/main.yml index b474264..1eb2345 100644 --- a/guests/host_vars/libvirt-ubuntu-1604/main.yml +++ b/guests/host_vars/libvirt-ubuntu-1604/main.yml @@ -22,6 +22,7 @@ os_name: 'Ubuntu' os_version: '1604' bash: /bin/bash +cc: /usr/bin/gcc ccache: /usr/bin/ccache java: /usr/bin/java make: /usr/bin/make diff --git a/guests/host_vars/libvirt-ubuntu-1804/main.yml b/guests/host_vars/libvirt-ubuntu-1804/main.yml index ddfeef2..c9515b6 100644 --- a/guests/host_vars/libvirt-ubuntu-1804/main.yml +++ b/guests/host_vars/libvirt-ubuntu-1804/main.yml @@ -23,6 +23,7 @@ os_name: 'Ubuntu' os_version: '1804' bash: /bin/bash +cc: /usr/bin/gcc ccache: /usr/bin/ccache java: /usr/bin/java make: /usr/bin/make diff --git a/guests/playbooks/update/tasks/users.yml b/guests/playbooks/update/tasks/users.yml index a6fb0aa..5d202b3 100644 --- a/guests/playbooks/update/tasks/users.yml +++ b/guests/playbooks/update/tasks/users.yml @@ -79,24 +79,7 @@ group: '{{ flavor }}' with_items: - cc - - clang - when: - - ccache != '' - - os_name == '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 != '' - - os_name != 'FreeBSD' + - '{{ cc | basename }}' - name: '{{ flavor }}: Create shell profile' template: -- 2.25.1

On Fri, Mar 27, 2020 at 08:34:53PM +0100, Andrea Bolognani wrote:
Instead of having the same code snippet twice, once for Linux and once for FreeBSD, the only actual difference being the name of the compiler, include the compiler's path in the inventory among other paths and then figure out the correct name for the symlink based on that information.
Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- guests/host_vars/libvirt-centos-7/main.yml | 1 + guests/host_vars/libvirt-centos-8/main.yml | 1 + guests/host_vars/libvirt-debian-10/main.yml | 1 + guests/host_vars/libvirt-debian-9/main.yml | 1 + guests/host_vars/libvirt-debian-sid/main.yml | 1 + guests/host_vars/libvirt-fedora-30/main.yml | 1 + guests/host_vars/libvirt-fedora-31/main.yml | 1 + .../host_vars/libvirt-fedora-rawhide/main.yml | 1 + guests/host_vars/libvirt-freebsd-11/main.yml | 1 + guests/host_vars/libvirt-freebsd-12/main.yml | 1 + .../libvirt-freebsd-current/main.yml | 1 + .../host_vars/libvirt-opensuse-151/main.yml | 1 + guests/host_vars/libvirt-ubuntu-1604/main.yml | 1 + guests/host_vars/libvirt-ubuntu-1804/main.yml | 1 + guests/playbooks/update/tasks/users.yml | 19 +------------------ 15 files changed, 15 insertions(+), 18 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> 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 :|

We're going to stop creating $HOME/.ccache soon, so we need an alternative way to configure ccache; environment variables work perfectly fine. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- guests/playbooks/update/tasks/users.yml | 7 ------- guests/playbooks/update/templates/bashrc.j2 | 1 + guests/playbooks/update/templates/ccache.conf.j2 | 1 - 3 files changed, 1 insertion(+), 8 deletions(-) delete mode 100644 guests/playbooks/update/templates/ccache.conf.j2 diff --git a/guests/playbooks/update/tasks/users.yml b/guests/playbooks/update/tasks/users.yml index 5d202b3..931d79b 100644 --- a/guests/playbooks/update/tasks/users.yml +++ b/guests/playbooks/update/tasks/users.yml @@ -63,13 +63,6 @@ - ccache - ccache/bin -- name: '{{ flavor }}: Configure ccache' - template: - src: '{{ playbook_base }}/templates/ccache.conf.j2' - dest: /home/{{ flavor }}/.ccache/ccache.conf - owner: '{{ flavor }}' - group: '{{ flavor }}' - - name: '{{ flavor }}: Create ccache wrappers' file: src: '{{ ccache }}' diff --git a/guests/playbooks/update/templates/bashrc.j2 b/guests/playbooks/update/templates/bashrc.j2 index 9cea90c..898d30b 100644 --- a/guests/playbooks/update/templates/bashrc.j2 +++ b/guests/playbooks/update/templates/bashrc.j2 @@ -5,6 +5,7 @@ export NINJA="{{ ninja }}" export PYTHON="{{ python }}" export MAKEFLAGS="-j{{ install_vcpus|int + 1 }}" +export CCACHE_MAXSIZE="2G" export VIRT_PREFIX="$HOME/build/libvirt" export PATH="$VIRT_PREFIX/bin:$HOME/.ccache/bin:$PATH" diff --git a/guests/playbooks/update/templates/ccache.conf.j2 b/guests/playbooks/update/templates/ccache.conf.j2 deleted file mode 100644 index 48c3756..0000000 --- a/guests/playbooks/update/templates/ccache.conf.j2 +++ /dev/null @@ -1 +0,0 @@ -max_size = 2G -- 2.25.1

On Fri, Mar 27, 2020 at 08:34:54PM +0100, Andrea Bolognani wrote:
We're going to stop creating $HOME/.ccache soon, so we need an alternative way to configure ccache; environment variables work perfectly fine.
Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- guests/playbooks/update/tasks/users.yml | 7 ------- guests/playbooks/update/templates/bashrc.j2 | 1 + guests/playbooks/update/templates/ccache.conf.j2 | 1 - 3 files changed, 1 insertion(+), 8 deletions(-) delete mode 100644 guests/playbooks/update/templates/ccache.conf.j2
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
diff --git a/guests/playbooks/update/templates/bashrc.j2 b/guests/playbooks/update/templates/bashrc.j2 index 9cea90c..898d30b 100644 --- a/guests/playbooks/update/templates/bashrc.j2 +++ b/guests/playbooks/update/templates/bashrc.j2 @@ -5,6 +5,7 @@ export NINJA="{{ ninja }}" export PYTHON="{{ python }}"
export MAKEFLAGS="-j{{ install_vcpus|int + 1 }}" +export CCACHE_MAXSIZE="2G"
I was wondering what a good size for ccache would be. Is there any history to why we picked 2G ? Having it too big didn't really matter for the Jenkins builders as it is kept local. For GitLab the cache is downloaded at start of the job off cloud cstorage. So we want it large enough to fit a libvirt.git compile but small enough that outdated cruft gets purged reasonably quickly, so we don't waste time in GitLab CI downloading GB's of data that is no longer needed in the cache. NB, this is NOT an objection to this patch, as 2GB is a pre-existing value we used. Just want to know how we should consider tuning it in future. 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 :|

On Mon, 2020-03-30 at 12:45 +0100, Daniel P. Berrangé wrote:
On Fri, Mar 27, 2020 at 08:34:54PM +0100, Andrea Bolognani wrote:
+export CCACHE_MAXSIZE="2G"
I was wondering what a good size for ccache would be. Is there any history to why we picked 2G ? Having it too big didn't really matter for the Jenkins builders as it is kept local. For GitLab the cache is downloaded at start of the job off cloud cstorage. So we want it large enough to fit a libvirt.git compile but small enough that outdated cruft gets purged reasonably quickly, so we don't waste time in GitLab CI downloading GB's of data that is no longer needed in the cache.
NB, this is NOT an objection to this patch, as 2GB is a pre-existing value we used. Just want to know how we should consider tuning it in future.
I think we just scaled it down (from the default of 5 GiB) so that it would use most of the disk space that remained free in the VM's 15 GiB disk, while leaving some leeway to allow for repositories to grow. Nothing more scientific than that, I'm afraid. Note that, for VMs, we're building not just libvirt but a bunch of other projects, so if we wanted to tweak it we'd have to take that into account as well and not size it for just libvirt itself. -- Andrea Bolognani / Red Hat / Virtualization

On Mon, Mar 30, 2020 at 02:11:29PM +0200, Andrea Bolognani wrote:
On Mon, 2020-03-30 at 12:45 +0100, Daniel P. Berrangé wrote:
On Fri, Mar 27, 2020 at 08:34:54PM +0100, Andrea Bolognani wrote:
+export CCACHE_MAXSIZE="2G"
I was wondering what a good size for ccache would be. Is there any history to why we picked 2G ? Having it too big didn't really matter for the Jenkins builders as it is kept local. For GitLab the cache is downloaded at start of the job off cloud cstorage. So we want it large enough to fit a libvirt.git compile but small enough that outdated cruft gets purged reasonably quickly, so we don't waste time in GitLab CI downloading GB's of data that is no longer needed in the cache.
NB, this is NOT an objection to this patch, as 2GB is a pre-existing value we used. Just want to know how we should consider tuning it in future.
I think we just scaled it down (from the default of 5 GiB) so that it would use most of the disk space that remained free in the VM's 15 GiB disk, while leaving some leeway to allow for repositories to grow. Nothing more scientific than that, I'm afraid.
Ok, I'll see if I can get some usage stats out of ccache for our CI jobs on GitLab.
Note that, for VMs, we're building not just libvirt but a bunch of other projects, so if we wanted to tweak it we'd have to take that into account as well and not size it for just libvirt itself.
True, but I imagine in terms of object size all the other projects probably barely reach 5% of the main libvirt.git build size, so likely lost in the noise. 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 :|

On Mon, Mar 30, 2020 at 01:18:49PM +0100, Daniel P. Berrangé wrote:
On Mon, Mar 30, 2020 at 02:11:29PM +0200, Andrea Bolognani wrote:
On Mon, 2020-03-30 at 12:45 +0100, Daniel P. Berrangé wrote:
On Fri, Mar 27, 2020 at 08:34:54PM +0100, Andrea Bolognani wrote:
+export CCACHE_MAXSIZE="2G"
I was wondering what a good size for ccache would be. Is there any history to why we picked 2G ? Having it too big didn't really matter for the Jenkins builders as it is kept local. For GitLab the cache is downloaded at start of the job off cloud cstorage. So we want it large enough to fit a libvirt.git compile but small enough that outdated cruft gets purged reasonably quickly, so we don't waste time in GitLab CI downloading GB's of data that is no longer needed in the cache.
NB, this is NOT an objection to this patch, as 2GB is a pre-existing value we used. Just want to know how we should consider tuning it in future.
I think we just scaled it down (from the default of 5 GiB) so that it would use most of the disk space that remained free in the VM's 15 GiB disk, while leaving some leeway to allow for repositories to grow. Nothing more scientific than that, I'm afraid.
Ok, I'll see if I can get some usage stats out of ccache for our CI jobs on GitLab.
Note that, for VMs, we're building not just libvirt but a bunch of other projects, so if we wanted to tweak it we'd have to take that into account as well and not size it for just libvirt itself.
True, but I imagine in terms of object size all the other projects probably barely reach 5% of the main libvirt.git build size, so likely lost in the noise.
The cache size that able to cover other libvirt-related projects which we currently cover in jenkins is IMO a bit irrelevant in the context of gitlab, because each project has their own namespace and their own pipeline, I've heard from crosa (on CC) that inter-project pipeline dependencies exist to some extend although such executions were not very reliable. Regarding the efforts moving all workloads we can to gitlab from other sources of CI, solving the current setup that we have in jenkins is going to be a challenge as I don't think libvirt as a project on gitlab should run builds for other projects, they can do it for themselves, we can and should only provide a base they can consume for their upstream build tests. Erik

Having the wrappers inside $HOME works fine when we have control over which user will run the build, as is the case for the current Jenkins-based environment, but not when the user is chosen by an external entity, as is the case for container-based builds. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- guests/playbooks/update/main.yml | 1 + guests/playbooks/update/tasks/global.yml | 14 ++++++++++++++ guests/playbooks/update/tasks/users.yml | 21 --------------------- guests/playbooks/update/templates/bashrc.j2 | 2 +- 4 files changed, 16 insertions(+), 22 deletions(-) create mode 100644 guests/playbooks/update/tasks/global.yml diff --git a/guests/playbooks/update/main.yml b/guests/playbooks/update/main.yml index 107a78a..a5a4de8 100644 --- a/guests/playbooks/update/main.yml +++ b/guests/playbooks/update/main.yml @@ -51,6 +51,7 @@ - include: '{{ playbook_base }}/tasks/kludges.yml' - include: '{{ playbook_base }}/tasks/bootloader.yml' - include: '{{ playbook_base }}/tasks/services.yml' + - include: '{{ playbook_base }}/tasks/global.yml' - include: '{{ playbook_base }}/tasks/users.yml' # Configure the Jenkins agent diff --git a/guests/playbooks/update/tasks/global.yml b/guests/playbooks/update/tasks/global.yml new file mode 100644 index 0000000..504a549 --- /dev/null +++ b/guests/playbooks/update/tasks/global.yml @@ -0,0 +1,14 @@ +--- +- name: 'Create ccache wrappers' + file: + path: /usr/local/share/ccache-wrappers + state: directory + +- name: 'Create ccache wrappers' + file: + src: '{{ ccache }}' + dest: /usr/local/share/ccache-wrappers/{{ item }} + state: link + with_items: + - cc + - '{{ cc | basename }}' diff --git a/guests/playbooks/update/tasks/users.yml b/guests/playbooks/update/tasks/users.yml index 931d79b..30e5fca 100644 --- a/guests/playbooks/update/tasks/users.yml +++ b/guests/playbooks/update/tasks/users.yml @@ -53,27 +53,6 @@ when: - flavor == 'test' -- name: '{{ flavor }}: Configure ccache' - file: - path: /home/{{ flavor }}/.{{ item }} - state: directory - owner: '{{ flavor }}' - group: '{{ flavor }}' - with_items: - - ccache - - ccache/bin - -- name: '{{ flavor }}: Create ccache wrappers' - file: - src: '{{ ccache }}' - dest: /home/{{ flavor }}/.ccache/bin/{{ item }} - state: link - owner: '{{ flavor }}' - group: '{{ flavor }}' - with_items: - - cc - - '{{ cc | basename }}' - - name: '{{ flavor }}: Create shell profile' template: src: '{{ playbook_base }}/templates/{{ item }}.j2' diff --git a/guests/playbooks/update/templates/bashrc.j2 b/guests/playbooks/update/templates/bashrc.j2 index 898d30b..77c8fb8 100644 --- a/guests/playbooks/update/templates/bashrc.j2 +++ b/guests/playbooks/update/templates/bashrc.j2 @@ -8,7 +8,7 @@ export MAKEFLAGS="-j{{ install_vcpus|int + 1 }}" export CCACHE_MAXSIZE="2G" export VIRT_PREFIX="$HOME/build/libvirt" -export PATH="$VIRT_PREFIX/bin:$HOME/.ccache/bin:$PATH" +export PATH="$VIRT_PREFIX/bin:/usr/local/share/ccache-wrappers:$PATH" export C_INCLUDE_PATH="$VIRT_PREFIX/include" export LD_LIBRARY_PATH="$VIRT_PREFIX/lib" export PKG_CONFIG_PATH="$VIRT_PREFIX/lib/pkgconfig" -- 2.25.1

On Fri, Mar 27, 2020 at 08:34:55PM +0100, Andrea Bolognani wrote:
Having the wrappers inside $HOME works fine when we have control over which user will run the build, as is the case for the current Jenkins-based environment, but not when the user is chosen by an external entity, as is the case for container-based builds.
Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- guests/playbooks/update/main.yml | 1 + guests/playbooks/update/tasks/global.yml | 14 ++++++++++++++ guests/playbooks/update/tasks/users.yml | 21 --------------------- guests/playbooks/update/templates/bashrc.j2 | 2 +- 4 files changed, 16 insertions(+), 22 deletions(-) create mode 100644 guests/playbooks/update/tasks/global.yml
diff --git a/guests/playbooks/update/tasks/global.yml b/guests/playbooks/update/tasks/global.yml new file mode 100644 index 0000000..504a549 --- /dev/null +++ b/guests/playbooks/update/tasks/global.yml @@ -0,0 +1,14 @@ +--- +- name: 'Create ccache wrappers' + file: + path: /usr/local/share/ccache-wrappers + state: directory
I weakly suggest "/usr/local/share/ccache/bin" Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> 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 :|

On Mon, 2020-03-30 at 12:47 +0100, Daniel P. Berrangé wrote:
On Fri, Mar 27, 2020 at 08:34:55PM +0100, Andrea Bolognani wrote:
+- name: 'Create ccache wrappers' + file: + path: /usr/local/share/ccache-wrappers + state: directory
I weakly suggest "/usr/local/share/ccache/bin"
I thought about that path, but then decided against it because /usr/local/share/ccache belongs to the ccache package itself on FreeBSD (which install all ports under /usr/local) and even on Linux when installing it from source without overriding the default prefix, so even though there would be no conflicts right now I'd rather steer clear of it. I also considered /usr/libexec/ccache-wrappers - what would you think of that option? -- Andrea Bolognani / Red Hat / Virtualization

On Mon, Mar 30, 2020 at 02:17:15PM +0200, Andrea Bolognani wrote:
On Mon, 2020-03-30 at 12:47 +0100, Daniel P. Berrangé wrote:
On Fri, Mar 27, 2020 at 08:34:55PM +0100, Andrea Bolognani wrote:
+- name: 'Create ccache wrappers' + file: + path: /usr/local/share/ccache-wrappers + state: directory
I weakly suggest "/usr/local/share/ccache/bin"
I thought about that path, but then decided against it because /usr/local/share/ccache belongs to the ccache package itself on FreeBSD (which install all ports under /usr/local) and even on Linux when installing it from source without overriding the default prefix, so even though there would be no conflicts right now I'd rather steer clear of it.
Ah ok, I forgot FreeBSD puts ports into /usr/local.
I also considered /usr/libexec/ccache-wrappers - what would you think of that option?
I don't mind either that or your original 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 :|

On Mon, 2020-03-30 at 13:19 +0100, Daniel P. Berrangé wrote:
On Mon, Mar 30, 2020 at 02:17:15PM +0200, Andrea Bolognani wrote:
I also considered /usr/libexec/ccache-wrappers - what would you think of that option?
I don't mind either that or your original
Okay, I'll go with /usr/libexec then because it's slighly shorter and I decided I like it a tiny bit better :) -- Andrea Bolognani / Red Hat / Virtualization

It will make further changes easier. This commit is better viewed with 'git show -w'. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- guests/lcitool | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/guests/lcitool b/guests/lcitool index 9559002..98ef2a0 100755 --- a/guests/lcitool +++ b/guests/lcitool @@ -808,20 +808,6 @@ class Application: sed -Ei 's,^# (en_US\\.UTF-8 .*)$,\\1,' /etc/locale.gen && \\ dpkg-reconfigure locales """).format(**varmap)) - if cross_arch: - # Intentionally a separate RUN command from the above - # so that the common packages of all cross-built images - # share a Docker image layer. - sys.stdout.write(textwrap.dedent(""" - RUN export DEBIAN_FRONTEND=noninteractive && \\ - dpkg --add-architecture {cross_arch} && \\ - {package_manager} update && \\ - {package_manager} dist-upgrade -y && \\ - {package_manager} install --no-install-recommends -y dpkg-dev && \\ - {package_manager} install --no-install-recommends -y {cross_pkgs} && \\ - {package_manager} autoremove -y && \\ - {package_manager} autoclean -y - """).format(**varmap)) elif package_format == "rpm": commands = [] @@ -882,10 +868,22 @@ class Application: sys.stdout.write(script.format(**varmap)) - if cross_arch: - # Intentionally a separate RUN command from the above - # so that the common packages of all cross-built images - # share a Docker image layer. + if cross_arch: + # Intentionally a separate RUN command from the above + # so that the common packages of all cross-built images + # share a Docker image layer. + if package_format == "deb": + sys.stdout.write(textwrap.dedent(""" + RUN export DEBIAN_FRONTEND=noninteractive && \\ + dpkg --add-architecture {cross_arch} && \\ + {package_manager} update && \\ + {package_manager} dist-upgrade -y && \\ + {package_manager} install --no-install-recommends -y dpkg-dev && \\ + {package_manager} install --no-install-recommends -y {cross_pkgs} && \\ + {package_manager} autoremove -y && \\ + {package_manager} autoclean -y + """).format(**varmap)) + elif package_format == "rpm": sys.stdout.write(textwrap.dedent(""" RUN {package_manager} install -y {cross_pkgs} && \\ {package_manager} clean all -y -- 2.25.1

On Fri, Mar 27, 2020 at 08:34:56PM +0100, Andrea Bolognani wrote:
It will make further changes easier.
This commit is better viewed with 'git show -w'.
Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- guests/lcitool | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> 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 :|

It's nicer to use, and will make further changes easier. This commit is better viewed with 'git show -w'. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- guests/lcitool | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/guests/lcitool b/guests/lcitool index 98ef2a0..fb0219b 100755 --- a/guests/lcitool +++ b/guests/lcitool @@ -797,20 +797,20 @@ class Application: print("FROM {}".format(facts["docker_base"])) + commands = [] + if package_format == "deb": - sys.stdout.write(textwrap.dedent(""" - RUN export DEBIAN_FRONTEND=noninteractive && \\ - {package_manager} update && \\ - {package_manager} dist-upgrade -y && \\ - {package_manager} install --no-install-recommends -y {pkgs} && \\ - {package_manager} autoremove -y && \\ - {package_manager} autoclean -y && \\ - sed -Ei 's,^# (en_US\\.UTF-8 .*)$,\\1,' /etc/locale.gen && \\ - dpkg-reconfigure locales - """).format(**varmap)) + commands.extend([ + "export DEBIAN_FRONTEND=noninteractive", + "{package_manager} update", + "{package_manager} dist-upgrade -y", + "{package_manager} install --no-install-recommends -y {pkgs}", + "{package_manager} autoremove -y", + "{package_manager} autoclean -y", + "sed -Ei 's,^# (en_US\\.UTF-8 .*)$,\\1,' /etc/locale.gen", + "dpkg-reconfigure locales", + ]) elif package_format == "rpm": - commands = [] - # Rawhide needs this because the keys used to sign packages are # cycled from time to time if os_name == "Fedora" and os_version == "Rawhide": @@ -864,9 +864,8 @@ class Application: "{package_manager} clean all -y", ]) - script = "\nRUN " + (" && \\\n ".join(commands)) + "\n" - - sys.stdout.write(script.format(**varmap)) + script = "\nRUN " + (" && \\\n ".join(commands)) + "\n" + sys.stdout.write(script.format(**varmap)) if cross_arch: # Intentionally a separate RUN command from the above -- 2.25.1

On Fri, Mar 27, 2020 at 08:34:57PM +0100, Andrea Bolognani wrote:
It's nicer to use, and will make further changes easier.
This commit is better viewed with 'git show -w'.
Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- guests/lcitool | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> 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 :|

It's nicer to use, and consistent with how we're building the native part of the Dockerfile. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- guests/lcitool | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/guests/lcitool b/guests/lcitool index fb0219b..117e1a5 100755 --- a/guests/lcitool +++ b/guests/lcitool @@ -868,25 +868,30 @@ class Application: sys.stdout.write(script.format(**varmap)) if cross_arch: + cross_commands = [] + # Intentionally a separate RUN command from the above # so that the common packages of all cross-built images # share a Docker image layer. if package_format == "deb": - sys.stdout.write(textwrap.dedent(""" - RUN export DEBIAN_FRONTEND=noninteractive && \\ - dpkg --add-architecture {cross_arch} && \\ - {package_manager} update && \\ - {package_manager} dist-upgrade -y && \\ - {package_manager} install --no-install-recommends -y dpkg-dev && \\ - {package_manager} install --no-install-recommends -y {cross_pkgs} && \\ - {package_manager} autoremove -y && \\ - {package_manager} autoclean -y - """).format(**varmap)) + cross_commands.extend([ + "export DEBIAN_FRONTEND=noninteractive", + "dpkg --add-architecture {cross_arch}", + "{package_manager} update", + "{package_manager} dist-upgrade -y", + "{package_manager} install --no-install-recommends -y dpkg-dev", + "{package_manager} install --no-install-recommends -y {cross_pkgs}", + "{package_manager} autoremove -y", + "{package_manager} autoclean -y", + ]) elif package_format == "rpm": - sys.stdout.write(textwrap.dedent(""" - RUN {package_manager} install -y {cross_pkgs} && \\ - {package_manager} clean all -y - """).format(**varmap)) + cross_commands.extend([ + "{package_manager} install -y {cross_pkgs}", + "{package_manager} clean all -y", + ]) + + cross_script = "\nRUN " + (" && \\\n ".join(cross_commands)) + "\n" + sys.stdout.write(cross_script.format(**varmap)) if "pip_pkgs" in varmap: sys.stdout.write(textwrap.dedent(""" -- 2.25.1

On Fri, Mar 27, 2020 at 08:34:58PM +0100, Andrea Bolognani wrote:
It's nicer to use, and consistent with how we're building the native part of the Dockerfile.
Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- guests/lcitool | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> 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 :|

VM-based builds have used ccache by default for a very long time, and now container-based builds will too. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- guests/lcitool | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/guests/lcitool b/guests/lcitool index 117e1a5..011fc07 100755 --- a/guests/lcitool +++ b/guests/lcitool @@ -651,6 +651,8 @@ class Application: varmap = self._dockerfile_build_varmap_rpm(facts, mappings, pip_mappings, projects, cross_arch) varmap["package_manager"] = facts["package_manager"] + varmap["cc"] = facts["cc"] + varmap["ccache"] = facts["ccache"] varmap["make"] = facts["make"] varmap["ninja"] = facts["ninja"] varmap["python"] = facts["python"] @@ -864,6 +866,21 @@ class Application: "{package_manager} clean all -y", ]) + commands.extend([ + "mkdir -p /usr/local/share/ccache-wrappers", + ]) + + if cross_arch: + commands.extend([ + "ln -s {ccache} /usr/local/share/ccache-wrappers/{cross_abi}-cc", + "ln -s {ccache} /usr/local/share/ccache-wrappers/{cross_abi}-$(basename {cc})", + ]) + else: + commands.extend([ + "ln -s {ccache} /usr/local/share/ccache-wrappers/cc", + "ln -s {ccache} /usr/local/share/ccache-wrappers/$(basename {cc})", + ]) + script = "\nRUN " + (" && \\\n ".join(commands)) + "\n" sys.stdout.write(script.format(**varmap)) @@ -900,6 +917,7 @@ class Application: sys.stdout.write(textwrap.dedent(""" ENV LANG "en_US.UTF-8" + ENV PATH "/usr/local/share/ccache-wrappers:$PATH" ENV MAKE "{make}" ENV NINJA "{ninja}" -- 2.25.1

On Fri, Mar 27, 2020 at 08:34:59PM +0100, Andrea Bolognani wrote:
VM-based builds have used ccache by default for a very long time, and now container-based builds will too.
Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- guests/lcitool | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
diff --git a/guests/lcitool b/guests/lcitool index 117e1a5..011fc07 100755 --- a/guests/lcitool +++ b/guests/lcitool @@ -651,6 +651,8 @@ class Application: varmap = self._dockerfile_build_varmap_rpm(facts, mappings, pip_mappings, projects, cross_arch)
varmap["package_manager"] = facts["package_manager"] + varmap["cc"] = facts["cc"] + varmap["ccache"] = facts["ccache"] varmap["make"] = facts["make"] varmap["ninja"] = facts["ninja"] varmap["python"] = facts["python"] @@ -864,6 +866,21 @@ class Application: "{package_manager} clean all -y", ])
+ commands.extend([ + "mkdir -p /usr/local/share/ccache-wrappers", + ]) + + if cross_arch: + commands.extend([ + "ln -s {ccache} /usr/local/share/ccache-wrappers/{cross_abi}-cc", + "ln -s {ccache} /usr/local/share/ccache-wrappers/{cross_abi}-$(basename {cc})", + ]) + else: + commands.extend([ + "ln -s {ccache} /usr/local/share/ccache-wrappers/cc", + "ln -s {ccache} /usr/local/share/ccache-wrappers/$(basename {cc})", + ]) + script = "\nRUN " + (" && \\\n ".join(commands)) + "\n" sys.stdout.write(script.format(**varmap))
This part makes sense.
@@ -900,6 +917,7 @@ class Application:
sys.stdout.write(textwrap.dedent(""" ENV LANG "en_US.UTF-8" + ENV PATH "/usr/local/share/ccache-wrappers:$PATH"
I don't think we should do this though. When doing local container builds "make ci-build@BLAH" the container content is throwaway, so using ccache is adding extra I/O to store the cache arifacts but will not speed up compile as the cache will always be initially empty. I think we only want to set $PATH in the .gitlab-ci.yml file where we have explicitly provided a persistent cache to use. 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 :|

On Mon, 2020-03-30 at 12:52 +0100, Daniel P. Berrangé wrote:
On Fri, Mar 27, 2020 at 08:34:59PM +0100, Andrea Bolognani wrote:
sys.stdout.write(textwrap.dedent(""" ENV LANG "en_US.UTF-8" + ENV PATH "/usr/local/share/ccache-wrappers:$PATH"
I don't think we should do this though.
When doing local container builds "make ci-build@BLAH" the container content is throwaway, so using ccache is adding extra I/O to store the cache arifacts but will not speed up compile as the cache will always be initially empty.
I think we only want to set $PATH in the .gitlab-ci.yml file where we have explicitly provided a persistent cache to use.
Sounds reasonable. We could still expose the path as something like ENV CCACHE_WRAPPERSDIR "/usr/local/share/ccache-wrappers" so that the CI rules would be able to do - export PATH="$CCACHE_WRAPPERSDIR:$PATH" instead of hardcoding the exact path. What do you think? -- Andrea Bolognani / Red Hat / Virtualization

On Mon, Mar 30, 2020 at 02:21:19PM +0200, Andrea Bolognani wrote:
On Mon, 2020-03-30 at 12:52 +0100, Daniel P. Berrangé wrote:
On Fri, Mar 27, 2020 at 08:34:59PM +0100, Andrea Bolognani wrote:
sys.stdout.write(textwrap.dedent(""" ENV LANG "en_US.UTF-8" + ENV PATH "/usr/local/share/ccache-wrappers:$PATH"
I don't think we should do this though.
When doing local container builds "make ci-build@BLAH" the container content is throwaway, so using ccache is adding extra I/O to store the cache arifacts but will not speed up compile as the cache will always be initially empty.
I think we only want to set $PATH in the .gitlab-ci.yml file where we have explicitly provided a persistent cache to use.
Sounds reasonable.
We could still expose the path as something like
ENV CCACHE_WRAPPERSDIR "/usr/local/share/ccache-wrappers"
so that the CI rules would be able to do
- export PATH="$CCACHE_WRAPPERSDIR:$PATH"
instead of hardcoding the exact path. What do you think?
Sure, works for me. 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 :|

On Mon, 2020-03-30 at 13:23 +0100, Daniel P. Berrangé wrote:
On Mon, Mar 30, 2020 at 02:21:19PM +0200, Andrea Bolognani wrote:
We could still expose the path as something like
ENV CCACHE_WRAPPERSDIR "/usr/local/share/ccache-wrappers"
so that the CI rules would be able to do
- export PATH="$CCACHE_WRAPPERSDIR:$PATH"
instead of hardcoding the exact path. What do you think?
Sure, works for me.
Cool! Can I have a Reviewed-by, then? O:-) -- Andrea Bolognani / Red Hat / Virtualization

On Mon, Mar 30, 2020 at 02:31:40PM +0200, Andrea Bolognani wrote:
On Mon, 2020-03-30 at 13:23 +0100, Daniel P. Berrangé wrote:
On Mon, Mar 30, 2020 at 02:21:19PM +0200, Andrea Bolognani wrote:
We could still expose the path as something like
ENV CCACHE_WRAPPERSDIR "/usr/local/share/ccache-wrappers"
so that the CI rules would be able to do
- export PATH="$CCACHE_WRAPPERSDIR:$PATH"
instead of hardcoding the exact path. What do you think?
Sure, works for me.
Cool! Can I have a Reviewed-by, then? O:-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> 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 :|

On Fri, Mar 27, 2020 at 08:34:59PM +0100, Andrea Bolognani wrote:
VM-based builds have used ccache by default for a very long time, and now container-based builds will too.
Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- guests/lcitool | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
diff --git a/guests/lcitool b/guests/lcitool index 117e1a5..011fc07 100755 --- a/guests/lcitool +++ b/guests/lcitool @@ -651,6 +651,8 @@ class Application: varmap = self._dockerfile_build_varmap_rpm(facts, mappings, pip_mappings, projects, cross_arch)
varmap["package_manager"] = facts["package_manager"] + varmap["cc"] = facts["cc"] + varmap["ccache"] = facts["ccache"] varmap["make"] = facts["make"] varmap["ninja"] = facts["ninja"] varmap["python"] = facts["python"] @@ -864,6 +866,21 @@ class Application: "{package_manager} clean all -y", ])
+ commands.extend([ + "mkdir -p /usr/local/share/ccache-wrappers", + ]) + + if cross_arch: + commands.extend([ + "ln -s {ccache} /usr/local/share/ccache-wrappers/{cross_abi}-cc", + "ln -s {ccache} /usr/local/share/ccache-wrappers/{cross_abi}-$(basename {cc})", + ]) + else: + commands.extend([ + "ln -s {ccache} /usr/local/share/ccache-wrappers/cc", + "ln -s {ccache} /usr/local/share/ccache-wrappers/$(basename {cc})", + ]) + script = "\nRUN " + (" && \\\n ".join(commands)) + "\n" sys.stdout.write(script.format(**varmap))
I've just realized that this addition has prevented the caching and reuse the base layer across the cross images. The first "RUN" cmmand was supposed to have stuff that is common across cross images, but we've accidentally included the "cross_abi" in the path for ccache here. We need to put the ccache setup in the second RUN command, for cross containers. Only native images can have it in the first RUN command. 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 :|

On Wed, 2020-07-15 at 16:57 +0100, Daniel P. Berrangé wrote:
On Fri, Mar 27, 2020 at 08:34:59PM +0100, Andrea Bolognani wrote:
+ commands.extend([ + "mkdir -p /usr/local/share/ccache-wrappers", + ]) + + if cross_arch: + commands.extend([ + "ln -s {ccache} /usr/local/share/ccache-wrappers/{cross_abi}-cc", + "ln -s {ccache} /usr/local/share/ccache-wrappers/{cross_abi}-$(basename {cc})", + ]) + else: + commands.extend([ + "ln -s {ccache} /usr/local/share/ccache-wrappers/cc", + "ln -s {ccache} /usr/local/share/ccache-wrappers/$(basename {cc})", + ]) + script = "\nRUN " + (" && \\\n ".join(commands)) + "\n" sys.stdout.write(script.format(**varmap))
I've just realized that this addition has prevented the caching and reuse the base layer across the cross images. The first "RUN" cmmand was supposed to have stuff that is common across cross images, but we've accidentally included the "cross_abi" in the path for ccache here.
We need to put the ccache setup in the second RUN command, for cross containers. Only native images can have it in the first RUN command.
Yeah, I realized that a while ago but always forgot to send out a patch :) Do you want to take a stab at it? -- Andrea Bolognani / Red Hat / Virtualization
participants (3)
-
Andrea Bolognani
-
Daniel P. Berrangé
-
Erik Skultety