Commit Graph

167 Commits

Author SHA1 Message Date
Ludovic Courtès 8856f409d1
derivations: Add properties.
* guix/derivations.scm (derivation): Add #:properties parameter.
[user+system-env-vars]: Honor it.
(derivation-properties): New procedure.
(build-expression->derivation): Add #:properties and pass it to
'derivation'.
* guix/gexp.scm (gexp->derivation): Likewise.
* tests/derivations.scm ("derivation-properties"): New test.
* tests/gexp.scm ("gexp->derivation properties"): New test.
* doc/guix.texi (Derivations, G-Expressions): Adjust accordingly.
2018-11-28 10:39:58 +01:00
Marius Bakke 79ee97a144
Merge branch 'master' into core-updates 2018-11-14 21:20:46 +01:00
Ludovic Courtès c6080c3249
store: Add a functional object cache and use it in 'lower-object'.
This leads to ~25% improvements on things like:

  guix system build desktop.tmpl --no-grafts -d

* guix/store.scm (<nix-server>)[object-cache]: New field.
* guix/store.scm (open-connection): Initialize it.
(cache-object-mapping, lookup-cached-object, %mcached): New procedures.
(mcached): New macro.
* guix/gexp.scm (lower-object): Use it.
* guix/grafts.scm (grafting?): New procedure.
2018-11-12 23:37:13 +01:00
Marius Bakke f4a5faa9dc
Merge branch 'master' into core-updates 2018-11-05 23:56:22 +01:00
Ludovic Courtès 932d160056
gexp: 'gexp-modules' now consistently deletes duplicates.
Fixes <https://bugs.gnu.org/32966>.
Reported by Clément Lassieur <clement@lassieur.org>.

* guix/gexp.scm (gexp-attribute): Add 'equal?' optional parameter; pass
it to 'delete-duplicates'.
(gexp-modules)[module=?]: New procedure.
Pass it to 'gexp-attribute'.
* tests/gexp.scm ("gexp-modules deletes duplicates"): New test.
2018-10-27 16:39:29 +02:00
Marius Bakke ffddb42d6c
Merge branch 'master' into core-updates 2018-10-21 18:06:02 +02:00
Ludovic Courtès 39d7fdce45
services: dhcp-client: Deprecate 'dhcp-client-service' procedure.
* gnu/services/networking.scm (dhcp-client-service-type): Add default
value.
* gnu/system/examples/bare-bones.tmpl: Use (service
dhcp-client-service-type) instead of (dhcp-client-service).
* gnu/system/examples/beaglebone-black.tmpl: Likewise.
* gnu/tests/base.scm (%avahi-os): Likewise.
* gnu/tests/databases.scm (%memcached-os): Likewise.
(%mongodb-os): Likewise.
* gnu/tests/dict.scm (%dicod-os): Likewise.
* gnu/tests/mail.scm (%opensmtpd-os): Likewise.
(%exim-os): Likewise.
(%dovecot-os): Likewise.
* gnu/tests/messaging.scm (run-xmpp-test): Likewise.
(run-bitlbee-test): Likewise.
* gnu/tests/monitoring.scm (%prometheus-node-exporter-os): Likewise.
* gnu/tests/networking.scm (%inetd-os): Likewise.
(run-iptables-test): Likewise.
* gnu/tests/nfs.scm (%base-os): Likewise.
* gnu/tests/rsync.scm (%rsync-os): Likewise.
* gnu/tests/ssh.scm (run-ssh-test): Likewise.
* gnu/tests/version-control.scm (%cgit-os): Likewise.
(%git-http-os): Likewise.
(%gitolite-os): Likewise.
* gnu/tests/virtualization.scm (%libvirt-os): Likewise.
* gnu/tests/web.scm (%httpd-os): Likewise.
(%nginx-os): Likewise.
(%varnish-os): Likewise.
(%php-fpm-os): Likewise.
(%hpcguix-web-os): Likewise.
(%tailon-os): Likewise.
* tests/guix-system.sh: Likewise.
* doc/guix.texi (Networking Services): Document
'dhcp-client-service-type' and remove 'dhcp-client-service'.
2018-10-18 01:12:22 +02:00
Marius Bakke 0aeb134850
Merge branch 'master' into core-updates 2018-09-09 17:40:35 +02:00
Ludovic Courtès 5dec93bb8b
gexp: 'file-union' accepts directory names.
* guix/gexp.scm (file-union): Import (guix build utils).  Make the
parent directories of TARGET.
* tests/gexp.scm ("file-union"): New test.
2018-09-08 23:02:01 +02:00
Ludovic Courtès 8afa18d6e7
gexp: Remove #:deprecation-warnings from 'imported-files'.
This is a followup to 30d722c392.

