Commit Graph

988 Commits (3af2d27eb39102aebba4d79a663a4e024fd9700d)

Author SHA1 Message Date
Ludovic Courtès 1d6243cf70 ui: Add 'size->number'.
* guix/scripts/gc.scm (size->number): Remove.
* guix/ui.scm (size->number): New procedure.
* tests/ui.scm ("size->number, bytes",
  "size->number, MiB", "size->number, GiB", "size->number, 1.2GiB",
  "size->number, invalid unit"): New tests.
2014-04-08 22:01:44 +02:00
Ludovic Courtès c950141495 offload: Remove all the GC roots in case of multiple-output derivations.
* guix/scripts/offload.scm (remove-gc-root): Rename to...
  (remove-gc-roots): ... this.
  [builder]: Use 'scandir' and remove all the files starting with
  %GC-ROOT-FILE.
  (transfer-and-offload): Adjust to renaming; remove
  'false-if-exception' wraps.
2014-04-08 13:48:30 +02:00
Ludovic Courtès a4b42825a1 offload: Bail out when failing to register a GC root on the build machine.
* guix/scripts/offload.scm (register-gc-root): Call 'leave' when
  'close-pipe' returns non-zero.
2014-04-08 10:09:27 +02:00
Ludovic Courtès af4535c58c utils: Make 'errno' procedure more robust.
Partially fixes <http://bugs.gnu.org/17212>.

* guix/utils.scm (errno): Move definition of 'bv' outside of the
  procedure.  Use 'bytevector-s32-native-ref' or
  'bytevector-s64-native-ref' instead of 'bytevector-sint-ref'.
2014-04-07 18:16:59 +02:00
Mark H Weaver d2d8779b21 Work around behavior of old 'scandir' in Guile 2.0.5.
Problem reported by John Darrington <john@darrington.wattle.id.au>.

* guix/nar.scm (write-file): Filter out "." and ".." from the result of
  'scandir'.  Previously we did this by passing a suitable predicate.
2014-04-07 04:20:30 -04:00
Ludovic Courtès 731b996255 hydra: Add 'qemu-image' job.
* build-aux/hydra/demo-os.scm: New file.
* Makefile.am (EXTRA_DIST): Add it.
* build-aux/hydra/gnu-system.scm (qemu-jobs): New procedure.
  (hydra-jobs): Use it.
* guix/scripts/system.scm (read-operating-system): Export.
2014-04-05 22:40:16 +02:00
Ludovic Courtès 512314d738 guix package: Fix indentation of packages to remove.
* guix/scripts/package.scm (show-what-to-remove/install): Add space when
  showing packages to remove.
2014-04-05 21:04:17 +02:00
Ludovic Courtès bde8c0e6d9 ui: Improve reporting of 'system-error' exceptions.
* guix/ui.scm (call-with-error-handling): Change 'system-error' handler
  to display the error message as it was raised.
2014-04-04 22:04:43 +02:00
Mark H Weaver 6a0b30f36c union: Ensure that the output is always a directory.
Fixes the creation of single-package profiles, reported by Ludovic Courtès.

* guix/build/union.scm (union-build): Add new internal procedure
  'union-of-directories' that always creates a directory, containing the code
  previously used only to merge multiple directories.  Call it from the
  multiple-directory case in 'union' and from the top-level 'union-build'.
2014-04-03 18:35:16 -04:00
Ludovic Courtès ded1012f3c pki: Introduce 'write-acl', and fix wrong conversion in 'ensure-acl'.
* guix/pki.scm (write-acl): New procedure.
  (ensure-acl): Use it.  Fixes a regression introduced in 39831f1,
  whereby 'ensure-acl' would yield a wrong-type-arg error.
* guix/scripts/archive.scm (authorize-key): Use 'write-acl'.
2014-04-04 00:23:17 +02:00
Ludovic Courtès 4b00f3434e offload: Prevent the '.drv' and build result from being GC'd.
Before that, there was a small time window during which the GC could
wipe the .drv (before 'guix build' has been called), or the build
result (before 'retrieve-files' has started.)

* guix/scripts/offload.scm (remote-pipe): Add #:quote? parameter and
  honor it.
  (%gc-root-file): New variable.
  (register-gc-root, remove-gc-root): New procedures.
  (offload): Adjust comment.  Run 'guix build' with '-r %GC-ROOT-FILE'.
  (transfer-and-offload): Call 'register-gc-root' before
  sending (derivation-file-name DRV).  Call 'remove-gc-root' after the
  call to 'offload' or 'retrieve-files'.
  (send-files): Call 'remote-pipe' with #:quote? #f.
  (retrieve-files): Likewise.
2014-04-03 23:55:51 +02:00
Mark H Weaver 1212999868 union: Rewrite to be faster; handle symlink/directory conflicts.
* guix/build/union.scm: Rewrite; only 'file=?' remains unchanged.  Remove
  'tree-union' and 'delete-duplicate-leaves' exports.  Merge inputs in a
  breadth-first fashion.  Follow symlinks for purposes of making decisions
  about the merge.

* tests/union.scm: Remove tests of 'tree-union' and 'delete-duplicate-leaves'.
2014-04-02 15:31:46 -04:00
Ludovic Courtès 27c68457d9 guix package: 'search-path-environment-variables' traverses module tree once.
* guix/scripts/package.scm (search-path-environment-variables)[manifest-entry->package]:
  Use 'find-best-packages-by-name' instead of 'find-packages-by-name'.
  On a profile with 140 packages, this reduces execution time of this
  procedure from 5.8 seconds to 2.9 seconds (50% improvement.)
2014-04-02 16:07:40 +02:00
Ludovic Courtès d2952326ae guix package: Register non-default profiles as GC roots.
* guix/scripts/package.scm (maybe-register-gc-root): New procedure.
* tests/guix-package.sh (profile): Grep the output of "guix gc
  --list-live" in a couple of places.
2014-04-02 16:07:40 +02:00
Ludovic Courtès 39831f1663 pki: Keep ACL in native sexp format to speed up 'authorized-key?'.
* guix/pki.scm (acl-entry-sexp, acl-sexp): Remove.
  (public-keys->acl, current-acl): Return a native sexp.
  (acl->public-keys, authorized-key?): Expect ACL to be a native sexp.
* guix/scripts/archive.scm (authorize-key): Convert ACL to
  canonical-sexp when writing it.
2014-04-01 23:47:51 +02:00
Ludovic Courtès 57832f2ce7 substitute-binary: Avoid consing 'regexp-exec' arguments.
* guix/scripts/substitute-binary.scm (regexp-exec): Change formals
  to (rx str . rest).
2014-04-01 23:47:51 +02:00
Ludovic Courtès c6e9485924 substitute-binary: Avoid reloading the ACL repeatedly.
* guix/scripts/substitute-binary.scm (guix-substitute-binary) <--query>:
  Cache the result of (current-acl); pass it to 'valid-narinfo?' calls.
  This saves 12% wall-clock time for "guix build emacs -n".
2014-04-01 23:47:51 +02:00
Ludovic Courtès e4687a5e68 Use 'signature-case' in (guix nar) and 'substitute-binary'.
* guix/nar.scm (restore-file-set)[assert-valid-signature]: Rewrite in
  terms of 'signature-case'.
* guix/scripts/substitute-binary.scm (narinfo-signature->canonical-sexp):
  Call 'leave' instead of 'raise' when SIGNATURE is invalid.
  (&nar-signature-error, &nar-invalid-hash-error): Remove.
  (assert-valid-signature): Add 'narinfo' parameter; remove 'port'.
  Rewrite in terms of 'signature-case' and 'leave'.  Mention NARINFO's
  URI in error messages.  Adjust caller.
  (narinfo-sha256): New procedure.
  (assert-valid-narinfo): Use it.
  (valid-narinfo?): Rewrite using 'narinfo-sha256' and
  'signature-case'.
