summaryrefslogtreecommitdiff
path: root/guix/derivations.scm
AgeCommit message (Expand)Author
2017-04-20derivations: Avoid string-to-bytevector conversions....On Guile 2.2.1, this yields a 5% speedup on: guix build libreoffice xmonad certbot -n --no-substitutes --no-build-hook * guix/derivations.scm (derivation->string): Rename to... (derivation->bytevector): ... this. Use 'open-bytevector-output-port' instead of 'call-with-output-string'. (derivation-hash): Remove string-to-bytevector conversion before 'sha256' call. (build-expression->derivation): Use 'add-data-to-store' and an bytevector port instead of a string port for the expression. Ludovic Courtès
2017-03-28derivations: Do not fetch narinfos for non-substitutable items....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. Ludovic Courtès
2017-03-16utils: Move base16 procedures to (guix base16)....* guix/utils.scm (bytevector->base16-string, base16-string->bytevector): Move to... * guix/base16.scm: ... here. New file. * tests/utils.scm ("bytevector->base16-string->bytevector"): Move to... * tests/base16.scm: ... here. New file. * Makefile.am (MODULES): Add guix/base16.scm. (SCM_TESTS): Add tests/base16.scm. * build-aux/download.scm, guix/derivations.scm, guix/docker.scm, guix/import/snix.scm, guix/pk-crypto.scm, guix/scripts/authenticate.scm, guix/scripts/download.scm, guix/scripts/hash.scm, guix/store.scm, tests/hash.scm, tests/pk-crypto.scm: Adjust imports accordingly. Ludovic Courtès
2017-01-28Use 'mlambda' instead of 'memoize'....* gnu/packages.scm (find-newest-available-packages): Use 'mlambda' instead of (memoize (lambda ...) ...). * gnu/packages/bootstrap.scm (package-with-bootstrap-guile): Likewise. * guix/build-system/gnu.scm (package-with-explicit-inputs)[rewritten-input]: Likewise. * guix/build-system/python.scm (package-with-explicit-python)[transform]: Likewise. * guix/derivations.scm (derivation->string): Likewise. * guix/gnu-maintenance.scm (gnu-package?): Likewise. * guix/modules.scm (module-file-dependencies): Likewise. * guix/scripts/graph.scm (standard-package-set): Likewise. * guix/scripts/lint.scm (official-gnu-packages*): Likewise. * guix/store.scm (store-regexp*): Likewise. * guix/utils.scm (location): Likewise. Ludovic Courtès
2017-01-28Add (guix memoization)....* guix/combinators.scm (memoize): Remove. * guix/memoization.scm: New file. * Makefile.am (MODULES): Add it. * gnu/packages.scm, gnu/packages/bootstrap.scm, guix/build-system/gnu.scm, guix/build-system/python.scm, guix/derivations.scm, guix/gnu-maintenance.scm, guix/import/cran.scm, guix/import/elpa.scm, guix/modules.scm, guix/scripts/build.scm, guix/scripts/graph.scm, guix/scripts/lint.scm, guix/store.scm, guix/utils.scm: Adjust imports accordingly. Ludovic Courtès
2017-01-11derivations: Make <derivation> record datatype immutable....* guix/derivations.scm (<derivation>): Make it immutable. (derivation): Use generic 'set-field' instead of ad-hoc functional setter. Mathieu Lirzin
2017-01-05derivations: Share a cache between 'derivation' and 'read-derivation'....This leads a 13% speedup on 'guix build libreoffice -d' and 18% on 'guix build gnome -d'. * guix/derivations.scm (%derivation-cache): New variable. (read-derivation): Use it instead of the private 'cache' variable. (derivation): Populate %DERIVATION-CACHE before returning. Ludovic Courtès
2017-01-05derivations: Micro-optimize 'write-derivation'....* guix/derivations.scm (write-derivation)[write-input]: Use 'display' instead of 'write' for PATH. Use 'simple-format' instead of 'format', and '~a' instead of '~s' for SYSTEM and BUILDER. Ludovic Courtès
2016-11-19derivations: Add 'raw-derivation'....* guix/derivations.scm (raw-derivation): New procedure. * guix/download.scm (raw-derivation): Remove. * guix/gexp.scm (raw-derivation): Remove. Ludovic Courtès
2016-10-19Use (ice-9 binary-ports) instead of (rnrs io ports)....This reduces the closure of (guix ui) from 123 to 106 modules. * guix/derivations.scm: Use (ice-9 binary-ports) instead of (rnrs io ports). (map-derivation)[substitute-file]: Use 'read-string' instead of 'get-string-all'. * guix/ftp-client.scm: Likewise. * guix/hash.scm: Likewise. * guix/http-client.scm: Likewise. * guix/pki.scm (ensure-acl, current-acl): Likewise. * guix/scripts/archive.scm (authorize-key)[read-key]: Likewise. * guix/scripts/authenticate.scm (read-canonical-sexp) (read-hash-data): Likewise. * guix/scripts/download.scm: Likewise. * guix/scripts/offload.scm (register-gc-root, remove-gc-roots) (send-files): Likewise. * guix/scripts/publish.scm (lazy-read-file-sexp): Likewise. * guix/scripts/refresh.scm: Likewise. * guix/scripts/substitute.scm (check-acl-initialized): Likewise. * guix/serialization.scm (read-maybe-utf8-string): Likewise. * guix/scripts/hash.scm (guix-hash): Use 'force-output' instead of 'flush-output-port'. * guix/store.scm (process-stderr): Likewise. * guix/tests.scm: Likewise. * guix/utils.scm: Use (ice-9 binary-ports) and autoload (rnrs io ports) for 'make-custom-binary-input-port'. Ludovic Courtès
2016-07-20derivations: Export 'fixed-output-path'....* guix/derivations.scm (fixed-output-path): Change 'output', 'hash-algo', and 'recursive?' to keyword parameters. Export. (derivation): Adjust accordingly. Ludovic Courtès
2016-05-21derivations: 'derivation' sorts items in the resulting object....* 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. Ludovic Courtès
2016-05-04utils: Move combinators to (guix combinators)....* guix/utils.scm (compile-time-value, memoize, fold2) (fold-tree, fold-tree-leaves): Move to... * guix/combinators: ... here. New file. * tests/utils.scm ("fold2, 1 list", "fold2, 2 lists") (fold-tree tests): Move to... * tests/combinators.scm: ... here. New file. * Makefile.am (MODULES, SCM_TESTS): Add them. * gnu/packages.scm, gnu/packages/bootstrap.scm, gnu/services/herd.scm, guix/build-system/gnu.scm, guix/build-system/python.scm, guix/derivations.scm, guix/gnu-maintenance.scm, guix/import/elpa.scm, guix/scripts/archive.scm, guix/scripts/build.scm, guix/scripts/graph.scm, guix/scripts/lint.scm, guix/scripts/size.scm, guix/scripts/substitute.scm, guix/serialization.scm, guix/store.scm, guix/ui.scm: Adjust imports accordingly. Ludovic Courtès
2016-03-23derivations: Raise an error when a module file is not found....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. Ludovic Courtès
2016-03-23derivations: Add 'module->source-file-name'....* guix/derivations.scm (module->source-file-name): New procedure. (%imported-modules): Use it. * guix/gexp.scm (imported-modules): Likewise. Ludovic Courtès
2016-03-20derivations: Add #:disallowed-references....* 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. Ludovic Courtès
2016-02-22derivations: Move grafts to (guix grafts)....* 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. Ludovic Courtès
2015-12-09guix build: Add '--check'....* guix/derivations.scm (build-derivations): Add optional 'mode' parameter. * guix/scripts/build.scm (%default-options): Add 'build-mode'. (show-help, %options): Add '--check'. (guix-build): Honor 'build-mode' key of OPTS. Pass it to 'show-what-to-build' and 'build-derivations'. * doc/guix.texi (Invoking guix build): Document it. (Substitutes): Mention it. Ludovic Courtès
2015-12-09derivations: Determine what's built in 'check' mode....* 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. Ludovic Courtès
2015-07-22derivations: Improve docstring of 'substitution-oracle'....* guix/derivations.scm (substitution-oracle): Improve docstring. Ludovic Courtès
2015-07-22derivations: Improve complexity of 'substitution-oracle'....* guix/derivations.scm (substitution-oracle): Use a final 'concatenate' instead of repeated 'append's. Ludovic Courtès
2015-07-03derivations: Add #:substitutable?, distinguished from #:local-build?....Fixes <http://bugs.gnu.org/18747>. * guix/derivations.scm (substitutable-derivation?): Rewrite to check for "allowSubstitutes". (derivation): Add #:substitutable? parameter. [user+system-env-vars]: Honor it. (build-expression->derivation): Add #:substitutable? and honor it. * guix/gexp.scm (gexp->derivation): Likewise. * tests/derivations.scm ("derivation-prerequisites-to-build and substitutes, non-substitutable build"): Use #:substitutable? instead of #:local-build?. ("substitutable-derivation?", "derivation-prerequisites-to-build and substitutes, local build"): New tests. * guix/download.scm (url-fetch): Adjust comment. * guix/git-download.scm (git-fetch): Likewise. * guix/build-system/gnu.scm (gnu-build, gnu-cross-build): Use #:substitutable? instead of #:local-build?. * doc/guix.texi (Derivations, G-Expressions): Adjust accordingly. Ludovic Courtès
2015-05-01derivations: Add #:leaked-env-vars parameter....Suggested by Joshua Randall <jcrandall@alum.mit.edu> in <http://bugs.gnu.org/20402>. * guix/derivations.scm (derivation): Add #:leaked-env-vars parameter. [user+system-env-vars]: Honor it. * guix/gexp.scm (gexp->derivation): Add #:leaked-env-vars and pass it to 'raw-derivation'. * doc/guix.texi (Derivations, G-Expressions): Adjust accordingly. Ludovic Courtès
2015-03-25derivations: 'substitution-oracle' now ignores sub-trees that are valid....Before that, "guix build qt", when only qt itself is missing, would lead 'substitution-oracle' to call 'substitutable-paths' with 318 items. Now, this is down to 6 items, because it doesn't ask about prerequisites that are already valid. * guix/derivations.scm (substitution-oracle)[valid-input?, dependencies]: New procedures. Use 'dependencies' and remove call to 'remove'. Ludovic Courtès
2015-03-25derivations: Add a 'cut?' parameter to 'derivation-prerequisites'....* guix/derivations.scm (valid-derivation-input?): New procedure. (derivation-prerequisites): Add 'cut?' parameter and honor it. * tests/derivations.scm ("derivation-prerequisites and derivation-input-is-valid?"): New test. Ludovic Courtès
2015-03-24derivations: Don't invoke the substituter when an item is already in store....Fixes <http://bugs.gnu.org/20188>. Reported by Mark H Weaver <mhw@netris.org>. * guix/derivations.scm (substitution-oracle): Add 'valid?' procedure. Remove 'valid?' items from PATHS. Ludovic Courtès
2015-03-17packages: Move grafting parameter to (guix derivations)....* guix/packages.scm (%graft?, set-grafting): Move to... * guix/derivations.scm: ... here. Ludovic Courtès
2015-02-13gexp: Implement 'imported-modules' & co. using 'gexp->derivation'....* guix/derivations.scm (imported-files): Keep private. (%imported-modules, %compiled-modules, build-expression->derivation): Mark as deprecated. (imported-modules, compiled-modules): Remove. * guix/gexp.scm (%mkdir-p-definition): New variable. (imported-files, search-path*, imported-modules, compiled-modules): New procedures. * tests/derivations.scm ("imported-files"): Remove. * tests/gexp.scm ("imported-files", "gexp->derivation #:modules"): New tests. Ludovic Courtès
2015-02-11derivations: Make the "grafting..." message directly visible....* guix/derivations.scm (graft-derivation)[build]: Add call to 'force-output'. Ludovic Courtès
2015-02-02store: Remove 'build-derivations'....* guix/store.scm (build-derivations): Remove. * guix/derivations.scm (build-derivations): Write in terms of 'build-things'. * doc/guix.texi (Invoking guix build): Adjust text accordingly. Ludovic Courtès
2015-01-24derivations: Raise an error for references to non-existent outputs....Fixes <http://bugs.gnu.org/19630>. Reported by Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>. * guix/derivations.scm (&derivation-error, &derivation-missing-output-error): New error conditions. (derivation->output-path): Raise a '&derivation-missing-output-error' if OUTPUT is not an output of DRV. * guix/ui.scm (call-with-error-handling): Add case for 'derivation-missing-output-error?'. (show-what-to-build): Check whether (derivation-outputs drv) is empty. * tests/packages.scm ("reference to non-existent output"): Add test. Ludovic Courtès
2015-01-14monads: Move '%store-monad' and related procedures where they belong....This turns (guix monads) into a generic module for monads, and moves the store monad and related monadic procedures in their corresponding module. * guix/monads.scm (store-return, store-bind, %store-monad, store-lift, text-file, interned-file, package-file, package->derivation, package->cross-derivation, origin->derivation, imported-modules, compiled, modules, built-derivations, run-with-store): Move to... * guix/store.scm (store-return, store-bind, %store-monad, store-lift, text-file, interned-file): ... here. (%guile-for-build): New variable. (run-with-store): Moved from monads.scm. Remove default value for #:guile-for-build. * guix/packages.scm (default-guile): Export. (set-guile-for-build): New procedure. (package-file, package->derivation, package->cross-derivation, origin->derivation): Moved from monads.scm. * guix/derivations.scm (%guile-for-build): Remove. (imported-modules): Rename to... (%imported-modules): ... this. (compiled-modules): Rename to... (%compiled-modules): ... this. (built-derivations, imported-modules, compiled-modules): New procedures. * gnu/services/avahi.scm, gnu/services/base.scm, gnu/services/dbus.scm, gnu/services/dmd.scm, gnu/services/networking.scm, gnu/services/ssh.scm, gnu/services/xorg.scm, gnu/system/install.scm, gnu/system/linux-initrd.scm, gnu/system/shadow.scm, guix/download.scm, guix/gexp.scm, guix/git-download.scm, guix/profiles.scm, guix/svn-download.scm, tests/monads.scm: Adjust imports accordingly. * guix/monad-repl.scm (default-guile-derivation): New procedure. (store-monad-language, run-in-store): Use it. * build-aux/hydra/gnu-system.scm (qemu-jobs): Add explicit 'set-guile-for-build' call. * guix/scripts/archive.scm (derivation-from-expression): Likewise. * guix/scripts/build.scm (options/resolve-packages): Likewise. * guix/scripts/environment.scm (guix-environment): Likewise. * guix/scripts/system.scm (guix-system): Likewise. * doc/guix.texi (The Store Monad): Adjust module names accordingly. Ludovic Courtès
2015-01-11derivations: Use a set for 'substitution-oracle'....* guix/derivations.scm (substitution-oracle): Use sets instead of lists. Ludovic Courtès
2015-01-11derivations: Use sets for 'derivations-prerequisites'....This yields a 46% improvement in 'derivation-prerequisites' invocations on the Emacs derivation. * guix/derivations.scm (derivation-prerequisites): Add 'input-set' variable, and use it in iterations. Ludovic Courtès
2015-01-10derivations: Add 'substitution-oracle' and use it....This makes 'guix environment PACKAGE' significantly faster when substitutes are enabled. Before that, it would lead to many invocations of 'guix substitute-binary', one per 'derivation-prerequisites-to-build' call. Now, all these are replaced by a single invocation. * guix/derivations.scm (derivation-output-paths, substitution-oracle): New procedures. (derivation-prerequisites-to-build): Replace #:use-substitutes? with #:substitutable?. Remove the local 'derivation-output-paths' and 'substitutable?'. * guix/ui.scm (show-what-to-build): Add 'substitutable?'. Pass it to 'derivation-prerequisites-to-build'. [built-or-substitutable?]: Use it instead of 'has-substitutes?'. * tests/derivations.scm ("derivation-prerequisites-to-build and substitutes"): Use #:substitutable? instead of #:use-substitutes?. Ludovic Courtès
2015-01-09derivations: Add 'derivation-output-names'....* guix/derivations.scm (derivation-output-names): New procedure. (derivation-prerequisites-to-build): Use it for #:outputs. (map-derivation): Likewise. * tests/derivations.scm ("derivation-output-names"): New test. Ludovic Courtès
2014-12-02derivations: Export 'derivation-builder'....* guix/derivations.scm: Export 'derivation-builder'. Ludovic Courtès
2014-11-13derivations: Clarify message produced by 'graft-derivation'....* guix/derivations.scm (graft-derivation): Use the term "grafting" in the build message. Ludovic Courtès
2014-11-02derivations: Add 'derivation-name'....* guix/derivations.scm (derivation-name): New procedure. * tests/derivations.scm ("derivation-name"): New test. Ludovic Courtès
2014-10-29derivations: Fix 'derivation-prerequisites-to-build' when #:local-build?....* guix/derivations.scm (derivation-prerequisites-to-build)[derivation-substitutable?]: Call 'substitutable-derivation?'. <body>: When 'substitutable-derivation?' returns #f, add DRV to BUILD. Ludovic Courtès
2014-10-29derivations: Add 'offloadable-derivation?' and 'substitutable-derivation?'....* guix/derivations.scm (offloadable-derivation?, substitutable-derivation?): New procedures. * tests/derivations.scm ("offloadable-derivation?"): New test. Ludovic Courtès
2014-10-17derivations: 'graft-derivation' correctly handles multiple-output sources....* guix/derivations.scm (graft-derivation): Add DRV as input for each one of OUTPUT-NAMES. Ludovic Courtès
2014-10-17derivations: Add #:system parameter to 'graft-derivation'....* guix/derivations.scm (graft-derivation): Add #:system parameter. Ludovic Courtès
2014-10-17derivations: Introduce 'graft' record type....* guix/derivations.scm (<graft>): New record type. (graft-derivation): Rename 'replacements' to 'grafts', and expect it to be a list of <graft> records. Adjust accordingly. * tests/derivations.scm ("graft-derivation"): Use 'graft' instead of pairs in argument to 'graft-derivation'. Ludovic Courtès
2014-10-13derivations: Micro-optimize 'imported-modules'....This reduces run time of (package-derivation s emacs) by ~5%. * guix/derivations.scm (search-path*): New procedure. (imported-modules): Use it instead of 'search-path'. Ludovic Courtès
2014-10-13derivations: Memoize 'derivation-path->base16-hash'....This reduces run time of (package-derivation s emacs) by ~10%. * guix/derivations.scm (derivation-path->base16-hash): New procedure. (derivation-hash): Use it. Ludovic Courtès
2014-10-12derivations: Add #:guile parameter to 'graft-derivation'....* guix/derivations.scm (graft-derivation): Add #:guile parameter; pass it to 'build-expression->derivation'. Ludovic Courtès
2014-10-08derivations: Add 'graft-derivation'....* guix/derivations.scm (graft-derivation): New procedure. * guix/build/graft.scm: New file. * Makefile.am (MODULES): Add it. * tests/derivations.scm ("graft-derivation"): New test. Ludovic Courtès
2014-06-06derivations: 'build-expression->derivation' supports #:allowed-references....* guix/derivations.scm (build-expression->derivation): Add #:allowed-references and pass it to 'derivation. * doc/guix.texi (Derivations): Adjust accordingly. Ludovic Courtès
2014-06-01derivations: Add #:allowed-references 'derivation' parameter....* 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. Ludovic Courtès