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(a)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 :|