Commit Graph

167 Commits

Author SHA1 Message Date
Ludovic Courtès 2c402b1a15
gexp: The result of 'imported-files/derivation' is non-substitutable.
* guix/gexp.scm (imported-files/derivation): Pass #:substitutable? #f to
'gexp->derivation'.
2020-05-25 23:00:30 +02:00
Ludovic Courtès f408d8d636
self: Optimize 'file-append*' for 'local-file?'.
* guix/self.scm (file-append*): Add 'local-file?' case.
* guix/gexp.scm (local-file-select?): Export.
2020-05-25 23:00:30 +02:00
Ludovic Courtès abf43d4511
gexp: Fix expansion for (file-append (local-file ...) ...).
Fixes <https://bugs.gnu.org/41527>.
Regression introduced in d03001a31a.

* 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.
2020-05-25 23:00:30 +02:00
Ludovic Courtès 644cb40cd8
gexp: Add 'let-system'.
* guix/gexp.scm (<system-binding>): New record type.
(let-system): New macro.
(system-binding-compiler): New procedure.
(default-expander): Add 'self-quoting?' case.
(self-quoting?): New procedure.
(lower-inputs): Add 'filterm'.  Pass the result of
'mapm/accumulate-builds' through FILTERM.
(gexp->sexp)[self-quoting?]: Remove.
* tests/gexp.scm ("let-system", "let-system, target")
("let-system, ungexp-native, target")
("let-system, nested"): New tests.
* doc/guix.texi (G-Expressions): Document it.
2020-05-16 00:34:41 +02:00
Ludovic Courtès d03001a31a
gexp: Compilers can now return lowerable objects.
* guix/gexp.scm (lower-object): Iterate if LOWERED is a struct.
(lower+expand-object): New procedure.
(gexp->sexp): Use it.
(define-gexp-compiler): Adjust docstring.
2020-05-16 00:34:40 +02:00
Marius Bakke 030f6f489f
Merge branch 'master' into core-updates
Conflicts:
	etc/news.scm
	gnu/local.mk
	gnu/packages/bootloaders.scm
	gnu/packages/linphone.scm
	gnu/packages/linux.scm
	gnu/packages/tls.scm
	gnu/system.scm
2020-04-23 13:33:09 +02:00
Ludovic Courtès 34faf63ebc
gexp: Add 'load-path?' field to <scheme-file>.
* guix/gexp.scm (<scheme-file>)[load-path?]: New field.
(scheme-file): Add #:set-load-path? and honor it.
(scheme-file-compiler): Pass #:set-load-path? to 'gexp->file'.
* doc/guix.texi (G-Expressions): Document it.
2020-04-22 19:23:57 +02:00
Marius Bakke 2778302399
Merge branch 'master' into core-updates
Conflicts:
	etc/news.scm
	gnu/local.mk
	gnu/packages/check.scm
	gnu/packages/cross-base.scm
	gnu/packages/gimp.scm
	gnu/packages/java.scm
	gnu/packages/mail.scm
	gnu/packages/sdl.scm
	gnu/packages/texinfo.scm
	gnu/packages/tls.scm
	gnu/packages/version-control.scm
2020-04-08 13:00:50 +02:00
Ludovic Courtès b34ead48dc
gexp: 'lower-references' uses 'mapm/accumulate-builds'.
* guix/gexp.scm (lower-references): Use 'mapm/accumulate-builds' instead
of 'mapm'.
2020-04-02 11:48:25 +02:00
Marius Bakke ae0badf5bb
Merge branch 'master' into core-updates
Conflicts:
	gnu/packages/admin.scm
	gnu/packages/commencement.scm
	gnu/packages/guile.scm
	gnu/packages/linux.scm
	gnu/packages/package-management.scm
	gnu/packages/pulseaudio.scm
	gnu/packages/web.scm
2020-03-30 12:17:33 +02:00
Ludovic Courtès 584dfdac37
gexp: 'lower-inputs' uses 'mapm/accumulate-builds'.
This doesn't have an noticeable impact on the run time of
'guix system build desktop.tmp --no-grafts -d'.

* guix/gexp.scm (lower-inputs): Use 'mapm/accumulate-builds' instead of 'mapm'.
2020-03-29 15:32:17 +02:00
Ludovic Courtès 2bc1a400ae
gexp: Change default Guile effective version to 3.0.
This is a followup to b6bee63bed.

