Commit Graph

24 Commits

Author SHA1 Message Date
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 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 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 1f9760339e tests: Add an indirection for white-box testing.
* tests/gexp.scm (gexp-inputs, gexp-native-inputs, gexp-outputs,
  gexp->sexp): Make an indirection, to facilitate live testing with
  Geiser.
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 4b23c4664e gexp: Add tests for 'gexp-outputs'.
* tests/gexp.scm (gexp-outputs): New procedure.
  ("output list", "output list, combined gexps"): New tests.
2015-02-27 22:03:20 +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 462a3fa36c monads: Rewrite 'text-file*' using gexps.
* guix/monads.scm (text-file*): Move to...
* guix/gexp.scm (text-file*): ... here.  Rewrite using gexps.
* tests/monads.scm ("text-file*"): Move to...
* tests/gexp.scm ("text-file*"): ... here.
2015-01-12 23:33:08 +01:00
Ludovic Courtès b53833b2ef gexp: Allow use of high-level objects in #:references-graphs.
* guix/gexp.scm (lower-reference-graphs): New procedure.
  (gexp->derivation)[graphs-file-names]: New procedure.
  Use 'lower-reference-graphs', and augment #:inputs argument as a
  function of #:references-graphs.
* doc/guix.texi (G-Expressions): Adjust 'gexp->derivation' documentation
  accordingly.
* tests/gexp.scm ("gexp->derivation, store copy"): Remove reference to
  TWO in BUILD-DRV.  Use TWO directly in #:references-graphs argument.
  ("gexp->derivation #:references-graphs"): New test.
* gnu/system/vm.scm (qemu-image): Remove variable 'graph'; use INPUTS as
  the #:references-graphs argument to
  'expression->derivation-in-linux-vm'.
2014-09-06 23:42:56 +02:00
Ludovic Courtès 6fd1a79674 vm: Move store copy handling to (guix build store-copy).
* gnu/build/vm.scm (read-reference-graph, populate-store): Move to...
* guix/build/store-copy.scm: ... here.  New file.
* Makefile.am (MODULES): Add it.
* gnu/system/vm.scm (expression->derivation-in-linux-vm): Adjust default
  #:modules values accordingly.
* tests/gexp.scm ("gexp->derivation, store copy"): New test.
2014-09-04 23:24:54 +02:00
Ludovic Courtès c1bc358f29 Factorize test suite support in (guix tests).
* guix/tests.scm: New file.
* Makefile.am (noinst_DATA): New variable.
  (GOBJECTS): Add guix/tests.go.
* tests/builders.scm (%store): Use 'open-connection-for-tests'
  from (guix tests).
* tests/derivations.scm: Likewise.
* tests/monads.scm: Likewise.
* tests/packages.scm: Likewise.
* tests/profiles.scm: Likewise.
* tests/union.scm: Likewise.
* tests/gexp.scm: Likewise.
  (guile-for-build): Remove.  Use (%guile-for-build) instead.
* tests/nar.scm (make-random-bytevector, %seed, random-text): Remove.
  (populate-file): Change 'make-random-bytevector' to 'random-bytevector'.
  Use (guix tests).
* tests/store.scm (%seed, random-text): Remove.
  Use (guix tests).
2014-08-23 22:33:04 +02:00
Ludovic Courtès 667b250846 gexp: Add 'ungexp-native' and 'ungexp-native-splicing'.
* guix/gexp.scm (<gexp>)[natives]: New field.
  (write-gexp): Use both 'gexp-references' and
  'gexp-native-references'.
  (gexp->derivation): Use both 'gexp-inputs' and 'gexp-native-inputs',
  and append them.
  (gexp-inputs): Add 'references' parameter and honor it.
  (gexp-native-inputs): New procedure.
  (gexp->sexp)[reference->sexp]: Add 'native?' parameter and honor it.
  Use it, and use 'gexp-native-references'.
  (gexp)[collect-native-escapes]: New procedure.
  [escape->ref]: Handle 'ungexp-native' and 'ungexp-native-splicing'.
  [substitute-ungexp, substitute-ungexp-splicing]: New procedures.
  [substitute-references]: Use them, and handle 'ungexp-native' and
  'ungexp-native-splicing'.
  Adjust generated 'make-gexp' call to provide both normal references
  and native references.
  [read-ungexp]: Support 'ungexp-native' and
  'ungexp-native-splicing'.
  Add reader extension for #+.
