From 0bc5d57776a99066f4f6b44015566063629d8ec4 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Fri, 10 Jan 2025 16:44:40 +0000 Subject: [PATCH] build: Simplify mounting the ccache Signed-off-by: Michael Tremer --- src/pakfire/build.c | 38 ++++++++------------------------------ 1 file changed, 8 insertions(+), 30 deletions(-) diff --git a/src/pakfire/build.c b/src/pakfire/build.c index 3f7c95577..4118102df 100644 --- a/src/pakfire/build.c +++ b/src/pakfire/build.c @@ -1938,29 +1938,6 @@ static int pakfire_build_setup_jail(struct pakfire_build* build) { /* Sets up the ccache for this build */ -static int pakfire_build_mount_ccache(struct pakfire_build* build) { - int r; - - // Do nothing if the ccache is disabled - if (pakfire_build_has_flag(build, PAKFIRE_BUILD_DISABLE_CCACHE)) - return 0; - - // Check that the path is set - if (!*build->ccache_path) - return -ENOTSUP; - - // Make sure the path exists - r = pakfire_mkdir(build->ccache_path, 0755); - if (r) { - ERROR(build->ctx, "Could not create %s: %m\n", build->ccache_path); - return r; - } - - // Bind-mount the directory - return pakfire_jail_bind(build->jail, build->ccache_path, CCACHE_DIR, - MS_NOSUID|MS_NOEXEC|MS_NODEV); -} - static int pakfire_build_setup_ccache(struct pakfire_build* build) { int r; @@ -1997,6 +1974,14 @@ static int pakfire_build_setup_ccache(struct pakfire_build* build) { if (r) return r; + // Bind-mount the directory into the jail + r = pakfire_jail_bind(build->jail, build->ccache_path, CCACHE_DIR, + MS_NOSUID|MS_NOEXEC|MS_NODEV); + if (r < 0) { + ERROR(build->ctx, "Could not mount the ccache: %s\n", strerror(-r)); + return r; + } + return 0; } @@ -2621,13 +2606,6 @@ int pakfire_build_exec(struct pakfire_build* build, const char* path) { goto ERROR; } - // Mount the ccache - r = pakfire_build_mount_ccache(build); - if (r) { - ERROR(build->ctx, "Could not mount the ccache: %m\n"); - goto ERROR; - } - // Open the makefile r = pakfire_build_read_makefile(build, &makefile, package); if (r) -- 2.47.3