Commit Graph

73 Commits

Author SHA1 Message Date
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 f9e8a12379
store: Rename '&nix-error' to '&store-error'.
* guix/store.scm (&nix-error): Rename to...
(&store-error): ... this, and adjust users.
(&nix-connection-error): Rename to...
(&store-connection-error): ... this, and adjust users.
(&nix-protocol-error): Rename to...
(&store-protocol-error): ... this, adjust users.
(&nix-error, &nix-connection-error, &nix-protocol-error): Define these
condition types and their getters as deprecrated aliases.
* build-aux/run-system-tests.scm, guix/derivations.scm,
guix/grafts.scm, guix/scripts/challenge.scm,
guix/scripts/graph.scm, guix/scripts/lint.scm,
guix/scripts/offload.scm, guix/serialization.scm,
guix/ssh.scm, guix/tests.scm, guix/ui.scm,
tests/derivations.scm, tests/gexp.scm, tests/guix-daemon.sh,
tests/packages.scm, tests/store.scm, doc/guix.texi: Adjust to use the
new names.
2019-01-21 23:09:55 +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
Marius Bakke 25ca46985c
Merge branch 'master' into core-updates 2018-11-29 15:56:49 +01:00
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 9ed86fe175
tests: Add 'test-assertm' to (guix tests).
* guix/tests.scm (test-assertm): New macro.
* tests/gexp.scm (test-assertm): Remove.
* tests/profiles.scm (test-assertm): Remove.
* tests/challenge.scm (%store, test-assertm): Remove.
* tests/debug-link.scm (%store, test-assertm): Remove.
* tests/size.scm (%store, test-assertm): Remove.
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 cf6db76d2a
Merge branch 'master' into core-updates 2018-10-05 19:15:39 +02:00
Ludovic Courtès d4e9317b9d
tests: Update (guix build store-copy) tests.
This is a followup to a387b0bebb.

* tests/gexp.scm ("gexp->derivation, store copy")
("gexp->derivation #:references-graphs"): Add (guix progress) and (guix
records) to the imported modules.
2018-09-27 23:46:44 +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 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
Leo Famulari 92bcccc51f
tests: Don't rely on temporary directories being permanent.
* tests/gexp.scm ("gexp->script #:module-path",
"program-file #:module-path"): Use run-with-store.
2018-07-13 17:33:45 -04:00
Ludovic Courtès 6892f0a247
store-copy: 'read-reference-graph' returns a list of records.
The previous implementation of 'read-reference-graph' was good enough
for many use cases, but it discarded the graph structure, which is
useful information in some cases.

* guix/build/store-copy.scm (<store-info>): New record type.
(read-reference-graph): Rewrite to return a list of <store-info>.
(closure-size, populate-store): Adjust accordingly.
* gnu/services/base.scm (references-file): Adjust accordingly.
* gnu/system/vm.scm (system-docker-image): Likewise.
* guix/scripts/pack.scm (squashfs-image, docker-image): Likewise.
* tests/gexp.scm ("gexp->derivation #:references-graphs"): Likewise.
2018-06-14 11:16:58 +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 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
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
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
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 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 e74f64b9e5
store: Add 'references*'.
* guix/store.scm (references*): New procedure.
* guix/profiles.scm (manifest-lookup-package)[references*]: Remove.
* guix/scripts/system.scm (references*): Remove.
* tests/gexp.scm ("gexp->file", "gexp->file + file-append")
("gexp->derivation", "gexp->derivation, cross-compilation")
("gexp->derivation, ungexp + ungexp-native")
("scheme-file", "text-file*", "mixed-text-file"): Remove 'references*'
instead of (store-lift references).
2016-11-19 18:44:53 +01: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 66a35ceb43
gexp: Remove more uses of #:modules.
* guix/scripts/system.scm (switch-to-system): Adjust comment.
* tests/gexp.scm ("gexp->derivation #:references-graphs"): Use
'with-imported-modules' instead of #:modules.
* tests/grafts.scm ("graft-derivation, preserve empty directories"):
Likewise.
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 4ff76a0a34
gexp: Add 'local-file' file name resolution test.
* tests/gexp.scm ("local-file, relative file name"): New test.
2016-06-16 09:34:37 +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
Mathieu Lirzin a9edb211e7 build: Add a Guile custom test driver using SRFI-64.
Before that '.log' files for scheme tests were fragmented and not
included in test-suite.log.  This unifies the semantics of SRFI-64 API
with Automake test suite.

