From 5c306c85c7ae78904a5ba7f4e5af5f3a6ffb8d6b Mon Sep 17 00:00:00 2001 From: Tobias Ulmer Date: Thu, 21 Dec 2017 16:24:18 +0100 Subject: [PATCH] e2build: check for chroot removal, add error message for common issue Signed-off-by: Tobias Ulmer --- local/e2build.lua | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/local/e2build.lua b/local/e2build.lua index e9b47ac..fbb7518 100644 --- a/local/e2build.lua +++ b/local/e2build.lua @@ -401,17 +401,28 @@ function e2build.build_process_class:helper_chroot_remove(res, rbs) return true end ---- +--- Remove previous chroot if it exists. -- @param res Result -- @param rbs Result Build Set +-- @return True on success, false on error. +-- @return Err object on failure. function e2build.build_process_class:_chroot_cleanup_if_exists(res, rbs) - local rc, re + local bc = res:build_config() - rc, re = self:helper_chroot_remove(res, rbs) - if not rc then - return false, re + if not e2lib.isfile(bc.chroot_marker) then + if not e2lib.isdir(bc.c) then + -- no cleanup needed + return true + end + + local e = err.new("removing chroot failed") + e:append("possible chroot directory without marker found: %s", bc.c) + e:append("run \"touch '%s'\" to mark this directory for cleanup", + bc.chroot_marker) + return false, e end - return true + + return self:helper_chroot_remove(res, rbs) end --- -- 2.39.5