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