summaryrefslogtreecommitdiff
path: root/guix/gexp.scm
AgeCommit message (Collapse)Author
2016-09-10gexp: Store compilers in a hash table for O(1) lookup.Ludovic Courtès
* guix/gexp.scm (<gexp-compiler>)[predicate]: Remove. [type]: New field. (%gexp-compilers): Turn into a hash table. (register-compiler!, lookup-compiler, lookup-expander): Adjust accordingly. (define-gexp-compiler): Replace 'predicate' by 'record-type'. (derivation-compiler, local-file-compiler, plain-file-compiler) (computed-file-compiler, program-file-compiler, scheme-file-compiler) (file-append-compiler): Adjust accordingly. * guix/packages.scm (package-compiler, origin-compiler): Likewise.
2016-09-09gexp: Add 'file-append'.Ludovic Courtès
* guix/gexp.scm (<file-append>): New record type. (file-append): New procedure. (file-append-compiler): New gexp compiler. * tests/gexp.scm ("file-append", "file-append, output") ("file-append, nested", "gexp->file + file-append"): New tests. * doc/guix.texi (G-Expressions): Use it in 'nscd' and 'list-files' examples. Document 'file-append'.
2016-09-09gexp: Compilers can now provide an "expander".Ludovic Courtès
* guix/gexp.scm (<gexp-compiler>)[expand]: New field. (default-expander, lookup-expander): New procedures. (define-gexp-compiler): Add second pattern to allow for the definition of both a compiler and an expander. (gexp->sexp)[reference->sexp]: Call 'lookup-expander' and use its result.
2016-09-09gexp: Remove outdated comment.Ludovic Courtès
* guix/gexp.scm (lower-references): Remove outdated "XXX" comment.
2016-07-12gexp: 'program-file' and 'gexp->script' no longer have #:modules.Ludovic Courtès
* guix/gexp.scm (<program-file>)[modules]: Remove. (program-file): Remove #:modules and adjust accordingly. (program-file-compiler): Likewise. (gexp->script): Likewise.
2016-07-12gexp: 'computed-file' no longer has a #:modules parameter.Ludovic Courtès
* guix/gexp.scm (<computed-file>)[modules]: Remove. (computed-file): Remove #:modules. (computed-file-compiler): Likewise. * doc/guix.texi (G-Expressions): Adjust accordingly.
2016-07-12gexp: 'gexp->file' emits code to set '%load-path'.Ludovic Courtès
* guix/gexp.scm (gexp->file): Add #:set-load-path? parameter and honor it. * gnu/system.scm (operating-system-parameters-file): Pass #:set-load-path? #f. * doc/guix.texi (G-Expressions): Adjust accordingly.
2016-07-12gexp: Factorize load-path-setting expression.Ludovic Courtès
* guix/gexp.scm (load-path-expression): New procedure. (gexp->script): Use it.
2016-07-12gexp: Add 'with-imported-modules' macro.Ludovic Courtès
* guix/gexp.scm (<gexp>)[modules]: New field. (gexp-modules): New procedure. (gexp->derivation): Use it and append the result to %MODULES. Update docstring to mark #:modules as deprecated. (current-imported-modules, with-imported-modules): New macros. (gexp): Pass CURRENT-IMPORTED-MODULES as second argument to 'gexp'. (gexp->script): Use and honor 'gexp-modules'; define '%modules'. * tests/gexp.scm ("gexp->derivation & with-imported-modules") ("gexp->derivation & nested with-imported-modules") ("gexp-modules & ungexp", "gexp-modules & ungexp-splicing"): New tests. ("program-file"): Use 'with-imported-modules'. Remove #:modules argument to 'program-file'. * doc/guix.texi (G-Expressions): Document 'with-imported-modules'. Mark #:modules of 'gexp->derivation' as deprecated. * emacs/guix-devel.el: Add syntax for 'with-imported-modules'. (guix-devel-keywords): Add it. * .dir-locals.el: Likewise.
2016-07-12gexp: Keep only a single 'references' field.Ludovic Courtès
The distinction between native inputs and "normal" inputs can already be determined by looking at the 'native?' field of <gexp-input>. The extra 'natives' field of <gexp> added complexity for no good reason. * guix/gexp.scm (<gexp>)[natives]: Remove. (write-gexp): Remove use of 'gexp-native-references'. (gexp-inputs)[native-input?]: New procedure. Use it. (gexp->sexp)[reference->sexp]: Honor N? for input lists. Remove use of 'gexp-native-references'. (gexp)[collect-native-escapes]: Remove. Simplify.
2016-06-20gexp: Use a relative file name.Ludovic Courtès
This is a followup to cbbbb7be0fbaa11ff75bce92f2d82131ff8db104. * guix/gexp.scm (%utils-module): Use a file name relative to this file instead of using 'search-path'.
2016-06-16gexp: Add #:select? parameter to 'local-file'.Ludovic Courtès
* guix/gexp.scm (<local-file>)[select?]: New field. (true): New procedure. (%local-file): Add #:select? and honor it. (local-file): Likewise. * tests/gexp.scm ("local-file, #:select?"): New test. * doc/guix.texi (G-Expressions): Adjust accordingly.
2016-06-16gexp: Move 'current-source-directory' to (guix utils).Ludovic Courtès
* guix/gexp.scm (extract-directory, current-source-directory): Move to... * guix/utils.scm (extract-directory, current-source-directory): ... here. New procedures.
2016-03-23derivations: Raise an error when a module file is not found.Ludovic Courtès
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.
2016-03-23derivations: Add 'module->source-file-name'.Ludovic Courtès
* guix/derivations.scm (module->source-file-name): New procedure. (%imported-modules): Use it. * guix/gexp.scm (imported-modules): Likewise.
2016-03-20gexp: Add #:disallowed-references.Ludovic Courtès
* guix/gexp.scm (gexp->derivation): Add #:disallowed-references and honor it. * tests/gexp.scm ("gexp->derivation #:disallowed-references, allowed") ("gexp->derivation #:disallowed-references"): New tests. * doc/guix.texi (G-Expressions): Adjust accordingly.
2016-02-22derivations: Move grafts to (guix grafts).Ludovic Courtès
* 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.
2015-12-14gexp: 'local-file' resolves relative file names.Ludovic Courtès
* guix/gexp.scm (<local-file>): Rename constructor to '%%local-file'. Add 'absolute' field. (%local-file, extract-directory, absolute-file-name): New procedures. (current-source-directory): New macro. (local-file): Adjust call to '%local-file'. (local-file-absolute-file-name): New procedure. (local-file-compiler): Force the 'absolute' field. * tests/guix-system.sh: Test whether 'local-file' canonicalization works. * doc/guix.texi (G-Expressions): Adjust.
2015-11-25gexp: Build text derivations locally.Ludovic Courtès
* guix/gexp.scm (gexp->file): Pass #:substitutable? #f. (text-file*): Likewise, and #:local-build? #t.
2015-10-10gexp: Add 'scheme-file'.Ludovic Courtès
* guix/gexp.scm (<scheme-file>): New record type. (scheme-file, scheme-file-compiler): New procedures. * tests/gexp.scm ("scheme-file"): New test. * doc/guix.texi (G-Expressions): Document 'scheme-file'.
2015-10-10gexp: Add 'mixed-text-file'.Ludovic Courtès
* guix/gexp.scm (mixed-text-file): New procedure. * tests/gexp.scm ("mixed-text-file"): New test. * doc/guix.texi (G-Expressions): Document it.
2015-10-10gexp: Add 'program-file'.Ludovic Courtès
* guix/gexp.scm (<program-file>): New record type. (program-file, program-file-compiler): New procedures. * tests/gexp.scm ("program-file"): New test. * doc/guix.texi (G-Expressions): Document it.
2015-10-10gexp: Add 'computed-file'.Ludovic Courtès
* guix/gexp.scm (<computed-file>): New record type. (computed-file, computed-file-compiler): New procedures. * tests/gexp.scm ("lower-object, computed-file"): New test. * doc/guix.texi (G-Expressions): Document 'computed-file'.
2015-09-02gexp: Remove duplicate 'mkdir-p' definition.Ludovic Courtès
* guix/gexp.scm (%mkdir-p-definition): Remove. (%utils-module): New variable. (imported-files, compiled-modules): Have gexp load %UTILS-MODULE instead of using %MKDIR-P-DEFINITION.
2015-08-29gexp: Add #:script-name parameter to 'gexp->derivation'.Ludovic Courtès
* guix/gexp.scm (gexp->derivation): Add #:script-name parameter. * doc/guix.texi (G-Expressions): Document it.
2015-08-27gexp: Add 'lower-object'.Ludovic Courtès
* guix/gexp.scm (lower-object): New procedure. (lower-inputs, lower-references, gexp->sexp): Use it. * tests/gexp.scm ("lower-object"): New test. * doc/guix.texi (G-Expressions): Document it.
2015-07-03derivations: Add #:substitutable?, distinguished from #:local-build?.Ludovic Courtès
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.
2015-07-01environment: Add only the specified outputs of the dependencies.Ludovic Courtès
Before that, 'guix environment guile' (for instance) would define environment variables that would refer to the "include" output of Bash, the "debug" output of libgc, etc., even though these are not listed as inputs in the recipe of 'guile'. * guix/gexp.scm (lower-inputs): Export. * guix/scripts/environment.scm (evaluate-input-search-paths): Remove 'derivations' parameter; add 'search-paths'. Expect 'inputs' to be a list of tuples. Adjust callers. (create-environment): Remove 'derivations' parameter; add 'search-paths'. (show-search-paths): Likewise. (package+propagated-inputs): New procedure. (packages->transitive-inputs, packages+propagated-inputs): Remove. (build-inputs): Expect INPUTS to be a list of derivation tuples. (guix-environment): Compute INPUTS using 'package+propagated-inputs', 'package->bag', and 'bag-transitive-inputs'. Move 'run-with-store' higher. * tests/guix-environment.sh: Add test with FINDUTILS-BOOT0.
2015-06-19gexp: 'local-file' canonicalizes its file argument.Ludovic Courtès
Reported by Alex Kost <alezost@gmail.com> at <http://lists.gnu.org/archive/html/guix-devel/2015-06/msg00235.html>. * guix/gexp.scm (local-file): Add call to 'canonicalize-path'. * tests/gexp.scm ("one local file, symlink"): New test.
2015-06-19gexp: 'local-file' now defaults to non-recursive.Ludovic Courtès
Reported by Alex Kost <alezost@gmail.com> at <http://lists.gnu.org/archive/html/guix-devel/2015-06/msg00235.html>. * guix/gexp.scm (local-file): Change #:recursive? to default to #f. * tests/gexp.scm ("one local file", "gexp->derivation, local-file"): Adjust calls to 'add-to-store' and 'interned-file' accordingly.
2015-06-03gexp: Add 'plain-file'.Ludovic Courtès
* guix/gexp.scm (<plain-file>): New type. (plain-file, plain-file-compiler): New procedures. * tests/gexp.scm ("one plain file"): New test. * doc/guix.texi (G-Expressions): Document 'plain-file'.
2015-06-03gexp: Export <local-file> accessors.Ludovic Courtès
* guix/gexp.scm (local-file-file, local-file-name, local-file-recursive?): Export.
2015-05-01derivations: Add #:leaked-env-vars parameter.Ludovic Courtès
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.
2015-04-20gexp: Add printers for <gexp-input> and <gexp-output>.Ludovic Courtès
* guix/gexp.scm (write-gexp-input, write-gexp-output): New procedures. (<gexp-input>, <gexp-output>): Use them as printers.
2015-03-29gexp: Slightly simplify 'lower-inputs'.Ludovic Courtès
* guix/gexp.scm (lower-inputs): Simplify first case by removing the 'input' binding.
2015-03-29gexp: Add 'local-file'.Ludovic Courtès
* guix/gexp.scm (<local-file>): New record type. (local-file): New procedure. (local-file-compiler): New compiler. (gexp->sexp) <struct? thing>: Handle the case where 'lower' returns a file name. (text-file*): Update docstring.local-file doc * tests/gexp.scm ("one local file", "gexp->derivation, local-file"): New tests. * doc/guix.texi (G-Expressions): Mention local files early. Document 'local-file'. Update 'text-file*' documentation.
2015-03-22gexp: Fix handling of nativeness in nested gexps.Ludovic Courtès
* guix/gexp.scm (gexp-inputs): Remove 'references' parameter; add #:native? and honor it. [add-reference-inputs]: Distinguish between native gexp inputs, and non-native gexp inputs. Honor 'native?' field of list inputs. * tests/gexp.scm ("ungexp + ungexp-native, nested"): New test.
2015-03-22gexp: Ignore nested gexps in macro expansion.Ludovic Courtès
Before that, the 'references' and 'natives' or the outer gexp in an expression like #~#+#~#$coreutils would include those of the inner gexp. * guix/gexp.scm (gexp)[collect-escapes]: Ignore everything below 'ungexp-native' or 'ungexp-native-splicing'. [collect-native-escapes]: Ignore everything below 'ungexp' or 'ungexp-splicing'.
2015-03-22gexp: Allow <gexp-input> objects in #:allowed-references.Ludovic Courtès
* guix/gexp.scm (lower-references): Add <gexp-input> case. * tests/gexp.scm ("gexp->derivation #:allowed-references, specific output"): New test.
2015-03-22gexp: Add identity compiler for derivations.Ludovic Courtès
* guix/gexp.scm (derivation-compiler): New procedure. (lower-inputs): Remove 'derivation?' case. (gexp-inputs)[add-reference-inputs]: Likewise. (gexp->sexp)[reference->sexp]: Likewise.
2015-03-17gexp: Move the package and origin compilers to (guix packages).Ludovic Courtès
From now own, (guix packages) depends on (guix gexps); it was the other way around now. This means that (guix packages) code can use gexps. * guix/gexp.scm (origin-compiler, package-compiler): Remove. (default-guile-derivation): New procedure. (gexp->derivation): Use it instead of 'default-guile' + 'package->derivation'. * guix/packages.scm (default-guile-derivation): New procedure. (package-compiler, origin-compiler): New variables. * doc/guix.texi (G-Expressions): Mention extensibility.
2015-03-17gexp: Separate "compilers" for origins and packages from the core.Ludovic Courtès
* guix/gexp.scm (<gexp-compiler>): New record type. (%gexp-compilers): New variable. (register-compiler!, lookup-compiler): New procedures. (define-gexp-compiler): New macro. (origin-compiler, package-compiler): New compilers. (lower-inputs): Remove clauses for 'origin?' and 'package?'. Add clause with 'lookup-compiler' instead. (lower-references): Likewise. (gexp-inputs)[add-reference-inputs]: Likewise. (gexp->sexp)[reference->sexp]: Likewise.
2015-03-17gexp: Remove special meaning of forms (PACKAGE OUTPUT) in ungexp.Ludovic Courtès
* guix/gexp.scm (gexp-inputs)[add-reference-inputs]: Remove clause for inputs of the form (PACKAGE OUTPUT). (gexp->sexp)[reference->sexp]: Likewise. * tests/gexp.scm ("input list splicing"): Change 'list' to 'gexp-input' for glibc:debug. ("text-file*"): Likewise for %bootstrap-guile:out. ("input list splicing + gexp-input + ungexp-native-splicing"): Remove, now redundant.
2015-03-17gexp: Export 'gexp-input' constructor.Ludovic Courtès
* guix/gexp.scm (<gexp-input>)[gexp-input]: Rename to... [%gexp-input]: ... this. Adjust callers accordingly. (gexp-input): New procedure. (gexp-inputs)[add-reference-inputs]: When the input is a list, check whether each item is already 'gexp-input?' and to not rewrap those. (gexp-outputs)[add-reference-output]: Likewise. (gexp->sexp): Likewise. * tests/gexp.scm ("input list splicing + gexp-input + ungexp-native-splicing"): New test.
2015-03-17gexp: Add <gexp-input>.Ludovic Courtès
* guix/gexp.scm (<gexp-input>): New record type. (gexp-inputs)[add-reference-inputs]: Adjust clauses to expect <gexp-input> objects. (gexp-outputs)[add-reference-output]: Likewise. (gexp->sexp)[reference->sexp]: Likewise. (canonicalize-reference): Remove. (gexp)[escape->ref]: Use 'gexp-input' for all the references. Remove use of 'canonicalize-reference'.
2015-03-17gexp: Rename <output-ref> to <gexp-output>.Ludovic Courtès
* guix/gexp.scm (<output-ref>): Rename to... (<gexp-output>): ... this. Adjust constructor/accessor names and users accordingly.
2015-03-02gexp: Make sure 'gexp-outputs' removes duplicate outputs.Ludovic Courtès
Fixes a regression introduced in f9efe56. * guix/gexp.scm (gexp-outputs): Add call to 'delete-duplicates'. * tests/gexp.scm ("output list, combined gexps, duplicate output"): New test.
2015-02-27gexp: Aggregate outputs of compound gexps.Ludovic Courtès
* guix/gexp.scm (gexp-outputs)[add-reference-output]: Recurse into lists. * tests/gexp.scm ("output list + ungexp-splicing list, combined gexps"): New test.
2015-02-13gexp: Add #:graft? parameter to 'gexp->derivation'.Ludovic Courtès
* guix/gexp.scm (gexp->derivation): Add #:graft? parameter and honor it. * tests/gexp.scm ("gexp->derivation vs. grafts"): New test. * doc/guix.texi (G-Expressions): Update 'gexp->derivation' documentation.
2015-02-13gexp: Implement 'imported-modules' & co. using 'gexp->derivation'.Ludovic Courtès
* 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.