Commit Graph

131 Commits

Author SHA1 Message Date
Ludovic Courtès 12d720fd1a tests: Factorize the network reachability test.
* guix/tests.scm (network-reachable?): New procedure.
* tests/builders.scm (network-reachable?): Remove.
  Replace references to it with calls to the new 'network-reachable?'
  procedure.
* tests/derivations.scm (%coreutils): Use 'network-reachable?' instead
  of 'getaddrinfo'.
* tests/packages.scm: Likewise.
* tests/union.scm: Likewise.
2015-02-24 00:01:34 +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 6eebbab562 tests: Further factorize substitute mocks.
* guix/tests.scm (derivation-narinfo): Turn 'nar' into a keyword
  parameter.  Add #:sha256 parameter, and honor it.
  (call-with-derivation-narinfo): Add #:sha256 and pass it to
  'derivation-narinfo'.
  (with-derivation-narinfo): Extend with support for (sha256 => value).
* tests/store.scm ("substitute query"): Use 'with-derivation-narinfo'.
  ("substitute"): Likewise.
  ("substitute, corrupt output hash"): Likewise.
  ("substitute --fallback"): Likewise.
* tests/derivations.scm: Remove Emacs local variable.
2015-02-02 12:46:35 +01:00
Ludovic Courtès e9651e39b3 derivations: Add 'substitution-oracle' and use it.
This makes 'guix environment PACKAGE' significantly faster when
substitutes are enabled.  Before that, it would lead to many invocations
of 'guix substitute-binary', one per 'derivation-prerequisites-to-build'
call.  Now, all these are replaced by a single invocation.

* guix/derivations.scm (derivation-output-paths, substitution-oracle):
  New procedures.
  (derivation-prerequisites-to-build): Replace #:use-substitutes? with
  #:substitutable?.  Remove the local 'derivation-output-paths' and
  'substitutable?'.
* guix/ui.scm (show-what-to-build): Add 'substitutable?'.  Pass it to
  'derivation-prerequisites-to-build'.
  [built-or-substitutable?]: Use it instead of 'has-substitutes?'.
