aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/util.hh
AgeCommit message (Collapse)Author
2016-04-25Improved logging abstractionEelco Dolstra
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-20Cache path info lookups in SQLiteEelco Dolstra
This re-implements the binary cache database in C++, allowing it to be used by other Store backends, in particular the S3 backend.
2016-03-29Improve SIGINT handling in multi-threaded programsEelco Dolstra
The flag remembering whether an Interrupted exception was thrown is now thread-local. Thus, all threads will (eventually) throw Interrupted. Previously, one thread would throw Interrupted, and then the other threads wouldn't see that they were supposed to quit.
2016-03-29Add "nix verify-paths" commandEelco Dolstra
Unlike "nix-store --verify-path", this command verifies signatures in addition to store path contents, is multi-threaded (especially useful when verifying binary caches), and has a progress indicator. Example use: $ nix verify-paths --store https://cache.nixos.org -r $(type -p thunderbird) ... [17/132 checked] checking ‘/nix/store/rawakphadqrqxr6zri2rmnxh03gqkrl3-autogen-5.18.6’
2016-02-24deletePath(): Succeed if path doesn't existEelco Dolstra
Also makes it robust against concurrent deletions.
2016-02-12Merge pull request #762 from ctheune/ctheune-floatsEelco Dolstra
Implement floats
2016-02-04Eliminate the "store" global variableEelco Dolstra
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-20string2Int: Barf on negative numbers for unsigned typesEelco Dolstra
2016-01-05Merge pull request #685 from vizanto/masterEelco Dolstra
POSIX compliant directory access (fixes build on Solaris)
2016-01-05First hit at providing support for floats in the language.Christian Theune
2015-11-16AutoDelete: Add default constructor with deletion disabledShea Levy
2015-11-09Fix namespace issueEelco Dolstra
2015-11-07Fix build on SolarisDanny Wilson
d_type is not part of the POSIX spec unfortunately.
2015-10-29int2String() -> std::to_string()Eelco Dolstra
2015-10-01nix-prefetch-url: Rewrite in C++Eelco Dolstra
2015-07-20Support systemd log severity prefixesEelco Dolstra
This is mostly useful for hydra-queue-runner.
2015-07-17OCD: foreach -> C++11 ranged forEelco Dolstra
2015-06-17Support URLs in $NIX_PATHEelco Dolstra
This didn't work (despite claims in the manual), because the colon in "http://" was parsed as a element separator. So handle "://" specially.
2015-06-09Use std::vector::data()Eelco Dolstra
2015-04-09Implement caching of fetchurl/fetchTarball resultsEelco Dolstra
ETags are used to prevent redownloading unchanged files.
2015-02-10Add base64 encoder/decoderEelco Dolstra
2015-02-04Use libsodium instead of OpenSSL for binary cache signingEelco Dolstra
Sodium's Ed25519 signatures are much shorter than OpenSSL's RSA signatures. Public keys are also much shorter, so they're now specified directly in the nix.conf option ‘binary-cache-public-keys’. The new command ‘nix-store --generate-binary-cache-key’ generates and prints a public and secret key.
2014-12-12Fix some memory leaksEelco Dolstra
2014-12-12Ensure we're writing to stderr in the builderEelco Dolstra
http://hydra.nixos.org/build/17862041
2014-12-10Use vforkEelco Dolstra
2014-11-19nix-daemon: Call exit(), not _exit()Eelco Dolstra
This was preventing destructors from running. In particular, it was preventing the deletion of the temproot file for each worker process. It may also have been responsible for the excessive WAL growth on Hydra (due to the SQLite database not being closed properly). Apparently broken by accident in 8e9140cfdef9dbd1eb61e4c75c91d452ab5e4a74.
2014-10-03Remove some duplicate codeEelco Dolstra
2014-08-21Use PR_SET_PDEATHSIG to ensure child cleanupEelco Dolstra
2014-08-20Add some colorEelco Dolstra
2014-08-04Get rid of "killing <pid>" message for unused build hooksEelco Dolstra
2014-08-01Eliminate redundant copyEelco Dolstra
2014-08-01Make readDirectory() return inode / file typeEelco Dolstra
2014-07-31Restore default SIGPIPE handler before invoking ‘man’Eelco Dolstra
Fixes NixOS/nixpkgs#3410.
2014-07-10Refactoring: Move all fork handling into a higher-order functionEelco Dolstra
C++11 lambdas ftw.
2014-07-10Remove maybeVforkEelco Dolstra
2014-05-21nix-store -l: Fetch build logs from the InternetEelco Dolstra
If a build log is not available locally, then ‘nix-store -l’ will now try to download it from the servers listed in the ‘log-servers’ option in nix.conf. For instance, if you have: log-servers = http://hydra.nixos.org/log then it will try to get logs from http://hydra.nixos.org/log/<base name of the store path>. So you can do things like: $ nix-store -l $(which xterm) and get a log even if xterm wasn't built locally.
2014-04-08If a .drv cannot be parsed, show its pathEelco Dolstra
Otherwise you just get ‘expected string `Derive(['’ which isn't very helpful.
2014-03-28Don't interpret strings as format stringsEelco Dolstra
Ludo reported this error: unexpected Nix daemon error: boost::too_few_args: format-string refered to more arguments than were passed coming from this line: printMsg(lvlError, run.program + ": " + string(err, 0, p)); The problem here is that the string ends up implicitly converted to a Boost format() object, so % characters are treated specially. I always assumed (wrongly) that strings are converted to a format object that outputs the string as-is. Since this assumption appears in several places that may be hard to grep for, I've added some C++ type hackery to ensures that the right thing happens. So you don't have to worry about % in statements like printMsg(lvlError, "foo: " + s); or throw Error("foo: " + s);
2014-02-27Set up a minimal /dev in chrootsEelco Dolstra
Not bind-mounting the /dev from the host also solves the problem with /dev/shm being a symlink to something not in the chroot.
2014-02-26Remove another unused functionEelco Dolstra
2014-02-26Remove unused functionEelco Dolstra
2013-11-14Remove nix-setuid-helperEelco Dolstra
AFAIK, nobody uses it, it's not maintained, and it has no tests.
2013-08-19Store Nix integers as longsEelco Dolstra
So on 64-bit systems, integers are now 64-bit. Fixes #158.
2013-07-12Garbage collector: Don't follow symlinks arbitrarilyEelco Dolstra
Only indirect roots (symlinks to symlinks to the Nix store) are now supported.
2013-01-03Remove tabsEelco Dolstra
2012-11-26Make "nix-build -A <derivation>.<output>" do the right thingEelco Dolstra
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-15Don't use std::cerr in a few placesEelco Dolstra
Slightly scared of using std::cerr in a vforked process...
2012-11-09Use vfork() instead of fork() if availableEelco Dolstra
Hopefully this reduces the chance of hitting ‘unable to fork: Cannot allocate memory’ errors. vfork() is used for everything except starting builders.
2012-11-09Remove the quickExit functionEelco Dolstra
2012-09-28Handle octal escapes in /proc/self/mountinfoEelco Dolstra