libstore/build: warn when the sandbox is force-enabled due to a diverted store

Builds using a diverted store strictly require sandboxing. It therefore makes
sense to automatically enable it even if otherwise explicitly disabled by the
user. However, they should still be informed that their choice is not being
respected.

Change-Id: Ia2cbdc24a4c55d8ecc49094e35e698e16a6a6964
This commit is contained in:
Alois Wohlschlager
2025-12-01 14:25:47 +00:00
committed by alois31
parent b4e2abdf5c
commit 7f176002c6
@@ -229,6 +229,9 @@ retry:
auto & localStore = getLocalStore();
if (localStore.config().storeDir != localStore.config().realStoreDir.get()) {
#if __linux__
if (!useChroot) {
printTaggedWarning("auto-enabling the sandbox due to using a diverted store");
}
useChroot = true;
#else
throw Error("building using a diverted store is not supported on this platform");