* tests/substitute-binary.scm (assert-valid-signature,
  test-error-condition): Remove.
  ("corrupt signature data", "unauthorized public key", "invalid
  signature"): Remove.
2014-03-31 23:47:02 +02:00
Ludovic Courtès 81deef270d pki: Add 'signature-case' macro.
* guix/pki.scm (%signature-status): New procedure.
  (signature-case): New macro.
* tests/pki.scm (%secret-key, %alternate-secret-key): New variables.
  ("signature-case valid-signature", "signature-case invalid-signature",
  "signature-case hash-mismatch", "signature-case unauthorized-key",
  "signature-case corrupt-signature"): New tests.
2014-03-31 23:34:20 +02:00
Ludovic Courtès 8146fdb334 substitute-binary: Notify of valid signatures.
* guix/scripts/substitute-binary.scm (assert-valid-narinfo): Add
  #:verbose? parameter; when true, write "found valid signature".
  (valid-narinfo?): Pass #:verbose? #f.
2014-03-31 21:59:14 +02:00
Ludovic Courtès de28fefd77 guix archive: Make sure $sysconfdir/guix exists in '--authorize'.
* guix/scripts/archive.scm (authorize-key): Add 'mkdir-p' call.
  Reported by Alex Sassmannshausen <alex.sassmannshausen@gmail.com>.
2014-03-31 21:59:14 +02:00
Ludovic Courtès 36b5851df6 offload: Exit with code 100 upon build failures.
* guix/scripts/offload.scm (transfer-and-offload): Exit with code 100
  upon build failure.
2014-03-31 10:57:28 +02:00
Ludovic Courtès cdea30e061 substitute-binary: Defer narinfo authentication and authorization checks.
* guix/scripts/substitute-binary.scm (narinfo-signature->canonical-sexp):
  Catch 'gcry-error' around 'string->canonical-sexp' call, and re-raise
  as a SRFI-35 &message and &nar-signature-error.
  (narinfo-maker): Handle when SIGNATURE is #f or an invalid canonical
  sexp.
  (&nar-signature-error, &nar-invalid-hash-error): New variables.
  (assert-valid-signature): Use them.  Expect 'signature' to be a
  canonical sexp.
  (read-narinfo): Remove authentication and authorization checks.
  (%signature-line-rx): New variable.
  (assert-valid-narinfo, valid-narinfo?): New procedures.
  (guix-substitute-binary): Wrap body in 'with-error-handling'.
  [valid?]: New procedure.
  <--query>: Show only store items of narinfos that match
  'valid-narinfo?'.
  <--substitute>: Call 'assert-valid-narinfo'.
* tests/substitute-binary.scm (test-error*): Use 'test-equal'.
  (%keypair): Remove.
  (%public-key, %private-key): Load from signing-key.{pub,sec}.
  (signature-body): Add #:public-key parameter.
  (call-with-narinfo): New procedure.
  (with-narinfo): New macro.
  ("corrupt signature data", "unauthorized public key", "invalid
  signature"): Make the first argument to 'assert-valid-signature' a
  canonical sexp.
  ("invalid hash", "valid read-narinfo", "valid write-narinfo"):
  Remove.
  ("query narinfo with invalid hash", "query narinfo signed with
  authorized key", "query narinfo signed with unauthorized key",
  "substitute, invalid hash", "substitute, unauthorized key"): New
  tests.
2014-03-30 22:32:11 +02:00
Ludovic Courtès 00230df107 substitute-binary: Store the cache's URI in the local cached narinfo.
* guix/scripts/substitute-binary.scm (<narinfo>)[uri-base]: New field.
  (narinfo-maker): Pass CACHE-URL as the 'uri-base' value.
  (string->narinfo): Add 'cache-uri' parameter.
  (lookup-narinfo)[cache-entry]: Switch to version 1.  Add 'cache-uri'
  field.  Adjust body accordingly.
  (remove-expired-cached-narinfos): Switch to version 1 by default.
2014-03-30 12:02:10 +02:00
Nikita Karetnikov e9c6c58418 substitute-binary: Support the Signature field of a narinfo file.
* guix/scripts/substitute-binary.scm (<narinfo>): Add the 'signature'
  and 'contents' fields.
  (narinfo-signature->canonical-sexp): New function.
  (narinfo-maker): Add the 'signature' argument and use it.
  (assert-valid-signature): New function.
  (read-narinfo): Support the Signature field.
  (write-narinfo): Use 'narinfo-contents'.
  (%allow-unauthenticated-substitutes?): New variable.
* guix/base64.scm, tests/base64.scm, tests/substitute-binary.scm: New files.
* Makefile.am (SCM_TESTS): Add tests/base64.scm and
  tests/substitute-binary.scm.
  (MODULES): Add guix/base64.scm.
* test-env.in: Set 'GUIX_ALLOW_UNAUTHENTICATED_SUBSTITUTES'.
2014-03-30 12:02:10 +02:00
Nikita Karetnikov 24194b6b54 nar: Clarify that 'assert-valid-signature' accepts a string.
* guix/nar.scm (assert-valid-signature): Improve the wording.
2014-03-30 12:02:10 +02:00
Sree Harsha Totakura b3acf3656e Add (guix svn-download).
* guix/svn-download.scm, guix/build/svn.scm: New files.
* Makefile.am (MODULES): Add them.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2014-03-27 00:21:44 +01:00
Ludovic Courtès 4979ee04f0 Merge branch 'core-updates' 2014-03-26 16:31:57 +01:00
Ludovic Courtès 07fb21b231 offload: Remove erroneous 'close-pipe' call.
* guix/scripts/offload.scm (send-files): Remove 'close-pipe' call from
  'guard' handler ('pipe' here referred to Guile's 'pipe' procedure.)
2014-03-26 16:27:46 +01:00
Ludovic Courtès 6c41cce0be offload: Wait for the processes involved in 'guix archive --missing'.
* guix/scripts/offload.scm (send-files): Keep the second return value of
  'filtered-port'.  Call 'waitpid' on it.
2014-03-26 16:27:46 +01:00
Ludovic Courtès 236e66481d offload: Allow one transfer in each direction simultaneously.
* guix/scripts/offload.scm (transfer-and-offload): Use 'upload' lock
  instead of 'bandwidth' around 'send-files' calls, and 'download' lock
  around 'retrieve-files' call.
2014-03-26 15:06:52 +01:00
Ludovic Courtès 3dfd8af534 offload: Disable SSH-level compression.
* guix/scripts/offload.scm (remote-pipe): Remove '-z' lsh command line
  argument.  This makes transfers almost an order of magnitude slower.
  OpenSSH's ssh(1) man page notes: "Compression is desirable on modem lines
  and other slow connections, but will only slow down things on fast
  networks."  See also
  <http://www.spikelab.org/blog/transfer-largedata-scp-tarssh-tarnc-compared.html>.
2014-03-26 15:06:52 +01:00
Ludovic Courtès 212ece42b0 download: Don't use 'http-get*' on Guile 2.0.10+.
* guix/build/download.scm (http-fetch)[post-2.0.7?]: Use
  'string->number' and numeric comparison.  This fixes version
  comparison with "2.0.10" and subsequent 2.0 releases.
2014-03-25 18:54:52 +01:00
Ludovic Courtès 8b7af63754 offload: Compress files being sent/retrieved.
* guix/scripts/offload.scm (send-files): Add "xz -dc |" to the remote
  pipe command.  Pass PIPE through 'call-with-compressed-output-port'.
  Remove 'close-pipe' call.
  (retrieve-files): Add "| xz -c" to the remote pipe command.  Pass PIPE
  through 'call-with-decompressed-port'.  Remove 'close-pipe' call.
2014-03-24 22:20:54 +01:00
Ludovic Courtès 01ac19dca4 utils: Add 'call-with-decompressed-port' and 'call-with-compressed-output-port'.
* guix/utils.scm (call-with-decompressed-port,
  call-with-compressed-output-port): New procedures.
* tests/utils.scm ("compressed-output-port + decompressed-port"):
  Rewrite to use them.
2014-03-24 22:15:29 +01:00
Ludovic Courtès 80dea563a3 utils: Add 'filtered-output-port' and 'compressed-output-port'.
* guix/utils.scm (filtered-output-port, compressed-output-port): New
  procedures.
* tests/utils.scm ("compressed-output-port + decompressed-port"): New
  test.
2014-03-24 21:09:15 +01:00
Ludovic Courtès 9b0a2233db authenticate: Support reading the hash or key from stdin.
* guix/scripts/authenticate.scm (guix-authenticate): Add clauses
  for ("rsautl" "-sign" "-inkey" key) and ("rsautl" "-verify" "-inkey" _
  "-pubin").
* tests/guix-authenticate.sh (hash): Add test using -sign and -verify in
  a pipeline.
2014-03-22 22:57:10 +01:00
Ludovic Courtès 9dbe6e43ea authenticate: Move actual work to separate procedures.
* guix/scripts/authenticate.scm (read-canonical-sexp): Change to expect
  a port instead of a file name.
  (read-hash-data): Likewise.
  (sign-with-key, validate-signature): New procedures.
  (guix-authenticate): Rewrite in terms of these two procedures.
2014-03-22 22:57:10 +01:00
Ludovic Courtès 7a8024a33a utils: Add 'decompressed-port' and 'compressed-port'.
* guix/utils.scm (decompressed-port, compressed-port): New procedures.
* guix/scripts/substitute-binary.scm (decompressed-port): Remove.
  (guix-substitute-binary): Pass a symbol or #f as the first argument to
  'decompress-port'.
* tests/utils.scm ("compressed-port, decompressed-port, non-file"): New
  test.
2014-03-22 22:57:09 +01:00
Ludovic Courtès 443eb4e950 utils: 'filtered-port' doesn't leave dangling processes behind.
* guix/utils.scm (filtered-port): Make sure the 'execl' child process
  always exits, and does (primitive-_exit 1) upon execution failure.
  Use 'primitive-_exit' in the 'dump-port' child process.
* tests/utils.scm ("filtered-port, does not exist"): New test.
2014-03-22 22:57:09 +01:00
Yakkala Yagnesh Raghava ca534666aa licenses: Fix Nixpkgs license URL.
* guix/licenses.scm: Fix Nixpkgs URL in comment.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2014-03-22 22:57:09 +01:00
Mark H Weaver 1eefbb2693 Merge branch 'master' into core-updates 2014-03-22 11:19:19 -04:00
Ludovic Courtès 1fda6840a8 pk-crypto: Don't use Ed25519 when libgcrypt is older than 1.6.0.
* guix/pk-crypto.scm (gcrypt-version): New procedure.
* guix/scripts/archive.scm (%key-generation-parameters): New variable.
  (%options) <generate-key>: Use it.
* tests/pk-crypto.scm ("sign + verify, Ed25519"): Skip if using gcrypt < 1.6.0.
2014-03-20 23:06:47 +01:00
Ludovic Courtès d81195bffd offload: Send build logs to file descriptor 4.
* guix/scripts/offload.scm (with-error-to-port): New macro.
  (remote-pipe): Add #:error-port parameter.  Use 'with-error-to-port'
  around 'open-pipe*' call.
  (build-log-port): New procedure.
  (offload): Change #:log-port to default to (build-log-port).  Call
  'remote-pipe' with #:error-port LOG-PORT.
2014-03-19 23:12:06 +01:00
Ludovic Courtès 19ee8c7dc5 substitute-binary: Quietly handle 404s when fetching narinfos.
* guix/scripts/substitute-binary.scm (fetch): Add #:quiet-404?
  parameter.  Upon &http-get-error, re-raise C if the QUIET-404? is
  true and the code is 404.
  (fetch-narinfo): Pass #:quiet-404? #t.
2014-03-19 22:26:08 +01:00
Ludovic Courtès 32a1eb8025 pk-crypto: Use RFC6979 when signing with an ECC or DSA key.
* guix/pk-crypto.scm (bytevector->hash-data): Add #:key-type parameter.
  Use the 'pkcs1' flag when KEY-TYPE is 'rsa', and 'rfc6979' when
  KEY-TYPE is 'ecc' or 'dsa'.
  (key-type): New procedure.
* guix/scripts/authenticate.scm (read-hash-data): Add 'key-type'
  parameter.  Pass it to 'bytevector->hash-data'.  Adjust caller
  accordingly.
* tests/pk-crypto.scm (%ecc-key-pair): New variable.
  ("key-type"): New test.
  ("sign + verify"): Pass #:key-type to 'bytevector->hash-data'.
  ("sign + verify, Ed25519"): New test.
2014-03-19 21:40:10 +01:00
Ludovic Courtès 1cbfce1669 guix archive: Generate curve Ed25519 keys by default.
* guix/scripts/archive.scm (%options) <generate-key>: Default to curve
  Ed25519.  Suggested by Christian Grothoff <grothoff@in.tum.de>.
2014-03-17 23:49:35 +01:00
Ludovic Courtès d0a850698a guix archive: Improve '--generate-key' error reporting.
* guix/scripts/archive.scm (%options) <generate-key>: Report the error
  source and string when 'string->canonical-sexp' fails.
2014-03-17 23:47:18 +01:00
Ludovic Courtès 0562dbe5d3 Merge branch 'master' into core-updates 2014-03-17 18:26:46 +01:00
Ludovic Courtès 11e7a6cf46 store: Add 'hash-part->path'.
* guix/store.scm (hash-part->path): New procedure.
* tests/store.scm ("hash-part->path"): New test.
2014-03-14 17:16:10 +01:00
Ludovic Courtès 1a8ea0a188 offload: Fix 'choose-build-machine' for several machines.
* guix/scripts/offload.scm (choose-build-machine)[undecorate]: Turn into
  a two-argument procedure.
2014-03-13 22:57:21 +01:00
Ludovic Courtès 3c0e6e6080 offload: Convert the port number to a string when invoking lsh.
* guix/scripts/offload.scm (remote-pipe, send-files): Pass the result of
  'build-machine-port' to 'number->string'.
2014-03-13 22:46:32 +01:00
Ludovic Courtès cecd72d55a offload: Allow build machines to specify a port number.
* guix/scripts/offload.scm (<build-machine>): Add 'port' field.
  (remote-pipe, send-files): Use lsh's '-p' option when invoking it.
2014-03-13 21:58:04 +01:00
Ludovic Courtès 257b93412a guix build: Support '--with-source' along with '-e'.
* guix/scripts/build.scm (derivation-from-expression): Remove.
  (options->derivations): Handle pairs of the form
  "('argument . (? derivation?))".
  (options/resolve-packages): Add 'store' parameter; update caller.  Add
  'system' variable.  Add case for 'expression pairs.
* guix/scripts/archive.scm (derivation-from-expression): New procedure.
2014-03-13 19:21:49 +01:00
Ludovic Courtès 7f3673f21d guix build: Add '--with-source'.
* guix/scripts/build.scm (package-with-source): New procedure.
  (show-help): Add '--with-source'.
  (%options): Likewise.
  (options->derivations): Call 'options/with-source' and
  'options/resolve-packages'.
  (options/resolve-packages, options/with-source): New procedures.
* doc/guix.texi (Invoking guix build): Document '--with-source'.
2014-03-12 00:22:41 +01:00
Ludovic Courtès d91a879121 download: 'download-to-store' accepts plain file names.
* guix/download.scm (download-to-store): When URI is #f, assume that URL
  is a file name, and handle it.
2014-03-11 22:09:42 +01:00
Ludovic Courtès 6f58d58243 More /gnu/store replacements.
* gnu/packages/gcc.scm (gcc-4.7): Change /nix/store in comment.
* gnu/system/vm.scm (operating-system-default-contents):
  Use (%store-prefix) instead of "/nix/store".
* guix/derivations.scm (derivation-path->output-path,
  derivation-path->output-paths): Change to /gnu/store in docstring.
2014-03-10 23:58:40 +01:00
Ludovic Courtès 8be3b8a39b Change default store values from /nix/store to /gnu/store.
* gnu/packages/ld-wrapper.scm (%store-directory): Change the default to
  /gnu/store.
* guix/build/utils.scm (%store-directory): New procedure.
  (remove-store-references): Use it for the default value of 'store'.
* guix/packages.scm (patch-and-repack)[builder]: Change default store to
  /gnu/store.
2014-03-10 23:54:27 +01:00
Ludovic Courtès e06f7865e2 Merge branch 'master' into core-updates 2014-03-10 23:54:17 +01:00
Ludovic Courtès c9c88118a1 gnu: linux-initrd: Make the pseudo-tty device nodes.
* guix/build/linux-initrd.scm (make-essential-device-nodes): Create
  /dev/ptmx and /dev/pts.
* gnu/system/vm.scm (qemu-image): Umount /fs/dev/pts before /fs.
2014-03-10 23:43:31 +01:00
Ludovic Courtès 714084e6c0 offload: Honor absolute build timeouts.
* guix/scripts/offload.scm (offload): Remove default value for
  'build-timeout'.  Pass '--timeout' to the remote 'guix build'
  process.
  (transfer-and-offload, process-request): Remove default value for
  'build-timeout'.
2014-03-09 23:15:09 +01:00
Ludovic Courtès 002622b65b guix build: Add '--timeout' to the common build options.
* guix/scripts/build.scm (show-build-options-help): Document
  '--timeout'.
  (set-build-options-from-command-line): Pass #:timeout to
  'set-build-options'.
  (%standard-build-options): Add '--timeout'.
* doc/guix.texi (Invoking guix build): Document it.
2014-03-09 23:09:18 +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 f5768afa33 build: Change state and log directories to $localstatedir/.../guix.
* daemon.am (libstore_a_CPPFLAGS): Change /nix to /guix.
* guix/config.scm.in (%state-directory): Likewise.
* guix/store.scm (log-file): Likewise.
2014-03-09 22:10:01 +01:00
Ludovic Courtès 59f704dff6 offload: Move macro definitions before use.
* guix/scripts/offload.scm (lock-file, unlock-file, with-file-lock,
  with-machine-lock, machine-slot-file, acquire-build-slot,
  release-build-slot): Move definitions above their first use.
2014-03-09 18:08:38 +01:00
Ludovic Courtès 88da0b6888 offload: Distinguish between 'decline' and 'postpone'.
* guix/scripts/offload.scm (transfer-and-offload): New procedure, with
  core formerly in 'process-request'.
  (choose-build-machine): Remove 'requirements' parameter.
  (process-request): Reply 'decline' when none of MACHINES matches the
  requirements, and 'postpone' when MACHINES are busy.
2014-03-09 14:06:35 +01:00
Ludovic Courtès 5cc569dc73 offload: Prevent locked files from being GC'd.
* guix/scripts/offload.scm (%slots): New variable.
  (choose-build-machine): Add SLOT to '%slots'.
2014-03-08 21:23:12 +01:00
Ludovic Courtès 7df3ade112 offload: Fix thinko.
* guix/scripts/offload.scm (choose-build-machine)[machine+slots]: Use
  'filter-map', not 'filter'.
2014-03-08 12:22:49 +01:00
Ludovic Courtès d652b85137 offload: Make 'parallel-builds' a hard limit.
* guix/scripts/offload.scm (machine-choice-lock-file,
  machine-slot-file, acquire-build-slot, release-build-slot): New
  procedures.
  (choose-build-machine): Operate with (machine-choice-lock-file)
  taken.  Acquire a build slot for each of MACHINES.  Release those not
  used.
2014-03-08 12:16:06 +01:00
Ludovic Courtès 4bf1eb4f88 offload: Further generalize lock files.
* guix/scripts/offload.scm (lock-machine, unlock-machine): Remove.
  (lock-file, unlock-file): New procedures.
  (with-file-lock): New macro.
  (with-machine-lock): Rewrite in terms of 'with-file-lock'.
2014-03-08 12:07:57 +01:00
Ludovic Courtès 178f5828eb offload: Generalize the machine lock mechanism.
* guix/scripts/offload.scm (lock-machine): Add 'hint' parameter.
  (unlock-machine): Remove 'machine' parameter.
  (with-machine-lock): Add 'hint' parameter, and pass it down.
  (process-request): Adjust uses of 'with-machine-lock' to pass the
  'bandwidth hint.
2014-03-08 11:29:52 +01:00
Ludovic Courtès c7445833eb utils: Add a non-blocking option for 'fcntl-flock'.
* guix/utils.scm (F_SETLK): New variable.
  (fcntl-flock): Add 'wait?' keyword parameter; honor it.
* tests/utils.scm ("fcntl-flock non-blocking"): New test.
2014-03-08 00:18:22 +01:00
Ludovic Courtès cafb92d853 store: 'export-paths' doesn't export references of the given files.
This fixes a regression introduced in
99fbddf9a6 ("store: Change 'export-paths'
to always export in topological order.")

* guix/store.scm (export-paths): Define 'ordered' variable.  Iterate
  over it.
* tests/store.scm ("export/import paths, ensure topological order"): Add
  'file0'.  Adjust accordingly.
2014-03-07 00:19:03 +01:00
Ludovic Courtès 9ea3ef2655 utils: 'fcntl-flock' passes an errno when throwing an exception.
* guix/utils.scm (%libc-errno-pointer, errno): New procedures.
  (fcntl-flock): Use it as the exception's argument.
2014-03-06 21:42:24 +01:00
Ludovic Courtès f326fef8a8 offload: Serialize file transfers to build machines.
* guix/scripts/offload.scm (machine-lock-file, lock-machine,
  unlock-machine): New procedures.
  (with-machine-lock): New macro.
  (process-request): Wrap 'send-files' and 'retrieve-files' calls in
  'with-machine-lock'.
2014-03-06 21:42:24 +01:00
Ludovic Courtès 56c72822a8 download: Perform derivations locally.
* guix/download.scm (url-fetch): Pass #:local-build? #t to
  'build-expression->derivation'.
* guix/git-download.scm (git-fetch): Likewise.
2014-03-06 21:42:24 +01:00
Ludovic Courtès dd67b429e1 guix package: Use the common build options from (guix scripts build).
* guix/scripts/build.scm (%standard-build-options): Change option
  handlers to support multiple seeds.
* guix/scripts/package.scm (show-help): Remove --dry-run, --fallback,
  --no-substitutes, and --max-silent-time.
  (%options): Likewise, and add %STANDARD-BUILD-OPTIONS.
  (%default-options): Add 'verbosity'.
  (guix-package): Call 'set-build-options-from-command-line' instead of
  'set-build-options'.
2014-03-01 18:29:29 +01:00
Ludovic Courtès 706e9e575d substitute-binary: Gracefully handle HTTP GET errors.
* guix/http-client.scm (&http-get-error): New condition type.
  (http-fetch): Raise it instead of using 'error'.
* guix/scripts/substitute-binary.scm (fetch) <http>: Wrap body into
  'guard' form; gracefully handle 'http-get-error?' conditions.
2014-03-01 15:38:11 +01:00
Ludovic Courtès 1f7fd80032 offload: Comment out attempt to set up an lsh gateway.
* guix/scripts/offload.scm (open-ssh-gateway): Comment out.
  (process-request): Remove call to 'open-ssh-gateway' and to 'kill'.
2014-03-01 12:24:39 +01:00
Ludovic Courtès aedbf9b873 offload: 'remote-pipe' uses the right SSH key.
* guix/scripts/offload.scm (remote-pipe): Pass -i when invoking
  %LSHG-COMMAND.
2014-03-01 12:15:47 +01:00
Ludovic Courtès 165f4b2add offload: Take the target machine load into account.
* guix/scripts/offload.scm (machine-load, machine-less-loaded?,
  machine-less-loaded-or-faster?): New procedures.
  (choose-build-machine): Use 'machine-less-loaded-or-faster?' when
  sorting.  Return the head of MACHINES unless it's loaded is >= 2.
2014-03-01 01:31:18 +01:00
Ludovic Courtès 36b56f081b guix archive: Change '--help' to show '--authorize'.
* guix/scripts/archive.scm (show-help): Add '--authorize'.
2014-02-28 22:31:16 +01:00
Ludovic Courtès 3ca00bb51e packages: Support 'patches' and 'snippets' for sources that are directories.
* guix/packages.scm (patch-and-repack)[numeric-extension?, tarxz-name]:
  New procedures.
  [builder]: Adjust to deal with SOURCE when it's a directory.
  <body>: Use 'tarxz-name'.  Always add (guix build utils) to
  IMPORTED-MODULES.
2014-02-28 10:42:09 +01:00
Ludovic Courtès a74da6b015 gnu-maintenance: Adjust 'latest-release' to filter Bash's patch directories.
* guix/gnu-maintenance.scm (latest-release)[patch-directory-name?]: New
  procedure.
  <subdirs>: Use it to filter out Bash-like patch directories.
2014-02-28 00:01:53 +01:00
Ludovic Courtès 829ecd002e Merge branch 'master' into core-updates
Conflicts:
	gnu/packages/libwebsockets.scm
2014-02-27 23:49:30 +01:00
Ludovic Courtès 371e87d286 store: Use 'when' instead of 'if' in effectful context.
* guix/store.scm (set-build-options): Use 'when' instead of 'if'.
2014-02-27 22:24:02 +01:00
Ludovic Courtès 17919a5801 build-system/gnu: Allow the source to be a directory.
* guix/build/gnu-build-system.scm (unpack): Check if SOURCE is a
  directory, and copy it locally if it is.
* gnu/packages/libwebsockets.scm (libwebsockets)[arguments]: Remove
  'unpack' phase.
2014-02-22 00:34:49 +01:00
Ludovic Courtès b2bfa32d25 Merge branch 'master' into core-updates
Conflicts:
	gnu-system.am
2014-02-22 00:27:57 +01:00
Ludovic Courtès 2096ef47aa derivations: Remove unused 'derivation' parameter.
* guix/derivations.scm (derivation): Remove unused #:hash-mode parameter.
* doc/guix.texi (Derivations): Adjust accordingly.
2014-02-21 23:49:53 +01:00
Ludovic Courtès 9b5b5c1740 Add (guix git-download).
* guix/git-download.scm, guix/build/git.scm: New files.
* Makefile.am (MODULES): Add them.
* guix/packages.scm (<origin>): Fix comment for 'method' field.
2014-02-21 23:49:53 +01:00
Ludovic Courtès 96c7448f37 nar: Produce archives with files sorted in C collation order.
* guix/nar.scm (write-file) <directory>: Pass 'string<?' as the second
  argument to 'scandir'.
* tests/nar.scm ("write-file puts file in C locale collation order"):
  New test.
2014-02-21 23:49:53 +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 3140f2df42 guix hash: Add '--recursive'.
* guix/scripts/hash.scm (show-help): Add --recursive.
  (%options): Likewise.
  (guix-hash)[file-hash]: New procedure.  Honor --recursive.
  Use it.
* guix/nar.scm (write-file): Add missing field to the &nar-error
  condition raised upon unsupported file type; change its message to be
  more descriptive.
* tests/guix-hash.sh: Add tests with -r.
* doc/guix.texi (Invoking guix hash): Document --recursive.
2014-02-21 23:49:52 +01:00
Ludovic Courtès c1d52c71aa ui: Handle SRFI-35 '&message' conditions.
* guix/ui.scm (call-with-error-handling): Add case for
  'message-condition?'.
* po/Makevars: Fix typo in comment.
2014-02-21 23:49:52 +01:00
Ludovic Courtès a93e91ff48 nar: 'write-file' can write to non-file ports.
* guix/nar.scm (write-contents): Use 'sendfile' only when P is a file
  port.
* tests/nar.scm ("write-file supports non-file output ports"): New test.
2014-02-21 23:49:52 +01:00
Ludovic Courtès c6d37be951 guix hash: Don't load the whole file in memory.
* guix/scripts/hash.scm (guix-hash)[eof->null]: Remove.
  (guix-hash): Use 'port-sha256' to compute the hash instead of
  'get-bytevector-all' and co.
2014-02-20 23:18:08 +01:00
Ludovic Courtès db4fdc04cc gnu: Introduce the (gnu services ...) modules.
* gnu/system/dmd.scm: Remove file.  Move contents to...
* gnu/services.scm, gnu/services/base.scm, gnu/services/dmd.scm,
  gnu/services/networking.scm, gnu/services/xorg.scm: ... here.  New
  files.
* gnu/system.scm, gnu/system/vm.scm: Adjust accordingly.
* guix/scripts/system.scm (%user-module): Likewise.
* doc/guix.texi (Using the Configuration System): Likewise.
  (Defining Services): Likewise.
2014-02-19 20:58:24 +01:00
Ludovic Courtès 523e48969b Add 'guix system'.
* guix/scripts/system.scm: New file.
* Makefile.am (MODULES): Add it.
* po/POTFILES.in: Likewise.
* doc/guix.texi (Using the Configuration System): Link to "Invoking guix
  system".
  (Invoking guix system): New node.
2014-02-18 23:47:49 +01:00
Ludovic Courtès e7fc17b592 guix build: Factorize common options.
* guix/scripts/build.scm (show-build-options-help,
  set-build-options-from-command-line): New procedures.
  (show-help): Remove description of --dry-run,
  --fallback, --no-substitutes, --max-silent-time, and --cores.  Call
  'show-build-options-help'.
  (%standard-build-options): New variable.
  (%options): Remove --dry-run, --fallback, --no-substitutes,
  --verbosity, --max-silent-time, and --cores.  Add
  %STANDARD-BUILD-OPTIONS.
  (guix-build): Use 'set-build-options-from-command-line' instead of
  'set-build-options'.
* guix/scripts/archive.scm (show-help): Remove description of --dry-run,
  --fallback, --no-substitutes, --max-silent-time, and --cores.  Call
  'show-build-options-help'.
  (%options): Remove --dry-run, --fallback, --no-substitutes,
  --verbosity, --max-silent-time, and --cores.  Add
  %STANDARD-BUILD-OPTIONS.
  (export-from-store): Call 'set-build-options-from-command-line'
  instead of 'set-build-options.
2014-02-18 00:13:24 +01:00
Ludovic Courtès bdff90a16a guix build: Move 'set-build-options' call earlier.
* guix/scripts/build.scm (guix-build): Move 'set-build-options' call
  before 'show-what-to-build'.
2014-02-12 00:03:20 +01:00
Ludovic Courtès d66b704b51 store: Add comments for the stracer.
* guix/store.scm (%worker-magic-1, %worker-magic-2): Add comments.
2014-02-12 00:03:20 +01:00
Ludovic Courtès 99fbddf9a6 store: Change 'export-paths' to always export in topological order.
* guix/store.scm (export-paths): Pass PATHS through
  'topologically-sorted' before iterating.
* tests/store.scm ("export/import paths, ensure topological order"): New
  test.
2014-02-10 23:36:42 +01:00
John Darrington c2e6516721 build-system/gnu: Set the docdir to "share/doc"
* guix/build/gnu-build-system.scm (configure):
  Change docdir directory from "doc" to "share/doc".

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2014-02-10 22:22:53 +01:00
Ludovic Courtès 6ede17ca69 union: Do not compare directories upon collision.
* guix/build/union.scm (file=?): Return #f if FILE1 and FILE2 are not
  regular files.  Fixes a bug whereby collisions among directories would
  lead to the invocation of 'file=?' and thus 'call-with-input-file' on
  directories.  Reported by Mark H. Weaver <mhw@netris.org>.
2014-02-10 00:05:39 +01:00
Ludovic Courtès 2de227af4b download: Provide a 'User-Agent' field in HTTP requests.
Fixes <http://bugs.gnu.org/16703>.
Reported by Raimon Grau <raimonster@gmail.com>.

* guix/build/download.scm (http-fetch)[headers]: New variable.
  Pass it as #:headers or #:extra-headers to 'http-get' and
  'http-get*'.
2014-02-10 00:03:34 +01:00
Ludovic Courtès 26fc862a61 gnu: linux-initrd: When booting, chdir to the new root before calling 'chroot'.
* guix/build/linux-initrd.scm (boot-system): Add 'chdir' call right
  before 'chroot'.
2014-02-09 23:28:18 +01:00
Ludovic Courtès 45adbd624f monads: Add 'text-file*'.
* guix/monads.scm (text-file*): New procedure.
* tests/monads.scm ("text-file*"): New test.
* doc/guix.texi (The Store Monad): Change example since the previous one
  would erroneously fail to retain a reference to Coreutils.  Document
  'text-file*'.
2014-02-03 23:20:49 +01:00
Ludovic Courtès 92cb2e2888 offload: Have 'build-machines' honor its argument.
* guix/scripts/offload.scm (build-machines): Honor FILE.
2014-02-02 01:32:50 +01:00
Ludovic Courtès 1c2215108b gnu: linux-initrd: Build /dev/input devices.
* guix/build/linux-initrd.scm (make-essential-device-nodes): Make
  dev/input devices.
2014-02-01 02:22:23 +01:00
Ludovic Courtès c04c6ff64c gnu: linux-initrd: Make /dev/{mem,kmem}.
* guix/build/linux-initrd.scm (make-essential-device-nodes): Make
  dev/{mem,kmem}.
2014-02-01 01:07:14 +01:00
Ludovic Courtès 44ddf33ed5 gnu: linux-initrd: Allow the root file system to be volatile.
* gnu/system/linux-initrd.scm (qemu-initrd): Add 'volatile-root?'
  parameter.
* guix/build/linux-initrd.scm (boot-system): Likewise.  Honor it.
2014-01-31 14:26:30 +01:00
Ludovic Courtès 4919d68432 gnu: linux-initrd: Recognize 9p file systems.
* gnu/system/linux-initrd.scm (qemu-initrd)[virtio-9p-modules]: New
  variable.
  [linux-modules]: Append VIRTIO-9P-MODULES when a 9p file system is in
  MOUNTS.
* guix/build/linux-initrd.scm (mount-qemu-9p): New procedure.
  (boot-system): Recognize '9p' in MOUNTS, and use 'mount-qemu-9p'.
2014-01-31 12:52:13 +01:00
Ludovic Courtès fc4bc4b6de gnu: linux-initrd: Properly distinguish between /dev/sda* and /dev/vda*.
* guix/build/linux-initrd.scm (make-essential-device-nodes): Rename
  devices with major = 8 to /dev/sda*.  Make /dev/vda* devices.
* gnu/system/vm.scm (qemu-image): Change '/dev/vda' to '/dev/sda'.
* gnu/system.scm (operating-system-derivation): Likewise.
2014-01-31 01:43:16 +01:00
Ludovic Courtès 83b9e6a185 gnu: linux-initrd: Start a REPL when the root could not be mounted.
* guix/build/linux-initrd.scm (boot-system): Catch errors when mounting
  ROOT and call 'start-repl' upon error.
2014-01-31 01:40:02 +01:00
Ludovic Courtès d425471182 gnu: linux-initrd: Factorize boot code.
* guix/build/linux-initrd.scm (boot-system): New procedure.
* gnu/system/linux-initrd.scm (qemu-initrd): Add keyword parameters
  'guile-modules-in-chroot?' and 'mounts'.  Change builder to simply
  call 'boot-system'.
  (gnu-system-initrd): Change to a simple call to 'qemu-initrd'.
* gnu/system/vm.scm (expression->derivation-in-linux-vm): Call
  'qemu-initrd' with #:guile-modules-in-chroot?.
2014-01-29 21:57:56 +01:00
Ludovic Courtès 413d5351aa monads: Add 'imported-modules' and 'compiled-modules'.
* guix/monads.scm (package-file): Fix typo.
  (imported-modules, compiled-modules): New procedures.
2014-01-29 13:05:42 +01:00
Ludovic Courtès 49a8b80da6 Revert "build-system/gnu: Pass --localstatedir=/var --sharedstatedir=/com."
This reverts commit 65529e49ff.
2014-01-28 08:57:37 +01:00
Ludovic Courtès 65529e49ff build-system/gnu: Pass --localstatedir=/var --sharedstatedir=/com.
Suggested by John Darrington <john@darrington.wattle.id.au>
and Mark H Weaver <mhw@netris.org>.

* guix/build/gnu-build-system.scm (configure): Pass --localstatedir=/var
  --sharedstatedir=/com.
* gnu/packages/admin.scm (dmd): Remove 'arguments' field.
* gnu/packages/avahi.scm (avahi): Remove --localstatedir flag.
* gnu/packages/glib.scm (dbus): Likewise.
* gnu/packages/package-management.scm (guix): Likewise.
* gnu/packages/pulseaudio.scm (pulseaudio): Likewise.
2014-01-27 23:45:59 +01:00
Ludovic Courtès f06afd4da2 download: Add archive.apache.org to the Apache mirrors.
* guix/download.scm (%mirrors)[apache]: Add archive.apache.org as a last
  resort.
2014-01-27 23:31:28 +01:00
Ludovic Courtès a76611c435 offload: Do not try to retrieve anything upon build failure.
* guix/scripts/offload.scm (offload): Add 'log-port' keyword parameter.
  Handle log display here.  Return the result of (close-pipe pipe).
  (process-request): Adjust 'offload' call site accordingly.  Call
  'retrieve-files' only when 'offload' returns zero; exit when 'offload'
  returns non-zero.
2014-01-27 21:32:59 +01:00
Ludovic Courtès 6ce206cb92 Prefer local builds for "small" derivations.
* gnu/system.scm (union, file-union, links): Pass #:local-build? #t to
  'derivation-expression'.
* guix/derivations.scm (imported-files, compiled-modules): Likewise.
* guix/profiles.scm (profile-derivation): Likewise.
2014-01-25 17:22:53 +01:00
Ludovic Courtès 200a97e64f Merge branch 'master' into core-updates 2014-01-25 17:07:21 +01:00
Ludovic Courtès 1909431c5b derivations: Add #:local-build? parameter for derivations.
* guix/derivations.scm (derivation): Add #:local-build? parameter and
  honor it.
  (build-expression->derivation): Likewise.
* doc/guix.texi (Derivations): Update documentation of these
  procedures.
2014-01-25 17:04:35 +01:00
Ludovic Courtès 9e55f04a4b profiles: Remove misleading message.
Fixes <http://bugs.gnu.org/16484>.
Reported by Andreas Enge <andreas@enge.fr>.

* guix/profiles.scm (profile-derivation)[builder]: Remove "building
  profile '~a' with ~a packages" message.
2014-01-25 16:20:23 +01:00
Ludovic Courtès 49e6291a7a Add 'guix offload' as a daemon build hook.
* nix/nix-daemon/guix-daemon.cc (GUIX_OPT_NO_BUILD_HOOK): New macro.
  (options): Add '--no-build-hook'.
  (parse_opt): Handle it.
  (main)[HAVE_DAEMON_OFFLOAD_HOOK]: Set 'useBuildHook' by default.
  Set $NIX_BUILD_HOOK to our offload hook unless otherwise specified.
  [!HAVE_DAEMON_OFFLOAD_HOOK]: Clear 'useBuildHook'.
* pre-inst-env.in: Set and export NIX_BUILD_HOOK.
* nix/scripts/offload.in, guix/scripts/offload.scm: New files.
* guix/ui.scm (show-guix-help)[internal?]: Add "offload".
* config-daemon.ac: Call 'GUIX_CHECK_UNBUFFERED_CBIP'.
  Instantiate 'nix/scripts/offload'.  Set 'BUILD_DAEMON_OFFLOAD'
  conditional, and optionally define 'HAVE_DEAMON_OFFLOAD_HOOK' cpp
  macro.
* daemon.am (nodist_pkglibexec_SCRIPTS)[BUILD_DAEMON_OFFLOAD]: Add it.
* Makefile.am (MODULES)[BUILD_DAEMON_OFFLOAD]: Add
  'guix/scripts/offload.scm'.
  (EXTRA_DIST)[!BUILD_DAEMON_OFFLOAD]: Likewise.
* m4/guix.m4 (GUIX_CHECK_UNBUFFERED_CBIP): New macro.
* doc/guix.texi (Setting Up the Daemon): Move most of the body to...
  (Build Environment Setup): ... this.  New subsection.
  (Daemon Offload Setup): New subsection.
2014-01-24 00:01:50 +01:00
Ludovic Courtès 50add47748 store: Add 'topologically-sorted'.
* guix/store.scm (topologically-sorted): New procedure.
* tests/store.scm ("topologically-sorted, one item",
  "topologically-sorted, several items", "topologically-sorted, more
  difficult"): New tests.
2014-01-24 00:01:50 +01:00
Ludovic Courtès cd4027fa47 nar: Add 'restore-file-set', for use by build hooks.
* guix/nar.scm (&nar-invalid-hash-error, &nar-signature-error): New
  condition types.
  (&nar-error): Add 'file' and 'port' fields.
  (&nar-read-error): Remove 'port' and 'file' fields.
  (lock-store-file, unlock-store-file, finalize-store-file,
  temporary-store-directory, restore-file-set): New procedures.
* tests/nar.scm (%seed): New variable.
  (random-text): New procedure.
  ("restore-file-set (signed, valid)", "restore-file-set (missing
  signature)", "restore-file-set (corrupt)"): New tests.
* po/Makevars (XGETTEXT_OPTIONS): Add '--keyword=message'.nar fixes
* po/POTFILES.in: Add guix/nar.scm.
2014-01-24 00:01:50 +01:00
Ludovic Courtès ce4a482983 store: Add 'with-store' convenience macro.
* guix/store.scm (with-store): New macro.
2014-01-24 00:01:49 +01:00
Ludovic Courtès 045111e10c hash: Add 'open-sha256-input-port', for Guile > 2.0.9.
* guix/hash.scm (open-sha256-input-port): New procedure.
* tests/hash.scm (supports-unbuffered-cbip?): New procedure.
  ("open-sha256-input-port, empty", "open-sha256-input-port, hello",
  "open-sha256-input-port, hello, one two",
  "open-sha256-input-port, hello, read from wrapped port"): New tests.
2014-01-24 00:01:49 +01:00
Ludovic Courtès d28684b5a5 pki: Factorize signature manipulation procedures.
* guix/pki.scm (signature-subject, signature-signed-data,
  valid-signature?): New procedures.
* guix/scripts/authenticate.scm (guix-authenticate): Adjust to use
  them.
2014-01-24 00:01:49 +01:00
Ludovic Courtès 2cd5c0380e utils: Add 'fcntl-flock'.
* guix/utils.scm (%struct-flock, F_SETLKW, F_xxLCK): New variables.
  (fcntl-flock): New procedure.
* tests/utils.scm ("fcntl-flock"): New test.
2014-01-24 00:01:49 +01:00
Ludovic Courtès 6bfec3edf5 store: Add 'register-path' procedure.
* guix/store.scm (register-path): New procedure.
* tests/store.scm ("register-path"): New test.
* guix/config.scm.in (%guix-register-program): New variable.
* configure.ac: Compute and substitute 'guix_sbindir'.  Compute
  'guix_prefix'.
* pre-inst-env.in: Define 'GUIX_REGISTER'.
2014-01-24 00:01:49 +01:00
Ludovic Courtès 5674a3fdb6 store: Add comments for the %stderr constants.
* guix/store.scm (process-stderr): Add comments for the various
  constants, to help when stracing.
2014-01-24 00:01:49 +01:00
Ludovic Courtès 59f734f351 ui: Filter out internal commands from '--help'.
* guix/ui.scm (show-guix-help)[internal?]: New procedure.
  Use it to filter out internal commands reported by '--help'.
2014-01-24 00:01:49 +01:00
Ludovic Courtès 66ea671393 licenses: Add GNU FDL 1.3+.
* guix/licenses.scm (fdl1.3+): New variable.
2014-01-22 00:20:40 +01:00
Ludovic Courtès d43eb499a6 Update 'nix-upstream' sub-module; adjust build system, doc, and substituter.
* nix-upstream: Update sub-module.
* daemon.am (libutil_a_SOURCES): Add affinity.cc.
  (libutil_headers): Add affinity.hh.
  (libexec_PROGRAMS, nix_setuid_helper_SOURCES,
  nix_setuid_helper_CPPFLAGS, nix_setuid_helper_LDADD): Remove.
* doc/guix.texi (Setting Up the Daemon): Remove paragraph about
  'nix-setuid-helper'.
* guix/scripts/substitute-binary.scm (guix-substitute-binary): Exit 0 when
  %CACHE-URL has an HTTP scheme and looking up its host fails.
  Always print a newline to stdout when starting.
2014-01-18 22:32:50 +01:00
Ludovic Courtès b97c95eb3c linux-initrd: Make /dev/{null,zero} world-writable.
Reported by zerwas on #guix.

* guix/build/linux-initrd.scm (make-essential-device-nodes): Make
  /dev/null and /dev/zero world-writable.
2014-01-18 22:32:50 +01:00
Ludovic Courtès c5e0eb2884 ui: Update copyright year in '--version' output.
* guix/ui.scm (show-version-and-exit): Increment copyright year.
2014-01-17 22:49:42 +01:00
Ludovic Courtès eb9a9feefd guix package: Gracefully handle EPIPE on '--search'.
* guix/scripts/package.scm (guix-package): Wrap body of 'search' in
  'leave-on-EPIPE'.
2014-01-13 18:51:07 +01:00
Ludovic Courtès 8fa3e6b338 ui: Don't use hyphens in 'package->recutils' output.
* guix/ui.scm (package->recutils): Rename recutils field from
  'home-page' to 'homepage'.
2014-01-13 18:49:26 +01:00
Ludovic Courtès 2f265602ff Merge branch 'master' into core-updates 2014-01-08 22:06:54 +01:00
Ludovic Courtès 1d6816f98c config: '%store-directory' always honors $NIX_STORE_DIR.
* guix/config.scm.in (%store-directory): Honor $NIX_STORE_DIR.
* guix/store.scm (%store-prefix): Use %store-directory directly.
2014-01-08 21:37:06 +01:00
Ludovic Courtès 80d0447c95 config: '%state-directory' always honors $NIX_STATE_DIR.
* guix/config.scm.in (%state-directory): Honor $NIX_STATE_DIR.
* guix/scripts/package.scm (%profile-directory): Use %state-directory
  directly.
* guix/store.scm (%default-socket-path, log-file): Likewise.
2014-01-08 21:12:55 +01:00
Ludovic Courtès 021a201f29 store: Fix 'log-file' to support uncompressed logs.
* guix/store.scm (log-file): Report the file without '.bz2' if it
  exists.
2014-01-08 19:23:33 +01:00
Ludovic Courtès 87236aed77 archive: Add '--missing'.
* guix/scripts/archive.scm (show-help, %options): Add '--missing'.
  (guix-archive)[lines]: New procedure.
  Use it to honor '--missing'.
* tests/guix-archive.sh: Add tests.
* doc/guix.texi (Invoking guix archive): Document '--missing'.
2014-01-06 22:25:29 +01:00
Ludovic Courtès 590e4154b6 archive: Make sure $sysconfdir/guix exists.
* guix/pki.scm (ensure-acl): Make sure the directory of %ACL-FILE
  exists.
* guix/scripts/archive.scm (generate-key-pair): Likewise for
  %PUBLIC-KEY-FILE.
2014-01-05 23:40:06 +01:00
Ludovic Courtès 425b0bfc2e guix build: Add '--no-build-hook'.
* guix/scripts/build.scm (%default-options): Add 'build-hook?' pair.
  (show-help, %options): Add --no-build-hook.
  (guix-build): Pass the 'build-hook?' value to 'set-build-options'.
* doc/guix.texi (Invoking guix build): Document '--no-build-hook'.
2014-01-05 22:58:32 +01:00
Ludovic Courtès 1a43e4dc57 guix package: Gracefully deal with EPIPE on stdout for --list-*.
* guix/scripts/package.scm (leave-on-EPIPE): New macro.
  (guix-package): Use it for 'list-installed', 'list-available', and
  '--list-generations'.
* tests/guix-package.sh: Add test.
2014-01-04 22:45:33 +01:00
Ludovic Courtès f82cc5fdbe archive: Add '--authorize'.
* guix/scripts/archive.scm (authorize-key): New procedure.
  (guix-archive): Call it when OPTS contains 'authorize-key'.
* tests/guix-archive.sh: Add test with invalid public key.
* guix/pki.scm: Export '%acl-file'.
* doc/guix.texi (Invoking guix archive): Make it clear that '--import'
  works only with authorized keys.  Document '--authorize'.
2013-12-30 23:18:52 +01:00
Ludovic Courtès 554f26ece3 archive: Add '--generate-key'.
* guix/pk-crypto.scm (error-source, error-string): New procedures.
* guix/pki.scm (%private-key-file): New variable.
* guix/scripts/archive.scm (show-help): Document '--generate-key'.
  (%options): Add "generate-key".
  (generate-key-pair): New procedure.
  (guix-archive): Call 'generate-key' when OPTS contains a
  'generate-key' pair.
* doc/guix.texi (Setting Up the Daemon): Suggest generating a key pair.
  (Invoking guix archive): Document '--generate-key'.
2013-12-30 22:57:37 +01:00
Ludovic Courtès dedb5d947e pk-crypto: Fix 'canonical-sexp->sexp' for atoms.
* guix/pk-crypto.scm (canonical-sexp->sexp): Add hack to extract an
  atom's buffer.
* tests/pk-crypto.scm ("sexp->canonical-sexp->sexp"): Add sample.
2013-12-30 22:29:12 +01:00
Ludovic Courtès 36341854df pk-crypto: Work around Libgcrypt bug <https://bugs.g10code.com/gnupg/issue1594>.
* guix/pk-crypto.scm (canonical-sexp-fold): Call 'nth-data' before
  'nth' to work around <https://bugs.g10code.com/gnupg/issue1594>.
* tests/pk-crypto.scm ("https://bugs.g10code.com/gnupg/issue1594"): New
  test.
2013-12-30 22:19:19 +01:00
Ludovic Courtès c909dab269 authenticate: Consistently use 'leave' for fatal error reporting.
* guix/scripts/authenticate.scm (guix-authenticate): Replace all uses of
  'format' + 'exit' with 'leave'.
2013-12-30 18:23:44 +01:00
Ludovic Courtès 96e5085c81 authenticate: Disallow imports signed with unauthorized keys.
* guix/scripts/authenticate.scm (signature-sexp): Remove.
  (guix-authenticate): Upon '-verify', check whether the signature's
  public key passes 'authorized-key?'.
2013-12-29 15:57:24 +01:00
Ludovic Courtès 8b420f74e4 Add (guix pki).
* guix/pki.scm, tests/pki.scm: New files.
* Makefile.am (MODULES): Add 'guix/pki.scm'.
  (SCM_TESTS): Add 'tests/pki.scm'.
2013-12-29 15:57:24 +01:00
Ludovic Courtès 3f40cfdece config: Export '%config-directory'.
* configure.ac: Define and substitute 'guix_sysconfdir'.
* guix/config.scm.in (%config-directory): New variable.
2013-12-29 15:57:24 +01:00
Ludovic Courtès 04d4c8a439 Move 'with-atomic-file-output' to (guix utils).
* guix/scripts/substitute-binary.scm (with-atomic-file-output): Move to...
* guix/utils.scm (with-atomic-file-output): ... here.
2013-12-29 15:57:24 +01:00
Ludovic Courtès 9501d7745e pk-crypto: Add canonical-sexp to sexp conversion procedures.
* guix/pk-crypto.scm (canonical-sexp-fold, canonical-sexp->sexp,
  sexp->canonical-sexp): New procedures.
* tests/pk-crypto.scm ("canonical-sexp->sexp",
  "sexp->canonical-sexp->sexp"): New tests.
2013-12-29 15:57:24 +01:00
Ludovic Courtès 363ae1da82 pk-crypto: Add 'canonical-sexp-length' and related procedures.
* guix/pk-crypto.scm (canonical-sexp-length, canonical-sexp-null?,
  canonical-sexp-list?): New procedures.
* tests/pk-crypto.scm ("canonical-sexp-length", "canonical-sexp-list?"):
  New tests.
2013-12-29 15:57:24 +01:00
Ludovic Courtès a2cbbb743d pk-crypto: 'canonical-sexp-nth-data' returns a symbol for "tokens".
* guix/pk-crypto.scm (token-string?): New procedure.
  (canonical-sexp-nth-data): Return a symbol when the element is a
  "token", and a bytevector otherwise.
  (latin1-string->bytevector): Remove.
  (hash-data->bytevector): Adjust accordingly.
* tests/pk-crypto.scm ("canonical-sexp-nth"): Adjust accordingly.  Add
  octet string example.
2013-12-29 15:57:23 +01:00
Ludovic Courtès 6df1fb8991 authenticate: Store the public key as part of the signature.
* guix/scripts/authenticate.scm (signature-sexp): New procedure.
  (guix-authenticate): Use it to produce the signature.  Adjust
  verification code accordingly.
* tests/store.scm ("import corrupt path"): Adjust test accordingly.
2013-12-29 15:57:23 +01:00
Ludovic Courtès b0a33ac157 pk-crypto: Rename 'gcry-sexp' to 'canonical-sexp'.
* guix/pk-crypto.scm: Rename procedures, variables, etc. from
  'gcry-sexp' to 'canonical-sexp'.  Add comment with references.
* guix/scripts/authenticate.scm, tests/pk-crypto.scm: Adjust
  accordingly.
2013-12-29 15:57:23 +01:00
Ludovic Courtès 760c60d684 Add 'guix archive'.
* guix/scripts/archive.scm, tests/guix-archive.sh: New files.
* Makefile.am (MODULES): Add 'archive.scm'.
  (SH_TESTS): Add 'guix-archive.sh'.
* doc/guix.texi (Invoking guix archive): New section.
* guix/scripts/build.scm: Export 'derivation-from-expression'.
* guix/scripts/package.scm: Export 'specification->package+output'.
2013-12-22 01:08:21 +01:00
Ludovic Courtès 81fa80b245 guix build: Improve procedural decomposition.
* guix/scripts/build.scm (%store): Remove.
  (derivation-from-expression): Add 'store' parameter.  Adjust caller
  accordingly.
  (register-root): New procedure, formerly within 'guix-build'.
  (options->derivations): New procedure, formerly inline within
  'guix-build'.
  (guix-build): Adjust accordingly.
2013-12-21 22:53:58 +01:00
Ludovic Courtès 3f26bfc18a Factorize package search between 'guix package' and 'guix build'.
* guix/scripts/package.scm (newest-available-packages): Remove.
  (find-best-packages-by-name): Move to...
* gnu/packages.scm (find-best-packages-by-name): ... here.
  (find-newest-available-packages): Memoize.
* guix/scripts/build.scm (specification->package): New procedure,
  formerly called 'find-package' within 'guix-build'.
  (guix-build): Adjust accordingly.
2013-12-21 22:36:32 +01:00
Ludovic Courtès 526382ff92 daemon: Implement signed archive import/export.
* guix/scripts/authenticate.scm, nix/scripts/guix-authenticate.in,
  tests/signing-key.pub, tests/signing-key.sec: New files.
* po/POTFILES.in: Add 'guix/scripts/authenticate.scm'.
* guix/store.scm (dump-port): New procedure.
  (process-stderr): Add 'user-port' optional parameter.  Handle
  the %STDERR-WRITE and %STDERR-READ cases as expected.
  (import-paths, export-path, export-paths): New procedures.
* tests/store.scm ("export/import several paths", "import corrupt
  path"): New tests.
* Makefile.am (MODULES): Add 'guix/scripts/authenticate.scm'.
  (EXTRA_DIST): Add 'tests/signing-key.{pub,sec}'.
* daemon.am (libstore_a_CPPFLAGS)[-DNIX_CONF_DIR]: Change 'NIX_CONF_DIR'
  to .../guix.  Change 'OPENSSL_PATH' to 'guix-authenticate'.
* config-daemon.ac: Instantiate 'nix/scripts/guix-authenticate'.
* nix/nix-daemon/guix-daemon.cc (main): Augment $PATH to include
  'settings.nixLibexecDir'.
* test-env.in: Export 'NIX_CONF_DIR' and 'NIX_LIBEXEC_DIR'.  Populate
  $NIX_CONF_DIR.
2013-12-20 17:17:42 +01:00
Ludovic Courtès ce507041f7 pk-crypto: Add a few sexp utility procedures.
* guix/pk-crypto.scm (gcry-sexp-car, gcry-sexp-cdr, gcry-sexp-nth,
  gcry-sexp-nth-data, dereference-size_t, latin1-string->bytevector,
  hash-data->bytevector): New procedures.
* tests/pk-crypto.scm ("gcry-sexp-car + cdr", "gcry-sexp-nth",
  "gcry-sexp-nth-data", "bytevector->hash-data->bytevector"): New tests.
2013-12-20 15:22:15 +01:00
Ludovic Courtès 3476ded934 Add (guix pk-crypto).
* guix/pk-crypto.scm, tests/pk-crypto.scm: New files.
* Makefile.am (MODULES, SCM_TESTS): Add them.
2013-12-20 00:36:26 +01:00
John Darrington db6190899e gnu: gnu-build-system: Add CC_FOR_BUILD to configure flags.
* guix/build/gnu-build-system.scm: Add new configure flag: CC_FOR_BUILD=gcc

* gnu/packages/gnupg.scm, gnu/packages/guile.scm, gnu/packages/make-bootstrap.scm:
  remove CC_FOR_BUILD from these package descriptions.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2013-12-17 21:28:07 +01:00
Ludovic Courtès 3dbeecd2ff pull: Move build code to (guix build pull).
* guix/build/pull.scm: New file.
* Makefile.am (MODULES): Add it.
* guix/scripts/pull.scm (unpack): Use it.
2013-12-16 23:26:48 +01:00
Cyril Roelandt af949e8ee7 gnu: gtk+: enable introspection.
* gnu/packages/gtk.scm (atk, gdk-pixbuf, gtk+, pango): enable introspection
* guix/build/gnome.scm: New file.
2013-12-15 23:39:43 +01:00
Mark H Weaver 6447738c01 guix package: allow multiple arguments after -i, -r, and -u.
* guix/scripts/package.scm (%options): Adapt option processors to accept and
  return a second seed value: 'arg-handler', which handles bare arguments (if
  not false).  The install, remove, and upgrade option processors return an
  arg-handler that repeat the same operation.  All other option processors
  return #f as the arg-handler.  Make the arguments to install and remove
  optional.  The upgrade option processor deletes (upgrade . #f) from the
  alist before adding a new entry.
  (guix-package): Procedures passed to 'args-fold*' accept the new seed value
  'arg-handler'.  The 'operand-proc' uses 'arg-handler' (if not false).

* doc/guix.texi (Invoking guix package): Update docs.

* tests/guix-package.sh: Add test.
2013-12-14 16:25:02 -05:00
Ludovic Courtès 52a79f1e73 pull: Compile guix/ files before gnu/ files.
* guix/scripts/pull.scm (unpack)[builder]: Build files under guix/
  before files under gnu/.
2013-12-14 16:48:38 +01:00
Ludovic Courtès ca6c4fa190 pull: Compile files in parallel.
* guix/scripts/pull.scm (unpack)[builder](compile-file*): Remove.
  (call-with-process, p-for-each): New procedures.  Use them to compile
  files in parallel.
2013-12-14 16:32:42 +01:00
Ludovic Courtès 0c2e1dd45d pull: Limit memory usage when compiling.
Reported by Arne Babenhauserheide <arne.babenhauserheide@kit.edu>.

* guix/scripts/pull.scm (unpack)[builder](compile-file*): Change to run
  'compile-file' in a child process.  This limits memory usage; before
  that memory usage was proportional to the number of files to compile.
2013-12-14 16:32:42 +01:00
Ludovic Courtès 5c0f184536 store: Optimize 'store-path-package-name' and 'store-path-hash-part'.
* guix/store.scm (store-regexp*): New procedure.
  (store-path-package-name, store-path-hash-part): Use it.
2013-12-11 00:19:27 +01:00
Ludovic Courtès 033adfe7e0 gnu: Add (gnu system).
* gnu/system/vm.scm (lower-inputs): Move to monads.scm.
  (qemu-image): Don't add GRUB-CONFIGURATION to the INPUTS-TO-COPY.
  (union, file-union, etc-directory): Move to gnu/system.scm.
  (%demo-operating-system): New variable.
  (system-qemu-image): Add 'os' parameter.  Rewrite in terms of
  'operating-system-derivation'.
* guix/monads.scm (lower-inputs): New procedure.
* gnu/system/grub.scm (grub-configuration-file): Change 'entries' to be
  a plain list instead of a list of monadic values.
* gnu/system.scm: New file.
* gnu-system.am (GNU_SYSTEM_MODULES): Add it.
2013-12-10 00:24:02 +01:00
Ludovic Courtès 593c3fe600 monads: Fix 'anym'.
* guix/monads.scm (anym): Fix successful case.
* tests/monads.scm ("anym"): New test.
2013-12-10 00:24:01 +01:00
Andreas Enge 9200c11009 build-system/perl: Honour phases argument in perl build system.
* guix/build-system/perl.scm (perl-build): Propagate phases argument to
    builder.
2013-12-09 13:50:58 +01:00
Ludovic Courtès 14f550c31c monads: Remove erroneous comment.
* guix/monads.scm (sequence): Remove erroneous comment.
2013-12-05 23:05:13 +01:00
Ludovic Courtès f4badde3fa build-system/gnu: Fix reference to Gettext in 'dist-package'.
* guix/build-system/gnu.scm (dist-package): Change 'gettext' to
  'gnu-gettext'.
2013-12-04 21:43:55 +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 4d5f0bae3e gnu-maintenance: Ignore "redirect" blurbs.
* guix/gnu-maintenance.scm (official-gnu-packages)[official-description]:
  Return #f for blurbs that start with "redirect ".
2013-12-03 21:33:55 +01:00
Ludovic Courtès 977f03ffd3 build-system/cmake: Build out of source tree by default.
* guix/build-system/cmake.scm (cmake-build): Change 'out-of-source?' to
  default to #t.
* guix/build/cmake-build-system.scm (configure): Add 'out-of-source?'
  keyword parameter and honor it.
2013-11-28 00:15:07 +01:00
Ludovic Courtès de6792699e substitute-binary: Work around Guile 2.0.5's broken 'n-par-map'.
* guix/scripts/substitute-binary.scm (n-par-map*): New procedure.
  (guix-substitute-binary): Use it instead of 'n-par-map'.
  Reported by Nikita Karetnikov and Eric Bavier.
2013-11-26 22:20:39 +01:00
Ludovic Courtès b874f305e5 guix package: Honor the current output when upgrading.
* guix/scripts/package.scm (specification->package+output): Pass OUTPUT
  to 'package-specification->name+version+output'.
2013-11-24 15:30:06 +01:00
Ludovic Courtès edae5b3d50 Merge branch 'master' into core-updates
Conflicts:
	guix/packages.scm
2013-11-20 23:51:26 +01:00
Ludovic Courtès 5dfd5b82c2 build-system/python: Add #:test-target parameter.
* guix/build-system/python.scm (python-build): Add #:test-target
  parameter.  Reported by Eric Bavier <ericbavier@gmail.com>.
2013-11-20 19:03:26 +01:00
Ludovic Courtès 0b8749b7bd packages: 'package-field-location' returns a relative file name.
* guix/packages.scm (package-field-location): Set
  %FILE-PORT-NAME-CANONICALIZATION.
* tests/packages.scm ("package-field-location, relative file name"): New
  test.
2013-11-18 23:56:07 +01:00
Ludovic Courtès ac5de156ae guix build: '-e' can be passed a monadic thunk.
* guix/ui.scm (read/eval): New procedure.
  (read/eval-package-expression): Use it.
* guix/scripts/build.scm (derivations-from-package-expressions): Rename to...
  (derivation-from-expression): ... this.  Accept procedures, under the
  assumption that they are monadic thunk.
  (show-help): Adjust accordingly.
  (guix-build): Ditto.
* tests/guix-build.sh: Add test.
* doc/guix.texi (Invoking guix build): Augment description of '-e'.
2013-11-18 23:08:20 +01:00
Ludovic Courtès c509bf8c87 substitute-binary: Adjust timeout handling for Guile > 2.0.9.
* guix/scripts/substitute-binary.scm (with-timeout): Update comment to
  mention the fix's commit ID.
  (fetch): In the 'with-timeout' handler, close PORT only one Guile
  versions < 2.0.9.39.  Before that, on Guile >= 2.0.9.39, the HTTP
  client would end up trying to read from a closed file descriptor.
2013-11-14 01:09:07 +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 f80594cc41 packages: Suitably cope with indirect store paths as package sources.
* guix/packages.scm (package-source-derivation): Don't let indirect
  store paths pass through.
* tests/packages.scm ("package-source-derivation, indirect store path"):
  New test.
2013-11-13 00:29:05 +01:00
Ludovic Courtès 9336e5b5e7 store: Make 'direct-store-path?' public.
* guix/store.scm (direct-store-path?): New procedure.
* guix/derivations.scm (derivation)[direct-store-path?]: Remove.
* tests/store.scm ("direct-store-path?"): New test.
2013-11-13 00:29:05 +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 56b943de6e utils: Add 'string-replace-substring'.
* guix/utils.scm (string-replace-substring): New procedure.  Based on
  code by Mark H. Weaver.
* tests/utils.scm ("string-replace-substring"): New test.
2013-11-13 00:29:05 +01:00
Ludovic Courtès bf4211523b guix build: Add '--log-file'.
* guix/scripts/build.scm (show-help): Add '--log-file'.
  (%options): Likewise.
  (guix-build): Set %FILE-PORT-NAME-CANONICALIZATION.  Honor '--log-file'.
* tests/guix-build.sh: Add '--log-file' tests.
* doc/guix.texi (Invoking guix build): Document '--log-file'.
2013-11-12 01:06:45 +01:00
Ludovic Courtès eddd4077a5 store: Add 'log-file' procedure.
* guix/store.scm (log-file): New procedure.
* tests/store.scm ("log-file, derivation", "log-file, output file
  name"): New tests.
2013-11-12 01:06:45 +01:00
Ludovic Courtès 50dc48922c substitute-binary: Increase lookup concurrency to reduce latency.
* guix/scripts/substitute-binary.scm (%lookup-threads): New variable.
  (guix-substitute-binary): Use 'n-par-map' instead of 'par-map' for
  batch 'lookup-narinfo' calls.
2013-11-08 22:47:02 +01:00
Ludovic Courtès 7db9608d52 Merge branch 'master' into core-updates
Conflicts:
	guix/packages.scm
2013-11-08 21:58:09 +01:00
Ludovic Courtès f9cc897105 packages: Add a 'snippet' field to <origin>.
* guix/packages.scm (<origin>): Add 'snippet', 'modules', and
  'imported-modules' fields.
  (patch-and-repack): Make 'inputs' a keyword parameter.  Add 'snippet',
  'modules', and 'imported-modules' parameters.  Accept SOURCE as a raw
  file name.  Insert SNIPPET in BUILDER.  Pass IMPORTED-MODULES to
  'build-expression->derivation'.
  (package-source-derivation): Pass the extra arguments to
  'patch-and-repack'.
* tests/packages.scm ("package-source-derivation, snippet"): New test.
* doc/guix.texi (Defining Packages): Mention the 'patches' and 'snippet'
  fields.
  (Invoking guix build): Tell that --source has patches and snippets
  applied.
  (Software Freedom): Mention packages that contain non-free code.
2013-11-07 22:57:30 +01:00
Ludovic Courtès 64a967cc9c ui: Make '--version' output GCS-compliant.
* guix/ui.scm (show-version-and-exit): Display copyright year, license,
  and LACK OF WARRANTY.
2013-11-03 23:09:30 +01:00
Ludovic Courtès 45b418d634 guix package: Show the output name of what's being removed.
* guix/scripts/package.scm (show-what-to-remove/install): Show the
  output name of packages being removed.
2013-11-01 23:59:25 +01:00
Ludovic Courtès 1b5ba6b1e9 guix package: Fix indentation of "will be removed" messages.
* guix/scripts/package.scm (show-what-to-remove/install): Remove extra
  indentation from the removal sentences.
2013-11-01 23:21:01 +01:00
Ludovic Courtès a20787706c guix package: Allow removal of a specific package output.
Fixes <http://bugs.gnu.org/15756>.

* guix/profiles.scm (<manifest-pattern>): New record type.
  (remove-manifest-entry): Remove.
  (entry-predicate, manifest-matching-entries): New procedures.
  (manifest-remove): Accept a list of <manifest-pattern>.
  (manifest-installed?): Replace 'name' parameter by 'pattern', a
  <manifest-pattern>.
* guix/scripts/package.scm (options->removable): Return a list of
  <manifest-pattern>.
  (guix-package)[process-action]: Use 'manifest-matching-entries' to
  compute the list of packages to remove.
* tests/profiles.scm: New file.
* Makefile.am (SCM_TESTS): Add it.
2013-11-01 23:21:01 +01:00
Ludovic Courtès 537630c5a7 guix package: Separate '--remove' option processing.
* guix/scripts/package.scm (options->removable): New procedure.
  (guix-package)[process-actions]: Use it.  Rename 'remove*' to 'remove'
  and 'install*' to 'install'.
2013-11-01 23:21:00 +01:00
Ludovic Courtès 2876b98925 ui: Factorize package specification parsing.
* guix/ui.scm (package-specification->name+version+output): New
  procedure.
* guix/scripts/package.scm (specification->package+output): Use it.
* tests/ui.scm ("package-specification->name+version+output"): New test.
2013-11-01 23:21:00 +01:00
Ludovic Courtès cc4ecc2d88 Add (guix profiles).
* guix/scripts/package.scm (show-what-to-remove/install): New procedure,
  moved from...
  (guix-package): ... here.
  (<manifest>, make-manifest, <manifest-entry>,
  profile-manifest, manifest->sexp, sexp->manifest, read-manifest,
  write-manifest, remove-manifest-entry, manifest-remove,
  manifest-installed?, manifest=?, profile-regexp, generation-numbers,
  previous-generation-number, profile-derivation, generation-number,
  generation-file-name, generation-time, lower-input): Move to...
* guix/profiles.scm: ... here.  New file.
* Makefile.am (MODULES): Add it.
2013-11-01 23:21:00 +01:00
Ludovic Courtès ff8061b591 Merge branch 'master' into core-updates 2013-11-01 12:59:31 +01:00
Ludovic Courtès cdbca518ca union: Do not warn when identical files collide.
* guix/build/union.scm (file=?): New procedure.
  (union-build)[resolve-collision]: Do not warn when identical files
  collide.
2013-10-31 23:38:58 +01:00
Ludovic Courtès 477d30d0d8 guix package: Factorize generation file name computation.
* guix/scripts/package.scm (generation-file-name): New procedure.
  Change all occurrences of (format #f "~a-~a-link" profile number) to
  use it.
2013-10-30 22:09:33 +01:00
Ludovic Courtès 1fcc3ba309 guix package: Specify inputs for each manifest entry.
* guix/scripts/package.scm (<manifest-entry>): Add 'inputs' field.
  (manifest=?, lower-input): New procedure.
  (profile-derivation)[builder]: Add #:log-port argument to
  'union-build'.
  [ensure-valid-input]: Remove.
  Add each entry's inputs to the input list.
  (options->installable): Return just the list of entries.
  [package->manifest-entry]: Set 'inputs' field.
  [canonicalize-deps]: Rename to...
  [deduplicate]: ... this.  Remove input fiddling.
  (guix-package)[process-actions]: Use 'manifest=?' to compare the new
  and old manifests.  Pass directly PROF-DRV to 'show-what-to-build'.
  Pass #:print-build-trace #f to 'set-build-options'.
2013-10-30 22:09:33 +01:00
Ludovic Courtès c065c443a0 union: Make the log port a parameter.
* guix/build/union.scm (union-build): Add 'log-port' keyword parameter;
  use it.
2013-10-30 22:09:32 +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 d595e456c1 guix package: Always use the term "profile", not "user environment".
* guix/scripts/package.scm (%user-environment-directory): Rename to...
  (%user-profile-directory): ... this.  Update users accordingly.
  (profile-derivation): Use the term "profile" instead of "user
  environment", and use "profile" as the derivation name.
2013-10-30 22:09:32 +01:00
Ludovic Courtès f067fc3e77 guix package: Introduce <manifest> and <manifest-entry> types.
* guix/scripts/package.scm (<manifest>, <manifest-entry>): New record
  types.
  (make-manifest, read-manifest, manifest->sexp, sexp->manifest,
  read-manifest, write-manifest, remove-manifest-entry, manifest-remove,
  manifest-installed?): New procedures.
  (profile-derivation): Take a manifest as the second parameter.  Use
  'manifest->sexp'.  Expect <manifest-entry> objects instead of
  "tuples".  Adjust callers accordingly.
  (search-path-environment-variables): Changes 'packages' parameter to
  'entries'.  Rename 'package-in-manifest->package' to
  'manifest-entry->package'; expect <manifest-entry> objects.
  (display-search-paths): Rename 'packages' to 'entries'.
  (options->installable): Change 'installed' to 'manifest'.  Have
  'canonicalize-deps' return name/path tuples instead of raw packages.
  Rename 'package->tuple' to 'package->manifest-entry'.  Use
  <manifest-entry> objects instead of tuples.
  (guix-package)[process-actions]: Likewise.  Rename 'packages' to
  'entries'.
  [process-query]: Use 'manifest-entries' instead of
  'manifest-packages'.
2013-10-30 22:09:32 +01:00
Ludovic Courtès edac884624 guix package: Better separate option processing.
* guix/scripts/package.scm (find-package): Rename to...
  (specification->package+output): ... this.  Rename 'name' parmameter
  to 'spec'.  Return a package and output name instead of a tuple.
  (options->installable): New procedure
  (guix-package)[process-actions]: Use it, and remove corresponding
  code.
2013-10-30 22:09:32 +01:00
Ludovic Courtès d46d8794a1 guix package: Declutter the entry point.
* guix/scripts/package.scm (newest-available-packages,
  find-best-packages-by-name, find-package, upgradeable?): New
  procedures, moved from...
  (guix-package): ... here.
2013-10-29 22:03:02 +01:00
Ludovic Courtès 7587041028 build-system/{cmake,perl}: Don't use (guix build gnu-build-system).
Previously references to '%standard-phases' in builder-side code would
refer to the wrong one.

* guix/build-system/cmake.scm (cmake-build): Remove (guix build
  gnu-build-system) from the default MODULES value.
* guix/build-system/perl.scm (perl-build): Likewise.
2013-10-29 00:08:44 +01:00
Ludovic Courtès f1352766fa utils: 'find-files' always returns a proper list.
Reported at <http://bugs.gnu.org/15608>.

* guix/build/utils.scm (find-files): Change the 'error' procedure to
  return RESULT.  Before we would end up with an improper list.
2013-10-16 15:53:59 +02:00
Ludovic Courtès 59fbeb8cae records: define-record-type*: Field bindings are bound with 'let*'.
* guix/records.scm (define-record-type*): Wrap field bindings in a
  'let*', not in a 'letrec*', which turned out to be pointlessly
  inconvenient.
* tests/records.scm: Adjust test names accordingly.
2013-10-15 23:31:22 +02:00
Ludovic Courtès b2ba65c897 guix package: '--search' matches against package names.
* guix/scripts/package.scm (find-packages-by-description): Return
  packages whose name matches RX.
2013-10-15 22:59:50 +02:00
Ludovic Courtès 178f77b2d2 pull: Compile modules correctly regardless of the compilation order.
* guix/scripts/pull.scm (unpack)[builder]: Work around
  <http://bugs.gnu.org/15602>.
2013-10-13 22:50:11 +02:00
Andreas Enge e78fd4ca63 guix: Make cmake build system aware of usual paths.
*  guix/build/cmake-build-system.scm (configure): Set CMAKE_LIBRARY_PATH to
     LIBRARY_PATH and CMAKE_INCLUDE_PATH to CPATH.
2013-10-13 18:02:49 +02:00
Ludovic Courtès 52af657aee pull: Simplify the builder.
* guix/scripts/pull.scm (unpack)[builder]: Use 'copy-recursively' and
  'copy-file' instead of 'file-system-fold'.
2013-10-13 01:14:21 +02:00
Ludovic Courtès b421cebd6a build-system/perl: Lazily resolve (gnu packages perl).
* guix/build-system/perl.scm (default-perl): New procedure.
  (perl-build): Use it.
2013-10-12 22:29:32 +02:00
Ludovic Courtès 0ad7da1e90 pull: Add '--url' option.
* guix/scripts/pull.scm (%default-options): Add 'tarball-url' pair.
  (%options, show-help): Add '--url'.
  (guix-pull): Honor it.
2013-10-12 22:29:32 +02:00
Ludovic Courtès d8907ac43f download: Support 'file://' URLs.
* guix/download.scm (download-to-store): When URL has a 'file' scheme or
  no scheme, use 'add-to-store' directly.
2013-10-12 22:29:31 +02:00
Ludovic Courtès 39e9f95d05 guix: Add missing call to 'bindtextdomain'.
* scripts/guix.in (config-lookup): Add "localedir" entry.
  (run-guix-main): Add call to 'bindtextdomain'.
* guix/ui.scm (initialize-guix): Use %GETTEXT-DOMAIN instead of a
  literal.
2013-10-12 22:29:31 +02:00
Ludovic Courtès 1a75f8d939 gnu-maintenance: Adjust URL of package description file.
* guix/gnu-maintenance.scm (%package-description-url): Adjust to the
  new URL.
2013-10-11 22:18:47 +02:00
Ludovic Courtès 7e2b10a53f build-system/{gnu,cmake}: Remove #:patches and #:patch-flags parameters.
* guix/build/gnu-build-system.scm (patch): Remove.
  (%standard-phases): Remove 'patch'.
* guix/build-system/gnu.scm (gnu-build, gnu-cross-build): Remove
  #:patches and #:patch-flags parameters.
* guix/build-system/cmake.scm (cmake-build): Likewise.
* guix/build-system/python.scm (package-with-explicit-python): Update
  comment.
2013-10-10 23:15:57 +02:00
Ludovic Courtès 1d9bc45925 packages: The 'patch-guile' field of <origin> is now a package.
* guix/packages.scm (default-guile): Return a package instead of a
  derivation.
  (package-source-derivation): Adjust accordingly.
2013-10-10 23:00:47 +02:00
Ludovic Courtès 4e45e35266 snix: Prefer descriptions from the Womb rather than from Nixpkgs.
* guix/snix.scm (snix-derivation->guix-package): Use
  'gnu-package-doc-description' as the description for GNU packages.
2013-10-09 16:18:23 +02:00
Ludovic Courtès 129f9e1173 gnu-maintenance: Get descriptions from 'gnumaint/pkgdescr.txt'.
* guix/gnu-maintenance.scm (%gnumaint-base-url): New variable.
  (%package-list-url): Use it.
  (%gsrc-package-list-url): Remove.
  (%package-description-url): New variable.
  (official-gnu-packages): Change to use %PACKAGE-DESCRIPTION-URL
  instead of %GSRC-PACKAGE-LIST-URL.  Adjust recutils field names
  accordingly.
2013-10-09 13:00:00 +02:00
Ludovic Courtès ac10e0e17e packages: Add 'patches' and related fields to <origin>.
See <https://lists.gnu.org/archive/html/guix-devel/2013-09/msg00137.html>
for the rationale.

* guix/packages.scm (<origin>)[patches, patch-flags, patch-inputs,
  patch-guile]: New fields.
  (%standard-patch-inputs, default-guile, patch-and-repack): New
  procedures.
  (package-source-derivation): When 'patches' is non-empty, call
  'patch-and-repack'.
* guix/utils.scm (file-sans-extension): New procedure.
2013-10-09 00:11:34 +02:00
Ludovic Courtès e0029b745a download: Add Debian mirrors.
* guix/download.scm (%mirrors)[debian]: New set of mirrors.
2013-10-05 16:45:39 +02:00
Ludovic Courtès aeb7ec5c9a monads: Allow resolution of a monad's bind/return at expansion time.
* guix/monads.scm (<monad>): Turn in a raw SRFI-9 record type.
  (define-monad): New macro.
  (with-monad): Add a case for when MONAD is a macro.
  (identity-return, identity-bind, store-return, store-bind): Inline.
  (%identity-monad, %store-monad): Use 'define-monad'.
* tests/monads.scm ("monad?"): New test.
2013-10-03 23:12:20 +02:00
Ludovic Courtès b860f38244 Add (guix monads).
* guix/monads.scm: New file.
* tests/monads.scm: New file.
* Makefile.am (MODULES): Add guix/monads.scm.
  (SCM_TESTS): Add tests/monads.scm.
* doc/guix.texi (The Store Monad): New node.
  (The Store): Reference it.
2013-10-03 23:12:20 +02:00
Ludovic Courtès 2442257f2d Merge branch 'core-updates' 2013-09-27 01:30:57 +02:00
Ludovic Courtès d7ddb257c9 guix package: '--delete-generations' deletes generations older than specified.
* guix/scripts/package.scm (matching-generations): Add
  'duration-relation' keyword parameter.
  (guix-package)[process-action](delete-generations): Pass
  #:duration-relation >.
* tests/guix-package.sh: Add test.
* doc/guix.texi (Invoking guix package): Clarify the meaning of
  durations for '--list-durations' and '--delete-durations'.
2013-09-27 01:23:59 +02:00
Ludovic Courtès 03761a4465 build-system/trivial: Take the 'source' field into account.
* guix/build-system/trivial.scm (trivial-build): When SOURCE is true,
  add it to INPUTS.
  (trivial-cross-build): Likewise.
* tests/packages.scm ("trivial with source"): New test.
2013-09-27 00:46:17 +02:00
Nikita Karetnikov b7884ca3ca guix package: Add '--delete-generations'.
* guix/scripts/package.scm (switch-to-previous-generation): New function.
  (roll-back): Use the new function instead of 'switch-link'.
  (show-help): Add '--delete-generations'.
  (%options): Likewise.
  (guix-package)[process-actions]: Add 'current-generation-number',
  'display-and-delete', and 'delete-generation'.  Add support for
  '--delete-generations', and reindent the code.
* tests/guix-package.sh: Test '--delete-generations'.
* doc/guix.texi (Invoking guix-package): Document '--delete-generations'.
2013-09-26 15:41:43 +00:00
Nikita Karetnikov 64d2e973fb guix package: Add 'link-to-empty-profile'.
* guix/scripts/package.scm (link-to-empty-profile): New function.
  (roll-back): Use it.
2013-09-26 15:41:43 +00:00
Nikita Karetnikov 4658b2c47b guix package: Exit with 0 when there is nothing to list.
* guix/scripts/package.scm (guix-package)[process-query]: Exit with 0
  when there are no generations containing packages or no profiles.
2013-09-26 15:41:43 +00:00
Ludovic Courtès 7facbf2b58 Merge branch 'master' into core-updates 2013-09-26 00:20:11 +02:00
Ludovic Courtès de8bcdaeb5 packages: Make the 'output' parameter of 'package-output' optional.
* guix/packages.scm (package-output): Make the 'output' parameter
  optional.
2013-09-25 23:26:42 +02:00
Nikita Karetnikov 9ac9360d6e guix package: Show which generation is the current one.
* guix/scripts/package.scm (guix-package)[process-query]: Show that a
  generation is the current one if the profile points to it.
* tests/guix-package.sh: Test it.
2013-09-25 16:10:40 +00:00
Nikita Karetnikov 4b2bc804d8 guix package: Do not list the zeroth generation.
* guix/scripts/package.scm (guix-package)[process-query]: Change
  'list-generation' to not list the zeroth generation.
* tests/guix-package.sh: Test it.
* doc/guix.texi (Invoking guix package): Document it, and use the
  right term when talking about generations.
2013-09-25 16:08:39 +00:00
Nikita Karetnikov 0ab212b946 guix package: Exit with 1 when a generation cannot be listed.
* guix/scripts/package.scm (guix-package)[process-query]: Exit with 1
  when a generation does not exist or the profile points to the zeroth
  generation.
* tests/guix-package.sh: Test the former case.
2013-09-25 16:07:50 +00:00
Ludovic Courtès 5608847c6f Merge branch 'master' into core-updates 2013-09-23 00:35:17 +02:00