about summary refs log tree commit diff
path: root/src/libstore/build.cc
AgeCommit message (Collapse)AuthorFilesLines
2016-09-21 Some notational convenience for formatting stringsEelco Dolstra1-3/+3
We can now write throw Error("file '%s' not found", path); instead of throw Error(format("file '%s' not found") % path); and similarly printError("file '%s' not found", path); instead of printMsg(lvlError, format("file '%s' not found") % path);
2016-09-08 Don't run builds as root in the user namespaceEelco Dolstra1-16/+31
This largely reverts c68e5913c71badc89ff346d1c6948517ba720c93. Running builds as root breaks "cp -p", since when running as root, "cp -p" assumes that it can succesfully chown() files. But that's not actually the case since the user namespace doesn't provide a complete uid mapping. So it barfs with a fatal error message ("cp: failed to preserve ownership for 'foo': Invalid argument").
2016-09-08 Give a better error message if a path in build-sandbox-paths is invalidEelco Dolstra1-2/+6
2016-09-08 Fix assertion failure after early build setup failureEelco Dolstra1-1/+1
2016-08-30 Fix --fallbackEelco Dolstra1-7/+10
This fixes an assertion failure in "assert(goal);" in Worker::waitForInput() after a substitution goal is cancelled by the termination of another goal. The problem was the line //worker.childTerminated(shared_from_this()); // FIXME in the SubstitutionGoal destructor. This was disabled because shared_from_this() obviously doesn't work from a destructor. So we now use a real pointer for object identity.
2016-08-17 Add a mechanism for derivation attributes to reference the derivation's outputsEelco Dolstra1-14/+15
For example, you can now say: configureFlags = "--prefix=${placeholder "out"} --includedir=${placeholder "dev"}"; The strings returned by the ‘placeholder’ builtin are replaced at build time by the actual store paths corresponding to the specified outputs. Previously, you had to work around the inability to self-reference by doing stuff like: preConfigure = '' configureFlags+=" --prefix $out --includedir=$dev" ''; or rely on ad-hoc variable interpolation semantics in Autoconf or Make (e.g. --prefix=\$(out)), which doesn't always work.
2016-08-10 Mark content-addressed paths in the Nix database and in .narinfoEelco Dolstra1-1/+1
This allows such paths to be imported without signatures.
2016-08-10 Add a "root" parameter to local storesEelco Dolstra1-1/+1
This makes it easier to create a diverted store, i.e. NIX_REMOTE="local?root=/tmp/root" instead of NIX_REMOTE="local?real=/tmp/root/nix/store&state=/tmp/root/nix/var/nix" NIX_LOG_DIR=/tmp/root/nix/var/log
2016-07-26 makeFixedOutputPath(): Drop superfluous HashType argumentEelco Dolstra1-5/+5
2016-07-23 Respect --keep-going when a substituter fails.Shea Levy1-2/+4
Fixes #977
2016-07-11 Modernize AutoCloseFDShea Levy1-44/+42
2016-06-09 Run builds in a user namespaceEelco Dolstra1-14/+65
This way, all builds appear to have a uid/gid of 0 inside the chroot. In the future, this may allow using programs like systemd-nspawn inside builds, but that will require assigning a larger UID/GID map to the build. Issue #625.
2016-06-09 Use O_CLOEXEC in most placesEelco Dolstra1-2/+1
2016-06-03 Support sandbox builds by non-root usersEelco Dolstra1-53/+63
This allows an unprivileged user to perform builds on a diverted store (i.e. where the physical store location differs from the logical location). Example: $ NIX_LOG_DIR=/tmp/log NIX_REMOTE="local?real=/tmp/store&state=/tmp/var" nix-build -E \ 'with import <nixpkgs> {}; runCommand "foo" { buildInputs = [procps nettools]; } "id; ps; ifconfig; echo $out > $out"' will do a build in the Nix store physically in /tmp/store but logically in /nix/store (and thus using substituters for the latter).
2016-06-03 Don't call shared_from_this() from a destructorEelco Dolstra1-1/+1
2016-06-02 LocalStore: Allow the physical and logical store directories to differEelco Dolstra1-0/+3
This is primarily to subsume the functionality of the copy-from-other-stores substituter. For example, in the NixOS installer, we can now do (assuming we're in the target chroot, and the Nix store of the installation CD is bind-mounted on /tmp/nix): $ nix-build ... --option substituters 'local?state=/tmp/nix/var&real=/tmp/nix/store' However, unlike copy-from-other-stores, this also allows write access to such a store. One application might be fetching substitutes for /nix/store in a situation where the user doesn't have sufficient privileges to create /nix, e.g.: $ NIX_REMOTE="local?state=/home/alice/nix/var&real=/home/alice/nix/store" nix-build ...
2016-06-02 Respect build-use-substitutesEelco Dolstra1-1/+1
2016-06-01 Skip substituters with an incompatible store directoryEelco Dolstra1-0/+5
2016-06-01 Make the store directory a member variable of StoreEelco Dolstra1-15/+15
2016-05-30 Check signatures before downloading the substituteEelco Dolstra1-0/+10
2016-05-30 Fix repair during substitutionEelco Dolstra1-1/+2
2016-05-04 Cleanup: Remove singleton()Eelco Dolstra1-4/+3
2016-05-04 Do compression in a sinkEelco Dolstra1-42/+19
2016-05-04 Add a copyStorePath() utility functionEelco Dolstra1-5/+1
2016-04-29 Eliminate the substituter mechanismEelco Dolstra1-207/+85
Substitution is now simply a Store -> Store copy operation, most typically from BinaryCacheStore to LocalStore.
2016-04-28 Really handle carriage returnEelco Dolstra1-4/+9
2016-04-25 Handle carriage returnEelco Dolstra1-12/+7
2016-04-25 Show the log tail when a build failsEelco Dolstra1-9/+45
If --no-build-output is given (which will become the default for the "nix" command at least), show the last 10 lines of the build output if the build fails.
2016-04-25 Remove --print-build-traceEelco Dolstra1-44/+1
This was added to support Hydra, but Hydra no longer uses it.
2016-04-25 Improved logging abstractionEelco Dolstra1-14/+7
This also gets rid of --log-type, since the nested log type isn't useful in a multi-threaded situation, and nobody cares about the "pretty" log type.
2016-04-19 Move path info caching from BinaryCacheStore to StoreEelco Dolstra1-5/+5
Caching path info is generally useful. For instance, it speeds up "nix path-info -rS /run/current-system" (i.e. showing the closure sizes of all paths in the closure of the current system) from 5.6s to 0.15s. This also eliminates some APIs like Store::queryDeriver() and Store::queryReferences().
2016-04-16 Print out all bad references/requisites at onceDan Peebles1-2/+13
Also updates tests to check for new information. Fixes #799
2016-04-14 Set RLIMIT_CORE to 0, infinity in buildersEelco Dolstra1-0/+7
This prevents the builder from being affected by whatever the host system limits happen to be.
2016-04-08 Remove failed build cachingEelco Dolstra1-40/+1
This feature was implemented for Hydra, but Hydra no longer uses it.
2016-04-08 Make LocalStore thread-safeEelco Dolstra1-4/+39
Necessary for multi-threaded commands like "nix verify-paths".
2016-04-07 Sign locally-built pathsEelco Dolstra1-0/+3
Locally-built paths are now signed automatically using the secret keys specified by the ‘secret-key-files’ option.
2016-03-30 LocalStore: Keep track of ultimately trusted pathsEelco Dolstra1-0/+9
These are content-addressed paths or outputs of locally performed builds. They are trusted even if they don't have signatures, so "nix verify-paths" won't complain about them.
2016-03-04 Eliminate some large string copyingEelco Dolstra1-3/+3
2016-03-03 build.cc: fs.h doesn't appear to be necessary anymoreNathan Zadoks1-1/+0
2016-02-24 deletePath(): Succeed if path doesn't existEelco Dolstra1-13/+9
Also makes it robust against concurrent deletions.
2016-02-16 Rename ValidPathInfo::hash -> narHash for consistencyEelco Dolstra1-3/+3
2016-02-04 Eliminate the "store" global variableEelco Dolstra1-63/+22
Also, move a few free-standing functions into StoreAPI and Derivation. Also, introduce a non-nullable smart pointer, ref<T>, which is just a wrapper around std::shared_ptr ensuring that the pointer is never null. (For reference-counted values, this is better than passing a "T&", because the latter doesn't maintain the refcount. Usually, the caller will have a shared_ptr keeping the value alive, but that's not always the case, e.g., when passing a reference to a std::thread via std::bind.)
2016-01-31 Add build mode to compute fixed-output derivation hashesEelco Dolstra1-6/+32
For example, $ nix-build --hash -A nix-repl.src will build the fixed-output derivation nix-repl.src (a fetchFromGitHub call), but instead of *verifying* the hash given in the Nix expression, it prints out the resulting hash, and then moves the result to its content-addressed location in the Nix store. E.g build produced path ‘/nix/store/504a4k6zi69dq0yjc0bm12pa65bccxam-nix-repl-8a2f5f0607540ffe56b56d52db544373e1efb980-src’ with sha256 hash ‘0cjablz01i0g9smnavhf86imwx1f9mnh5flax75i615ml71gsr88’ The goal of this is to make all nix-prefetch-* scripts unnecessary: we can just let Nix run the real thing (i.e., the corresponding fetch* derivation). Another example: $ nix-build --hash -E 'with import <nixpkgs> {}; fetchgit { url = "https://github.com/NixOS/nix.git"; sha256 = "ffffffffffffffffffffffffffffffffffffffffffffffffffff"; }' ... git revision is 9e7c1a4bbdbe6129dd9dc385776612c307d3d1bb ... build produced path ‘/nix/store/gmsnh9i7x4mb7pyd2ns7n3c9l90jfsi1-nix’ with sha256 hash ‘1188xb621diw89n25rifqg9lxnzpz7nj5bfh4i1y3dnis0dmc0zp’ (Having to specify a fake sha256 hash is a bit annoying...)
2016-01-12 --option build-repeat: Keep the differing output if -K is givenEelco Dolstra1-7/+38
Similar to 00903fa79961d7eb0fadeb9ed2d7cda7821dc293. Regardless of -K, we now also print which output differs.
2016-01-12 --check: Keep the differing output if -K is givenEelco Dolstra1-2/+12
This makes it easier to investigate the non-determinism, e.g. $ nix-build pkgs/stdenv/linux -A stage1.pkgs.zlib --check -K error: derivation ‘/nix/store/l54i8wlw22656i4pk05c52ngv9rpl39q-zlib-1.2.8.drv’ may not be deterministic: output ‘/nix/store/11a27shh6n2ivi4a7s964i65ql80cf27-zlib-1.2.8’ differs from ‘/nix/store/11a27shh6n2ivi4a7s964i65ql80cf27-zlib-1.2.8-check’ $ diffoscope /nix/store/11a27shh6n2ivi4a7s964i65ql80cf27-zlib-1.2.8 /nix/store/11a27shh6n2ivi4a7s964i65ql80cf27-zlib-1.2.8-check ... ├── lib/libz.a │ ├── metadata │ │ @@ -1,15 +1,15 @@ │ │ -rw-r--r-- 30001/30000 3096 Jan 12 15:20 2016 adler32.o ... │ │ +rw-r--r-- 30001/30000 3096 Jan 12 15:28 2016 adler32.o ...
2016-01-12 --check: Fix "failed to produce output path"Eelco Dolstra1-1/+1
This occured when sandbox building is disabled, at least one output exists, and at least one other output does not.
2016-01-12 --check: Fix assertion failure when some outputs are missingEelco Dolstra1-1/+1
E.g. $ nix-build pkgs/stdenv/linux/ -A stage1.pkgs.perl --check nix-store: src/libstore/build.cc:1323: void nix::DerivationGoal::tryToBuild(): Assertion `buildMode != bmCheck || validPaths.size() == drv->outputs.size()' failed. when perl.out exists but perl.man doesn't. The fix is to only check the outputs that exist. Note that "nix-build -A stage1.pkgs.all --check" will still give a (proper) error in this case.
2016-01-07 Fix "Bad address" executing build hookEelco Dolstra1-5/+9
This was observed in the deb_debian7x86_64 build: http://hydra.nixos.org/build/29973215 Calling c_str() on a temporary should be fine because the temporary shouldn't be destroyed until after the execl() call, but who knows...
2016-01-07 Fix some signedness warningsEelco Dolstra1-1/+1
2016-01-06 nix-store --repair-path: Rebuild if there is no substituterEelco Dolstra1-2/+12