summaryrefslogtreecommitdiff
path: root/guix/gexp.scm
AgeCommit message (Expand)Author
2022-02-15gexp: 'computed-file' always uses a native Guile....Fixes a regression whereby, when cross-compiling, 'computed-file' would use a cross-compiled Guile as its builder, which would fail to run. Regression introduced in af57d1bf6c46f47d82dbc234dde1e16fa8634e9d (the problem had always been there but was hidden before behind the (not guile) condition.) * guix/gexp.scm (computed-file-compiler): For 'guile', pass #:target #f. * tests/gexp.scm ("lower-object, computed-file, #:target"): New test. Ludovic Courtès
2022-02-11tests: Pass #:guile to 'computed-file' & co....Fixes a regression introduced in af57d1bf6c46f47d82dbc234dde1e16fa8634e9d whereby tests would end up building the world. * guix/gexp.scm (mixed-text-file): Add #:guile parameter and honor it. * tests/gexp.scm ("mixed-text-file"): Pass #:guile to 'mixed-text-file'. ("file-union"): Pass #:guile to 'file-union'. ("lower-object, computed-file"): Pass #:guile to 'computed-file'. ("lower-object, computed-file + grafts"): Likewise. * tests/packages.scm ("origin->derivation, single file with snippet"): Likewise. * tests/profiles.scm ("profile-derivation, ordering & collisions"): Likewise. * guix/tests.scm (test-file): Likewise. Ludovic Courtès
2022-02-11gexp: <computed-file> does not honor (%guile-for-build)....* guix/gexp.scm (computed-file-compiler): Default to (default-guile). That way, lowering of <computed-file> is not affected by the '%guile-for-build' parameter. (file-union): Add #:guile parameter and honor it. * gnu/packages/ruby.scm (ruby-tzinfo-data): Pass #:guile to 'file-union'. Ludovic Courtès
2021-11-27gexp: 'file-append' correctly handles bases without an expander....This fixes this use case: (file-append (let-system ...) ...) * guix/gexp.scm (file-append-compiler): When BASE lacks an expander, delegate to LOWERED. * tests/gexp.scm ("let-system in file-append"): New test. Ludovic Courtès
2021-09-25gexp: Leave grafting as is when lowering allowed/disallowed references....Fixes <https://issues.guix.gnu.org/50676>. Reported by Mathieu Othacehe <othacehe@gnu.org>. Commit a779363b6aa581e88eda21f9f35530962d54ac25 was partially incorrect: references passed to #:allowed-references or #:references-graphs *can* be lowered as references to grafted elements. This is for example the case when doing: (computed-file "partition.img" exp #:options `(#:references-graphs ,inputs)) Here INPUTS must be lowered as a reference to suitably grafted elements. Failing to do that, the reference graph will not match the actual INPUTS. However, when building a package, those references must indeed refer only to ungrafted packages. This commit preserves that by having build systems pass #:graft? #f. * guix/gexp.scm (lower-reference-graphs, lower-references): Remove uses of 'without-grafting'. This reverts a779363b6aa581e88eda21f9f35530962d54ac25. * guix/build-system/cmake.scm (cmake-build, cmake-cross-build): Pass #:graft? #f. * guix/build-system/glib-or-gtk.scm (glib-or-gtk-build) (glib-or-gtk-cross-build): Likewise. * guix/build-system/gnu.scm (gnu-build, gnu-cross-build): Likewise. * guix/build-system/meson.scm (meson-build, meson-cross-build): Likewise. * guix/build-system/trivial.scm (trivial-build, trivial-cross-build): Likewise. * tests/gexp.scm ("lower-object, computed-file + grafts"): New test. * tests/packages.scm ("trivial with #:allowed-references + grafts"): New test. Ludovic Courtès
2021-07-18Merge branch 'master' into core-updatesLudovic Courtès
2021-06-30guix: gexp: Define gexp->approximate-sexp....It will be used in the 'optional-tests' linter. * guix/gexp.scm (gexp->approximate-sexp): New procedure. * tests/gexp.scm ("no references", "unquoted gexp", "unquoted gexp (native)") ("spliced gexp", "unspliced gexp, approximated") ("unquoted gexp, approximated"): Test it. * doc/gexp.scm ("G-Expressions"): Document it. Signed-off-by: Mathieu Othacehe <othacehe@gnu.org> Maxime Devos
2021-06-23gexp: 'mixed-text-file' UTF-8-encodes its output....* guix/gexp.scm (mixed-text-file)[build]: Call 'set-port-encoding!'. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Andrew Tropin
2021-03-31gexp: 'compiled-modules' honors extensions....Fixes a regression introduced in 2eafeb2f3d661061bc412c3f27c90202e4532532 whereby extensions would not be added as inputs of the resulting derivation. * guix/gexp.scm (compiled-modules): Append EXTENSIONS to the second argument of 'gexp-with-hidden-inputs'. Ludovic Courtès
2021-03-30gexp: 'compiled-modules' gets source and parameters an environment variables....This reduces the number of 'add-text-to-store' RPCs by 15 (out of 3336) oin "guix build -d --no-grafts libreoffice". * guix/gexp.scm (gexp-with-hidden-inputs): New procedure. (compiled-modules): Use it. Pass #:script-name. Augment #:env-vars. Ludovic Courtès
2021-03-30gexp: 'gexp->script' uses #:guile also as the guile-for-build....Previously 'gexp->script' would unconditionally use the default #:guile-for-build value of 'gexp->derivation'. * guix/gexp.scm (gexp->script): Pass #:guile to 'load-path-expression'. Pass #:guile-for-build to 'gexp->derivation'. Ludovic Courtès
2021-03-30gexp: Add #:guile parameter to 'load-path-expression'....* guix/gexp.scm (load-path-expression): Add #:guile parameter and honor it. Ludovic Courtès
2021-03-30gexp: 'imported+compiled-modules' fully honors #:guile....* guix/gexp.scm (imported+compiled-modules): Pass #:guile to 'imported-modules'. Ludovic Courtès
2021-03-30gexp: Do not add derivations to the object cache....That was needlessly making the object cache grow. * guix/gexp.scm (lower-object, lower+expand-object): Bypass the object cache when OBJ is a derivation. This almost halves the number of cache lookups and reduces the number of entries from 3.4K to 2.6K when doing "guix build libreoffice -d --no-grafts". Ludovic Courtès
2021-03-30gexp: Allowed/disallowed references and graphs never refer to grafted inputs....* guix/gexp.scm (lower-reference-graphs, lower-references): Wrap 'lower-object' call in 'without-grafting' since these things never refer to grafted inputs. Ludovic Courtès
2021-03-30build-system: Use 'input-tuples->gexp' and 'outputs->gexp'....* guix/gexp.scm (input-tuples->gexp, outputs->gexp): Make public. * guix/build-system/cargo.scm (cargo-build): Use them. * guix/build-system/gnu.scm (gnu-cross-build): Likewise. * guix/build-system/ocaml.scm (ocaml-build): Likewise. * guix/build-system/cmake.scm (cmake-cross-build): Likewise. Ludovic Courtès
2021-03-30gexp: Add 'sexp->gexp'....* guix/gexp.scm (sexp->gexp): New procedure. * tests/gexp.scm ("sexp->gexp"): New test. Ludovic Courtès
2021-03-30build-system: Rewrite using gexps....* guix/packages.scm (expand-input): Remove 'store', 'system', and 'cross-system' parameters; add #:native?. Rewrite to return name/gexp-input tuples. (bag->derivation): Adjust accordingly. Lower (bag-build bag). (bag->cross-derivation): Ditto. Instead of #:native-drvs and #:target-drvs, pass #:build-inputs, #:host-inputs, and #:target-inputs. (%derivation-cache): Remove. * gnu/packages/bootstrap.scm (raw-build): Turn into a monadic procedure. * gnu/packages/commencement.scm (glibc-final)[arguments]: Use 'gexp-input' for the #:allowed-references argument. * guix/build-system/cmake.scm (cmake-build): Remove 'store' parameter. Switch to the use of gexps and 'gexp->derivation'. (lower): Remove #:source from 'private-keywords'. * guix/build-system/glib-or-gtk.scm (glib-or-gtk-build, lower): Likewise. * guix/build-system/font.scm (font-build): Likewise. * guix/build-system/gnu.scm (gnu-build): Likewise, and remove 'canonicalize-reference'. (gnu-cross-build): Likewise, and expect #:build-inputs, #:host-inputs, and #:target-inputs instead of #:native-drvs and #:target-drvs. (lower): Likewise. * guix/build-system/perl.scm (perl-build, lower): Likewise. * guix/build-system/python.scm (python-build, lower): Likewise. * guix/build-system/ruby.scm (ruby-build, lower): Likewise. * guix/build-system/waf.scm (waf-build, lower): Likewise. * guix/build-system/trivial.scm (guile-for-build): Remove. (trivial-build): Remove 'store' parameter, change to gexps. (trivial-cross-build): Ditto, and change to #:build-inputs & co. * guix/build-system/cargo.scm (cargo-build): Change to 'gexp->derivation'. * guix/build-system/copy.scm (copy-build): Likewise. * guix/build-system/dune.scm (dune-build): Likewise. * guix/build-system/guile.scm (guile-build, guile-cross-build): Likewise. * guix/build-system/meson.scm (meson-build): Likewise. * guix/build-system/ocaml.scm (ocaml-build): Likewise. * guix/build-system/scons.scm (scons-build): Likewise. * guix/build-system/texlive.scm (texlive-build): Likewise. * guix/build-system/android-ndk.scm (android-ndk-build): Likewise. * guix/build-system/ant.scm (ant-build): Likewise. * guix/build-system/asdf.scm (asdf-build/source, asdf-build): Likewise. * guix/build-system/chicken.scm (chicken-build): Likewise. * guix/build-system/clojure.scm (clojure-build): Likewise. (source->output-path, maybe-guile->guile): Remove. * guix/build-system/dub.scm (dub-build): Likewise. * guix/build-system/emacs.scm (emacs-build): Likewise. * guix/build-system/go.scm (go-build): Likewise. * guix/build-system/haskell.scm (haskell-build): Likewise. * guix/build-system/julia.scm (julia-build): Likewise. * guix/build-system/linux-module.scm (linux-module-build) (linux-module-build-cross): Likewise. * guix/build-system/maven.scm (maven-build): Likewise. * guix/build-system/minify.scm (minify-build): Likewise. * guix/build-system/node.scm (node-build): Likewise. * guix/build-system/qt.scm (qt-build, qt-cross-build): Likewise. * guix/build-system/r.scm (r-build): Likewise. * guix/build-system/rakudo.scm (rakudo-build): Likewise. * guix/build-system/renpy.scm (renpy-build): Likewise. * tests/builders.scm ("gnu-build"): Call 'store-lower' on 'gnu-build'. Pass #:source parameter. * tests/packages.scm ("search paths"): Use 'abort-to-prompt' instead of a normal return from the 'build' method. ("package->bag, sensitivity to %current-target-system"): Change 'build' to match the new build system signature. squash! build-system: Rewrite using gexps. squash! build-system: Rewrite using gexps. Ludovic Courtès
2021-03-30gexp: Optimize 'with-build-variables'....* guix/gexp.scm (input-tuples->gexp, outputs->gexp): New procedures. (with-build-variables): Use it. Ludovic Courtès
2021-03-30gexp: Add 'with-build-variables'....* guix/gexp.scm (with-build-variables): New procedure. Ludovic Courtès
2021-03-29gexp: 'gexp->script' uses #:guile also as the guile-for-build....Previously 'gexp->script' would unconditionally use the default #:guile-for-build value of 'gexp->derivation'. * guix/gexp.scm (gexp->script): Pass #:guile to 'load-path-expression'. Pass #:guile-for-build to 'gexp->derivation'. Ludovic Courtès
2021-03-29gexp: Add #:guile parameter to 'load-path-expression'....* guix/gexp.scm (load-path-expression): Add #:guile parameter and honor it. Ludovic Courtès
2021-03-29gexp: 'imported+compiled-modules' fully honors #:guile....* guix/gexp.scm (imported+compiled-modules): Pass #:guile to 'imported-modules'. Ludovic Courtès
2021-03-06Merge branch 'master' into core-updatesChristopher Baines
2021-03-05gexp: Honor #:target in 'compiled-modules'....* guix/gexp.scm (compiled-modules): Pass #:target to 'gexp->derivation'. Ludovic Courtès
2021-03-03gexp: #:references-graphs refers to non-native derivations....Fixes a regression introduced in c6d6aee6659acb293eb33f498fdac3b47a19a48, where #:reference-graphs would end up referring to native inputs. This would notably break the compilation of systems using a childhurd, because they would attempt to build the 'hurd' package natively. * guix/gexp.scm (lower-reference-graphs)[tuple->gexp-input]: Honor TARGET. * tests/gexp.scm ("gexp->derivation #:references-graphs cross-compilation"): New test. Ludovic Courtès
2021-02-23gexp: Reduce allocations in 'gexp-attribute'....* guix/gexp.scm (gexp-attribute): Use 'fold' and 'fold/tree' instead of 'append-map'. Ludovic Courtès
2021-02-23gexp: Reduce allocations while traversing lists....This reduces the total amount of memory allocated by 8% when running "guix build qemu -d --no-grafts". * guix/gexp.scm (fold/tree): New procedure. (gexp-inputs)[interesting?]: New procedure. [add-reference-inputs]: Change (lst ...) clause to (? pair? lst), and use 'fold/tree' to recurse into it. (gexp-inputs)[add-reference-output]: Likewise, and remove plain (lst ...) clause. Call 'fold'. (gexp->sexp)[reference->sexp]: In the list case, avoid boxing and recursive call when the object has a plain non-aggregate type. Ludovic Courtès
2021-02-23gexp: Micro-optimize 'gexp->sexp' and 'lower-inputs'....* guix/gexp.scm (lower-inputs, gexp->sexp): Change keyword parameters to positional parameters. Adjust callers accordingly. * tests/gexp.scm (gexp->sexp*, "gexp->file"): Adjust accordingly. Ludovic Courtès
2021-02-23gexp: Keep 'lower-inputs' private....It had been made public in 6b6298ae39bfe185ce1ab18bb3d641ddfad17c8f but it's no longer needed since 779aa003fbacbbcb6973f289b607d1d285009cec. * guix/gexp.scm (lower-inputs): Do not export. Ludovic Courtès
2021-02-23gexp: 'gexp-inputs' returns both native and non-native inputs....This avoids double traversal of references and extra bookkeeping, thereby further reducing memory allocations. * guix/gexp.scm (lower-gexp): Include only one call to 'lower-inputs'. (gexp-inputs): Remove #:native? parameter. [set-gexp-input-native?]: New procedure. [add-reference-inputs]: Use it. (gexp-native-inputs): Remove. * tests/gexp.scm (gexp-native-inputs): Remove. (gexp-input->tuple): Include 'gexp-input-native?'. ("let-system") ("let-system, nested") ("ungexp + ungexp-native") ("ungexp + ungexp-native, nested") ("ungexp + ungexp-native, nested, special mixture") ("input list") ("input list + ungexp-native") ("input list splicing") ("input list splicing + ungexp-native-splicing") ("gexp list splicing + ungexp-splicing"): Adjust accordingly. Ludovic Courtès
2021-02-23gexp: 'gexp-inputs' returns a list of <gexp-input> records....This slightly reduces memory allocation. * guix/gexp.scm (lower-inputs): Expect a list of <gexp-input> rather than a list of tuples. (lower-reference-graphs)[tuple->gexp-input]: New procedure. Use it. (gexp-inputs): Return a list of <gexp-input> rather than a list of tuples. * tests/gexp.scm (gexp-input->tuple): New procedure. ("one input package") ("one input package, dotted list") ("one input origin") ("one local file") ("one local file, symlink") ("one plain file") ("two input packages, one derivation, one file") ("file-append") ("file-append, output") ("file-append, nested") ("let-system") ("let-system, nested") ("ungexp + ungexp-native") ("ungexp + ungexp-native, nested") ("ungexp + ungexp-native, nested, special mixture") ("input list") ("input list + ungexp-native") ("input list splicing") ("input list splicing + ungexp-native-splicing") ("gexp list splicing + ungexp-splicing"): Adjust accordingly. Ludovic Courtès
2021-02-23gexp: Micro-optimize sexp serialization....* guix/gexp.scm (sexp->string): New procedure. (gexp->derivation): Use it instead of 'object->string'. Ludovic Courtès
2021-01-13Merge branch 'staging' into 'core-updates'....Conflicts: gnu/local.mk gnu/packages/cmake.scm gnu/packages/curl.scm gnu/packages/gl.scm gnu/packages/glib.scm gnu/packages/guile.scm gnu/packages/node.scm gnu/packages/openldap.scm gnu/packages/package-management.scm gnu/packages/python-xyz.scm gnu/packages/python.scm gnu/packages/tls.scm gnu/packages/vpn.scm gnu/packages/xorg.scm Maxim Cournoyer
2020-12-19maint: Require Guile >= 2.2.6....* configure.ac: For Guile 2.2, require 2.2.6 or later. * guix/gexp.scm (define-syntax-parameter-once): Remove. Use 'define-syntax-parameter' instead. * guix/mnoads.scm: Likewise. * guix/inferior.scm (proxy)[select*]: Remove. * guix/scripts/publish.scm <top level>: Remove replacement for (@@ (web http) read-header-line). * guix/store/deduplication.scm (counting-wrapper-port): Remove. (nar-sha256): Call 'port-position' on PORT to compute SIZE. Ludovic Courtès
2020-11-29Merge remote-tracking branch 'origin/master' into core-updatesChristopher Baines
2020-11-05gexp: Warn when importing (guix config) or (ice-9 …)....While importing those modules from the host system is valid, it is often a mistake that introduces non-reproducibility. This patch prints a warning when that happens. * guix/gexp.scm (gexp-attribute): Add #:validate parameter and honor it. (gexp-modules)[validate-modules]: New procedure. Pass it to 'gexp-attribute'. * tests/gexp.scm ("gexp-modules, warning"): New test. Ludovic Courtès
2020-11-05gexp: Store the source code location in <gexp>....* guix/gexp.scm (<gexp>)[location]: New field. (gexp-location): New procedure. (write-gexp): Print the location of GEXP. (gexp->derivation): Adjust call to 'make-gexp'. (gexp): Likewise. Ludovic Courtès
2020-10-19Merge branch 'staging'...Conflicts: gnu/packages/admin.scm gnu/packages/commencement.scm gnu/packages/gdb.scm gnu/packages/llvm.scm gnu/packages/package-management.scm gnu/packages/tls.scm Maxim Cournoyer
2020-10-18gexp: 'assume-valid-file-name' has files looked up under the CWD....Fixes a bug introduced in 5d4ad8e1be6d60c38577e2f3d92cc5642b12eff0, whereby files enclosed in 'assume-valid-file-name' would be looked up relative to the source directory instead of relative to the current directory. * guix/gexp.scm (local-file): In the 'assume-valid-file-name' case, look up FILE relative to the current working directory. Ludovic Courtès
2020-10-16gexp: Add 'assume-valid-file-name' syntax for use with 'local-file'....* guix/gexp.scm (assume-valid-file-name): New variable. (local-file): Add clause with (assume-valid-file-name file). Ludovic Courtès
2020-10-02gexp: Fix argument ordering in 'local-file' macro....Fixes a regression introduced in f43ffee90882c2d61b46d69728daa7432be297e4. Reported by jonsger on #guix. * guix/gexp.scm (local-file): In the non-literal case, add #:literal? and #:location after REST. Ludovic Courtès
2020-10-02gexp: 'local-file' warns when passed a non-literal relative file name....Fixes <https://bugs.gnu.org/43736>. Reported by Vitaliy Shatrov <guix.vits@disroot.org>. * guix/gexp.scm (%local-file): Add #:literal? and #:location. Emit a warning when LITERAL? is false and FILE is not absolute. (local-file): In the non-literal case, pass #:location and #:literal?. * po/guix/POTFILES.in: Add guix/gexp.scm. * tests/guix-system.sh: Add test for the warning. Ludovic Courtès
2020-09-14Merge remote-tracking branch 'origin/master' into core-updatesMaxim Cournoyer
2020-09-01gexp: computed-file: Prevent mistakenly overriding default option values....In order to do so, default to an empty options list, and expose options whose default values are sensitive directly as keyword arguments. * guix/gexp.scm (computed-file): Extract the LOCAL-BUILD? parameter from the OPTIONS parameter to make it a stand-alone keyword argument. Introduce an OPTIONS* binding which is obtained by combining the LOCAL-BUILD? keyword and its value with OPTIONS. * doc/guix.texi (G-Expressions): Adjust doc. Suggested-by: Ludovic Courtès <ludo@gnu.org> Maxim Cournoyer
2020-08-26gexp: 'compiled-modules' defaults to '-O1'....* guix/gexp.scm (compiled-modules): Add #:optimization-level. [build](optimizations-for-level): New variable. (process-entry): Use it. Ludovic Courtès
2020-06-14Merge branch 'master' into core-updatesMarius Bakke
2020-05-25gexp: The result of 'imported-files/derivation' is non-substitutable....* guix/gexp.scm (imported-files/derivation): Pass #:substitutable? #f to 'gexp->derivation'. Ludovic Courtès
2020-05-25self: Optimize 'file-append*' for 'local-file?'....* guix/self.scm (file-append*): Add 'local-file?' case. * guix/gexp.scm (local-file-select?): Export. Ludovic Courtès
2020-05-25gexp: Fix expansion for (file-append (local-file ...) ...)....Fixes <https://bugs.gnu.org/41527>. Regression introduced in d03001a31a6d460b712825640dba11e3f1a53a14. * guix/gexp.scm (lower+expand-object): When LOWERED is not a struct and EXPAND is true, call EXPAND. * tests/gexp.scm ("file-append, raw store item"): New test. Ludovic Courtès