* tests/gexp.scm (gexp-native-inputs): New procedure.
  (gexp->sexp*): Add 'target' parameter.
  ("ungexp + ungexp-native",
  "input list + ungexp-native",
  "input list splicing + ungexp-native-splicing",
  "gexp->derivation, ungexp-native",
  "gexp->derivation, ungexp + ungexp-native"): New tests.
  ("sugar"): Add tests for #+ and #+@.
* doc/guix.texi (G-Expressions): Document 'ungexp-native' et al.
2014-08-18 15:01:58 +02:00
Ludovic Courtès 68a61e9ffb gexp: Add #:target parameter to 'gexp->derivation'.
* guix/gexp.scm (lower-inputs): Add #:system and #:target.  Use
  'package->cross-derivation' when TARGET is true.  Honor SYSTEM.
  (gexp->derivation): Add #:target argument.  Pass SYSTEM and TARGET to
  'lower-inputs' and 'gexp->sexp'.
  (gexp->sexp): Add #:system and #:target.  Pass them in recursive call
  and to 'package-file'.
* tests/gexp.scm (gexp->sexp*): Add 'system' and 'target' parameters.
  ("gexp->derivation, cross-compilation"): New test.
2014-08-17 21:20:11 +02:00
Ludovic Courtès 6c9e7b2bea build: Better reject systems where the shebang would be too long.
* tests/gexp.scm (shebang): Add "#!".
2014-07-25 00:26:29 +02:00
Ludovic Courtès 2cf0ea0dbb gexp: Gracefully handle printing of gexps with spliced references.
* guix/gexp.scm (write-gexp): Wrap 'write' call in
  'false-if-exception'.
* tests/gexp.scm ("printer", "printer vs. ungexp-splicing"): New tests.
2014-07-17 15:40:06 +02:00
Ludovic Courtès 5d0984595c gexp: Resolve the default system at '>>=' time.
Partly fixes <http://bugs.gnu.org/18002>.
Reported by David Thompson <dthompson2@worcester.edu>.

* guix/gexp.scm (gexp->derivation): Change #:system to default #f.
  Use (%current-system) from within the 'mlet*'.
* tests/gexp.scm ("gexp->derivation, default system"): New test.
2014-07-12 23:17:53 +02:00
Ludovic Courtès c17b5ab4db tests: Skip tests that would hit the shebang length limitation.
* tests/gexp.scm (shebang): New variable.
  Skip "gexp->script" when SHEBANG is longer than 127 chars.
* guix/gexp.scm (gexp->script): Add comment on the issue.
2014-06-04 18:15:50 +02:00
Ludovic Courtès 79c0c8cdf7 gexp: Add support for 'origin?' objects in 'ungexp' forms.
* guix/gexp.scm (lower-inputs, gexp-inputs, gexp->sexp,
  canonicalize-reference): Add 'origin?' case.
* guix/monads.scm (origin->derivation): New procedure.
* tests/gexp.scm ("one input origin"): New test.
2014-05-01 22:31:36 +02:00
Ludovic Courtès 21b679f694 Add (guix gexp).
* guix/gexp.scm: New file.
* tests/gexp.scm: New file.
* Makefile.am (MODULES): Add guix/gexp.scm.
  (SCM_TESTS): Add tests/gexp.scm.
* doc/guix.texi (Derivations): Add #:inputs in 'derivation' example.
  Mark 'build-expression->derivation' as deprecated, refer to
  "G-Expressions".  Remove paragraph about code strata.
  (G-Expressions): New node.
2014-04-28 23:24:17 +02:00