Skip to content

Commit b7df478

Browse files
committed
Place cache in project directory
Fixes permission errors when running pkgman on a real machine (like Mac in CI)
1 parent 72db1a4 commit b7df478

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ RUN pip3 install requests
3131

3232
RUN mkdir -p /cxx-common
3333
WORKDIR /cxx-common
34-
COPY . ./
3534

36-
# Try to recover cache
35+
# Will try to use cache at './cache'
3736
# Get cache using
38-
# docker run --rm --entrypoint /bin/bash -v $(pwd)/cache:/tmp cxx-bootstrap -c "cp -r /cache/* /tmp"
39-
RUN mv ./cache /cache || true
37+
# docker build -t cxx-common-build --target cxx-common-build .
38+
# docker run --rm --entrypoint /bin/bash -v $(pwd)/cache:/tmp cxx-common-build -c "cp -r ./cache /tmp"
39+
COPY . ./
4040

4141
RUN mkdir -p "${BOOTSTRAP}" && mkdir -p "${LIBRARIES}"
4242

pkgman/installers/common.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -628,12 +628,13 @@ def common_installer_llvm(properties):
628628
cmake_command += ["-DLLVM_ENABLE_Z3_SOLVER=OFF", "-DCLANG_ANALYZER_ENABLE_Z3_SOLVER=OFF"]
629629

630630
if properties["ccache"]:
631-
print(" i Enabling ccache on /cache/ccache ... ")
631+
ccache_dir = f"{os.getcwd()}/cache/ccache"
632+
print(f" i Enabling ccache on {ccache_dir} ... ")
632633
# some versions of LLVM use CCACHE_MAX_SIZE, others use CCACHE_SIZE
633634
cmake_command.extend(
634635
["-DLLVM_CCACHE_BUILD=ON",
635636
"-DLLVM_CCACHE_SIZE=5G",
636-
"-DLLVM_CCACHE_DIR=/cache/ccache",
637+
f'-DLLVM_CCACHE_DIR="{ccache_dir}"',
637638
"-DLLVM_CCACHE_MAXSIZE=5G"])
638639

639640
if use_libcxx:

pkgman/installers/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ def set_ccache_compiler():
4949
"""
5050
os.environ["CMAKE_CXX_COMPILER_LAUNCHER"] = "ccache"
5151
os.environ["CMAKE_C_COMPILER_LAUNCHER"] = "ccache"
52-
os.environ["CCACHE_DIR"] = "/cache/ccache"
52+
# Only works if we never change directories in the script(s)
53+
os.environ["CCACHE_DIR"] = f'"{os.getcwd()}/cache/ccache"'
5354

5455

5556
def get_parallel_build_options():

0 commit comments

Comments
 (0)