* guix/gexp.scm (lower-gexp, gexp->derivation): #:effective-version
defaults to "3.0".
2020-03-17 15:32:36 +01:00
Ludovic Courtès b6bee63bed
gnu: Default to Guile 3.0.
This patch changes three things:

  1. package derivations are built using Guile 3.0;

  2. 'gexp->derivation' defaults to Guile 3.0;

  3. "guile3.0-" packages are deprecated aliases for the regular
     package, which now depends on Guile 3.0; "guile2.2-" packages are
     introduced; "guile-next" is renamed to "guile".

* gnu/packages/guile.scm (guile-2.0/fixed): Remove.
(guile-3.0/fixed): New variable.
(package-for-guile-3.0): Remove.
(package-for-guile-2.2): New variable.
(define-deprecated-guile3.0-package): New macro.
(guile-3.0)[name]: Change to "guile".
(guile-json-3)[native-inputs, inputs]: New fields.
(guile2.2-json): New variable.
(guile3.0-json): Deprecate.
(guile-gdbm-ffi)[native-inputs]: Switch to GUILE-3.0.
(guile2.2-gdbm-ffi): New variable.
(guile3.0-gdbm-ffi): Deprecate.
(guile-sqlite3): Switch to GUILE-3.0.
(guile2.2-sqlite3): New variable.
(guile3.0-sqlite3): Deprecate.
(guile-bytestructures): Switch to GUILE-3.0.
(guile2.2-bytestructures): New variable.
(guile3.0-bytestructures): Deprecate.
(guile-git): Switch to GUILE-3.0.
(guile2.2-git): New variable.
(guile3.0-git): Deprecate.
(guile-2.2/bug-fix):
* gnu/packages/ci.scm (cuirass): Switch to GUILE-3.0.
* gnu/packages/emacs-xyz.scm (emacs-guix): Switch to GUILE-3.0.
* gnu/packages/gtk.scm (guile-cairo)[arguments]: New field.
Switch to GUILE-3.0.
(guile2.2-cairo): New variable.
(guile3.0-cairo): Deprecate.
(guile-rsvg): Switch to GUILE-3.0.
(guile2.2-cairo): New variable.
(guile3.0-cairo): Deprecate.
(guile-present): Switch to GUILE-3.0.
(guile2.2-present): New variable.
(guile3.0-present): Deprecate.
(guile-gnome)[propagated-inputs]: Use GUILE2.2-CAIRO and GUILE2.2-LIB.
* gnu/packages/guile-xyz.scm (guile-fibers)[arguments]: Add #:configure-flags.
Switch to GUILE-3.0.
(guile2.2-fibers): New variable.
(guile3.0-fibers): Deprecate.
(guile-syntax-highlight): Switch to GUILE-3.0.
(guile2.2-syntax-highlight): New variable.
(guile3.0-syntax-highlight): Deprecate.
(guile-colorized): Switch to GUILE-3.0.
(guile2.2-colorized): New variable.
(guile3.0-colorized): Deprecate.
(guile-pfds): Switch to GUILE-3.0.
(guile2.2-pfds): New variable.
(guile3.0-pfds): Deprecate.
(guile-simple-zmq): Switch to GUILE-3.0.
(guile2.2-simple-zmq): New variable.
(guile3.0-simple-zmq): Deprecate.
(guile-newt): Switch to GUILE-3.0.
(guile2.2-newt): New variable.
(guile3.0-newt): Deprecate.
(guile-parted): Switch to GUILE-3.0.
(guile2.2-parted): New variable.
(guile3.0-parted): Deprecate.
(guile-config): Switch to GUILE-3.0.
(guile2.2-config): New variable.
(guile3.0-config): Deprecate.
(guile-hall): Switch to GUILE-3.0.
(guile2.2-hall): New variable.
(guile3.0-hall): Deprecate.
(guile-ics): Switch to GUILE-3.0.
(guile2.2-ics): New variable.
(guile3.0-ics): Deprecate.
(guile-wisp)[arguments]: Add 'support-guile-3.0' phase.
Switch to GUILE-3.0.
(guile2.2-wisp): New variable.
(guile3.0-wisp): Deprecate.
(guile-lib): Switch to GUILE-3.0.
(guile2.2-lib): New variable.
(guile3.0-lib): Deprecate.
(guile-minikanren): Switch to GUILE-3.0.
(guile2.2-minikanren): New variable.
(guile3.0-minikanren): Deprecate.
(guile-irregex): Switch to GUILE-3.0.
(guile2.2-irregex): New variable.
(guile3.0-irregex): Deprecate.
(haunt): Switch to GUILE-3.0, and remove GUILE-READER.
(guile2.2-haunt): New variable.
(guile3.0-haunt): Deprecate.
(guile-commonmark): Switch to GUILE-3.0.
(guile2.2-commonmark): New variable.
(guile3.0-commonmark): Deprecate.
(mcron): Switch to GUILE-3.0.
(guile2.0-mcron): New variable.
(guile3.0-mcron): Deprecate.
(guile-picture-language): Switch to GUILE-3.0.
(guile2.2-picture-language): New variable.
(guile3.0-picture-language): Deprecate.
(guile-gi): Switch to GUILE-3.0.
(guile2.2-gi): New variable.
(guile3.0-gi): Deprecate.
(guile-hashing): Switch to GUILE-3.0.
(guile2.2-hashing): New variable.
(guile3.0-hashing): Deprecate.
* gnu/packages/package-management.scm (guix): Switch to GUILE-3.0.
(guile2.2-guix): New variable.
(guile3.0-guix): Deprecate.
(gwl): Replace "guile3.0-" with "guile-".
(guix-jupyter)[source]: Adjust for Guile 3.0.
Switch to GUILE-3.0.
* gnu/packages/ssh.scm (guile-ssh): Switch to GUILE-3.0.
(guile2.2-ssh): New variable.
(guile3.0-ssh): Deprecate.
* gnu/packages/admin.scm (shepherd): Switch to GUILE-3.0.
(guile2.2-shepherd): New variable.
(guile3.0-shepherd): Deprecate.
* gnu/packages/mail.scm (mailutils): Switch to GUILE-3.0.
(guile2.2-mailutils): New variable.
(guile3.0-mailutils): Deprecate.
* gnu/packages/plotutils.scm (guile-charting): Switch to GUILE-3.0.
(guile2.2-charting): New variable.
(guile3.0-charting): Deprecate.
* gnu/packages/version-control.scm (libgit2): Switch to GUILE-3.0.
* gnu/packages/vpn.scm (vpnc-scripts): Switch to GUILE-3.0.
* gnu/packages/web.scm (guix-data-service): Switch to GUILE-3.0.
(hpcguix-web): Switch to GUILE-3.0.
* guix/self.scm (specification->package): Refer to the "guile-" variants
instead of "guile3.0-".
* guix/gexp.scm (default-guile): Change to GUILE-3.0.
* build-aux/build-self.scm (build): #:guile-version defaults to "3.0".
* gnu/packages/commencement.scm (guile-final): Base on GUILE-3.0/FIXED.
2020-03-16 15:44:02 +01:00
Marius Bakke 961d2ee269
Merge branch 'master' into core-updates 2020-03-14 13:13:40 +01:00
Ludovic Courtès cf2ac04f13
gexp: Add 'with-parameters'.
* guix/gexp.scm (<parameterized>): New record type.
(with-parameters): New macro.
(compile-parameterized): New gexp compiler.
* tests/gexp.scm ("with-parameters for %current-system")
("with-parameters for %current-target-system")
("with-parameters + file-append"): New tests.
* doc/guix.texi (G-Expressions): Document it.
2020-03-12 18:32:15 +01:00
Mathieu Othacehe 9a2f99f42f
gexp: Default to current target.
* guix/gexp.scm (lower-object): Set target argument to 'current by default and
look for the current target system at bind time if needed,
(gexp->file): ditto,
(gexp->script): ditto,
(lower-gexp): make sure lowered extensions are not cross-compiled.

