Commit graph

4743 commits

Author SHA1 Message Date
Ben Burdette a0705e0dd1 invalid pos check 2020-06-30 11:01:46 -06:00
Ben Burdette e72a16a339 check for a null symbol 2020-06-30 11:00:51 -06:00
Carlo Nucera a1f66d1d9e Factor the prefix splitting in hash 2020-06-30 12:49:00 -04:00
Carlo Nucera 77b51f4598 Factor the prefix splitting in content-address 2020-06-30 11:57:46 -04:00
Carlo Nucera 7ba0fae0dd Create the spitPrefix function in parser.hh 2020-06-30 11:57:09 -04:00
Ben Burdette c484a67914 trace formatting 2020-06-29 15:46:21 -06:00
Eelco Dolstra 2b834d48aa NAR parser: Fix missing name field check
Discovered by @Kloenk.
2020-06-29 22:45:41 +02:00
John Ericson a83566e5bc Merge branch 'hash-always-has-type' of github.com:obsidiansystems/nix into better-ca-parse-errors 2020-06-29 18:40:34 +00:00
John Ericson 987a4a0be9 Merge remote-tracking branch 'upstream/master' into hash-always-has-type 2020-06-29 18:03:21 +00:00
Ben Burdette 8f81fae116 showTrace flag in loggers 2020-06-29 10:20:51 -06:00
Eelco Dolstra 58bc3b6578
Merge pull request #3729 from obsidiansystems/simpler-hased-mirror
hashed-mirrors: Use parsed derivation output rather than reconstructing it
2020-06-29 14:04:12 +02:00
Eelco Dolstra 64232f3ea6
Merge pull request #3749 from rodarima/master
Fall back to copyPath if link fails with EPERM
2020-06-29 13:31:24 +02:00
Ben Burdette ef24a0835d showtrace as function arg 2020-06-27 12:19:31 -06:00
Ben Burdette bc9e87412c 'string' makes more sense in nix repl 2020-06-25 09:56:32 -06:00
Ben Burdette 9ab808c926 showTrace flag for ErrorInfo; showTrace test. 2020-06-25 09:23:12 -06:00
Eelco Dolstra de2641ae99 Fix empty std::optional dereference in writeDerivation()
https://hydra.nixos.org/build/123017579
2020-06-25 15:50:30 +02:00
Rodrigo 3a642187c3 Fall back to copyPath if link fails with EPERM
BeeGFS doesn't allow hard-links and returns EPERM, so we fall back
to copyPath. See https://github.com/NixOS/nix/issues/3748
2020-06-25 12:03:26 +02:00
Ben Burdette 9c0e1fd4f1 add trace test; error formatting refinements 2020-06-24 18:31:28 -06:00
Ben Burdette 6359d71d6b re-enable --show-trace check 2020-06-24 18:28:20 -06:00
Ben Burdette 023912def3 convenience form of addTrace 2020-06-24 13:46:25 -06:00
Ben Burdette 93e9307329 repl indenting 2020-06-24 13:14:49 -06:00
Ben Burdette b18ed02b76 repl indenting 2020-06-24 13:10:41 -06:00
regnat d38f860c3e Add a way to get all the outputs of a derivation with their label
Generalize `queryDerivationOutputNames` and `queryDerivationOutputs` by
adding a `queryDerivationOutputMap` that returns the map
`outputName=>outputPath`

(not that this is not equivalent to merging the results of
`queryDerivationOutputs` and `queryDerivationOutputNames` as sets don't
preserve the order, so we would end up with an incorrect mapping).

squash! Add a way to get all the outputs of a derivation with their label

