about summary refs log tree commit diff
path: root/src/libstore/build.cc
AgeCommit message (Collapse)AuthorFilesLines
2012-12-18 Revert brain fartEelco Dolstra1-2/+0
This reverts commit cc511fd65b7b6de9e87e72fb4bed16fc7efeb8b7.
2012-12-18 Check for potential infinite select() loops when buildingEelco Dolstra1-0/+2
2012-11-26 Only substitute wanted outputs of a derivationEelco Dolstra1-9/+50
If a derivation has multiple outputs, then we only want to download those outputs that are actuallty needed. So if we do "nix-build -A openssl.man", then only the "man" output should be downloaded. Likewise if another package depends on ${openssl.man}. The tricky part is that different derivations can depend on different outputs of a given derivation, so we may need to restart the corresponding derivation goal if that happens.
2012-11-26 Make "nix-build -A <derivation>.<output>" do the right thingEelco Dolstra1-3/+5
For example, given a derivation with outputs "out", "man" and "bin": $ nix-build -A pkg produces ./result pointing to the "out" output; $ nix-build -A pkg.man produces ./result-man pointing to the "man" output; $ nix-build -A pkg.all produces ./result, ./result-man and ./result-bin; $ nix-build -A pkg.all -A pkg2 produces ./result, ./result-man, ./result-bin and ./result-2.
2012-11-15 Disable use of vfork()Eelco Dolstra1-1/+1
vfork() is just too weird. For instance, in this build: http://hydra.nixos.org/build/3330487 the value fromHook.writeSide becomes corrupted in the parent, even though the child only reads from it. At -O0 the problem goes away. Probably the child is overriding some spilled temporary variable. If I get bored I may implement using posix_spawn() instead.
2012-11-15 Don't use std::cerr in a few placesEelco Dolstra1-10/+8
Slightly scared of using std::cerr in a vforked process...
2012-11-09 Use vfork() instead of fork() if availableEelco Dolstra1-14/+13
Hopefully this reduces the chance of hitting ‘unable to fork: Cannot allocate memory’ errors. vfork() is used for everything except starting builders.
2012-11-09 Remove some redundant close() callsEelco Dolstra1-6/+0
They are unnecessary because we set the close-on-exec flag.
2012-11-09 Remove the quickExit functionEelco Dolstra1-4/+4
2012-10-23 If hashes do not match, print them in base-32 for SHA-1/SHA-256Eelco Dolstra1-1/+1
Fixes #57.
2012-10-11 Shorten the names of temporary build directoriesEelco Dolstra1-1/+1
2012-10-03 nix-env: Support ‘--repair’ flagEelco Dolstra1-2/+4
2012-10-03 Handle repairing paths that are in build-chroot-dirsEelco Dolstra1-0/+7
2012-10-03 When repairing a derivation, check and repair the entire output closureEelco Dolstra1-2/+66
If we find a corrupted path in the output closure, we rebuild the derivation that produced that particular path.
2012-10-02 Add a --repair flag to ‘nix-store -r’ to repair derivation outputsEelco Dolstra1-59/+94
With this flag, if any valid derivation output is missing or corrupt, it will be recreated by using a substitute if available, or by rebuilding the derivation. The latter may use hash rewriting if chroots are not available.
2012-10-02 Add operation ‘nix-store --repair-path’Eelco Dolstra1-28/+67
This operation allows fixing corrupted or accidentally deleted store paths by redownloading them using substituters, if available. Since the corrupted path cannot be replaced atomically, there is a very small time window (one system call) during which neither the old (corrupted) nor the new (repaired) contents are available. So repairing should be used with some care on critical packages like Glibc.
2012-09-28 Handle octal escapes in /proc/self/mountinfoEelco Dolstra1-2/+3
2012-09-28 Print a more descriptive error message if setting up the build environment failsEelco Dolstra1-3/+14
2012-09-19 Remove setting of the immutable bitEelco Dolstra1-11/+2
Using the immutable bit is problematic, especially in conjunction with store optimisation. For instance, if the garbage collector deletes a file, it has to clear its immutable bit, but if the file has additional hard links, we can't set the bit afterwards because we don't know the remaining paths. So now that we support having the entire Nix store as a read-only mount, we may as well drop the immutable bit. Unfortunately, we have to keep the code to clear the immutable bit for backwards compatibility.
2012-09-19 Templatise tokenizeString()Eelco Dolstra1-11/+8
2012-09-18 Keep build directory if not all expected outputs were producedEelco Dolstra1-3/+3
Fixes issue #123 in Nixpkgs.
2012-09-13 In startBuilder(), only print the new paths we're buildingEelco Dolstra1-2/+3
2012-09-12 Build hook: Pass the timeout to the remote builderEelco Dolstra1-1/+1
Note that this will only work if the client has a very recent Nix version (post 15e1b2c223494ecb5efefc3ea0e3b926a6b1d7dc), otherwise the --option flag will just be ignored. Fixes #50.
2012-09-11 Fix "non-zero padding" errorEelco Dolstra1-1/+2
Probably it's not a good idea to pass a temporary object to StringSource.
2012-09-11 Support building a derivation if some outputs are already valid (non-chroot ↵Eelco Dolstra1-11/+67
case) This uses scary hash rewriting. Fixes #21.
2012-09-11 Remove debug lineEelco Dolstra1-3/+1
2012-09-11 Support building a derivation if some outputs are already validEelco Dolstra1-12/+16
This handles the chroot and build hook cases, which are easy. Supporting the non-chroot-build case will require more work (hash rewriting!). Issue #21.
2012-08-27 Fix stupid type error in calling std::maxEelco Dolstra1-1/+1
2012-08-27 Merge branch 'master' into no-manifestsEelco Dolstra1-13/+30
2012-08-20 Check if MS_PRIVATE is definedEelco Dolstra1-1/+1
http://hydra.nixos.org/build/2955671
2012-08-20 In the chroot, make all mounted filesystems privateEelco Dolstra1-0/+18
This is required on systemd, which mounts filesystems as "shared" subtrees. Changes to shared trees in a private mount namespace are propagated to the outside world, which is bad.
2012-08-20 Don't bind-mount /proc since we mount our ownEelco Dolstra1-2/+2
2012-08-19 Fix 1755 permission on temporary directories left behind by ‘-K’Eelco Dolstra1-4/+4
2012-08-01 Drop the block count in the garbage collectorEelco Dolstra1-6/+5
2012-07-30 Refactor settings processingEelco Dolstra1-99/+77
Put all Nix configuration flags in a Settings object.
2012-07-30 Pass configuration settings to the substitutersEelco Dolstra1-0/+4
Previously substituters could read nix.conf themselves, but this didn't take --option flags into account.
2012-07-27 Let build.cc verify the expected hash of a substituter's outputEelco Dolstra1-6/+33
Since SubstitutionGoal::finished() in build.cc computes the hash anyway, we can prevent the inefficiency of computing the hash twice by letting the substituter tell Nix about the expected hash, which can then verify it.
2012-07-27 Remove more tabsEelco Dolstra1-9/+9
2012-07-27 Remove trailing whitespace / tabsEelco Dolstra1-130/+130
2012-07-26 Merge branch 'master' into no-manifestsEelco Dolstra1-1/+6
2012-07-26 Set permissions on temporary build directories to 0700Eelco Dolstra1-1/+2
Fixes #39.
2012-07-23 Automatically optimise the Nix store when a new path is addedEelco Dolstra1-0/+4
Auto-optimisation is enabled by default. It can be turned off by setting auto-optimise-store to false in nix.conf.
2012-07-18 Merge branch 'master' into no-manifestsEelco Dolstra1-12/+29
2012-07-17 Return an exit code of 100 for cached failed buildsEelco Dolstra1-0/+1
Exit code 100 should be returned for all permanent failures. This includes cached failures. Fixes #34.
2012-07-17 Update Nix 1.1 release notesEelco Dolstra1-0/+3
2012-07-17 Allow disabling log compressionEelco Dolstra1-12/+25
2012-07-08 build.cc: Don't use hasSubstitute()Eelco Dolstra1-11/+25
Instead make a single call to querySubstitutablePathInfo() per derivation output. This is faster and prevents having to implement the "have" function in the binary cache substituter.
2012-07-06 download-from-binary-cache: parallelise fetching of NAR info filesEelco Dolstra1-4/+6
Getting substitute information using the binary cache substituter has non-trivial latency overhead. A package or NixOS system configuration can have hundreds of dependencies, and in the worst case (when the local info cache is empty) we have to do a separate HTTP request for each of these. If the ping time to the server is t, getting N info files will take tN seconds; e.g., with a ping time of 0.1s to nixos.org, sequentially downloading 1000 info files (a typical NixOS config) will take at least 100 seconds. To fix this problem, the binary cache substituter can now perform requests in parallel. This required changing the substituter interface to support a function querySubstitutablePathInfos() that queries multiple paths at the same time, and rewriting queryMissing() to take advantage of parallelism. (Due to local caching, parallelising queryMissing() is sufficient for most use cases, since it's almost always called before building a derivation and thus fills the local info cache.) For example, parallelism speeds up querying all 1056 paths in a particular NixOS system configuration from 116s to 2.6s. It works so well because the eccentricity of the top-level derivation in the dependency graph is only 9. So we only need 10 round-trips (when using an unlimited number of parallel connections) to get everything. Currently we do a maximum of 150 parallel connections to the server. Thus it's important that the binary cache server (e.g. nixos.org) has a high connection limit. Alternatively we could use HTTP pipelining, but WWW::Curl doesn't support it and libcurl has a hard-coded limit of 5 requests per pipeline.
2012-06-27 nix-store -r: do substitutions in parallelEelco Dolstra1-4/+9
I.e. when multiple non-derivation arguments are passed to ‘nix-store -r’ to be substituted, do them in parallel.
2012-06-27 Mount an empty /dev/shm tmpfs in the chrootEelco Dolstra1-0/+6
This ensures that whatever the builder writes in /dev/shm is automatically cleaned up.