* tests/gexp.scm: Add cross-compilation test-cases for gexp->script and
gexp->file with a target passed explicitely and with a default target.
2020-03-08 20:28:31 +01:00
Mathieu Othacehe a6bf7a9745
gexp: Default to current target.
* guix/gexp.scm (lower-object): Set target argument to 'current by default and
look for the current target system at bind time if needed,
(gexp->file): ditto,
(gexp->script): ditto,
(lower-gexp): make sure lowered extensions are not cross-compiled.

* tests/gexp.scm: Add cross-compilation test-cases for gexp->script and
gexp->file with a target passed explicitely and with a default target.
2020-03-06 10:16:51 +01:00
Ludovic Courtès 68dbd5c9de
gexp: Move 'file-mapping->tree' to (guix store).
* guix/gexp.scm (%not-slash): Remove.
(file-mapping->tree): Move to...
* guix/store.scm (file-mapping->tree): ... here.
2020-01-30 01:17:54 +01:00
Marius Bakke b7bf02a418
Merge branch 'master' into core-updates 2020-01-11 22:38:24 +01:00
Ludovic Courtès d63ee94d63
gexp: Add 'raw-derivation-file'.
* guix/gexp.scm (<raw-derivation-file>): New record type.
(raw-derivation-file-compiler): New gexp compiler.
* tests/gexp.scm ("lower-gexp, raw-derivation-file")
("raw-derivation-file"): New tests.
2020-01-04 23:44:26 +01:00
Ludovic Courtès 52207b3938
gexp: 'gexp->script' marks its result as non-offloadable and non-substitutable.
* guix/gexp.scm (gexp->script): Pass #:local-build? and #:substitutable?
to 'gexp->derivation'.
2020-01-03 16:06:26 +01:00
Mathieu Othacehe ce9383c090
Merge remote-tracking branch 'master' into core-updates. 2019-12-31 11:04:51 +01:00
Mathieu Othacehe 3cd1444df7
gexp: Add system and target support to gexp->file.
* guix/gexp.scm (gexp->file): Add system and target arguments and pass them to
gexp->derivation and load-path-expression calls,
(scheme-file-compiler): adapt accordingly to pass system and target arguments.
2019-12-22 10:06:57 +01:00
Mathieu Othacehe 7e0539649c
gexp: Add system and target support to gexp->file.
* guix/gexp.scm (gexp->file): Add system and target arguments and pass them to
gexp->derivation and load-path-expression calls,
(scheme-file-compiler): adapt accordingly to pass system and target arguments.
2019-12-22 10:04:04 +01:00
Marius Bakke ab7010af1f
gexp: Allow character literals in GEXP->SEXP.
Fixes <https://bugs.gnu.org/38628>.