* build-aux/test-driver.scm: New file.
* Makefile.am (SCM_LOG_DRIVER, AM_SCM_LOG_DRIVER_FLAGS): New variables.
(SCM_LOG_COMPILER, AM_SCM_LOG_FLAGS): Delete variables.
(AM_TESTS_ENVIRONMENT): Set GUILE_AUTO_COMPILE to 0.
* test-env.in: Silence guix-daemon.
* doc/guix.texi (Running the Test Suite): Describe how to display the
detailed results.  Bug reports require only 'test-suite.log' file.
* tests/base32.scm, tests/build-utils.scm, tests/builders.scm,
tests/challenge.scm, tests/cpan.scm, tests/cpio.scm, tests/cran.scm,
tests/cve.scm, tests/derivations.scm, tests/elpa.scm,
tests/file-systems.scm, tests/gem.scm, tests/gexp.scm,
tests/gnu-maintenance.scm, tests/grafts.scm, tests/graph.scm,
tests/gremlin.scm, tests/hackage.scm, tests/hash.scm,
tests/import-utils.scm, tests/lint.scm, tests/monads.scm, tests/nar.scm,
tests/packages.scm, tests/pk-crypto.scm, tests/pki.scm,
tests/profiles.scm, tests/publish.scm, tests/pypi.scm,
tests/records.scm, tests/scripts-build.scm, tests/scripts.scm,
tests/services.scm, tests/sets.scm, tests/size.scm, tests/snix.scm,
tests/store.scm, tests/substitute.scm, tests/syscalls.scm,
tests/system.scm, tests/ui.scm, tests/union.scm, tests/upstream.scm,
tests/utils.scm: Don't exit at the end of test groups.
* tests/containers.scm: Likewise.  Use 'test-skip' instead of exiting
with error code 77.
2016-04-03 14:19:09 +02: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 ef8de9852e tests: Disable grafting by default for most tests.
This allows tests to run as expected even in the presence of
replacements among the bootstrap packages, such as Perl (commit
d8173f21f7).

* tests/cpan.scm: Add (%graft? #f).
* tests/derivations.scm: Likewise.
* tests/graph.scm: Likewise.
* tests/monads.scm: Likewise.
* tests/profiles.scm: Likewise.
* tests/gexp.scm: Likewise.
("gexp->derivation vs. grafts"): Explicitly reenable grafting before,
and disable it after, using 'set-grafting'.
2016-03-06 23:16:35 +01:00
Ludovic Courtès 47b3124a8e tests: Skip 'program-file' test when shebang is too long.
* tests/gexp.scm ("program-file"): Skip when SHEBANG is too long.
2015-11-04 11:59:46 +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 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 72cd8ec0b1 tests: Make #:references-graphs gexp test more tolerant.
* tests/gexp.scm ("gexp->derivation #:references-graphs"): Use 'lset=' instead
  of 'equal?' since the order in which references are listed in not
  guaranteed.
2015-07-20 13:37:45 +02:00
Ludovic Courtès 686784d0b9 tests: Adjust tests for new bootstrap Guile.
This is a followup to commit 5d6792f ("gnu: bootstrap: Create a wrapper for
guile to set the system load path.")

* tests/size.scm ("store-profile"): Expect profile of 'bash' bootstrap binary.
* tests/gexp.scm ("gexp->derivation #:references-graphs"): Expect GUILE-DRV to
  depend on 'bash' bootstrap binary.
2015-07-12 01:27:00 +02:00
Ludovic Courtès a8afb9aed3 store: 'run-with-store' initializes %CURRENT-TARGET-SYSTEM to #f.
* guix/store.scm (run-with-store): Set %CURRENT-TARGET-SYSTEM to #f.
* tests/gexp.scm ("gexp->derivation vs. %current-target-system"): New test.
2015-07-08 00:06:45 +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 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