Rename StorePathMap to OutputPathMap
2020-06-24 20:38:40 +02:00
Ben Burdette 6fe660acf9 re-remove 2020-06-24 12:33:05 -06:00
Ben Burdette 00fe653ea5 nixCode -> LinesOfCode 2020-06-24 08:33:53 -06:00
Ben Burdette 1d43a6e123 use plain errPos instead of nixCode; fix tests 2020-06-23 15:30:13 -06:00
Carlo Nucera 8d51d38e4c Fix test suite 2020-06-23 17:16:20 -04:00
John Ericson ec3a857307 Fix and clean up hash parser 2020-06-23 18:19:40 +00:00
John Ericson 98e5d1af03 Merge remote-tracking branch 'upstream/master' into hash-always-has-type 2020-06-23 17:03:37 +00:00
Ben Burdette d0e78fbb03 re-add Pos origin in tests 2020-06-23 10:51:58 -06:00
Ben Burdette abe0552504 Merge remote-tracking branch 'upstream/master' into add-trace 2020-06-23 09:40:28 -06:00
Ben Burdette 13e87535ff traces to bottom 2020-06-23 09:36:58 -06:00
Eelco Dolstra 015e1c2131
Merge pull request #3724 from bburdette/hintfmt-percent
Hintfmt percent test, and fix
2020-06-23 12:26:00 +02:00
John Ericson 55d4bd6e0e Improve content address parsing
- Ensure hash is in form <algo>-<prefix> and not SRI.

 - Better errors if something goes wrong

 - string_view for no coppying
2020-06-22 18:08:27 +00:00
Ben Burdette 9d1cb0c5e6 with normaltxt, elide yellow color code instead of canceling it; use normaltxt on plain_string hintfmt 2020-06-22 11:32:20 -06:00
Ben Burdette 28b079067f
Update src/libutil/fmt.hh
Co-authored-by: John Ericson <git@JohnEricson.me>
2020-06-22 10:00:37 -06:00
John Ericson f4a5913125 hashed-mirrors: Use parsed derivation output rather than reconstructing it
Now the derivation outputs are parsed up front, we can avoid a reparse
by doing it. Also, this just feels a bit better as the `output*` env
vars are more of a `libnixexpr` interface than `libnixstore` interface:
ultimately, it's the derivation outputs that decide whether the
derivation is fixed-output.