* tests/gexp.scm ("lower-gexp, character literal"): New test.
* guix/gexp.scm (gexp->sexp)[self-quoting?]: Add CHAR? to the tested types.
* guix/repl.scm (self-quoting?): Likewise.
* gnu/tests.scm (marionette-shepherd-service)[self-quoting?]: Likewise.
2019-12-18 22:36:37 +01:00
Marius Bakke 326dc63094
gexp: Unconditionally include (system base target) in 'compiled-modules'.
* guix/gexp.scm (compiled-modules): Remove conditional.
2019-12-05 17:59:03 +01:00
Ludovic Courtès 99c45877a9
gexp: 'local-file' properly resolves non-literal relative file names.
* guix/gexp.scm (local-file): Distinguish the case where FILE is a
literal string and when it's not.  Add a clause for when FILE is not a
literal string.
* tests/gexp.scm ("local-file, non-literal relative file name"): New test.
* doc/guix.texi (G-Expressions): Update accordingly.
2019-11-30 23:50:40 +01:00
Ludovic Courtès f5fca9a82c
gexp: Cache the module to derivation mappings.
This reduces the number of 'add-data-to-store' cache lookups from 3329
to 2743 (hit rate: 27% to 11%) when running:

  GUIX_PROFILING=add-data-to-store-cache guix build libreoffice -nd

Execution time of "guix build libreoffice -nd" goes from 1.86s to 1.80s.

