From cada1869ece3a2a4c94e8b15dccdc4216b59418f Mon Sep 17 00:00:00 2001 From: Leon Romanovsky Date: Tue, 20 Apr 2021 13:40:02 +0300 Subject: [PATCH] cbuild: Avoid permission denied error due to SElinux MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When using SELinux for controlling processes within a container, we need to make sure any content that gets volume mounted into the container is readable. Use :Z option for volume mounts, so docker will set correct labels. This change fixes the error below: ➜ rdma-core git:(master) buildlib/cbuild make centos7 CMake Error: The source directory "/home/leonro/src/rdma-core" does not appear to contain CMakeLists.txt. Specify --help for usage, or press the help button on the CMake GUI. .... Signed-off-by: Leon Romanovsky --- buildlib/cbuild | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/buildlib/cbuild b/buildlib/cbuild index 8e17a3325..cda72ac3f 100755 --- a/buildlib/cbuild +++ b/buildlib/cbuild @@ -977,7 +977,7 @@ def cmd_make(args): home = os.path.join(os.path.sep,"home",os.getenv("LOGNAME")); - dirs = [os.getcwd(),"/tmp"]; + dirs = [os.getcwd()]; # Import the symlink target too if BUILD is a symlink BUILD_r = os.path.realpath(BUILD); if not BUILD_r.startswith(os.path.realpath(SRC)): @@ -1008,9 +1008,12 @@ def cmd_make(args): "-e","HOME=%s"%(home), "-w",BUILD_r, ]; + + opts.append("-v"); + opts.append("/tmp:/tmp"); for I in dirs: opts.append("-v"); - opts.append("%s:%s"%(I,I)); + opts.append("%s:%s:Z"%(I,I)); for I in cmake_envs: opts.append("-e"); opts.append(I);