From: Tobias Ulmer Date: Thu, 21 Dec 2017 15:24:18 +0000 (+0100) Subject: e2build: check for chroot removal, add error message for common issue X-Git-Tag: e2factory-2.3.18rc1~87 X-Git-Url: https://git.e2factory.org/?a=commitdiff_plain;h=5c306c85c7ae78904a5ba7f4e5af5f3a6ffb8d6b;p=e2factory.git e2build: check for chroot removal, add error message for common issue Signed-off-by: Tobias Ulmer --- 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 ---