* guix/gexp.scm (imported-files/derivation): Remove
 #:deprecation-warnings.  Pass "GUILE_WARN_DEPRECATED=no"
unconditionally to #:env-vars of 'gexp->derivation'.  Adjust caller.
(imported-files): Remove #:deprecation-warnings and adjust callers.
(imported-modules): Likewise.
(compiled-modules, gexp->derivation): Adjust accordingly.
2018-07-27 00:09:52 +02:00
Ludovic Courtès 4a42abc52c
gexp: Inline bug-fix in 'compiled-modules'.
This is a followup to 5d669883ec.

* guix/gexp.scm (compiled-modules)[build-utils-hack?]: Remove.
Inline everything as if BUILD-UTILS-HACK? is true.
2018-07-27 00:02:00 +02:00
Ludovic Courtès 8c7bebd6ea
gexp: Remove backward compatibility hack for 'imported-files'.
* guix/gexp.scm (gexp->derivation): Remove #:import-creates-derivation?.
(imported-files): Remove #:derivation? and adjust callers.
(imported-modules), compiled-modules): Likewise.
* guix/packages.scm (patch-and-repack): Adjust 'gexp->derivation' call.
2018-07-26 22:59:49 +02:00
Ludovic Courtès e529d46828
gexp: 'imported-files/derivation' can copy files instead of symlinking.
* guix/gexp.scm (imported-files/derivation): Add #:symlink? and honor
it.
(imported-files): Pass #:symlink? to 'imported-files/derivation'.
* tests/gexp.scm ("imported-files with file-like objects"): Add 'file=?'
and use it instead of calling 'readlink'.
2018-07-19 11:48:04 +02:00
Ludovic Courtès 8df2eca6b0
gexp: 'imported-files' no longer creates a derivation by default.
* guix/gexp.scm (gexp->derivation): Add #:import-creates-derivation?.
Pass #:derivation? to 'imported-modules' and 'compiled-modules'.  In -L
argument, check whether MODULES is a derivation.
(%not-slash): New variable.
(file-mapping->tree): New procedure.
(imported-files): Rename to...
(imported-files/derivation): ... this.
(imported-files): New procedure.  Rewrite in terms of
'interned-file-tree' when possible; add #:derivation? parameter.
(imported-modules, compiled-modules): Add #:derivation? parameter and
pass it to 'imported-files'.
* guix/packages.scm (patch-and-repack): Pass
 #:import-creates-derivation? to 'gexp->derivation'.
* tests/gexp.scm ("imported-files"): Adjust to no longer expect a
derivation.
2018-07-19 11:48:04 +02:00
Ludovic Courtès 4d20d87b53
gexp: Remove unnecessary 'mlet'.
* guix/gexp.scm (imported-modules): Use 'let' instead of 'mlet'.
2018-07-19 11:48:04 +02:00
Jan Nieuwenhuizen e8e1f295f1
gexp: Allow bytevector as content of `plain-file'.
This allows for using a package source directly from git, doing something like

    (define (command->bytevector command)
      (let ((port (apply open-pipe* OPEN_READ command)))
        (let ((output (get-bytevector-all port)))
          (close-port port)
          output)))

    (define-public hello-git
      (package
        (name "hello")
        (version "git")
        (source (let* ((commit "stable-2.0")
                       (content (command->bytevector
                                 `("git" "archive" "--format" "tar" "--prefix"
                                   ,(string-append commit "/") ,commit)))
                       (file-name (string-append "hello-" commit)))
                  (plain-file file-name content)))
        ...
        ))