Yes, hashed mirrors might go away with #3689, but this bit of code would
be moved rather than deleted, so it's worth doing a cleanup anyways I
think.
2020-06-22 15:17:20 +00:00
Ben Burdette be4f444175 tidying up 2020-06-19 16:58:12 -06:00
Ben Burdette 0309488a66 fmt -> hintfmt test 2020-06-19 16:46:49 -06:00
Ben Burdette 397dbe114e remove formathelper 2020-06-19 15:57:19 -06:00
John Ericson 507aa48739 WIP: Make Hash always store a valid hash type 2020-06-19 21:48:57 +00:00
Ben Burdette b193aca4ae escape percents 2020-06-19 15:29:19 -06:00
Ben Burdette db475f9e7e too few, too many args 2020-06-19 15:28:13 -06:00
Ben Burdette cdddf24f25 add hintfmt test 2020-06-19 14:54:41 -06:00
Ben Burdette 54e8f550c9 addErrorTrace 2020-06-19 13:44:08 -06:00
John Ericson e288c0987a Merge remote-tracking branch 'upstream/master' into validPathInfo-ca-proper-datatype 2020-06-19 18:44:24 +00:00
John Ericson 68294746ae Merge remote-tracking branch 'upstream/master' into no-hash-type-unknown 2020-06-19 17:53:34 +00:00
John Ericson c98081d270 Merge remote-tracking branch 'upstream/master' into no-hash-type-unknown 2020-06-19 17:50:05 +00:00
John Ericson c1892a5316 tabs -> spaces 2020-06-19 17:49:57 +00:00
John Ericson 911fc88bcb More designated initializers 2020-06-19 17:42:56 +00:00
John Ericson 2f0e395c99 Merge remote-tracking branch 'me/no-stringly-typed-derivation-output' into validPathInfo-ca-proper-datatype 2020-06-19 15:26:59 +00:00
John Ericson fb39a5e00c Remove unneeded constructor for DerivationOutputHash 2020-06-19 15:11:11 +00:00
John Ericson b90cac3bad Remove uneeded = default for Hash 2020-06-19 15:00:38 +00:00
John Ericson 01dc8b0bab Merge remote-tracking branch 'upstream/master' into no-stringly-typed-derivation-output 2020-06-19 14:59:05 +00:00
John Ericson 145d88cb2a Use designated initializers for DerivationOutputHash 2020-06-19 14:58:30 +00:00
John Ericson 237d88c97e FileSystemHash -> DerivationOutputHash 2020-06-19 14:47:10 +00:00
Eelco Dolstra 2886c92aef
Merge pull request #3669 from gilligan/add-compression-tests
Add compression unit tests
2020-06-19 13:59:04 +02:00
John Ericson 3fc58a9638 Remove some Base:: that crept in 2020-06-19 00:24:47 +00:00
John Ericson 3f8dcfe3fd Merge branch 'validPathInfo-temp' into validPathInfo-ca-proper-datatype 2020-06-18 23:01:58 +00:00
John Ericson 669c3992e8 Merge branch 'no-hash-type-unknown' into validPathInfo-temp 2020-06-18 22:33:07 +00:00
John Ericson 15abb2aa2b Revert the enum struct change
Not a regular git revert as there have been many merges and things.
2020-06-18 22:11:26 +00:00
John Ericson bbbf3602a3 Merge branch 'enum-class' into no-hash-type-unknown 2020-06-18 22:11:19 +00:00
John Ericson 40526fbea5 Merge remote-tracking branch 'upstream/master' into enum-class 2020-06-18 21:38:15 +00:00
Ben Burdette 4d1a4f0217 addTrace 2020-06-18 15:25:26 -06:00
Ben Burdette e6f93b94fc Merge branch 'master' into caveman-LOCs 2020-06-18 13:07:53 -06:00
Eelco Dolstra 6c000eed80
Merge pull request #3709 from expipiplus1/master
Mention number of derivations to be build/fetched in output
2020-06-18 19:03:05 +02:00
Eelco Dolstra 5771c8bbf2 Don't provide 'getFlake' if the 'flakes' feature is not enabled
(cherry picked from commit 0a1d3c1dd3)
2020-06-18 14:03:00 +02:00
Eelco Dolstra 2a61bbf77f Some backports from the flakes branch 2020-06-18 14:03:00 +02:00
Eelco Dolstra 7083d33efe Make constant primops lazy
(cherry picked from commit aa0e2a2e70)
2020-06-18 13:42:47 +02:00
regnat 4fef2ba7e4 Rename content-addressed-paths into ca-derivations
See <https://github.com/NixOS/nix/pull/3710#issuecomment-645480333>
2020-06-18 09:25:55 +02:00
Eelco Dolstra 2b8f33bf5f
Merge pull request #3713 from matthewbauer/cleanup-warnings
Cleanup class StorePath warning
2020-06-17 21:19:30 +02:00
Eelco Dolstra 3078404e35
Merge pull request #3712 from obsidiansystems/make-http-successful-states-coherent
Make successful states coherent
2020-06-17 19:37:46 +02:00
Matthew Bauer 22d7d36703 Remove unused narInfoFile in binary-cache-store 2020-06-17 13:27:19 -04:00
Matthew Bauer f767bedfac Replace struct StorePath with class StorePath
also a similar case with struct Goal
2020-06-17 13:26:37 -04:00
Carlo Nucera 4930cb48a2 Include review comments 2020-06-17 12:58:59 -04:00
Eelco Dolstra 2f51cd8dc9
Merge pull request #3710 from tweag/reserve_ca_derivations
Reserve the `__contentAddressed` derivation parameter
2020-06-17 18:28:26 +02:00
Eelco Dolstra 4d5169bdd5
Merge pull request #3707 from p01arst0rm/outdated-function-fix
replaced uncaught_exception with uncaught_exceptions
2020-06-17 18:26:01 +02:00
regnat 480b54e1c6 fixup! Reserve the __contentAddressed derivation parameter 2020-06-17 17:37:04 +02:00
Carlo Nucera 079c6e87de Make successful states coherent
The successful states used in these two places in the code were slightly
different. Should they be the same list?
2020-06-17 11:16:16 -04:00
John Ericson 6403508f5a Use ansicolor.hh in nix repl rather than duplicates 2020-06-17 15:13:00 +00:00
regnat 56d75bf4fc Reserve the __contentAddressed derivation parameter
Not implementing anything here, just throwing an error if a derivation
sets `__contentAddressed = true` without
`--experimental-features content-addressed-paths`
(and also with it as there's nothing implemented yet)
2020-06-17 15:41:17 +02:00
Eelco Dolstra ccbea8255c
Merge pull request #3657 from obsidiansystems/sligthly-improve-store-path-documentation
Clarify the description of StorePath inputs
2020-06-17 14:54:37 +02:00
Joe Hermaszewski da8aac6ce8 Mention number of derivations to be build/fetched in output
Also correct grammar for the case of a single derivation.
2020-06-17 20:27:27 +08:00
John Ericson 517f5980e2 Merge remote-tracking branch 'upstream/master' into no-stringly-typed-derivation-output 2020-06-17 04:58:43 +00:00
p01arst0rm e9970a34e8 appended ' __attribute__((weak)); ' to 'extern char * * environ ' 2020-06-17 03:25:34 +01:00
p01arst0rm c9d06558b6 replaced uncaught_exception with uncaught_exceptions 2020-06-17 03:15:47 +01:00
Eelco Dolstra 29542865ce Remove StorePath::clone() and related functions 2020-06-16 22:20:18 +02:00
Eelco Dolstra df4da4f5da
Merge pull request #3702 from NixOS/store-path-cxx
Rewrite StorePath class in C++
2020-06-16 21:37:26 +02:00
John Ericson fbf90bd693 Add another missing #include 2020-06-16 14:19:49 +00:00
Eelco Dolstra 759947bf72 StorePath: Rewrite in C++
On nix-env -qa -f '<nixpkgs>', this reduces maximum RSS by 20970 KiB
and runtime by 0.8%. This is mostly because we're not parsing the hash
part as a hash anymore (just validating that it consists of base-32
characters).

Also, replace storePathToHash() by StorePath::hashPart().
2020-06-16 14:28:41 +02:00
Eelco Dolstra 72e17290d4 Fix FTP support
Fixes #3618.
2020-06-16 11:53:04 +02:00
Tobias Pflug cd8214c398 Fix logging unit tests 2020-06-16 10:23:15 +02:00
John Ericson 7e7e3b71f3 Add mising #include for strerror 2020-06-15 23:35:07 +00:00
Eelco Dolstra a588b6b19d Print only one error message if a build fails
E.g. instead of

  error: --- BuildError ----------------------------------------------- nix
  builder for '/nix/store/03nk0a3n8h2948k4lqfgnnmym7knkcma-foo.drv' failed with exit code 1
  error: --- Error ---------------------------------------------------- nix
  build of '/nix/store/03nk0a3n8h2948k4lqfgnnmym7knkcma-foo.drv' failed

we now get

  error: --- Error ---------------------------------------------------- nix
  builder for '/nix/store/03nk0a3n8h2948k4lqfgnnmym7knkcma-foo.drv' failed with exit code 1
2020-06-15 19:35:31 +02:00
Eelco Dolstra 24a3208247 Include only the base name of the program in error messages 2020-06-15 19:35:31 +02:00
Eelco Dolstra 8b099812ea Respect terminal width printing error messages 2020-06-15 19:35:31 +02:00
Eelco Dolstra f20bb983ca Cleanup 2020-06-15 18:16:03 +02:00
Eelco Dolstra 4e995bc8a6 Always hide the progress bar on exit 2020-06-15 18:01:05 +02:00
Eelco Dolstra 31707735b6 Remove unnecessary amDone() overrides 2020-06-15 16:47:21 +02:00
Eelco Dolstra ccfa6b3eee Give better error message about <...> in pure eval mode 2020-06-15 16:12:27 +02:00