* guix/gexp.scm (imported+compiled-modules): Wrap body in 'mcached'.
2019-10-27 23:05:00 +01:00
Ludovic Courtès f58b45350b
gexp: Add 'imported+compiled-modules'.
* guix/gexp.scm (imported+compiled-modules): New procedure.
(lower-gexp): Use it instead of separate calls to 'imported-modules' and
'compiled-modules'.
2019-10-27 23:05:00 +01:00
Mathieu Othacehe 396b05f04e
gexp: Use cross extensions when cross-compiling.
* guix/gexp.scm (load-path-expression): Use ungexp-splicing instead of
ungexp-native-splicing so that the cross extensions are used when target is
set.
2019-10-14 09:59:04 +02:00
Ricardo Wurmus e08902d3cb
Merge branch 'master' into core-updates 2019-10-06 22:02:20 +02:00
Ludovic Courtès cdf9811d24
gexp: 'load-path-expression' produces an expression that deletes duplicates.
Fixes <https://bugs.gnu.org/37531>.

"herd eval root '(length %load-path)'" on a freshly-booted bare-bones
system now returns 8 instead of 119 before.

* guix/gexp.scm (load-path-expression): Rewrite expression to that it
deletes duplicates.
2019-10-03 23:48:59 +02:00
Ludovic Courtès 11da634a6e
Merge branch 'master' into core-updates 2019-09-24 10:11:38 +02:00
Ludovic Courtès 7b7e5b88fc
gexp: Remove unused procedure.
* guix/gexp.scm (syntax-location-string): Remove.
2019-09-23 23:41:19 +02:00
Ludovic Courtès 24ab804ce1
gexp: Catch and report non-self-quoting gexp inputs.
Previously we would, for example, generate build scripts in the store;
when trying to run them, we'd get a 'read' error due to the presence
of #<foo> syntax in there.

* guix/gexp.scm (gexp->sexp)[self-quoting?]: New procedure.
[reference->sexp]: Check whether the argument in a <gexp-input> box is
self-quoting.  Raise a '&gexp-input-error' condition if it's not.
* tests/gexp.scm ("lower-gexp, non-self-quoting input"): New test.
2019-09-23 23:41:19 +02:00
Marius Bakke 6a2e54236e
Merge branch 'master' into core-updates 2019-07-31 14:28:56 +02:00
Ludovic Courtès 2e8cabb8d6
gexp: 'program-file' honors the current system and cross-compilation target.
Fixes <https://bugs.gnu.org/36813>.
Reported by Jakob L. Kreuze <zerodaysfordays.sdf.org@sdf.org>.

* guix/gexp.scm (program-file-compiler): Pass #:system and #:target to
'gexp->script'.
(load-path-expression): Add #:system and #:target and honor them.
(gexp->script): Likewise.
* tests/gexp.scm ("program-file #:system"): New test.
* doc/guix.texi (G-Expressions): Adjust accordingly.
2019-07-26 23:50:12 +02:00
Ludovic Courtès 2cc5ec7f0d
gexp: 'compiled-modules' can cross-compile.
* guix/gexp.scm (compiled-modules): Add #:target and honor it.
2019-07-26 23:47:43 +02:00
Ludovic Courtès 64de896a71
Merge branch 'master' into core-updates 2019-07-17 15:51:10 +02:00
Ludovic Courtès b9373e2627
gexp: 'lowered-gexp-guile' now returns a <derivation-input>.
* guix/derivations.scm (derivation-input-output-path): New procedure.
* guix/gexp.scm (lower-gexp): Wrap GUILE in a <derivation-input>.
(gexp->derivation): Adjust accordingly.
* guix/remote.scm (remote-pipe-for-gexp, remote-eval): Adjust
accordingly.
* tests/gexp.scm ("lower-gexp"): Adjust accordingly.
2019-07-15 10:01:05 +02:00
Ludovic Courtès 3868577480
gexp: <lowered-gexp> separates sources from derivation inputs.
* guix/gexp.scm (lower-inputs): Return either <derivation-input> records
or store items.
(lower-reference-graphs): Return file/input pairs.
(<lowered-gexp>)[sources]: New field.
(lower-gexp): Adjust accordingly.
(gexp->input-tuple): Remove.
(gexp->derivation)[graphs-file-names]: Handle only the
'derivation-input?' and 'string?' cases.
Pass #:sources to 'raw-derivation'; ensure #:inputs contains only
<derivation-input> records.
* guix/remote.scm (remote-eval): Adjust to the new <lowered-gexp>
interface.
* tests/gexp.scm ("lower-gexp"): Adjust to expect <derivation-input>
records instead of <gexp-input>
2019-07-15 10:01:05 +02:00
Marius Bakke fb9a23a3f3
Merge branch 'master' into core-updates
Conflicts:
	gnu/local.mk
	gnu/packages/python-xyz.scm
	gnu/packages/xml.scm
	guix/gexp.scm
	po/guix/POTFILES.in