* guix/gexp.scm (<plain-file>): Also allow bytevector content.
(plain-file-compiler): Handle bytevector content.
* doc/guix.texi (G-Expressions): Describe plain-file now also taking
bytevectors.
2018-07-12 06:22:04 +02:00
Ludovic Courtès a13c1bf4ca
Merge branch 'master' into core-updates 2018-06-01 23:41:40 +02:00
Ludovic Courtès 838e17d805
gexp: Add 'with-extensions'.
* guix/gexp.scm (<gexp>)[extensions]: New field.
(gexp-attribute): New procedure.
(gexp-modules): Write in terms of 'gexp-attribute'.
(gexp-extensions): New procedure.
(gexp->derivation): Add #:effective-version.
[extension-flags]: New procedure.
Honor extensions of EXP.
(current-imported-extensions): New syntax parameter.
(with-extensions): New macro.
(gexp): Honor CURRENT-IMPORTED-EXTENSIONS.
(compiled-modules): Add #:extensions and honor it.
(load-path-expression): Likewise.
(gexp->script, gexp->file): Honor extensions.
* tests/gexp.scm (%extension-package): New variable.
("gexp-extensions & ungexp")
("gexp-extensions & ungexp-splicing")
("gexp-extensions and literal Scheme object")
("gexp->derivation & with-extensions")
("program-file & with-extensions"): New tests.
* doc/guix.texi (G-Expressions): Document 'with-extensions'.
2018-06-01 15:20:54 +02:00
Ludovic Courtès 5d669883ec
gexp: 'compiled-modules' no longer overrides (guix build utils).
Until now 'compiled-modules' would override (guix build utils) with its
own.  Thus, when asked to build a different (guix build utils),
via #:module-path, it would fail badly because a (guix build utils)
module was already loaded and possibly incompatible with the new one.

