aboutsummaryrefslogtreecommitdiff
path: root/tests/derivations.scm
Commit message (Collapse)AuthorAge
* tests: Assume ‘git’ is always available.Ludovic Courtès2023-09-26
| | | | | | | | | | * tests/channels.scm (gpg+git-available?): Check for ‘gpg-command’ only. Remove all ‘test-skip’ statements. * tests/derivations.scm: Likewise. * tests/git-authenticate.scm: Likewise. * tests/git.scm: Likewise. * tests/import-git.scm: Likewise.
* daemon: Add “git-download” built-in builder.Ludovic Courtès2023-09-26
| | | | | | | | | | | | | | | | | | The new builder makes it possible to break cycles that occurs when the fixed-output derivation for the source of a dependency of ‘git’ would itself depend on ‘git’. * guix/scripts/perform-download.scm (perform-git-download): New procedure. (perform-download): Move fixed-output derivation check to… (guix-perform-download): … here. Invoke ‘perform-download’ or ‘perform-git-download’ depending on what ‘derivation-builder’ returns. * nix/libstore/builtins.cc (builtins): Add “git-download”. * tests/derivations.scm ("built-in-builders"): Update. ("'git-download' built-in builder") ("'git-download' built-in builder, invalid hash") ("'git-download' built-in builder, invalid commit") ("'git-download' built-in builder, not found"): New tests.
* daemon: Improve error message for wrong hash sizes.Ludovic Courtès2023-01-09
| | | | | | | * nix/libutil/hash.cc (parseHash): Show the hash algorithm name and expected size in the error message. * tests/derivations.scm ("fixed-output derivation, invalid hash size"): New test.
* derivations: 'read-derivation' correctly handles case with empty hash.Ludovic Courtès2023-01-09
| | | | | | | | | | | Reported by Stephen Paul Weber <singpolyma@singpolyma.net> at <https://lists.gnu.org/archive/html/guix-devel/2023-01/msg00035.html>. * guix/derivations.scm (read-derivation)[outputs->alist]: Treat the empty hash case as non-fixed-output whether or not the hash algorithm is the empty string, and preserve the hash algorithm in <derivation-output>. * tests/derivations.scm ("'download' built-in builder, no fixed-output hash") ("fixed-output-derivation?, no hash", "read-derivation with hash = #f"): New tests.
* Remove now unnecessary uses of (guix grafts).Ludovic Courtès2022-10-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These modules would use (guix grafts) just to access '%graft?' and related bindings, which are now in (guix store). * gnu/ci.scm, guix/gexp.scm, guix/lint.scm, guix/scripts.scm, guix/scripts/archive.scm, guix/scripts/build.scm, guix/scripts/challenge.scm, guix/scripts/deploy.scm, guix/scripts/environment.scm, guix/scripts/home.scm, guix/scripts/pack.scm, guix/scripts/package.scm, guix/scripts/pull.scm, guix/scripts/size.scm, guix/scripts/system.scm, guix/scripts/weather.scm, tests/builders.scm, tests/channels.scm, tests/cpan.scm, tests/derivations.scm, tests/gexp.scm, tests/graph.scm, tests/guix-daemon.sh, tests/monads.scm, tests/pack.scm, tests/packages.scm, tests/profiles.scm, tests/system.scm: Remove #:use-module (guix grafts).
* derivations: Coalesce inputs that have the same output path.Ludovic Courtès2022-03-07
| | | | | | | | | | Fixes <https://issues.guix.gnu.org/54209>. * guix/derivations.scm (coalesce-duplicate-inputs): Use the output paths of DRV as a hash table key. * tests/derivations.scm ("derivation with duplicate fixed-output inputs"): Expect a single input for FINAL. ("derivation with equivalent fixed-output inputs"): New test.
* daemon: Do not deduplicate files smaller than 8 KiB.Ludovic Courtès2021-11-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Files smaller than 8 KiB typically represent ~70% of the entries in /gnu/store/.links but only contribute to ~4% of the space savings afforded by deduplication. Not considering these files for deduplication speeds up file insertion in the store and, more importantly, leaves 'removeUnusedLinks' with fewer entries to traverse, thereby speeding it up proportionally. Partly fixes <https://issues.guix.gnu.org/24937>. * config-daemon.ac: Remove symlink hard link check and CAN_LINK_SYMLINK definition. * guix/store/deduplication.scm (%deduplication-minimum-size): New variable. (deduplicate)[loop]: Do not recurse when FILE's size is below %DEDUPLICATION-MINIMUM-SIZE. (dump-port): New procedure. (dump-file/deduplicate)[hash]: Turn into... [dump-and-compute-hash]: ... this thunk. Call 'deduplicate' only when SIZE is greater than %DEDUPLICATION-MINIMUM-SIZE; otherwise call 'dump-port'. * nix/libstore/gc.cc (LocalStore::removeUnusedLinks): Drop files where st.st_size < deduplicationMinSize. * nix/libstore/local-store.hh (deduplicationMinSize): New declaration. * nix/libstore/optimise-store.cc (deduplicationMinSize): New variable. (LocalStore::optimisePath_): Return when PATH is a symlink or smaller than 'deduplicationMinSize'. * tests/derivations.scm ("identical files are deduplicated"): Produce files bigger than %DEDUPLICATION-MINIMUM-SIZE. * tests/nar.scm ("restore-file-set with directories (signed, valid)"): Likewise. * tests/store-deduplication.scm ("deduplicate, below %deduplication-minimum-size"): New test. ("deduplicate", "deduplicate, ENOSPC"): Produce files bigger than %DEDUPLICATION-MINIMUM-SIZE. * tests/store.scm ("substitute, deduplication"): Likewise.
* tests: do not hard code HTTP portsMaxime Devos2021-03-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, test cases could fail if some process was listening at a hard-coded port. This patch eliminates most of these potential failures, by automatically assigning an unbound port. This should allow for building multiple guix trees in parallel outside a build container, though this is currently untested. The test "home-page: Connection refused" in tests/lint.scm still hardcodes port 9999, however. * guix/tests/http.scm (http-server-can-listen?): remove now unused procedure. (%http-server-port): default to port 0, meaning the OS will automatically choose a port. (open-http-server-socket): remove the false statement claiming this procedure is exported and also return the allocated port number. (%local-url): raise an error if the port is obviously unbound. (call-with-http-server): set %http-server-port to the allocated port while the thunk is called. * tests/derivations.scm: adjust test cases to use automatically assign a port. As there is no risk of a port conflict now, do not make any tests conditional upon 'http-server-can-listen?' anymore. * tests/elpa.scm: likewise. * tests/lint.scm: likewise, and add a TODO comment about a port that is still hard-coded. * tests/texlive.scm: likewise. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* packages: Introduce <content-hash> and use it in <origin>.Ludovic Courtès2020-05-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * guix/packages.scm (<content-hash>): New record type. (define-content-hash-constructor, build-content-hash) (content-hash): New macros. (print-content-hash): New procedure. (<origin>): Rename constructor to '%origin'. [sha256]: Remove field. [hash]: New field. Adjust users. (origin-compatibility-helper, origin): New macros. (origin-sha256): New deprecated procedure. (origin->derivation): Adjust accordingly. * tests/packages.scm ("package-source-derivation, origin, sha512"): New test. * guix/tests.scm: Hide (gcrypt hash) 'sha256' for proper syntax matching. * tests/challenge.scm: Add #:prefix for (gcrypt hash) and adjust users. * tests/derivations.scm: Likewise. * tests/store.scm: Likewise. * tests/graph.scm ("bag DAG, including origins"): Provide 'sha256' field with the right length. * gnu/packages/aspell.scm (aspell-dictionary) (aspell-dict-ca, aspell-dict-it): Use 'hash' and 'content-hash' for proper syntax matching. * gnu/packages/bash.scm (bash-patch): Rename 'sha256' to 'sha256-bv'. * gnu/packages/bootstrap.scm (bootstrap-executable): Rename 'sha256' to 'bv'. * gnu/packages/readline.scm (readline-patch): Likewise. * gnu/packages/virtualization.scm (qemu-patch): Rename 'sha256' to 'sha256-bv'. * guix/import/utils.scm: Hide (gcrypt hash) 'sha256'.
* tests: Test fixed-output derivations with several hash algorithms.Ludovic Courtès2020-05-22
| | | | | * tests/derivations.scm ("fixed-output derivation"): Test several hash algorithms.
* derivations: Add 'derivation-input-fold'.Ludovic Courtès2019-12-07
| | | | | | | * guix/derivations.scm (derivation-input-fold): New procedure. (substitution-oracle)[closure]: Rewrite in terms of 'derivation-input-fold'. * tests/derivations.scm ("derivation-input-fold"): New test.
* Merge branch 'master' into core-updatesMark H Weaver2019-09-06
|\
| * tests: 'with-http-server' accepts multiple responses.Ludovic Courtès2019-09-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * guix/tests/http.scm (call-with-http-server): Replace 'code' and 'data' parameters with 'responses+data'. Compute RESPONSES as a function of that. Remove #:headers parameter. [http-write]: Quit only when RESPONSES is empty. [server-body]: Get the response and data from RESPONSES, and set it to point to the rest. (with-http-server): Adjust accordingly. * tests/derivations.scm ("'download' built-in builder") ("'download' built-in builder, invalid hash") ("'download' built-in builder, not found") ("'download' built-in builder, check mode"): Adjust to new 'with-http-server' interface. * tests/lint.scm ("home-page: 200") ("home-page: 200 but short length") ("home-page: 404", "home-page: 301, invalid"): ("home-page: 301 -> 200", "home-page: 301 -> 404") ("source: 200", "source: 200 but short length") ("source: 404", "source: 404 and 200") ("source: 301 -> 200", "source: 301 -> 404"): ("github-url", github-url): Likewise. * tests/swh.scm (with-json-result) ("lookup-origin, not found"): Likewise.
* | Merge branch 'master' into core-updatesMark H Weaver2019-08-22
|\|
| * derivations: Delete duplicate inputs when computing derivation hash.Ludovic Courtès2019-08-16
| | | | | | | | | | | | | | | | | | | | Fixes <https://bugs.gnu.org/36777>. Reported by Carl Dong <contact@carldong.me>. * guix/derivations.scm (derivation/masked-inputs): Call 'delete-duplicates' on INPUTS. * tests/derivations.scm ("derivation with duplicate fixed-output inputs"): New test.
* | Merge branch 'master' into core-updatesLudovic Courtès2019-07-17
|\|
| * derivations: Update tests to use new calling convention.Ludovic Courtès2019-07-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * tests/derivations.scm ("build derivation with 1 source"): Adjust to new 'derivation' calling convention. ("identical files are deduplicated"): Likewise. ("fixed-output-derivation?"): Likewise. ("fixed-output derivation"): Likewise. ("fixed-output derivation, recursive"): Likewise. ("derivation with a fixed-output input"): Likewise. ("multiple-output derivation"): Likewise. ("multiple-output derivation, non-alphabetic order"): Likewise. ("read-derivation vs. derivation"): Likewise. ("user of multiple-output derivation"): Likewise. ("derivation with #:references-graphs"): Likewise. ("derivation #:allowed-references, ok"): Likewise. ("derivation #:allowed-references, not allowed"): Likewise. ("derivation #:allowed-references, self allowed"): Likewise. ("derivation #:allowed-references, self not allowed"): Likewise. ("derivation #:disallowed-references, ok"): Likewise. ("derivation #:disallowed-references, not ok"): Likewise. ("derivation #:leaked-env-vars"): Likewise. ("build derivation with coreutils"): Likewise. ("map-derivation, sources"): Likewise. ("derivation with local file as input"): Remove.
* | Merge branch 'master' into core-updatesMarius Bakke2019-07-12
|\| | | | | | | | | | | | | | | | | Conflicts: gnu/local.mk gnu/packages/python-xyz.scm gnu/packages/xml.scm guix/gexp.scm po/guix/POTFILES.in
| * derivations: 'derivation-build-plan' recurses on substituables.Ludovic Courtès2019-07-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a bug whereby "guix build texlive -n" would report: 0.0 MB would be downloaded: /gnu/store/…-texlive-20180414 instead of: The following derivation would be built: /gnu/store/…-texlive-texmf-20180414.drv 2,595.2 MB would be downloaded: /gnu/store/…-texlive-20180414-texmf.tar.xz /gnu/store/…-texlive-20180414 where 'texlive-texmf' is a non-substitutable dependency of 'texlive'. * guix/derivations.scm (dependencies-of-substitutables): New procedure. (derivation-build-plan): When 'input-substitutable-info' returns true, append the subset of DEPS that corresponds to SUBSTITUABLES to the first argument of 'loop'. * guix/ui.scm (show-what-to-build): Remove half-baked traversal of DOWNLOAD. * tests/derivations.scm ("derivation-build-plan and substitutes, non-substitutable dep"): New test.
* | Merge branch 'master' into core-updatesLudovic Courtès2019-06-27
|\|
| * derivations: 'build-derivations' can be passed derivation inputs.Ludovic Courtès2019-06-27
| | | | | | | | | | | | | | * guix/derivations.scm (build-derivations): Accept <derivation-input> records among DERIVATIONS. * tests/derivations.scm ("build-derivations with specific output"): Test it.
| * derivations: <derivation-input> now aggregates a <derivation>.Ludovic Courtès2019-06-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Consequently, the whole graph of <derivation> object is readily available without having to go through 'read-derivation-from-file', which could have cache misses if the requested <derivation> object had been GC'd in the meantime. This is an important property for the performance of things like 'derivation-build-plan' that traverse the derivation graph. * guix/derivations.scm (<derivation-input>): Replace 'path' field by 'derivation'. (derivation-input-path): Adjust accordingly. (derivation-input-key): New procedure. (derivation-input-output-paths): Adjust accordingly. (coalesce-duplicate-inputs): Likewise. (derivation-prerequisites): Use 'derivation-input-key' to compute keys for INPUT-SET. (derivation-build-plan): Likewise. (read-derivation): Add optional 'read-derivation-from-file' parameter. [make-input-drvs]: Call it. (write-derivation)[write-input]: Adjust to new <derivation-input>. (derivation/masked-inputs): Likewise, and remove redundant 'coalesce-duplicate-inputs' call. (derivation)[input->derivation-input]: Change to consider only the derivation case. Update call to 'make-derivation-input'. [input->source]: New procedure. Separate sources from inputs. (map-derivation): Adjust to new <derivation-input>. * tests/derivations.scm ("parse & export"): Pass a second argument to 'read-derivation'. ("build-expression->derivation and derivation-prerequisites") ("derivation-prerequisites and valid-derivation-input?"): Adjust to new <derivation-input>.
| * derivations: Rewrite and replace 'derivations-prerequisites-to-build'.Ludovic Courtès2019-06-27
| | | | | | | | | | | | | | | | | | | | | | | | The new 'derivation-build-plan' procedure has a more appropriate signature: it takes a list of <derivation-inputs> instead of taking one <derivation>. Its body is also much simpler. * guix/derivations.scm (derivation-build-plan): New procedure. (derivation-prerequisites-to-build): Express in terms of 'derivation-build-plan' and mark as deprecated. * tests/derivations.scm: Change 'derivation-prerequisites-to-build' tests to 'derivation-build-plan' and adjust accordingly.
* | Merge branch 'staging' into core-updatesMarius Bakke2019-06-20
|\|
| * tests: Avoid 'delete-paths' calls for 'derivation-prerequisites-to-build'.Ludovic Courtès2019-06-18
| | | | | | | | | | | | | | * tests/derivations.scm ("derivation-prerequisites-to-build when outputs already present"): Insert random text in BUILDER, and remove two calls to 'delete-paths'. Use 'derivation->output-path' for INPUT-PATH instead of an old idiom.
* | packages: Remove 'search-bootstrap-binary'.Ludovic Courtès2019-06-14
|/ | | | | | | | | | | * gnu/packages.scm (%bootstrap-binaries-path, search-bootstrap-binary): Remove. * gnu/packages/bootstrap.scm (bootstrap-executable): Export. * guix/tests.scm (bootstrap-binary-file, search-bootstrap-binary): Export. * tests/derivations.scm: Remove (gnu packages) import. * tests/grafts.scm: Likewise. * tests/guix-daemon.sh: Likewise.
* store: 'build-things' accepts derivation/output pairs.Ludovic Courtès2019-06-10
| | | | | | | | | | | | | | This allows callers to request the substitution of a single derivation output. * guix/store.scm (build-things): Accept derivation/output pairs among THINGS. * guix/derivations.scm (build-derivations): Likewise. * tests/store.scm ("substitute + build-things with specific output"): New test. * tests/derivations.scm ("build-derivations with specific output"): New test. * doc/guix.texi (The Store): Adjust accordingly.
* daemon: Rename 'NIX_STATE_DIR' and 'NIX_DB_DIR' environment variables.Ludovic Courtès2019-02-04
| | | | | | | | | | | | | | | | | Fixes <https://bugs.gnu.org/22459>. Reported by Jeff Mickey <j@codemac.net>. * guix/config.scm.in (%state-directory): Change NIX_STATE_DIR to GUIX_STATE_DIRECTORY. (%store-database-directory): Change NIX_DB_DIR to GUIX_DATABASE_DIRECTORY. * nix/libstore/globals.cc (Settings::processEnvironment): Likewise. * guix/self.scm (make-config.scm): Likewise. * build-aux/build-self.scm (make-config.scm): Likewise. * build-aux/test-env.in: Likewise. * tests/derivations.scm ("derivation #:leaked-env-vars"): Likewise. * tests/guix-build.sh (GUIX_DAEMON_SOCKET): Likewise. * tests/guix-daemon.sh (socket): Likewise.
* store: Rename '&nix-error' to '&store-error'.Ludovic Courtès2019-01-21
| | | | | | | | | | | | | | | | | | | * guix/store.scm (&nix-error): Rename to... (&store-error): ... this, and adjust users. (&nix-connection-error): Rename to... (&store-connection-error): ... this, and adjust users. (&nix-protocol-error): Rename to... (&store-protocol-error): ... this, adjust users. (&nix-error, &nix-connection-error, &nix-protocol-error): Define these condition types and their getters as deprecrated aliases. * build-aux/run-system-tests.scm, guix/derivations.scm, guix/grafts.scm, guix/scripts/challenge.scm, guix/scripts/graph.scm, guix/scripts/lint.scm, guix/scripts/offload.scm, guix/serialization.scm, guix/ssh.scm, guix/tests.scm, guix/ui.scm, tests/derivations.scm, tests/gexp.scm, tests/guix-daemon.sh, tests/packages.scm, tests/store.scm, doc/guix.texi: Adjust to use the new names.
* derivations: Add properties.Ludovic Courtès2018-11-28
| | | | | | | | | | | | * guix/derivations.scm (derivation): Add #:properties parameter. [user+system-env-vars]: Honor it. (derivation-properties): New procedure. (build-expression->derivation): Add #:properties and pass it to 'derivation'. * guix/gexp.scm (gexp->derivation): Likewise. * tests/derivations.scm ("derivation-properties"): New test. * tests/gexp.scm ("gexp->derivation properties"): New test. * doc/guix.texi (Derivations, G-Expressions): Adjust accordingly.
* Switch to Guile-Gcrypt.Ludovic Courtès2018-09-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This removes (guix hash) and (guix pk-crypto), which now live as part of Guile-Gcrypt (version 0.1.0.) * guix/gcrypt.scm, guix/hash.scm, guix/pk-crypto.scm, tests/hash.scm, tests/pk-crypto.scm: Remove. * configure.ac: Test for Guile-Gcrypt. Remove LIBGCRYPT and LIBGCRYPT_LIBDIR assignments. * m4/guix.m4 (GUIX_ASSERT_LIBGCRYPT_USABLE): Remove. * README: Add Guile-Gcrypt to the dependencies; move libgcrypt as "required unless --disable-daemon". * doc/guix.texi (Requirements): Likewise. * gnu/packages/bash.scm, guix/derivations.scm, guix/docker.scm, guix/git.scm, guix/http-client.scm, guix/import/cpan.scm, guix/import/cran.scm, guix/import/crate.scm, guix/import/elpa.scm, guix/import/gnu.scm, guix/import/hackage.scm, guix/import/texlive.scm, guix/import/utils.scm, guix/nar.scm, guix/pki.scm, guix/scripts/archive.scm, guix/scripts/authenticate.scm, guix/scripts/download.scm, guix/scripts/hash.scm, guix/scripts/pack.scm, guix/scripts/publish.scm, guix/scripts/refresh.scm, guix/scripts/substitute.scm, guix/store.scm, guix/store/deduplication.scm, guix/tests.scm, tests/base32.scm, tests/builders.scm, tests/challenge.scm, tests/cpan.scm, tests/crate.scm, tests/derivations.scm, tests/gem.scm, tests/nar.scm, tests/opam.scm, tests/pki.scm, tests/publish.scm, tests/pypi.scm, tests/store-deduplication.scm, tests/store.scm, tests/substitute.scm: Adjust imports. * gnu/system/vm.scm: Likewise. (guile-sqlite3&co): Rename to... (gcrypt-sqlite3&co): ... this. Add GUILE-GCRYPT. (expression->derivation-in-linux-vm)[config]: Remove. (iso9660-image)[config]: Remove. (qemu-image)[config]: Remove. (system-docker-image)[config]: Remove. * guix/scripts/pack.scm: Adjust imports. (guile-sqlite3&co): Rename to... (gcrypt-sqlite3&co): ... this. Add GUILE-GCRYPT. (self-contained-tarball)[build]: Call 'make-config.scm' without #:libgcrypt argument. (squashfs-image)[libgcrypt]: Remove. [build]: Call 'make-config.scm' without #:libgcrypt. (docker-image)[config, json]: Remove. [build]: Add GUILE-GCRYPT to the extensions Remove (guix config) from the imported modules. * guix/self.scm (specification->package): Remove "libgcrypt", add "guile-gcrypt". (compiled-guix): Remove #:libgcrypt. [guile-gcrypt]: New variable. [dependencies]: Add it. [*core-modules*]: Remove #:libgcrypt from 'make-config.scm' call. Add #:extensions. [*config*]: Remove #:libgcrypt from 'make-config.scm' call. (%dependency-variables): Remove %libgcrypt. (make-config.scm): Remove #:libgcrypt. * build-aux/build-self.scm (guile-gcrypt): New variable. (make-config.scm): Remove #:libgcrypt. (build-program)[fake-gcrypt-hash]: New variable. Add (gcrypt hash) to the imported modules. Adjust load path assignments. * gnu/packages/package-management.scm (guix)[propagated-inputs]: Add GUILE-GCRYPT. [arguments]: In 'wrap-program' phase, add GUILE-GCRYPT to the search path.
* derivations: Adjust tests for Stow environments.Ludovic Courtès2018-01-30
| | | | | | | | Fixes <https://bugs.gnu.org/30250>. Reported by Jorge <jorge+list@disroot.org>. * tests/derivations.scm ("add-to-store, flat") ("add-to-store, recursive"): Call 'readlink*'.
* tests: Support multiple HTTP server instances.Ludovic Courtès2017-10-12
| | | | | | | | | | | | | * guix/tests/http.scm (%http-server-socket): Turn into... (open-http-server-socket): ... this procedure. (http-server-can-listen?): New procedure. (http-write, %http-server-lock, %http-server-ready) (http-open, stub-http-server): Move to 'call-with-http-server' body. (call-with-http-server): Add #:headers parameter. (with-http-server): Add an additional pattern with headers. * tests/derivations.scm: Use (http-server-can-listen?) instead of (force %http-server-socket). * tests/lint.scm: Likewise.
* derivations: 'derivation-prerequisites-to-build' returns <substitutable>.Ludovic Courtès2017-06-02
| | | | | | | | | | | | | | | | * guix/derivations.scm (derivation-prerequisites-to-build): Rename #:substitutable? to #:substitutable-info. [derivation-substitutable?]: Rename to... [derivation-substitutable-info]: ... this. Return a list of <substitutable>. Second return value is now a list of <substitutable> instead of a list of strings. * guix/ui.scm (show-what-to-build)[substitutable?]: Rename to... [substitutable-info]: ... this. Adjust to new 'derivation-prerequisites-to-build' return value type. * tests/derivations.scm ("derivation-prerequisites-to-build and substitutes"): Adjust. ("derivation-prerequisites-to-build and substitutes, local build"): Likewise.
* derivations: 'substitution-oracle' returns a <substitutable>.Ludovic Courtès2017-06-02
| | | | | | | | | * guix/derivations.scm (substitution-oracle): Use 'substitution-path-info' instead of 'substitution-paths'. Turn SUBST into a vhash from path to <substitutable>. Change the returned procedure to provide a <substitutable> instead of a Boolean. * tests/derivations.scm ("substitution-oracle and #:substitute? #f"): Mock 'substitutable-path-info' instead of 'substitutable-paths'.
* derivations: Adjust builder encoding test.Ludovic Courtès2017-04-22
| | | | | | | This is a followup to 9231ef12f2a595b8f1e677dbe50cc499555302b6. * tests/derivations.scm ("build-expression->derivation and builder encoding"): Set '%default-port-encoding' to "UTF-8".
* derivations: Restore UTF-8 encoding of build scripts.Ludovic Courtès2017-04-21
| | | | | | | | | | | Reported by Mark H Weaver <mhw@netris.org> at <https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00457.html>. * guix/derivations.scm (build-expression->derivation): Use a string output port for the expression. This reverts part of 2dce88d5bbe7a65e101c0734d1c6db44ecc8c299. * tests/derivations.scm ("build-expression->derivation and builder encoding"): New test.
* derivations: Do not fetch narinfos for non-substitutable items.Ludovic Courtès2017-03-28
| | | | | | | | | | | | This avoids connections to substitute servers for derivations that are not substitutable anyway, such as profiles. Reported by Andy Wingo. * guix/derivations.scm (substitution-oracle): Skip derivations that do not pass 'substitutable-derivation?'. * tests/derivations.scm ("substitution-oracle and #:substitute? #f"): New test.
* daemon: Allow check builds of 'builtin:download' derivations.Ludovic Courtès2017-01-11
| | | | | | | | | | | | | | | | | | Fixes <http://bugs.gnu.org/25089>. Reported by Leo Famulari <leo@famulari.name>. * nix/libstore/build.cc (DerivationGoal::runChild): In the 'isBuiltin' case, check whether DRV's output is in 'redirectedOutputs', and pass an 'output' argument to the built-in builder. (DerivationGoal::addHashRewrite): Add 'printMsg' call. * nix/libstore/builtins.hh (derivationBuilder): Add 'output' parameter. * nix/libstore/builtins.cc (builtinDownload): Likewise. Add OUTPUT to ARGV. * guix/scripts/perform-download.scm (perform-download): Add 'output' parameter. (guix-perform-download): Adjust 'match' clauses accordingly. * tests/derivations.scm ("'download' built-in builder, check mode"): New test.
* daemon: Add 'built-in-builders' RPC.Ludovic Courtès2016-11-16
| | | | | | | | | | | | * nix/libstore/builtins.cc (builtinBuilderNames): New function. * nix/libstore/builtins.hh (builtinBuilderNames): New declaration. * nix/libstore/worker-protocol.hh (PROTOCOL_VERSION): Bump to 0x160. (WorkerOp)[wopBuiltinBuilders]: New value. * nix/nix-daemon/nix-daemon.cc (performOp): Handle it. * guix/store.scm (operation-id)[built-in-builders]: New value. * guix/store.scm (read-arg): Add 'string-list'. (built-in-builders): New procedure. * tests/derivations.scm ("built-in-builders"): New test.
* daemon: Add "builtin:download" derivation builder.Ludovic Courtès2016-11-16
| | | | | | | | | | | | | | | | | | | | | | | | | | This ensures that 1) the derivation doesn't change when Guix changes; 2) the derivation closure doesn't contain Guix and its dependencies; 3) we don't have to rely on ugly chroot hacks. Adapted from Nix commit 0a2bee307b20411f5b0dda0c662b1f9bb9e0e131. * nix/libstore/build.cc (DerivationGoal::runChild): Add special case for 'isBuiltin(drv)'. Disable chroot when 'isBuiltin(drv)'. * nix/libstore/builtins.cc, nix/libstore/builtins.hh, nix/scripts/download.in, guix/scripts/perform-download.scm: New files. * guix/ui.scm (show-guix-help)[internal?]: Add 'perform-download'. * nix/local.mk (libstore_a_SOURCES): Add builtins.cc. (libstore_headers): Add builtins.hh. (nodist_pkglibexec_SCRIPTS): Add 'scripts/download'. * config-daemon.ac: Emit 'scripts/download'. * Makefile.am (MODULES): Add 'guix/scripts/perform-download.scm'. * tests/derivations.scm ("unknown built-in builder") ("'download' built-in builder") ("'download' built-in builder, invalid hash") ("'download' built-in builder, not found") ("'download' built-in builder, not fixed-output"): New tests. Co-authored-by: Eelco Dolstra <eelco.dolstra@logicblox.com>
* derivations: 'derivation' sorts items in the resulting object.Ludovic Courtès2016-05-21
| | | | | | | | | | | | * guix/derivations.scm (derivation-input<?): New procedure. (write-derivation)[coalesce-duplicate-inputs]: Remove. Remove calls to 'sort'. (coalesce-duplicate-inputs): New procedure. (derivation-hash): Sort INPUTS and use 'coalesce-duplicate-inputs'. (derivation)[input->derivation-input] [coalesce-duplicate-inputs]: New procedures. Sort OUTPUTS, INPUTS, and ENV-VARS. * tests/derivations.scm ("read-derivation vs. derivation"): New test.
* build: Add a Guile custom test driver using SRFI-64.Mathieu Lirzin2016-04-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before that '.log' files for scheme tests were fragmented and not included in test-suite.log. This unifies the semantics of SRFI-64 API with Automake test suite. * build-aux/test-driver.scm: New file. * Makefile.am (SCM_LOG_DRIVER, AM_SCM_LOG_DRIVER_FLAGS): New variables. (SCM_LOG_COMPILER, AM_SCM_LOG_FLAGS): Delete variables. (AM_TESTS_ENVIRONMENT): Set GUILE_AUTO_COMPILE to 0. * test-env.in: Silence guix-daemon. * doc/guix.texi (Running the Test Suite): Describe how to display the detailed results. Bug reports require only 'test-suite.log' file. * tests/base32.scm, tests/build-utils.scm, tests/builders.scm, tests/challenge.scm, tests/cpan.scm, tests/cpio.scm, tests/cran.scm, tests/cve.scm, tests/derivations.scm, tests/elpa.scm, tests/file-systems.scm, tests/gem.scm, tests/gexp.scm, tests/gnu-maintenance.scm, tests/grafts.scm, tests/graph.scm, tests/gremlin.scm, tests/hackage.scm, tests/hash.scm, tests/import-utils.scm, tests/lint.scm, tests/monads.scm, tests/nar.scm, tests/packages.scm, tests/pk-crypto.scm, tests/pki.scm, tests/profiles.scm, tests/publish.scm, tests/pypi.scm, tests/records.scm, tests/scripts-build.scm, tests/scripts.scm, tests/services.scm, tests/sets.scm, tests/size.scm, tests/snix.scm, tests/store.scm, tests/substitute.scm, tests/syscalls.scm, tests/system.scm, tests/ui.scm, tests/union.scm, tests/upstream.scm, tests/utils.scm: Don't exit at the end of test groups. * tests/containers.scm: Likewise. Use 'test-skip' instead of exiting with error code 77.
* derivations: Raise an error when a module file is not found.Ludovic Courtès2016-03-23
| | | | | | | | | | | | Suggested by Jookia. * guix/derivations.scm (&file-search-error): New error condition. (search-path*): Raise it when 'search-path' returns #f. * guix/gexp.scm (search-path*): Remove. * guix/ui.scm (call-with-error-handling): Add case for 'file-search-error?'. * tests/derivations.scm ("build-expression->derivation and invalid module name"): New test.
* derivations: Add #:disallowed-references.Ludovic Courtès2016-03-20
| | | | | | | | | * guix/derivations.scm (derivation): Add #:disallowed-references. [user+system-env-vars]: Honor it. (build-expression->derivation): Likewise. * tests/derivations.scm ("derivation #:disallowed-references, ok") ("derivation #:disallowed-references, not ok"): New tests. * doc/guix.texi (Derivations): Adjust accordingly.
* tests: Disable grafting by default for most tests.Ludovic Courtès2016-03-06
| | | | | | | | | | | | | | | This allows tests to run as expected even in the presence of replacements among the bootstrap packages, such as Perl (commit d8173f21f7b4e3cb83541b8fa70621d2b6d4ce1c). * tests/cpan.scm: Add (%graft? #f). * tests/derivations.scm: Likewise. * tests/graph.scm: Likewise. * tests/monads.scm: Likewise. * tests/profiles.scm: Likewise. * tests/gexp.scm: Likewise. ("gexp->derivation vs. grafts"): Explicitly reenable grafting before, and disable it after, using 'set-grafting'.
* derivations: Move grafts to (guix grafts).Ludovic Courtès2016-02-22
| | | | | | | | | | | | * guix/derivations.scm (<graft>, graft-derivation, %graft?) (set-grafting): Move to... * guix/grafts.scm: ... here. New file. * guix/gexp.scm, guix/packages.scm, tests/packages.scm, guix/scripts/build.scm: Use it. * Makefile.am (MODULES): Add it. (SCM_TESTS): Add tests/grafts.scm. * tests/derivations.scm ("graft-derivation"): Move to... * tests/grafts.scm: ... here. New file.
* derivations: Add test in keep-going mode.Ludovic Courtès2016-01-19
| | | | * tests/derivations.scm ("derivation fails but keep going"): New test.
* derivations: Add test for #:leaked-env-vars.Ludovic Courtès2016-01-18
| | | | * tests/derivations.scm ("derivation #:leaked-env-vars"): New test.
* derivations: Determine what's built in 'check' mode.Ludovic Courtès2015-12-09
| | | | | | | | | | | * guix/derivations.scm (substitution-oracle): Add #:mode parameter and honor it. (derivation-prerequisites-to-build): Likewise. [derivation-built?]: Take it into account. * guix/ui.scm (show-what-to-build): Add #:mode parameter. Pass it to 'substitute-oracle' and 'derivations-prerequisites-to-build'. * tests/derivations.scm ("derivation-prerequisites-to-build in 'check' mode"): New test.