aboutsummaryrefslogtreecommitdiff
path: root/guix/derivations.scm
Commit message (Collapse)AuthorAge
* derivations: 'build-expression->derivation' supports #:allowed-references.Ludovic Courtès2014-06-06
| | | | | | * guix/derivations.scm (build-expression->derivation): Add #:allowed-references and pass it to 'derivation. * doc/guix.texi (Derivations): Adjust accordingly.
* derivations: Add #:allowed-references 'derivation' parameter.Ludovic Courtès2014-06-01
| | | | | | | | | | | * guix/derivations.scm (derivation): Add #:allowed-references parameter. [user+system-env-vars]: Honor it. * tests/derivations.scm ("derivation #:allowed-references, ok", "derivation #:allowed-references, not allowed", "derivation #:allowed-references, self allowed", "derivation #:allowed-references, self not allowed"): New tests. * doc/guix.texi (Derivations): Document #:allowed-references.
* derivations: Micro-optimize 'derivation'.Ludovic Courtès2014-04-29
| | | | | | | * guix/derivations.scm (derivation->string): New procedure. (derivation-hash, derivation): Use it. Memoization here yields a 5% improvement on "guix build -e '(@ (gnu packages emacs) emacs)' -n --no-substitutes".
* derivations: Fix 'fixed-output-derivation?'.Ludovic Courtès2014-04-13
| | | | | | | Reported by Nikita Karetnikov <nikita@karetnikov.org>. * guix/derivations.scm (fixed-output-derivation?): Fix pattern. * tests/derivations.scm ("fixed-output-derivation?"): Add test.
* Merge branch 'master' into core-updatesLudovic Courtès2014-03-17
|\
| * More /gnu/store replacements.Ludovic Courtès2014-03-10
| | | | | | | | | | | | | | | | * gnu/packages/gcc.scm (gcc-4.7): Change /nix/store in comment. * gnu/system/vm.scm (operating-system-default-contents): Use (%store-prefix) instead of "/nix/store". * guix/derivations.scm (derivation-path->output-path, derivation-path->output-paths): Change to /gnu/store in docstring.
* | Merge branch 'master' into core-updatesLudovic Courtès2014-02-22
|\| | | | | | | | | Conflicts: gnu-system.am
| * derivations: Remove unused 'derivation' parameter.Ludovic Courtès2014-02-21
| | | | | | | | | | * guix/derivations.scm (derivation): Remove unused #:hash-mode parameter. * doc/guix.texi (Derivations): Adjust accordingly.
| * derivations: Add support for recursive fixed-output derivations.Ludovic Courtès2014-02-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * guix/derivations.scm (<derivation-output>): Add 'recursive?' field. Adjust 'make-derivation-output' callers. (%read-derivation) <fixed-output>: When HASH-ALGO starts with 'r:', set the 'recursive?' field and drop 'r:' from the hash algo name. (write-derivation)[write-output]: Write the algo as 'r:HASH-ALGO' when the RECURSIVE? field is set. (derivation-hash) <fixed-output>: Prepend "r:" when RECURSIVE? is set. (fixed-output-path): New procedure. (derivation): Add #:recursive? parameter. Use 'fixed-output-path' to compute the output file name of a fixed output derivation. (build-expression->derivation): Add #:recursive? parameter. Pass it to 'derivation'. * tests/derivations.scm ("fixed-output derivation, recursive", "build-expression->derivation produces recursive fixed-output", "build-expression->derivation uses recursive fixed-output"): New tests. * doc/guix.texi (Derivations): Document #:recursive? for 'derivation'. Add #:recursive? for 'build-expression->derivation'.
* | Prefer local builds for "small" derivations.Ludovic Courtès2014-01-25
|/ | | | | | | * gnu/system.scm (union, file-union, links): Pass #:local-build? #t to 'derivation-expression'. * guix/derivations.scm (imported-files, compiled-modules): Likewise. * guix/profiles.scm (profile-derivation): Likewise.
* derivations: Add #:local-build? parameter for derivations.Ludovic Courtès2014-01-25
| | | | | | | | * guix/derivations.scm (derivation): Add #:local-build? parameter and honor it. (build-expression->derivation): Likewise. * doc/guix.texi (Derivations): Update documentation of these procedures.
* derivations: Use more keyword parameters for 'build-expression->derivation'.Ludovic Courtès2013-12-04
| | | | | | | | | | | | | | | | | * guix/derivations.scm (build-expression->derivation): Turn 'system' and 'inputs' into keyword parameters. Adjust callers accordingly. * gnu/system/linux.scm, gnu/system/vm.scm, guix/build-system/cmake.scm, guix/build-system/gnu.scm, guix/build-system/perl.scm, guix/build-system/python.scm, guix/build-system/trivial.scm, guix/download.scm, guix/packages.scm, guix/profiles.scm, guix/scripts/pull.scm, tests/derivations.scm, tests/guix-build.sh, tests/monads.scm, tests/store.scm, tests/union.scm: Adjust users of 'build-expression->derivation' and 'derivation-expression' accordingly. * doc/guix.texi (Derivations): Adjust 'build-expression->derivation' documentation accordingly. (The Store Monad): Likewise for 'derivation-expression'.
* derivations: Allow 'map-derivations' to replace sources.Ludovic Courtès2013-11-13
| | | | | | | * guix/derivations.scm (map-derivation)[input->output-paths]: Allow non-derivation inputs. Allow replacements to be store files. Replace in SOURCES too. * tests/derivations.scm ("map-derivation, sources"): New test.
* store: Make 'direct-store-path?' public.Ludovic Courtès2013-11-13
| | | | | | * guix/store.scm (direct-store-path?): New procedure. * guix/derivations.scm (derivation)[direct-store-path?]: Remove. * tests/store.scm ("direct-store-path?"): New test.
* derivations: Add 'map-derivation'.Ludovic Courtès2013-11-13
| | | | | * guix/derivations.scm (map-derivation): New procedure. * tests/derivations.scm ("map-derivation"): New test.
* derivations: 'derivation-path->output-path' honors the 'output' parameter.Ludovic Courtès2013-10-30
| | | | | | * guix/derivations.scm (derivation-path->output-path): Pass OUTPUT. * tests/derivations.scm ("multiple-output derivation, derivation-path->output-path"): New test.
* derivations: 'derivation' and related procedures return a single value.Ludovic Courtès2013-09-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * guix/derivations.scm (derivation->output-path, derivation->output-paths): New procedures. (derivation-path->output-path): Use 'derivation->output-path'. (derivation-path->output-paths): Use 'derivation->output-paths'. (derivation): Accept 'derivation?' objects as inputs. Return a single value. (build-derivations): New procedure. (compiled-modules): Use 'derivation->output-paths'. (build-expression->derivation)[source-path]: Add case for when the input matches 'derivation?'. [prologue]: Accept 'derivation?' objects in INPUTS. [mod-dir, go-dir]: Use 'derivation->output-path'. * guix/download.scm (url-fetch): Adjust to the single-value return. * guix/packages.scm (package-output): Use 'derivation->output-path'. * guix/scripts/build.scm (guix-build): When the argument is 'derivation-path?', pass it through 'read-derivation'. Use 'derivation-file-name' to print out the .drv file names, and to register them. Use 'derivation->output-path' instead of 'derivation-path->output-path'. * guix/scripts/package.scm (roll-back): Adjust to the single-value return. (guix-package): Use 'derivation->output-path'. * guix/ui.scm (show-what-to-build): Adjust to deal with 'derivation?' objects instead of .drv file names. * gnu/system/grub.scm (grub-configuration-file): Use 'derivation->output-path' instead of 'derivation-path->output-path'. * gnu/system/vm.scm (qemu-image, system-qemu-image): Likewise. * tests/builders.scm, tests/derivations.scm, tests/packages.scm, tests/store.scm, tests/union.scm: Adjust to the new calling convention. * doc/guix.texi (Defining Packages, The Store, Derivations): Adjust accordingly.
* derivations: Add a nicer printer.Ludovic Courtès2013-09-18
| | | | * guix/derivations.scm (<derivation>): Add a printer.
* derivations: Keep the .drv file name in <derivation> objects.Ludovic Courtès2013-09-17
| | | | | | | | | * guix/derivations.scm (<derivation>): Add 'file-name' field. (%read-derivation): Use (port-filename DRV-PORT) as the file name for the result. (derivation): Set the 'file-name' field in the result. * tests/derivations.scm ("build derivation with 1 source"): Assert that 'derivation-file-name' returns the right thing.
* gnu: linux-initrd: Allow Guile modules to be embedded in the initrd.Ludovic Courtès2013-08-29
| | | | | | | | | * gnu/packages/linux-initrd.scm (raw-build-system): New macro. (module-package, compiled-module-package): New procedures. (expression->initrd): Add `modules' keyword parameter. Add "modules" and "modules/compiled" inputs; copy them onto the initrd. * guix/derivations.scm (imported-modules, compiled-modules): Publicize.
* derivations: Rename #:dependency-graphs to #:references-graphs.Ludovic Courtès2013-08-28
| | | | | | | * guix/derivations.scm (derivation, build-expression->derivation): Rename #:dependency-graphs to #:references-graphs, for consistency in the terminology. * tests/derivations.scm: Adjust accordingly.
* derivations: Add #:dependency-graphs to `build-expression->derivation'.Ludovic Courtès2013-08-26
| | | | | | | | | * guix/derivations.scm (build-expression->derivation): Add #:dependency-graphs keyword argument. Pass it to `derivation'. * tests/derivations.scm ("build-expression->derivation with #:dependency-graphs"): New test. * doc/guix.texi (Derivations): Update `build-expression->derivation' description.
* derivations: Add #:dependency-graphs `derivation' parameter.Ludovic Courtès2013-08-26
| | | | | | | | | | | * guix/derivations.scm (derivation): Add `dependency-graphs' keyword parameter; honor it. * tests/derivations.scm (bootstrap-binary): New procedure. (%bash): Use it. (%mkdir): New variable. (directory-contents): Add `slurp' optional parameter. ("derivation with #:dependency-graphs"): New test. * doc/guix.texi (Derivations): Update accordingly.
* derivations: Move 3 positional parameters into keyword parameters.Ludovic Courtès2013-08-26
| | | | | | | | | * guix/derivations.scm (derivation): Turn `system', `env-vars', and `inputs' into keyword parameters. (build-expression->derivation): Adjust accordingly. * gnu/packages/bootstrap.scm (%bootstrap-guile): Likewise. * tests/derivations.scm, tests/store.scm: Likewise. * doc/guix.texi (Derivations): Likewise.
* Use `port-sha256' and `open-sha256-port'.Ludovic Courtès2013-07-03
| | | | | | | | * guix/derivations.scm (derivation-hash): Add comment as to why we keep the plain `sha256' call. * guix/scripts/download.scm (guix-download): Use `port-sha256' instead of (compose sha256 get-bytevector-all). * guix/scripts/refresh.scm (update-package): Likewise.
* Move `sha256' to (guix hash).Ludovic Courtès2013-07-01
| | | | | | | | | * guix/utils.scm (sha256): Move to... * guix/hash.scm: ... here. New file. * Makefile.am (MODULES): Add it. * guix/derivations.scm, guix/scripts/download.scm, guix/scripts/hash.scm, guix/scripts/refresh.scm, tests/base32.scm, tests/derivations.scm, tests/store.scm: Use (guix hash).
* derivations: Micro-optimize `derivation-hash'.Ludovic Courtès2013-06-14
| | | | | * guix/derivations.scm (derivation-hash): Use a UTF-8-encoded string output port. This makes things deterministic, and slightly faster.
* scripts: Report what will be substituted.Ludovic Courtès2013-04-17
| | | | | | | | | | | | | | | | * guix/derivations.scm (derivation-input-output-paths): New procedure. (derivation-prerequisites-to-build): New `use-substitutes?' keyword argument. Change two return the list of substitutable paths as a second argument. * guix/ui.scm (show-what-to-build): Turn `dry-run?' into a keyword argument. New `use-substitutes?' keyword argument. Use `fold2' and adjust to use both return values of `derivation-prerequisites-to-build'. Display what will/would be downloaded. * guix/scripts/build.scm (guix-build): Adjust accordingly. * guix/scripts/package.scm (guix-package): Likewise. * tests/derivations.scm ("derivation-prerequisites-to-build and substitutes"): New test.
* derivations: Optimize `build-expression->derivation'.Ludovic Courtès2013-03-16
| | | | | | | | | This reduces the execution time of "guix build -e '(@ (gnu packages emacs) emacs)' -d" by 6%, from 1.15s to 1.08s. * guix/derivations.scm (build-expression->derivation): Write the builder as UTF-8.
* derivations: Optimize `write-derivation'.Ludovic Courtès2013-03-16
| | | | | | | | | | | | This reduces the execution time of "guix build -e '(@ (gnu packages emacs) emacs)' -d" by 25%, from 1.54 s. to 1.15s. * guix/derivations.scm (write-sequence, write-list, write-tuple): New procedures. (write-derivation)[list->string, write-list]: Remove. [write-string-list, write-output, write-input, write-env-var]: New helpers. Rewrite in terms of these new helpers.
* derivations: Add a search path parameter for module derivations.Ludovic Courtès2013-02-20
| | | | | * guix/derivations.scm (imported-modules, compiled-modules): Add a `module-path' parameter. Use it instead of %LOAD-PATH.
* derivations: Memoize `read-derivation'.Ludovic Courtès2013-01-30
| | | | | | | * guix/derivations.scm (read-derivation): Rename to... (%read-derivation): ... this. (read-derivation): New procedure. This reduces the execution of "guix-build gdb" from 2.5s to 1.7s.
* store: Remove the `fixed?' parameter from `add-to-store'.Ludovic Courtès2013-01-30
| | | | | | | | * guix/store.scm (add-to-store): Remove the `fixed?' parameter from the public interface. * gnu/packages/bootstrap.scm, guix-download.in, guix/derivations.scm, guix/packages.scm, tests/derivations.scm: Update all callers accordingly.
* doc: Start documenting derivations.Ludovic Courtès2013-01-16
| | | | | | | * doc/guix.texi (Defining Packages): Add cross-reference to "Derivations". (The Store): Add `build-derivations'. (Derivations): Populate.
* derivations: Fix `derivation-prerequisites-to-build' when outputs are there.Ludovic Courtès2013-01-09
| | | | | | | | | | | Before it would list inputs not built, even if the outputs of the given derivation were already available. * guix/derivations.scm (derivation-prerequisites-to-build): Add `outputs' keyword parameter. [built?, derivation-built?]: New procedures. [loop]: Add `sub-drvs' parameter. Use `derivation-built?' to check if the SUB-DRVS of DRV are built before checking its inputs.
* Update license headers.Ludovic Courtès2013-01-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change all license headers, except guix/build/* and ld-wrapper.scm, with this code: (use-modules (guix build utils) (srfi srfi-1)) (fluid-set! %default-port-encoding "UTF-8") (substitute* (remove (lambda (f) (or (string-contains f ".tar.") (string-contains f ".git/") (string-contains f ".so") (string-suffix? ".o" f) (string-suffix? ".a" f) (string-suffix? ".go" f) (string-suffix? ".pdf" f) (string-suffix? ".png" f) (string-suffix? ".info" f) (equal? (basename f) "guix-daemon") (equal? (basename f) "nix-setuid-helper") (string-contains f "nix-upstream/") (string-contains f "distro/packages/bootstrap/"))) (find-files "." "\\.[a-z]+$")) (("^([[:graph:]]+) This file is part of Guix." _ comment-start) (string-append comment-start " This file is part of GNU Guix.")) (("^([[:graph:]]+) Guix --- Nix package management.*" _ comment-start) (string-append comment-start " GNU Guix --- Functional package management for GNU\n")) (("^([[:graph:]]+) Guix is " _ comment-start) (string-append comment-start " GNU Guix is ")) (("^([[:graph:]]+) along with Guix." _ comment-start) (string-append comment-start " along with GNU Guix.")) (("^([[:graph:]]+) Copyright \\(C\\)" _ comment-start) (string-append comment-start " Copyright ©"))) Change headers using C-style comments manually.
* derivations: Add `derivation-path->output-paths'.Ludovic Courtès2013-01-05
| | | | | * guix/derivations.scm (derivation-path->output-paths): New procedure. * tests/derivations.scm ("multiple-output derivation"): Test it.
* derivations: Distinguish direct store paths from files within a store path.Ludovic Courtès2012-12-10
| | | | | * guix/derivations.scm (derivation)[direct-store-path?]: New procedure. Use it to determine which inputs must be added to the store.
* derivations: Fix erroneous call to `add-to-store' for local files as input.Ludovic Courtès2012-12-04
| | | | | | | * guix/derivations.scm (derivation)[inputs]: Fix typo in call to `add-to-store'. * tests/derivations.scm ("derivation with local file as input"): New test. * tests/packages.scm ("trivial with local file as input"): New test.
* Move base32 code to (guix base32).Ludovic Courtès2012-11-11
| | | | | | | | | | | | | | | | | | | | | | * guix/utils.scm (bytevector-quintet-ref, bytevector-quintet-ref-right, bytevector-quintet-length, bytevector-quintet-fold, bytevector-quintet-fold-right, make-bytevector->base32-string, %nix-base32-chars, %rfc4648-base32-chars, bytevector->base32-string, bytevector->nix-base32-string, bytevector-quintet-set!, bytevector-quintet-set-right!, base32-string-unfold, base32-string-unfold-right, make-base32-string->bytevector, base32-string->bytevector, nix-base32-string->bytevector): Move to... * guix/base32.scm: ... here. New file. * tests/utils.scm (%nix-hash, "bytevector->base32-string", "base32-string->bytevector", "nix-base32-string->bytevector", "sha256 & bytevector->base32-string"): Move to... * tests/base32.scm: ... here. New file * guix-download.in, guix/derivations.scm, guix/packages.scm, guix/snix.scm, tests/builders.scm, tests/derivations.scm: Adjust accordingly. * guix.scm (%public-modules): Add `base32'.
* derivations: build-expression->derivation: Builder only refers to sources.Ludovic Courtès2012-11-09
| | | | | | | | | | * guix/derivations.scm (build-expression->derivation)[source-path]: New procedure. [builder]: Pass only sources as references. This fixes a bug whereby changing a fixed-output drv referred to by a builder would cause the builder's hash to change, thereby leading to a full rebuild. * tests/derivations.scm ("build-expression->derivation with a fixed-output input"): New test.
* derivations: Make sure `build-expression->derivation' & co. pass `system'.Ludovic Courtès2012-10-25
| | | | | | | * guix/derivations.scm (imported-files): Call `build-expression->derivation' with SYSTEM, not (%current-system). (build-expression->derivation): Pass SYSTEM to `imported-modules' and `compiled-modules'.
* derivations: Pass the derivation of guile-for-build to `imported-files' & co.Ludovic Courtès2012-10-25
| | | | | | | | | | | * guix/derivations.scm (%guile-for-build): Initialize to #f. (imported-files, imported-modules, compiled-modules): Add `guile' keyword parameter. Pass it down to `build-expression->derivation'. (build-expression->derivation)[guile-drv]: New variable. Pass it as the #:guile parameter for `imported-modules' and `compiled-modules'. * tests/derivations.scm: Set %GUILE-FOR-BUILD to the derivation of %BOOTSTRAP-GUILE.
* derivations: Compile the #:modules passed to `build-expression->derivation'.Ludovic Courtès2012-10-24
| | | | | | | | | | * guix/derivations.scm (imported-files)[parent-dirs]: Move to... (parent-directories): ... here. New procedure. (compiled-modules): New procedure. (build-expression->derivation): Use it. * tests/derivations.scm ("build-expression->derivation with modules"): New test.
* derivations: Set input port to UTF-8 in `read-derivation'.Ludovic Courtès2012-10-07
| | | | | * guix/derivations.scm (read-derivation): Set DRV-PORT's encoding to UTF-8.
* Optimize `write-derivation' and `derivation-path->output-path'.Ludovic Courtès2012-09-02
| | | | | | * guix/derivations.scm (write-derivation): Explicitly use `simple-format'. (derivation-path->output-path): Memoize.
* Add a `guile-for-build' parameter to `build-expression->derivation'.Ludovic Courtès2012-09-01
| | | | | | | * guix/derivations.scm (%guile-for-build): Use `nixpkgs-derivation*' instead of `nixpkgs-derivation'. (build-expression->derivation): New `guile-for-build' keyword parameter. Use it.
* Add an `env-vars' keyword parameter to `build-expression->derivation'.Ludovic Courtès2012-09-01
| | | | | * guix/derivations.scm (build-expression->derivation): New `env-vars' keyword parameter; default to '(). Use it.
* Unset `LD_LIBRARY_PATH' in `build-expression->derivation'.Ludovic Courtès2012-07-07
| | | | | * guix/derivations.scm (build-expression->derivation)[prolog]: Unset `LD_LIBRARY_PATH'.
* derivation: Coalesce multiple occurrences of the same input.Ludovic Courtès2012-07-02
| | | | | | | | | * guix/derivations.scm (write-derivation)[coalesce-duplicate-inputs]: New procedure. Use it to process INPUTS. * tests/derivations.scm ("user of multiple-output derivation"): New test.