This happened when running 'guix pull --branch=core-updates' from
current master: in 'core-updates', (guix build utils) exports
'ignore-error?' but in 'master' it does not.  Thus, 'guix pull' would
fail with:

  no binding `invoke-error?' in module (guix build utils)
  builder for `/gnu/store/…-module-import-compiled.drv' failed with exit code 1
  cannot build derivation `/gnu/store/…-compute-guix-derivation.drv': 1 dependencies couldn't be built

This patch fixes it.

* guix/gexp.scm (compiled-modules)[build-utils-hack?]: New variable.
[build]: Load MODULES/build/utils.scm when it exists.
2018-06-01 13:50:27 +02:00
Mark H Weaver 539bf8f2c0
Merge branch 'master' into core-updates 2018-05-17 01:00:50 -04:00
Ludovic Courtès 30d722c392
gexp: Disable deprecation warnings for 'imported-modules'.
Fixes <https://bugs.gnu.org/31450>.
Reported by Martin Castillo <castilma@uni-bremen.de>.

* guix/gexp.scm (gexp->derivation): Pass #:deprecation-warnings to
'imported-modules'.
(imported-files): Add #:deprecation-warnings and pass #:env-vars to
'gexp->derivation'.
(imported-modules): Add #:deprecation-warnings and pass it to
'imported-files'.
2018-05-15 10:34:45 +02:00
Mark H Weaver 3c0316169b
Merge branch 'master' into core-updates 2018-04-11 17:19:06 -04:00
Ludovic Courtès 4fbd1a2b7f
gexp: 'scheme-file' can splice expressions.
* guix/gexp.scm (<scheme-file>)[splice?]: New field.
(scheme-file): Add #:splice? and pass it to '%scheme-file'.
(scheme-file-compiler): Pass SPLICE? to 'gexp->file'.
(gexp->file): Add #:splice? and honor it.
* tests/gexp.scm ("gexp->file + #:splice?"): New test.
("gexp->derivation & with-imported-module & computed module"): Use
 #:splice? #t.
2018-04-11 01:03:47 +02:00
Mark H Weaver f89aa1521a
Merge branch 'master' into core-updates 2018-04-10 00:42:22 -04:00
Ludovic Courtès b244ae25f9
gexp: 'directory-union' has a #:resolve-collision parameter.
* guix/gexp.scm (directory-union): Add #:resolve-collision and honor it.
2018-04-08 17:41:08 +02:00
Ludovic Courtès d32922759b
gexp: 'compiled-modules' prints a line for each module.
* guix/gexp.scm (compiled-modules)[build]: Add 'processed' parameter to
'process-entry' and 'process-directory'.  Print a message before each
'compile-file' call.
2018-04-01 12:36:03 +02:00
Ludovic Courtès e640c9e6f3
gexp: compiled-modules: Factorize build code.
* guix/gexp.scm (compiled-modules)[build]: Factorize 'process-entry'.
2018-04-01 12:36:02 +02:00
Ludovic Courtès 427ec19e88
gexp: 'program-file' has a new #:module-path parameter.
* guix/gexp.scm (<program-file>): Add 'path' field.
(program-file): Add #:module-path parameter and honor it.
(program-file-compiler): Honor the 'path' field.
* tests/gexp.scm ("program-file #:module-path"): New test.
* doc/guix.texi (G-Expressions): Update.
2018-03-23 18:41:07 +01:00
Ludovic Courtès 1ae16033f3
gexp: 'gexp->script' and 'gexp->file' have a new #:module-path parameter.
* guix/gexp.scm (load-path-expression): Add 'path' optional parameter.
(gexp->script): Add #:module-path and honor it.
(gexp->file): Likewise.
* tests/gexp.scm ("gexp->script #:module-path"): New test.
* doc/guix.texi (G-Expressions): Update accordingly.
2018-03-23 18:41:07 +01:00
Clément Lassieur bdcf0e6fd4
services: messaging: Prosody config supports file-like objects.
* doc/guix.texi (Messaging Services): Update accordingly.
* gnu/services/configuration.scm (serialize-configuration,
serialize-maybe-stem, serialize-package): Return strings or string-valued
gexps (these procedures were only used for their side-effects).
* gnu/services/messaging.scm (serialize-field, serialize-field-list,
enclose-quotes, serialize-raw-content, serialize-ssl-configuration,
serialize-virtualhost-configuration-list,
serialize-int-component-configuration-list,
serialize-ext-component-configuration-list,
serialize-virtualhost-configuration, serialize-int-component-configuration,
serialize-ext-component-configuration, serialize-prosody-configuration):
Return strings or string-valued gexps and stop printing.
(prosody-activation): Use SERIALIZE-PROSODY-CONFIGURATION's return value with
MIXED-TEXT-FILE instead of using its output with PLAIN-FILE.
(serialize-non-negative-integer, serialize-non-negative-integer-list): Convert
numbers to strings.
(file-object?, serialize-file-object, file-object-list?,
serialize-file-object-list): New procedures.
(ssl-configuration)[capath, cafile], (prosody-configuration)[plugin-paths,
groups-file]: Replace FILE-NAME with FILE-OBJECT.
* guix/gexp.scm (file-like?): New exported procedure.
2018-03-03 18:21:52 +01:00
Ludovic Courtès ab25eb7caa
gexp: 'computed-file' has a new #:guile parameter.
* guix/gexp.scm (<computed-file>)[guile]: New field.
(computed-file): Add #:guile.
(computed-file-compiler): Honor 'guile'.
2017-12-18 17:52:58 +01:00
Ludovic Courtès 6ee797f326
gexp: Default to 'guile-2.2' for 'program-file'.
Previously things returned by 'program-file', such as %MODPROBE-WRAPPER
in (gnu services), would refer to 'guile-final'.  This would introduce
'guile-final' in the system closure, which is otherwise absent.  By
referring to 'guile-2.2' we remove that extra Guile.

* guix/gexp.scm (default-guile): Refer to GUILE-2.2 instead of
GUILE-FINAL.
2017-11-29 23:40:39 +01:00
Ludovic Courtès a912c723f7
gexp: 'compiled-modules' disables deprecation warnings by default.
This avoids repeated deprecation messages, particularly while running
'guix system build' or similar.

* guix/gexp.scm (gexp->derivation): Add #:deprecation-warnings.  Pass it
to 'compiled-modules'.
(compiled-modules): Add #:deprecation-warnings and honor it.
* doc/guix.texi (G-Expressions): Update 'gexp->derivation'
documentation.
* guix/packages.scm (patch-and-repack): Pass #:deprecation-warnings #t.
2017-11-29 16:44:54 +01:00
Ludovic Courtès de98b302a1
gexp: 'directory-union' has a #:quiet? parameter.
* guix/gexp.scm (directory-union): Add #:quiet? and honor it.
2017-11-21 23:09:16 +01:00
Ludovic Courtès 59523429d6
union: Parametrize the symlink procedure .
* guix/gexp.scm (directory-union): Add #:hard-links and honor it.
* guix/build/union.scm (union-build): Add #:symlink parameter.
2017-11-21 23:09:16 +01:00
Ludovic Courtès d298c815e6
gexp: Add 'directory-union'.
* gnu/services.scm (directory-union): Move to...
* guix/gexp.scm (directory-union): ... here.  New procedure.
* doc/guix.texi (G-Expressions): Document it.
2017-10-22 22:09:00 -07:00
Ludovic Courtès dedb512f8f
gexp: Add 'file-union'.
* gnu/services.scm (file-union): Move to...
* guix/gexp.scm (file-union): ... here.  New procedure.
* doc/guix.texi (G-Expressions): Document it.
2017-10-22 22:09:00 -07:00
Ludovic Courtès 302d46e63f
gexp: Slightly improve error reporting for 'local-file'.
Reported by Ricardo Wurmus.

* guix/gexp.scm (local-file): Define using 'syntax-case' instead of
'syntax-rules'.  Explicitly handle the zero-argument case and the
use-as-an-identifier case.
2017-07-20 18:08:00 +02:00
Ludovic Courtès 578dfbe07b
gexp: 'ungexp-splicing' properly accounts for nested native inputs.
Previously, (gexp-native-inputs #~#$@(list #~#+foo)) would return '().

This is a followup to 5b14a7902c.

* guix/gexp.scm (gexp-inputs)[add-reference-inputs]: In the list case,
remove 'if' around 'fold-right'.  In 'map' lambda, always inherit N?.
* tests/gexp.scm ("gexp list splicing + ungexp-splicing"): New test.
2017-07-17 23:41:36 +02:00
Ludovic Courtès 2363bdd707
gexp: 'gexp-modules' accepts plain Scheme objects.
* guix/gexp.scm (gexp-modules): Return '() when not (gexp? GEXP).
* tests/gexp.scm ("gexp-modules and literal Scheme object"): New test.
2017-04-19 17:51:39 +02:00
Ludovic Courtès 3e43166ffc
gexp: 'lower-object' raises an exception when passed an invalid object.
* guix/gexp.scm (&gexp-error, &gexp-input-error): New error conditions.
(lower-object): Raise &gexp-input-error when 'lookup-compiler' returns #f.
* tests/gexp.scm ("lower-object & gexp-input-error?"): New test.
* guix/ui.scm (call-with-error-handling): Add case for 'gexp-input-error?'.
2017-04-04 00:10:00 +02:00
Ludovic Courtès d938a58bee
gexp: Add '=>' syntax to import computed modules.
* guix/gexp.scm (imported-files)[file-pair]: Add case for pairs where
the cdr is not a string.
(imported-modules): Support '=>' syntax in MODULES.
* tests/gexp.scm ("imported-files with file-like objects")
("gexp->derivation & with-imported-module & computed module"): New tests.
* doc/guix.texi (G-Expressions): Document '=>' syntax for
'with-imported-modules'.
2017-03-16 22:50:14 +01:00
Roel Janssen 64fc9f65f1
gexp: Expose functions to allow creating derivation builders.
* guix/gexp.scm: Add load-path-expression and gexp-modules to the public
  interface of the module.  See <http://bugs.gnu.org/26023>.
2017-03-09 12:39:05 +01:00
Ludovic Courtès 5e2e4a51f9
gexp: Support 'ungexp' forms in improper lists.
* guix/gexp.scm (gexp)[collect-escapes, substitute-references]: Replace
the (exp0 exp ...) patterns with (exp0 . exp) to match improper lists.
Adjust clause bodies accordingly.
* tests/gexp.scm ("one input package, dotted list"): New test.
2017-01-01 23:30:30 +01:00
Ludovic Courtès 4a6e889feb
gexp: Properly report substitution errors.
* guix/gexp.scm (gexp)[substitute-ungexp]: Wrap body in 'with-syntax'
and pass EXP as the last argument to 'syntax-error'.
[substitute-ungexp-splicing]: Pass EXP as the last argument to
'syntax-error'.
2017-01-01 23:30:30 +01:00
Ludovic Courtès d343a60f93
gexp: Slightly simplify 'gexp-inputs'.
* guix/gexp.scm (gexp-inputs)[add-reference-inputs]: Remove unneeded
'if' in the non-native nested gexp case.
2016-12-19 17:51:00 +01:00
Ludovic Courtès 5b14a7902c
gexp: Native inputs of nested gexps are properly accounted for.
Previously, 'gexp-native-inputs' would not return the native inputs of
nested gexps.  For example, this:

  (gexp-native-inputs #~(foo #$#~(bar #+coreutils)))

would return '().

* guix/gexp.scm (gexp-inputs)[add-reference-inputs]: In the
non-recursive cases, check whether N? and NATIVE? are the same, and act
accordingly.
[native-input?]: Remove.
Fold over all of (gexp-references exp).
* tests/gexp.scm ("ungexp + ungexp-native, nested, special mixture"):
New test.
* tests/gexp.scm ("input list splicing + ungexp-native-splicing"): Pass
 #:native? #t to 'gexp-input'.
2016-12-19 17:51:00 +01:00
Ludovic Courtès 713335fa61
derivations: Add 'raw-derivation'.
* guix/derivations.scm (raw-derivation): New procedure.
* guix/download.scm (raw-derivation): Remove.
* guix/gexp.scm (raw-derivation): Remove.
2016-11-19 18:44:53 +01:00
Ludovic Courtès 1cdecf24f5
gexp: Store compilers in a hash table for O(1) lookup.
* 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-10 13:10:06 +02:00
Ludovic Courtès a9e5e92f94
gexp: Add 'file-append'.
* 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-09 23:54:43 +02:00
Ludovic Courtès ebdfd776f4
gexp: Compilers can now provide an "expander".
* 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-09 23:54:43 +02:00
Ludovic Courtès b5fed903c4
gexp: Remove outdated comment.
* guix/gexp.scm (lower-references): Remove outdated "XXX" comment.
2016-09-09 23:54:43 +02:00
Ludovic Courtès 9c14a487bb
gexp: 'program-file' and 'gexp->script' no longer have #:modules.
* guix/gexp.scm (<program-file>)[modules]: Remove.
(program-file): Remove #:modules and adjust accordingly.
(program-file-compiler): Likewise.
(gexp->script): Likewise.
2016-07-12 22:47:08 +02:00
Ludovic Courtès a769bffb65
gexp: 'computed-file' no longer has a #:modules parameter.
* guix/gexp.scm (<computed-file>)[modules]: Remove.
(computed-file): Remove #:modules.
(computed-file-compiler): Likewise.
* doc/guix.texi (G-Expressions): Adjust accordingly.
2016-07-12 22:47:08 +02:00
Ludovic Courtès 2b4185792d
gexp: 'gexp->file' emits code to set '%load-path'.
* 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-12 22:47:08 +02:00
Ludovic Courtès dd8d1a3046
gexp: Factorize load-path-setting expression.
* guix/gexp.scm (load-path-expression): New procedure.
(gexp->script): Use it.
2016-07-12 22:47:08 +02:00
Ludovic Courtès 0bb9929eaa
gexp: Add 'with-imported-modules' macro.
* 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-12 22:47:08 +02:00
Ludovic Courtès affd7761f3
gexp: Keep only a single 'references' field.
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-07-12 22:47:08 +02:00
Ludovic Courtès a9601e2352
gexp: Use a relative file name.
This is a followup to cbbbb7be0f.

* guix/gexp.scm (%utils-module): Use a file name relative to this file
instead of using 'search-path'.
2016-06-20 23:50:46 +02:00
Ludovic Courtès 0687fc9cd9
gexp: Add #:select? parameter to 'local-file'.
* 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-16 09:34:32 +02:00
Ludovic Courtès 07c8a98c3b
gexp: Move 'current-source-directory' to (guix utils).
* guix/gexp.scm (extract-directory, current-source-directory): Move to...
* guix/utils.scm (extract-directory, current-source-directory):
... here.  New procedures.
2016-06-16 09:34:32 +02:00
Ludovic Courtès d26e19671e derivations: 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.
2016-03-23 00:23:12 +01:00
Ludovic Courtès 6985335faa derivations: Add 'module->source-file-name'.
* guix/derivations.scm (module->source-file-name): New procedure.
(%imported-modules): Use it.
* guix/gexp.scm (imported-modules): Likewise.
2016-03-23 00:23:12 +01:00
Ludovic Courtès 3f4ecf3229 gexp: Add #:disallowed-references.
* 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-03-20 22:46:14 +01:00
Ludovic Courtès 7adf9b8469 derivations: 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.
2016-02-22 22:11:37 +01:00
Ludovic Courtès 9d3994f700 gexp: 'local-file' resolves relative file names.
* 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-12-14 19:57:42 +01:00
Ludovic Courtès 851b6f6283 gexp: Build text derivations locally.
* guix/gexp.scm (gexp->file): Pass #:substitutable? #f.
(text-file*): Likewise, and #:local-build? #t.
2015-11-25 11:59:54 +01:00
Ludovic Courtès e1c153e0ab gexp: Add 'scheme-file'.
* 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-10 22:46:15 +02:00
Ludovic Courtès b751cde36b gexp: Add 'mixed-text-file'.
* 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-10 22:46:14 +02:00
Ludovic Courtès 15a01c7220 gexp: Add 'program-file'.
* 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-10 22:46:14 +02:00
Ludovic Courtès 919370291f gexp: Add 'computed-file'.
* 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-10-10 22:46:14 +02:00
Ludovic Courtès df2d51f025 gexp: Remove duplicate 'mkdir-p' definition.
* 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-09-02 11:24:57 +02:00
Ludovic Courtès 0309e1b0ba gexp: Add #:script-name parameter to 'gexp->derivation'.
* guix/gexp.scm (gexp->derivation): Add #:script-name parameter.
* doc/guix.texi (G-Expressions): Document it.
2015-08-29 01:22:54 +02:00
Ludovic Courtès c2b8467645 gexp: Add 'lower-object'.
* 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-08-27 00:49:23 +02:00
Ludovic Courtès 4a6aeb670f derivations: 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.
2015-07-03 00:30:55 +02:00
Ludovic Courtès 6b6298ae39 environment: Add only the specified outputs of the dependencies.
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-07-01 23:29:49 +02:00
Ludovic Courtès 7833db1f30 gexp: 'local-file' canonicalizes its file argument.
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-19 10:23:29 +02:00
Ludovic Courtès 020f3e4156 gexp: 'local-file' now defaults to non-recursive.
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-19 10:23:28 +02:00
Ludovic Courtès 558e8b11d7 gexp: Add 'plain-file'.
* 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-03 11:47:36 +02:00
Ludovic Courtès 74d441abee gexp: Export <local-file> accessors.
* guix/gexp.scm (local-file-file, local-file-name, local-file-recursive?):
  Export.
2015-06-03 11:47:36 +02:00
Ludovic Courtès c04681554d derivations: 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.
2015-05-01 00:06:17 +02:00
Ludovic Courtès f73286345e gexp: Add printers for <gexp-input> and <gexp-output>.
* guix/gexp.scm (write-gexp-input, write-gexp-output): New procedures.
  (<gexp-input>, <gexp-output>): Use them as printers.
2015-04-20 15:41:41 +02:00
Ludovic Courtès 2242ff45fa gexp: Slightly simplify 'lower-inputs'.
* guix/gexp.scm (lower-inputs): Simplify first case by removing the
  'input' binding.
2015-03-29 22:23:33 +02:00
Ludovic Courtès d9ae938f2c gexp: Add 'local-file'.
* 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-29 22:23:33 +02:00
Ludovic Courtès 1123759b45 gexp: Fix handling of nativeness in nested gexps.
* 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-22 23:18:33 +01:00
Ludovic Courtès 607e1b51f4 gexp: Ignore nested gexps in macro expansion.
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-22 23:18:31 +01:00
Ludovic Courtès accb682c50 gexp: Allow <gexp-input> objects in #:allowed-references.
* guix/gexp.scm (lower-references): Add <gexp-input> case.
* tests/gexp.scm ("gexp->derivation #:allowed-references, specific
  output"): New test.
2015-03-22 23:18:30 +01:00
Ludovic Courtès 2924f0d6ce gexp: Add identity compiler for derivations.
* 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-22 23:18:28 +01:00
Ludovic Courtès ff40e9b7e5 gexp: Move the package and origin compilers to (guix packages).
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-17 22:25:55 +01:00
Ludovic Courtès bcb1328763 gexp: Separate "compilers" for origins and packages from the core.
* 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-17 22:25:54 +01:00
Ludovic Courtès a482cfdcae gexp: Remove special meaning of forms (PACKAGE OUTPUT) in ungexp.
* 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-17 22:25:54 +01:00
Ludovic Courtès 0dbea56bbf gexp: Export 'gexp-input' constructor.
* 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-17 22:25:54 +01:00
Ludovic Courtès e39d146107 gexp: Add <gexp-input>.
* 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-17 22:25:54 +01:00
Ludovic Courtès 1e87da58a1 gexp: Rename <output-ref> to <gexp-output>.
* guix/gexp.scm (<output-ref>): Rename to...
  (<gexp-output>): ... this.  Adjust constructor/accessor names and
  users accordingly.
2015-03-17 22:25:54 +01:00
Ludovic Courtès 7e75a6739b gexp: Make sure 'gexp-outputs' removes duplicate outputs.
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-03-02 16:26:13 +01:00
Ludovic Courtès f9efe568c3 gexp: Aggregate outputs of compound gexps.
* 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-27 22:05:40 +01:00
Ludovic Courtès ce45eb4c38 gexp: Add #:graft? parameter to 'gexp->derivation'.
* 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-13 23:19:49 +01:00
Ludovic Courtès aa72d9afdf gexp: 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.
2015-02-13 17:28:19 +01:00
Ludovic Courtès c8351d9a40 gexp: Add #:allowed-references parameter to 'gexp->derivation'.
* guix/gexp.scm (lower-references): New procedure.
  (gexp->derivation): Add #:allowed-references and honor it.
* tests/gexp.scm ("gexp->derivation #:allowed-references",
  "gexp->derivation #:allowed-references, disallowed"): New tests.
* doc/guix.texi (G-Expressions): Update 'gexp->derivation' doc.
2015-02-11 22:10:14 +01:00
Ludovic Courtès e87f0591f3 monads: 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.
2015-01-14 13:34:52 +01:00