Test nix-build with non-local-store --store
Just a few small things needed fixing!
This commit is contained in:
parent
85f2e9e8fa
commit
fed1237246
|
@ -592,9 +592,17 @@ void DerivationGoal::tryToBuild()
|
||||||
PathSet lockFiles;
|
PathSet lockFiles;
|
||||||
/* FIXME: Should lock something like the drv itself so we don't build same
|
/* FIXME: Should lock something like the drv itself so we don't build same
|
||||||
CA drv concurrently */
|
CA drv concurrently */
|
||||||
for (auto & i : drv->outputsAndOptPaths(worker.store))
|
if (dynamic_cast<LocalStore *>(&worker.store))
|
||||||
if (i.second.second)
|
/* If we aren't a local store, we might need to use the local store as
|
||||||
lockFiles.insert(worker.store.Store::toRealPath(*i.second.second));
|
a build remote, but that would cause a deadlock. */
|
||||||
|
/* FIXME: Make it so we can use ourselves as a build remote even if we
|
||||||
|
are the local store (separate locking for building vs scheduling? */
|
||||||
|
/* FIXME: find some way to lock for scheduling for the other stores so
|
||||||
|
a forking daemon with --store still won't farm out redundant builds.
|
||||||
|
*/
|
||||||
|
for (auto & i : drv->outputsAndOptPaths(worker.store))
|
||||||
|
if (i.second.second)
|
||||||
|
lockFiles.insert(worker.store.Store::toRealPath(*i.second.second));
|
||||||
|
|
||||||
if (!outputLocks.lockPaths(lockFiles, "", false)) {
|
if (!outputLocks.lockPaths(lockFiles, "", false)) {
|
||||||
if (!actLock)
|
if (!actLock)
|
||||||
|
@ -680,6 +688,12 @@ void DerivationGoal::tryLocalBuild() {
|
||||||
/* Make sure that we are allowed to start a build. If this
|
/* Make sure that we are allowed to start a build. If this
|
||||||
derivation prefers to be done locally, do it even if
|
derivation prefers to be done locally, do it even if
|
||||||
maxBuildJobs is 0. */
|
maxBuildJobs is 0. */
|
||||||
|
if (!dynamic_cast<LocalStore *>(&worker.store)) {
|
||||||
|
throw Error(
|
||||||
|
"unable to build with a primary store that isn't a local store; "
|
||||||
|
"either pass a different '--store' or enable remote builds."
|
||||||
|
"\nhttps://nixos.org/nix/manual/#chap-distributed-builds");
|
||||||
|
}
|
||||||
unsigned int curBuilds = worker.getNrLocalBuilds();
|
unsigned int curBuilds = worker.getNrLocalBuilds();
|
||||||
if (curBuilds >= settings.maxBuildJobs && !(buildLocally && curBuilds == 0)) {
|
if (curBuilds >= settings.maxBuildJobs && !(buildLocally && curBuilds == 0)) {
|
||||||
worker.waitForBuildSlot(shared_from_this());
|
worker.waitForBuildSlot(shared_from_this());
|
||||||
|
|
13
tests/binary-cache-build-remote.sh
Normal file
13
tests/binary-cache-build-remote.sh
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
source common.sh
|
||||||
|
|
||||||
|
clearStore
|
||||||
|
clearCacheCache
|
||||||
|
|
||||||
|
# Fails without remote builders
|
||||||
|
(! nix-build --store "file://$cacheDir" dependencies.nix)
|
||||||
|
|
||||||
|
# Succeeds with default store as build remote.
|
||||||
|
nix-build --store "file://$cacheDir" --builders 'auto - - 1 1' -j0 dependencies.nix
|
||||||
|
|
||||||
|
# Succeeds without any build capability because no-op
|
||||||
|
nix-build --store "file://$cacheDir" -j0 dependencies.nix
|
|
@ -9,7 +9,9 @@ nix_tests = \
|
||||||
local-store.sh remote-store.sh export.sh export-graph.sh \
|
local-store.sh remote-store.sh export.sh export-graph.sh \
|
||||||
timeout.sh secure-drv-outputs.sh nix-channel.sh \
|
timeout.sh secure-drv-outputs.sh nix-channel.sh \
|
||||||
multiple-outputs.sh import-derivation.sh fetchurl.sh optimise-store.sh \
|
multiple-outputs.sh import-derivation.sh fetchurl.sh optimise-store.sh \
|
||||||
binary-cache.sh nix-profile.sh repair.sh dump-db.sh case-hack.sh \
|
binary-cache.sh \
|
||||||
|
binary-cache-build-remote.sh \
|
||||||
|
nix-profile.sh repair.sh dump-db.sh case-hack.sh \
|
||||||
check-reqs.sh pass-as-file.sh tarball.sh restricted.sh \
|
check-reqs.sh pass-as-file.sh tarball.sh restricted.sh \
|
||||||
placeholders.sh nix-shell.sh \
|
placeholders.sh nix-shell.sh \
|
||||||
linux-sandbox.sh \
|
linux-sandbox.sh \
|
||||||
|
|
Loading…
Reference in a new issue