2019-07-12 01:03:53 +02:00
Ludovic Courtès 2ca41030d5
gexp: Add 'lower-gexp' and express 'gexp->derivation' in terms of it.
* guix/gexp.scm (gexp-input-thing, gexp-input-output)
(gexp-input-native?): Export.
(lower-inputs): Return <gexp-input> records instead of tuples.
(lower-reference-graphs): Adjust accordingly.
(<lowered-gexp>): New record type.
(lower-gexp, gexp-input->tuple): New procedure.
(gexp->derivation)[%modules]: Remove.
[requested-graft?]: New variable.
[add-modules]: New procedure.
Rewrite in terms of 'lower-gexp'.
(gexp-inputs): Add TODO comment.
* tests/gexp.scm ("lower-gexp"): New test.
2019-07-04 18:05:02 +02:00
Ludovic Courtès 3c6b9fb5d2
gexp: Remove #:pre-load-modules? parameter.
* guix/gexp.scm (gexp->derivation): Remove #:pre-load-modules?.
(compiled-modules): Likewise.  Inline the case correspoding to
PRE-LOAD-MODULES? = #t.
* guix/packages.scm (patch-and-repack): Remove #:pre-load-modules?.
2019-06-17 15:54:17 +02:00
Ludovic Courtès a31174e896
gexp: 'compiled-modules' loads modules before compiling them.
This works around <https://bugs.gnu.org/15602> in the context of
modules specified with 'with-imported-modules'.

* guix/gexp.scm (gexp->derivation): Add #:pre-load-modules? parameter
and pass it to 'compiled-modules'.
(compiled-modules): Add #:pre-load-modules? parameter and honor it.
* guix/packages.scm (patch-and-repack): Pass #:pre-load-modules? to
'gexp->derivation'.
2019-04-04 17:47:02 +02:00
Ludovic Courtès 8245bb74fc
monads, gexp: Prevent redefinition of syntax parameters.
Fixes <https://bugs.gnu.org/27476>.

This fixes multi-threaded compilation of this code where syntax
parameters could end up being redefined and where a race condition could
lead a thread to see the "wrong" value of the syntax parameter.

* guix/monads.scm (define-syntax-parameter-once): New macro.
(>>=, return): Use it.
* guix/gexp.scm (define-syntax-parameter-once): New macro.
(current-imported-modules, current-imported-extensions): Use it.
2019-02-06 23:06:18 +01:00
Ludovic Courtès efff32452a
gexp: 'gexp->script' does not emit load-path expression when unnecessary.
This removes two elements from %LOAD-PATH and %LOAD-COMPILED-PATH of the
'guix' command and thus further reduces the number of 'stat' calls it
makes.

* guix/gexp.scm (load-path-expression): Return #f when MODULES and
EXTENSIONS are both empty.
(gexp->script): Don't emit anything when SET-LOAD-PATH is #f.
2019-01-07 23:50:56 +01:00
Ludovic Courtès 9ec154f51f
gexp: Lowering a <computed-file> honors SYSTEM and TARGET.
* guix/gexp.scm (computed-file-compiler): Pass #:system and #:target to
'gexp->derivation'.
* tests/gexp.scm ("lower-object, computed-file, #:system"): New test.
2019-01-05 00:08:04 +01:00
Ludovic Courtès b334674fe5
Use 'mapm' instead of 'sequence' + 'map'.
Previously we'd use the (sequence M (map P L)) idiom just because 'mapm'
was slower (not specialized for the given monad).  This is no longer the
case since commit dcb95c1fc9.

* guix/gexp.scm (lower-inputs): Use (mapm M P L) instead of (sequence
M (map P L)).
(lower-references, gexp->sexp, imported-files): Likewise.
* guix/profiles.scm (profile-derivation): Likewise.
* guix/scripts/environment.scm (inputs->requisites): Likewise.
* guix/scripts/system.scm (copy-closure): Likewise.
2018-12-19 23:52:24 +01:00
Marius Bakke 25ca46985c
Merge branch 'master' into core-updates 2018-11-29 15:56:49 +01:00