* tests/derivations.scm ("derivation-prerequisites-to-build and
  substitutes"): Use #:substitutable? instead of #:use-substitutes?.
2015-01-10 00:39:59 +01:00
Ludovic Courtès 0b6af195fe derivations: Add 'derivation-output-names'.
* guix/derivations.scm (derivation-output-names): New procedure.
  (derivation-prerequisites-to-build): Use it for #:outputs.
  (map-derivation): Likewise.
* tests/derivations.scm ("derivation-output-names"): New test.
2015-01-09 23:36:24 +01:00
Ludovic Courtès e786293e76 derivations: Add 'derivation-name'.
* guix/derivations.scm (derivation-name): New procedure.
* tests/derivations.scm ("derivation-name"): New test.
2014-11-02 21:22:12 +01:00
Ludovic Courtès d2d0514b58 derivations: Fix 'derivation-prerequisites-to-build' when #:local-build?.
* guix/derivations.scm (derivation-prerequisites-to-build)[derivation-substitutable?]:
  Call 'substitutable-derivation?'.
  <body>: When 'substitutable-derivation?' returns #f, add DRV to BUILD.
2014-10-29 00:31:23 +01:00
Ludovic Courtès e6740741d1 tests: Move some of the narinfo test tools to (guix tests).
* guix/tests.scm (derivation-narinfo, call-with-derivation-narinfo): New
  procedures.
  (with-derivation-narinfo): New macro.
* tests/derivations.scm ("derivation-prerequisites-to-build and
  substitutes"): Use them.
2014-10-29 00:31:23 +01:00
Ludovic Courtès fc93e30919 derivations: Add 'offloadable-derivation?' and 'substitutable-derivation?'.
* guix/derivations.scm (offloadable-derivation?,
  substitutable-derivation?): New procedures.
* tests/derivations.scm ("offloadable-derivation?"): New test.
2014-10-29 00:31:23 +01:00
Ludovic Courtès 969df97487 derivations: Introduce 'graft' record type.
* guix/derivations.scm (<graft>): New record type.
  (graft-derivation): Rename 'replacements' to 'grafts', and expect it
  to be a list of <graft> records.  Adjust accordingly.
* tests/derivations.scm ("graft-derivation"): Use 'graft' instead of
  pairs in argument to 'graft-derivation'.
2014-10-17 23:23:20 +02:00
Ludovic Courtès fb59e275dd derivations: Add 'graft-derivation'.
* guix/derivations.scm (graft-derivation): New procedure.
* guix/build/graft.scm: New file.
* Makefile.am (MODULES): Add it.
* tests/derivations.scm ("graft-derivation"): New test.
2014-10-08 12:01:49 +02:00
Ludovic Courtès 44d43c7a85 daemon: Really enable automatic deduplication by default.
* nix/nix-daemon/guix-daemon.cc (main): Set 'autoStoreOptimise' to
  true.  Add 'printMsg' call.
* tests/derivations.scm ("identical files are deduplicated"): New test.
2014-08-31 14:44:34 +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 b53be755e4 derivations: Add #:allowed-references 'derivation' parameter.
* guix/derivations.scm (derivation): Add #:allowed-references
  parameter.
  [user+system-env-vars]: Honor it.
* tests/derivations.scm ("derivation #:allowed-references, ok",
  "derivation #:allowed-references, not allowed",
  "derivation #:allowed-references, self allowed",
  "derivation #:allowed-references, self not allowed"): New tests.
* doc/guix.texi (Derivations): Document #:allowed-references.
2014-06-01 23:32:26 +02:00
Ludovic Courtès 99e17dc927 derivations: Fix 'fixed-output-derivation?'.
Reported by Nikita Karetnikov <nikita@karetnikov.org>.

* guix/derivations.scm (fixed-output-derivation?): Fix pattern.
* tests/derivations.scm ("fixed-output-derivation?"): Add test.
2014-04-13 00:42:07 +02:00
Ludovic Courtès 1950bf56d0 tests: Make sure substitutes are usable when we need them.
* tests/derivations.scm ("derivation-prerequisites-to-build and
  substitutes"): Add call to 'set-build-options'.
2014-03-22 22:57:10 +01:00
Ludovic Courtès 6c20d1d0c3 store: Add #:timeout build option.
* guix/serialization.scm (write-string-pairs): New procedure.
* guix/store.scm (write-arg): Add 'string-pairs' case.
  (set-build-options): Add 'timeout' keyword parameter.  Honor it.
* tests/derivations.scm ("build-expression->derivation and timeout"):
  New test.
2014-03-09 23:01:18 +01:00
Ludovic Courtès 36bbbbd150 derivations: Add support for recursive fixed-output derivations.
* guix/derivations.scm (<derivation-output>): Add 'recursive?' field.
  Adjust 'make-derivation-output' callers.
  (%read-derivation) <fixed-output>: When HASH-ALGO starts with 'r:',
  set the 'recursive?' field and drop 'r:' from the hash algo name.
  (write-derivation)[write-output]: Write the algo as 'r:HASH-ALGO' when
  the RECURSIVE? field is set.
  (derivation-hash) <fixed-output>: Prepend "r:" when RECURSIVE? is set.
  (fixed-output-path): New procedure.
  (derivation): Add #:recursive? parameter.  Use 'fixed-output-path' to
  compute the output file name of a fixed output derivation.
  (build-expression->derivation): Add #:recursive? parameter.  Pass it
  to 'derivation'.
* tests/derivations.scm ("fixed-output derivation, recursive",
  "build-expression->derivation produces recursive fixed-output",
  "build-expression->derivation uses recursive fixed-output"): New
  tests.
* doc/guix.texi (Derivations): Document #:recursive? for 'derivation'.
  Add #:recursive? for 'build-expression->derivation'.
2014-02-21 23:49:52 +01:00
Ludovic Courtès dd1a5a152c derivations: Use more keyword parameters for 'build-expression->derivation'.
* guix/derivations.scm (build-expression->derivation): Turn 'system' and
  'inputs' into keyword parameters.
  Adjust callers accordingly.
* gnu/system/linux.scm, gnu/system/vm.scm, guix/build-system/cmake.scm,
  guix/build-system/gnu.scm, guix/build-system/perl.scm,
  guix/build-system/python.scm, guix/build-system/trivial.scm,
  guix/download.scm, guix/packages.scm, guix/profiles.scm,
  guix/scripts/pull.scm, tests/derivations.scm, tests/guix-build.sh,
  tests/monads.scm, tests/store.scm, tests/union.scm: Adjust users of
  'build-expression->derivation' and 'derivation-expression'
  accordingly.
* doc/guix.texi (Derivations): Adjust 'build-expression->derivation'
  documentation accordingly.
  (The Store Monad): Likewise for 'derivation-expression'.
2013-12-04 16:07:53 +01:00
Ludovic Courtès a716e36de9 derivations: Allow 'map-derivations' to replace sources.
* guix/derivations.scm (map-derivation)[input->output-paths]: Allow
  non-derivation inputs.
  Allow replacements to be store files.  Replace in SOURCES too.
* tests/derivations.scm ("map-derivation, sources"): New test.
2013-11-13 11:22:07 +01:00
Ludovic Courtès e387ab7c10 derivations: Add 'map-derivation'.
* guix/derivations.scm (map-derivation): New procedure.
* tests/derivations.scm ("map-derivation"): New test.
2013-11-13 00:29:05 +01:00
Ludovic Courtès 01e82af55f tests: Fix max-silent-time test.
* tests/derivations.scm ("build-expression->derivation and
  max-silent-time"): Use STORE instead of %STORE.  Change BUILDER to
  succeed by default.  Return #f when no exception is raised.
2013-11-04 23:41:33 +01:00
Ludovic Courtès bde2d9cf8d tests: Add the builder as an input to raw derivations.
* tests/derivations.scm ("build derivation with 1 source",
  "derivation with local file as input",
  "derivation with a fixed-output input",
  "multiple-output derivation",
  "multiple-output derivation, non-alphabetic order",
  "user of multiple-output derivation"): Add %BASH as an input, needed
  in chroot builds.
2013-11-04 23:06:13 +01:00
Ludovic Courtès d0dc4907d6 derivations: 'derivation-path->output-path' honors the 'output' parameter.
* guix/derivations.scm (derivation-path->output-path): Pass OUTPUT.
* tests/derivations.scm ("multiple-output derivation,
  derivation-path->output-path"): New test.
2013-10-30 22:09:32 +01:00
Ludovic Courtès 59688fc4b5 derivations: 'derivation' and related procedures return a single value.
* guix/derivations.scm (derivation->output-path,
  derivation->output-paths): New procedures.
  (derivation-path->output-path): Use 'derivation->output-path'.
  (derivation-path->output-paths): Use 'derivation->output-paths'.
  (derivation): Accept 'derivation?' objects as inputs.  Return a single
  value.
  (build-derivations): New procedure.
  (compiled-modules): Use 'derivation->output-paths'.
  (build-expression->derivation)[source-path]: Add case for when the
  input matches 'derivation?'.
  [prologue]: Accept 'derivation?' objects in INPUTS.
  [mod-dir, go-dir]: Use 'derivation->output-path'.
* guix/download.scm (url-fetch): Adjust to the single-value return.
* guix/packages.scm (package-output): Use 'derivation->output-path'.
* guix/scripts/build.scm (guix-build): When the argument is
  'derivation-path?', pass it through 'read-derivation'.
  Use 'derivation-file-name' to print out the .drv file names, and to
  register them.  Use 'derivation->output-path' instead of
  'derivation-path->output-path'.
* guix/scripts/package.scm (roll-back): Adjust to the single-value
  return.
  (guix-package): Use 'derivation->output-path'.
* guix/ui.scm (show-what-to-build): Adjust to deal with 'derivation?'
  objects instead of .drv file names.
* gnu/system/grub.scm (grub-configuration-file): Use
  'derivation->output-path' instead of 'derivation-path->output-path'.
* gnu/system/vm.scm (qemu-image, system-qemu-image): Likewise.
* tests/builders.scm, tests/derivations.scm, tests/packages.scm,
  tests/store.scm, tests/union.scm: Adjust to the new calling
  convention.
* doc/guix.texi (Defining Packages, The Store, Derivations): Adjust
  accordingly.
2013-09-18 18:49:53 +02:00
Ludovic Courtès 6a446d5680 derivations: Keep the .drv file name in <derivation> objects.
* guix/derivations.scm (<derivation>): Add 'file-name' field.
  (%read-derivation): Use (port-filename DRV-PORT) as the file name for
  the result.
  (derivation): Set the 'file-name' field in the result.
* tests/derivations.scm ("build derivation with 1 source"): Assert that
  'derivation-file-name' returns the right thing.
2013-09-17 23:02:13 +02:00
Ludovic Courtès 858e92823f derivations: Rename #:dependency-graphs to #:references-graphs.
* guix/derivations.scm (derivation, build-expression->derivation):
  Rename #:dependency-graphs to #:references-graphs, for consistency in
  the terminology.
* tests/derivations.scm: Adjust accordingly.
2013-08-28 00:55:40 +02:00
Ludovic Courtès 9c629a27a4 derivations: Add #:dependency-graphs to `build-expression->derivation'.
* guix/derivations.scm (build-expression->derivation): Add
  #:dependency-graphs keyword argument.  Pass it to `derivation'.
* tests/derivations.scm ("build-expression->derivation with
  #:dependency-graphs"): New test.
* doc/guix.texi (Derivations): Update `build-expression->derivation'
  description.
2013-08-26 22:20:58 +02:00
Ludovic Courtès 5b0c9d1635 derivations: Add #:dependency-graphs `derivation' parameter.
* guix/derivations.scm (derivation): Add `dependency-graphs' keyword
  parameter; honor it.
* tests/derivations.scm (bootstrap-binary): New procedure.
  (%bash): Use it.
  (%mkdir): New variable.
  (directory-contents): Add `slurp' optional parameter.
  ("derivation with #:dependency-graphs"): New test.
* doc/guix.texi (Derivations): Update accordingly.
2013-08-26 22:20:53 +02:00
Ludovic Courtès a987d2c025 derivations: Move 3 positional parameters into keyword parameters.
* guix/derivations.scm (derivation): Turn `system', `env-vars', and
  `inputs' into keyword parameters.
  (build-expression->derivation): Adjust accordingly.
* gnu/packages/bootstrap.scm (%bootstrap-guile): Likewise.
* tests/derivations.scm, tests/store.scm: Likewise.
* doc/guix.texi (Derivations): Likewise.
2013-08-26 22:20:27 +02:00
Ludovic Courtès 72626a71a9 Move `sha256' to (guix hash).
* guix/utils.scm (sha256): Move to...
* guix/hash.scm: ... here.  New file.
* Makefile.am (MODULES): Add it.
* guix/derivations.scm, guix/scripts/download.scm,
  guix/scripts/hash.scm, guix/scripts/refresh.scm, tests/base32.scm,
  tests/derivations.scm, tests/store.scm: Use (guix hash).
2013-07-01 23:28:21 +02:00
Ludovic Courtès 969e678ed9 Add `--max-silent-time' to `guix build' and `guix package'.
* guix/scripts/build.scm (%default-options): Add default
  `max-silent-time' value.
  (show-help, %options):  Add `--max-silent-time'.
  (guix-build): Pass `max-silent-time' to `set-build-options'.
* guix/scripts/package.scm (%default-options): Add default
  `max-silent-time' value.
  (show-help, %options):  Add `--max-silent-time'.
  (guix-package): Pass `max-silent-time' to `set-build-options'.
* guix/ui.scm (string->number*): New procedure.
* tests/derivations.scm ("build-expression->derivation and
  max-silent-time"): New test.
* doc/guix.texi (Invoking guix package, Invoking guix build): Document
  `--max-silent-time'.
2013-05-20 18:29:26 +02:00
Ludovic Courtès dd36b51bf7 scripts: Report what will be substituted.
* guix/derivations.scm (derivation-input-output-paths): New procedure.
  (derivation-prerequisites-to-build): New `use-substitutes?' keyword
  argument.  Change two return the list of substitutable paths as a
  second argument.
* guix/ui.scm (show-what-to-build): Turn `dry-run?' into a keyword
  argument.  New `use-substitutes?' keyword argument.  Use `fold2' and
  adjust to use both return values of
  `derivation-prerequisites-to-build'.  Display what will/would be
  downloaded.
* guix/scripts/build.scm (guix-build): Adjust accordingly.
* guix/scripts/package.scm (guix-package): Likewise.
* tests/derivations.scm ("derivation-prerequisites-to-build and
  substitutes"): New test.
2013-04-17 00:08:21 +02:00
Ludovic Courtès bbb76f6f71 tests: Fix thinko in `derivation' test.
* tests/derivations.scm ("derivation with local file as input"): Return
  a Boolean instead of a bytevector.  Don't attempt to compare the
  content of the result with that of the input.
2013-02-04 08:58:48 +01:00
Ludovic Courtès 0bdba772ca Augment `.dir-locals.el'.
* .dir-locals.el: Add more Scheme settings.
* guix-build.in, tests/base32.scm, tests/build-utils.scm,
  tests/builders.scm, tests/derivations.scm, tests/packages.scm,
  tests/snix.scm, tests/store.scm, tests/union.scm, tests/utils.scm:
  Remove redundant Emacs local variable settings.
2013-02-01 13:16:45 +01:00
Ludovic Courtès a9ebd9efd0 store: Remove the `fixed?' parameter from `add-to-store'.
* guix/store.scm (add-to-store): Remove the `fixed?' parameter from the
  public interface.
* gnu/packages/bootstrap.scm, guix-download.in, guix/derivations.scm,
  guix/packages.scm, tests/derivations.scm: Update all callers
  accordingly.
2013-01-30 16:30:49 +01:00
Ludovic Courtès 59a43334a9 distro: Rename (distro) to (gnu packages).
* distro.scm: Rename to...
* gnu/packages.scm: ... this.  Update all users accordingly.
* Makefile.am (MODULES): Adjust accordingly.
* po/POTFILES.in: Likewise.
2013-01-18 01:07:53 +01:00
Ludovic Courtès 1ffa7090b9 distro: Change the module name space to (gnu ...).
* distro: Rename to...
* gnu: ... this.  Update module names accordingly.
* Makefile.am: Adjust accordingly.
* po/POTFILES.in: Likewise.
* distro.scm: Search for files under /gnu/packages instead of
  /distro/packages.
* gnu/packages/base.scm (ld-wrapper-boot3): Likewise.
2013-01-18 01:07:31 +01:00
Ludovic Courtès 01e354eb83 Merge branch 'core-updates'
Conflicts:
	guix/build/union.scm
2013-01-11 16:01:49 +01:00
Ludovic Courtès 784bb1f37b derivations: Fix `derivation-prerequisites-to-build' when outputs are there.
Before it would list inputs not built, even if the outputs of the given
derivation were already available.

* guix/derivations.scm (derivation-prerequisites-to-build): Add
  `outputs' keyword parameter.
  [built?, derivation-built?]: New procedures.
  [loop]: Add `sub-drvs' parameter.  Use `derivation-built?' to check if
  the SUB-DRVS of DRV are built before checking its inputs.
2013-01-09 08:38:57 +01:00
Ludovic Courtès 4050e5d6cf Merge branch 'master' into core-updates
Conflicts:
	build-aux/download.scm
	distro/packages/autotools.scm
	distro/packages/base.scm
	distro/packages/bootstrap.scm
	distro/packages/lsh.scm
	distro/packages/make-bootstrap.scm
	distro/packages/ncurses.scm
	distro/packages/perl.scm
	tests/derivations.scm
	tests/union.scm
2013-01-06 17:33:02 +01:00
Ludovic Courtès 233e76769a Update license headers.
Change all license headers, except guix/build/* and ld-wrapper.scm, with
this code:

  (use-modules (guix build utils)
	       (srfi srfi-1))

  (fluid-set! %default-port-encoding "UTF-8")

  (substitute* (remove (lambda (f)
			 (or (string-contains f ".tar.")
			     (string-contains f ".git/")
			     (string-contains f ".so")
			     (string-suffix? ".o" f)
			     (string-suffix? ".a" f)
			     (string-suffix? ".go" f)
			     (string-suffix? ".pdf" f)
			     (string-suffix? ".png" f)
			     (string-suffix? ".info" f)
			     (equal? (basename f) "guix-daemon")
			     (equal? (basename f) "nix-setuid-helper")
			     (string-contains f "nix-upstream/")
			     (string-contains f "distro/packages/bootstrap/")))
		       (find-files "." "\\.[a-z]+$"))
    (("^([[:graph:]]+) This file is part of Guix." _ comment-start)
     (string-append comment-start " This file is part of GNU Guix."))
    (("^([[:graph:]]+) Guix --- Nix package management.*" _ comment-start)
     (string-append comment-start
		    " GNU Guix --- Functional package management for GNU\n"))
    (("^([[:graph:]]+) Guix is " _ comment-start)
     (string-append comment-start " GNU Guix is "))
    (("^([[:graph:]]+) along with Guix." _ comment-start)
     (string-append comment-start " along with GNU Guix."))
    (("^([[:graph:]]+) Copyright \\(C\\)" _ comment-start)
     (string-append comment-start " Copyright ©")))

Change headers using C-style comments manually.
2013-01-06 00:47:50 +01:00
Ludovic Courtès 7244a5f74e derivations: Add `derivation-path->output-paths'.
* guix/derivations.scm (derivation-path->output-paths): New procedure.
* tests/derivations.scm ("multiple-output derivation"): Test it.
2013-01-05 23:51:13 +01:00
Ludovic Courtès 97d3998e7a tests: Adjust to not rely on /bin/sh.
* tests/derivations.scm (%bash): New variable.
  Replace occurrences of "/bin/sh" by %BASH.
* tests/union.scm ("union-build"): Delete duplicates from
  %BOOTSTRAP-INPUTS.
2013-01-02 01:04:37 +01:00
Ludovic Courtès ad1ebab379 tests: Skip network-dependent tests when the network is unreachable.
* tests/builders.scm (network-reachable?): New variable.
  ("url-fetch", "gnu-build"): Skip unless NETWORK-REACHABLE?.
* tests/derivations.scm (%coreutils): Check for network access.
  ("build-expression->derivation with one input"): Skip when %COREUTILS
  is #f.
* tests/guix-package.sh: Skip installation of GNU Make when the network
  is unreachable.
* tests/packages.scm ("GNU Make, bootstrap"): Likewise.
* tests/union.scm ("union-build"): Likewise.
2012-12-13 22:06:45 +01:00
Ludovic Courtès 29833b26eb build: Update skip count in `tests/derivations.scm'.
* tests/derivations.scm: When %STORE if #f, skip 11 tests.
2012-12-06 00:07:17 +01:00
Ludovic Courtès 860a6f1ae0 derivations: Fix erroneous call to `add-to-store' for local files as input.
* guix/derivations.scm (derivation)[inputs]: Fix typo in call to
  `add-to-store'.
* tests/derivations.scm ("derivation with local file as input"): New test.
* tests/packages.scm ("trivial with local file as input"): New test.
2012-12-04 23:46:50 +01:00
Ludovic Courtès 1dfb715df0 tests: Remove extraneous test.
* tests/derivations.scm ("build-expression->derivation for fixed-output
  derivation"): Remove test.  It is redundant with that in builders.scm,
  and doesn't work out of the box with the statically-linked
  %BOOTSTRAP-GUILE.
2012-11-13 00:34:56 +01:00
Ludovic Courtès ddc29a782e Move base32 code to (guix base32).
* guix/utils.scm (bytevector-quintet-ref, bytevector-quintet-ref-right,
  bytevector-quintet-length, bytevector-quintet-fold,
  bytevector-quintet-fold-right, make-bytevector->base32-string,
  %nix-base32-chars, %rfc4648-base32-chars, bytevector->base32-string,
  bytevector->nix-base32-string, bytevector-quintet-set!,
  bytevector-quintet-set-right!, base32-string-unfold,
  base32-string-unfold-right, make-base32-string->bytevector,
  base32-string->bytevector, nix-base32-string->bytevector): Move to...
* guix/base32.scm: ... here.  New file.

* tests/utils.scm (%nix-hash, "bytevector->base32-string",
  "base32-string->bytevector", "nix-base32-string->bytevector", "sha256
  & bytevector->base32-string"): Move to...
* tests/base32.scm: ... here.  New file

* guix-download.in, guix/derivations.scm, guix/packages.scm,
  guix/snix.scm, tests/builders.scm, tests/derivations.scm: Adjust
  accordingly.
* guix.scm (%public-modules): Add `base32'.
2012-11-11 22:33:28 +01:00
Ludovic Courtès 7bdd1f0e3c derivations: build-expression->derivation: Builder only refers to sources.
* guix/derivations.scm (build-expression->derivation)[source-path]: New
  procedure.
  [builder]: Pass only sources as references.  This fixes a bug whereby
  changing a fixed-output drv referred to by a builder would cause the
  builder's hash to change, thereby leading to a full rebuild.
* tests/derivations.scm ("build-expression->derivation with a
  fixed-output input"): New test.
2012-11-09 00:07:10 +01:00
Ludovic Courtès 813986ac09 derivations: Add tests relative to fixed-output derivations.
* tests/derivations.scm ("fixed-output derivation"): Add comment that
  the reference to BUILDER is optional.
  ("fixed-output derivation: output paths are equal",
  "derivation with a fixed-output input",
  "build-expression->derivation: same fixed-output path"): New tests.
2012-11-08 23:55:12 +01:00
Ludovic Courtès 18633d4f35 distro: Move bootstrap packages to (distro packages bootstrap).
* distro/packages/base.scm (glibc-dynamic-linker, %bootstrap-guile,
  bootstrap-origin, package-from-tarball, %bootstrap-base-url,
  %bootstrap-coreutils&co, %bootstrap-binutils, %bootstrap-glibc,
  %bootstrap-gcc, %bootstrap-inputs, package-with-bootstrap-guile): Move
  to ...
* distro/packages/bootstrap.scm: ... here.  New file.
* Makefile.am (MODULES): Add it.
* tests/builders.scm: Use (distro packages bootstrap).
  (%bootstrap-guile): Remove.
* tests/packages.scm: Likewise.
* tests/union.scm: Likewise, and remove @@ to access %bootstrap-inputs.
* tests/derivations.scm: Use (distro packages bootstrap) and remove @@
  to access %bootstrap-coreutils&co.
* HACKING (When the platform is supported by Nixpkgs): Update
  accordingly.
2012-11-04 22:04:41 +01:00
Ludovic Courtès 81dbd783bd tests: Run without substitutes.
* tests/builders.scm, tests/derivations.scm, tests/packages.scm: Set
  #:use-substitutes? #f for %STORE.
2012-11-02 22:38:52 +01:00
Ludovic Courtès 8f3ecbd715 tests: Use our own bootstrap tools.
* tests/builders.scm (%bootstrap-inputs): Use %BOOT0-INPUTS from the distro.
* tests/packages.scm (%bootstrap-inputs): Likewise.
* tests/derivations.scm (%coreutils): Alias for %BOOTSTRAP-COREUTILS&CO.
2012-10-28 01:58:39 +02:00
Ludovic Courtès b272c47433 derivations: Pass the derivation of guile-for-build to `imported-files' & co.
* guix/derivations.scm (%guile-for-build): Initialize to #f.
  (imported-files, imported-modules, compiled-modules): Add `guile'
  keyword parameter.  Pass it down to `build-expression->derivation'.
  (build-expression->derivation)[guile-drv]: New variable.  Pass it as
  the #:guile parameter for `imported-modules' and `compiled-modules'.

* tests/derivations.scm: Set %GUILE-FOR-BUILD to the derivation of
  %BOOTSTRAP-GUILE.
2012-10-25 18:03:48 +02:00
Ludovic Courtès 82058eff59 store: Add `query-path-hash'.
* guix/store.scm (write-arg, read-arg): Add `base16' literal and
  corresponding rule.
  (query-path-hash): New operation.

* tests/derivations.scm ("fixed-output derivation"): Check whether
  `query-path-hash' returns a bytevector.
2012-10-24 23:52:15 +02:00
Ludovic Courtès d90248844b derivations: Compile the #:modules passed to `build-expression->derivation'.
* guix/derivations.scm (imported-files)[parent-dirs]: Move to...
  (parent-directories): ... here.  New procedure.
  (compiled-modules): New procedure.
  (build-expression->derivation): Use it.

* tests/derivations.scm ("build-expression->derivation with modules"):
  New test.
2012-10-24 00:09:25 +02:00
Ludovic Courtès d66ac374e9 derivation: Coalesce multiple occurrences of the same input.
* guix/derivations.scm (write-derivation)[coalesce-duplicate-inputs]:
  New procedure.
  Use it to process INPUTS.

* tests/derivations.scm ("user of multiple-output derivation"): New
  test.
2012-07-02 01:35:39 +02:00
Ludovic Courtès 4b1786aa2c Fix `derivation-hash' for outputs not sorted alphabetically.
* guix/derivations.scm (derivation-hash): Reorder OUTPUTS.
* tests/derivations.scm ("multiple-output derivation, non-alphabetic
  order"): New test.
2012-07-02 01:35:39 +02:00
Ludovic Courtès 9a20830e57 Add `derivation-prerequisites' and `derivation-prerequisites-to-build'.
* guix/derivations.scm (derivation-prerequisites,
  derivation-prerequisites-to-build): New procedures.

* tests/derivations.scm ("build-expression->derivation and
  derivation-prerequisites", "build-expression->derivation and
  derivation-prerequisites-to-build"): New tests.
2012-07-01 00:37:03 +02:00
Ludovic Courtès 31ef99a8a5 Add the `valid-path?' RPC.
* guix/store.scm (valid-path?): New procedure.

* tests/builders.scm ("http-fetch", "gnu-build"): Use it.
* tests/derivations.scm ("add-to-store, flat", "add-to-store,
  recursive", "derivation with no inputs", "build derivation with 1
  source", "build derivation with coreutils",
  "build-expression->derivation with expression returning #f"):
  Likewise.
2012-07-01 00:27:27 +02:00
Ludovic Courtès db393b333f build-expression->derivation: Have the build fail when EXP returns #f.
* guix/derivations.scm (build-expression->derivation)[builder]: Pass the
  result of EXP to `exit'.

* tests/derivations.scm ("build-expression->derivation with expression
  returning #f"): New test.
2012-06-16 16:46:29 +02:00
Ludovic Courtès 2acb2cb6d0 Change `build-expression->derivation' to support sub-derivation inputs.
* guix/derivations.scm (build-expression->derivation): Change to expect
  INPUTS to have the form (NAME DRV-PATH SUB-DRV) or (NAME DRV-PATH),
  instead of (NAME . DRV-PATH).  Update callers accordingly.

* guix/gnu-build-system.scm, tests/builders.scm, tests/derivations.scm:
  Update accordingly.
2012-06-13 17:21:27 +02:00
Ludovic Courtès 224f7ad6a3 Fix `imported-files' for files with a common prefix.
* guix/derivations.scm (imported-files)[builder]: For TAIL, check
  whether it exists before (mkdir TAIL).

* tests/derivations.scm ("imported-files"): Add file with a common
  prefix.
2012-06-12 23:30:00 +02:00
Ludovic Courtès d1b1c4249a Add `add-to-store' test for flat files.
* tests/derivations.scm ("add-to-store, flat"): New test.
2012-06-12 00:19:04 +02:00
Ludovic Courtès 99634e3ff4 Add `imported-files'.
* guix/derivations.scm (imported-files): New procedure.
  (build-expression->derivation): Correctly handle inputs that are
  sources and not derivation paths.

* tests/derivations.scm ("imported-files"): New test.
2012-06-11 23:12:55 +02:00
Ludovic Courtès 0e383c76ce Fix the `build-expression->derivation' fixed-output test.
* tests/derivations.scm ("build-expression->derivation"): Fix the
  builder to actually pass a bytevector to `put-bytevector'.
2012-06-11 23:02:39 +02:00
Ludovic Courtès 9809055707 Add a `%current-system' fluid.
* guix/utils.scm (gnu-triplet->nix-system): New procedure.
  (%current-system): New variable.

* tests/utils.scm ("gnu-triplet->nix-system"): New test.

* tests/derivations.scm (%current-system): Remove.  Update users to
  use (%current-system) instead.
2012-06-11 21:50:17 +02:00
Ludovic Courtès b37eb5ede6 Add `add-to-store' with recursive directory storage.
* guix/store.scm (write-file): Implement directory recursive dump.
  (add-to-store): Fix the parameter list.

* tests/derivations.scm (directory-contents): New procedure.
  ("add-to-store, recursive"): New test.
2012-06-10 22:43:02 +02:00
Ludovic Courtès 81095052a8 tests: Don't hard-code the system type.
* tests/derivations.scm (%current-system): New variable.  Replace
  occurrences of "x86_64-linux" by %CURRENT-SYSTEM.
2012-06-10 15:34:46 +02:00
Ludovic Courtès 9bc07f4df0 Add multiple-output support to `build-expression->derivation'.
* guix/derivations.scm (build-expression->derivation): Add `outputs'
  keyword parameter; pass it to `derivation'.  Define `%outputs' in the
  prologue.

* tests/derivations.scm ("build-expression->derivation with two
  outputs"): New test.
2012-06-09 23:16:55 +02:00
Ludovic Courtès 7946c4e710 Add `derivation' test for multiple-output derivations.
* tests/derivations.scm ("multiple-output derivation"): New test.
2012-06-09 21:52:31 +02:00
Ludovic Courtès af7f9e5f13 Sort environment variables alphabetically in `derivation'.
* guix/derivations.scm (derivation)[env-vars-with-empty-outputs]: Sort
  the result alphabetically.

* tests/derivations.scm ("build derivation with 1 source"): Add
  environment variables.
2012-06-09 21:50:30 +02:00
Ludovic Courtès 26b969dee0 Add support for fixed-output derivations in `build-expression->derivation'.
* guix/derivations.scm (build-expression->derivation): Pass HASH and
  HASH-ALGO to `derivation'.

* tests/derivations.scm ("build-expression->derivation for fixed-output
  derivation"): New test.
2012-06-09 18:52:16 +02:00
Ludovic Courtès 749c656755 Add support for fixed-output derivations.
* guix/derivations.scm (read-derivation)[outputs->alist]: For
  fixed-outputs, convert HASH with `base16-string->bytevector'.
  (write-derivation): Likewise, convert HASH-ALGO to a string and HASH
  to a base16 string.
  (derivation-hash): Expect HASH to be a bytevector, not a string;
  convert HASH with `bytevector->base16-string'.

* tests/derivations.scm ("fixed-output derivation"): New test.
2012-06-09 18:49:19 +02:00
Ludovic Courtès d9085c23c4 Add `build-expression->derivation'.
* guix/derivations.scm (%guile-for-build): New parameter.
  (build-expression->derivation): New procedure.

* tests/derivations.scm ("build-expression->derivation without inputs",
  "build-expression->derivation with one input"): New tests.
2012-06-08 21:31:01 +02:00
Ludovic Courtès de4c3f26cb Allow derivations with input derivations.
* guix/derivations.scm (derivation-path->output-path): New procedure.
  (derivation-hash): Call `memoize'.  In the fixed-output case, convert
  HASH-ALGO to a string.  In the other case, sort inputs in the
  alphabetical order of their hex hash.  For inputs with no sub-drvs,
  add "out" as the sub-drv.

* guix/utils.scm (%nixpkgs-directory): New parameter.
  (nixpkgs-derivation, memoize): New procedures.

* tests/derivations.scm ("build derivation with 1 source"): Remove
  useless shebang.
  (%coreutils): New variable.
  ("build derivation with coreutils"): New test.
2012-06-07 23:15:00 +02:00
Ludovic Courtès 33594aa489 tests: Look up `test.drv' using `search-path'.
* tests/derivations.scm ("parse & export"): Use `search-path' to find
  `test.drv'.
2012-06-05 11:18:20 +02:00
Ludovic Courtès fb3eec8301 Test the `build-derivations' operation.
* guix/derivations.scm (derivation): Return DRV as a second value.
* tests/derivations.scm ("build derivation with 1 source"): New test.
2012-06-05 00:04:07 +02:00
Ludovic Courtès 26bbbb9520 First stab at the `derivation' primitive.
* guix/store.scm (%store-prefix): New parameter.
  (store-path?, derivation-path?): New procedures.

* guix/derivations.scm (write-derivation): Pass SOURCES through
  `object->string'.
  (compressed-hash, store-path, output-path, derivation): New
  procedures.

* tests/derivations.scm (%store): New global variable.
  ("derivation with no inputs"): New test.
2012-06-03 23:32:06 +02:00
Ludovic Courtès 341c6fdd82 Add unit test for derivation parsing and output.
* guix/derivations.scm: Export `read-derivation' and `write-derivation'.

* srfi/srfi-64.scm, srfi/srfi-64.upstream.scm: New files, from libchop.
* tests/derivations.scm, tests/test.drv: New files.
2012-04-19 23:09:55 +02:00