Commit Graph

891 Commits

Author SHA1 Message Date
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 66018f1c33 utils: 'find-files' returns a sorted list.
* guix/build/utils.scm (find-files): Sort the result lexicographically.
* guix/scripts/pull.scm (unpack): Don't sort the result of 'find-files'.
2013-09-15 23:21:30 +02:00
Ludovic Courtès 29479de565 substitute-binary: Add '--help'.
Reported by Nikita Karetnikov <nikita@karetnikov.org>.

* guix/scripts/substitute-binary.scm (show-help): New procedure.
  (guix-substitute-binary): Add '--help'.
2013-09-13 23:42:36 +02:00
Nikita Karetnikov 1b0a8212d1 guix package: Rename generation-related procedures.
* guix/scripts/package.scm (profile-numbers): Rename to 'generation-numbers'.
  (previous-profile-number): Rename to 'previous-generation-number'.
  (profile-number): Rename to 'generation-number'.
  (roll-back): Rename 'previous-profile' to 'previous-generation'.
2013-09-13 07:07:01 +00:00
Ludovic Courtès bda44eed93 pull: Compile files in the lexicographic order.
* guix/scripts/pull.scm (unpack): Print the name of the file being
  compiled.  Sort the names of files to compile.
2013-09-03 10:48:52 +02:00
Ludovic Courtès 00554b2a0f substitute-binary: Show the Nar size, when available.
* guix/scripts/substitute-binary.scm (guix-substitute-binary)["--substitute"]:
  Show the Nar size, when available.
* guix/ui.scm (show-what-to-build): Add 'TODO'.
2013-09-02 23:33:13 +02:00
Ludovic Courtès 7db3ff4a29 utils: Add `guile-version>?', and use it.
This fixes Guile version comparisons when (version) has a
vendor-specific suffix.

Reported by Andreas Enge <andreas@enge.fr>.

* guix/utils.scm (guile-version>?): New procedure.
* tests/utils.scm ("guile-version>? 1.8", "guile-version>? 10.5"): New
  tests.
* guix/scripts/substitute-binary.scm (fetch, progress-report-port): Use
  `guile-version>?' instead of `version>?'.
* guix/http-client.scm (when-guile<=2.0.5, http-fetch): Likewise.
2013-08-23 15:51:36 +02:00
Ludovic Courtès b6952cad8d substitute-binary: Try hard to avoid port buffering.
* guix/scripts/substitute-binary.scm (fetch): In the `file' case, open
  with the `b' flag, so that the coding cookie reading thing doesn't
  lead to buffering some of the data (on 2.0.5).
* tests/utils.scm ("filtered-port, file"): Open with `r0b'.  Fixes a
  test failure with Guile 2.0.5 whereby the first byte of FILE would be
  missing from DECOMPRESSED.
2013-08-22 17:14:20 +02:00
Ludovic Courtès db90b40dfd substitute-binary: Don't pretend to report download progress on Guile 2.0.5.
* guix/scripts/substitute-binary.scm (progress-report-port): On Guile
  2.0.5, return PORT directly and emit a warning.
2013-08-21 02:19:36 +02:00
Ludovic Courtès 079d127391 guix package: Allow separate install of several outputs of the same package.
* guix/scripts/package.scm (guix-package)[process-actions](same-package?):
  New procedure.  Use it instead of `alist-delete' when filtering out
  duplicate packages from the profile.
2013-07-15 23:51:28 +02:00
Ludovic Courtès 3b8258c569 Rename (guix web) to (guix http-client).
* guix/web.scm: Rename to...
* guix/http-client.scm: ... this.
* guix/gnu-maintenance.scm, guix/scripts/substitute-binary.scm,
  Makefile.am, po/POTFILES.in: Update accordingly.
2013-07-14 16:44:15 +02:00
Ludovic Courtès 2096b516e0 guix package: Fix handling of `-e'.
This fixes a bug whereby a command like

  guix package -e '(@@ (gnu packages base) gnu-make-boot0)'

would only succeed when the outputs of that package are available, and
otherwise fail with "/nix/store/... is not valid".

* guix/scripts/package.scm (guix-package)[process-action](package->tuple):
  Leave P as is in the result.  Move `package->tuple' call from INSTALL*
  to INSTALL.
2013-07-12 23:27:35 +02:00
Ludovic Courtès e3ccdf9e96 guix package: Reuse FTP connections for subsequent `latest-release' calls.
* guix/gnu-maintenance.scm (latest-release): Add `ftp-close' and
  `ftp-open' keyword parameters.
* guix/scripts/package.scm (ftp-open*): New variable.
  (check-package-freshness): Call `latest-release' with `ftp-open*' and
  a no-op procedure.
2013-07-12 22:59:33 +02:00
Ludovic Courtès ce689ccf18 substitute-binary: Directly replace the global `regexp-exec'.
* guix/scripts/substitute-binary.scm (%regexp-exec-mutex, string->uri):
  Remove.
  (regexp-exec): Replace this global binding by a thread-safety wrapper.
  (fields->alist): Remove `with-mutex', and directly alias `recutils->alist'.
2013-07-11 22:42:41 +02:00
Ludovic Courtès 8b79e2e641 substitute-binary: Increase the default timeout.
* guix/scripts/substitute-binary.scm (%fetch-timeout): Set to 5 seconds.
2013-07-11 22:22:22 +02:00
Ludovic Courtès 560d4787f4 guix refresh: Keep only the newest versions of packages as upgrade candidates.
* guix/scripts/refresh.scm (guix-refresh)[keep-newest]: New procedure.
  Use it to keep only once copy of each package.
2013-07-11 19:56:30 +02:00
Ludovic Courtès fdc1bf659d records: Add `recutils->alist' for public consumption.
* guix/records.scm (%recutils-field-rx): New variable.
  (recutils->alist): New procedure, formerly known as `fields->alist'.
* guix/scripts/substitute-binary.scm (fields->alist): Use it.
* tests/records.scm ("recutils->alist"): New test.
2013-07-10 17:01:08 +02:00
Ludovic Courtès b0fad8a2d4 Use `port-sha256' and `open-sha256-port'.
* guix/derivations.scm (derivation-hash): Add comment as to why we keep
  the plain `sha256' call.
* guix/scripts/download.scm (guix-download): Use `port-sha256' instead
  of (compose sha256 get-bytevector-all).
* guix/scripts/refresh.scm (update-package): Likewise.
2013-07-03 01:18:24 +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 bb7dcaea57 substitute-binary: Avoid dangling connections to the server.
* guix/web.scm (open-socket-for-uri): New procedure.
  (http-fetch): Add `port' keyword parameter; use it.
* guix/scripts/substitute-binary.scm (%random-state): New variable.
  (with-timeout): Wait a little before retrying.
  (fetch): Use `open-socket-for-uri', and keep a copy of the socket in
  variable `port'.  Close PORT upon timeout.
2013-06-29 22:20:25 +02:00
Ludovic Courtès fe1818e26a package: Fix i18n of the number of packages message.
* guix/scripts/package.scm (guix-package)[process-actions]: Use `N_' for
  i18n of the number of packages message.
2013-06-20 23:41:31 +02:00
Ludovic Courtès a85060efec substitute-binary: Report progress while downloading.
* guix/scripts/substitute-binary.scm (decompressed-port): Improve docstring.
  (progress-report-port): New procedure.
  (guix-substitute-binary)["--substitute"]: Use it to report progress.
* guix/build/download.scm: Export `progress-proc' and `uri-abbreviation'.
2013-06-20 23:41:28 +02:00
Ludovic Courtès 9af05aa29d package: Display the number of installed packages upon completion.
* guix/scripts/package.scm (guix-package)[process-actions]: Display the
  number of packages in the profile upon completion.
2013-06-19 22:42:03 +02:00
Ludovic Courtès 2207f73156 substitute-binary: Provide feedback when the server is unresponsive.
* guix/scripts/substitute-binary.scm (%fetch-timeout): New variable.
  (with-timeout): New macro.
  (fetch): Add `timeout?' keyword parameter.  Enclose `http-fetch' call
  in `with-timeout'.
  (guix-substitute-binary): Call `fetch' with #:timeout? #f.
2013-06-18 00:12:22 +02:00
Ludovic Courtès 8e59fdd53b guix gc: Add `--requisites'.
* guix/scripts/gc.scm (show-help, %options): Add `--requisites'.
  (guix-gc): Handle it.
* doc/guix.texi (Invoking guix gc): Document `--requisites'.
* NEWS: Update.
2013-06-13 22:15:41 +02:00
Nikita Karetnikov 392b5d8cab guix refresh: Add '--key-download'.
* guix/gnu-maintenance.scm (download-tarball): Add a 'key-download'
  keyword argument and pass it to 'gnupg-verify*'.  Make
  'archive-type' a keyword argument.
  (package-update): Add a 'key-download' keyword argument.  Pass
  'archive-type' and 'key-download' keyword arguments to
  'download-tarball'.

* guix/gnupg.scm: Import (ice-9 i18n) and (guix ui).
  (gnupg-verify*): Add a 'key-download' keyword argument and adjust
  'gnupg-verify*' to use it.  Make 'server' a keyword argument.

* guix/scripts/refresh.scm (show-help, %options): Add and document
  '--key-download'.
  (update-package): Add a 'key-download' keyword argument and pass it
  to 'package-update'.
  (guix-refresh): Pass 'key-download' to 'update-package'.  Limit
  lines to a maximum of 79 characters.
2013-06-10 08:15:17 +00:00
Ludovic Courtès ae3b6bb0f4 substitute-binary: Don't cache .narinfo lookups when lacking networking.
* guix/scripts/substitute-binary.scm (lookup-narinfo): Don't cache
  NARINFO when CACHE is #f.
2013-06-04 09:43:38 +02:00
Ludovic Courtès cf5d2ca329 substitute-binary: Gracefully exit upon networking errors.
Suggested by Andreas Enge <andreas@enge.fr>.

* guix/scripts/substitute-binary.scm (with-networking): New macro.
  (guix-substitute-binary): Wrap the body in `with-networking'.
2013-05-29 23:22:05 +02:00
Ludovic Courtès 56b1f4b780 build, package: Add `--fallback' option.
* guix/scripts/build.scm (%options, show-help): Add `--fallback'.
  (guix-build): Call `set-build-options' with #:fallback?.
* guix/scripts/package.scm (%options, show-help): Add `--fallback'.
  (guix-package): Call `set-build-options' with #:fallback?.
* doc/guix.texi (Invoking guix package, Invoking guix build): Document
  `--fallback'.
2013-05-29 23:22:05 +02:00
Ludovic Courtès cba363bea8 package: Fix default profile ownership check when it's just been created.
* guix/scripts/package.scm (guix-package)[ensure-default-profile]: Check
  whether S is true before checking its owner.  Fixes the case where we
  built %PROFILE-DIRECTORY just above.
2013-05-24 23:14:19 +02:00
Ludovic Courtès e55ec43d8b build: Add `--target' option.
* guix/scripts/build.scm (derivations-from-package-expressions): Add
  `package-derivation' parameter.
  (show-help, %options): Add `--target'.
  (guix-build): Use `package-cross-derivation' when `--target' is
  passed.
* tests/guix-build.sh: Add dry-run test with `--target'.
* doc/guix.texi (Invoking guix build): Document `--target'.
2013-05-24 22:52:52 +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 70c4329172 package: Make sure the profile directory is owned by the user.
* guix/scripts/package.scm (guix-package)[ensure-default-profile]: Check
  the owner of %PROFILE-DIRECTORY.  Report an error when the owner is
  not the current user.  Add `rtfm' procedure.
* doc/guix.texi (Invoking guix package): Mention the ownership test.
2013-05-16 20:04:13 +02:00
Ludovic Courtès 101d9f3fd4 substitute-binary: Pass `filtered-port' an unbuffered port.
This fixes a bug whereby `read-response' would read more than just the
response, with the extra data going into the port's buffer; the
"bzip2 -dc" process spawned by `filtered-port' would not see the those
buffered data, which are definitely lost, and would bail out with
"bzip2: (stdin) is not a bzip2 file."

* guix/utils.scm (filtered-port): Document that INPUT must be
  unbuffered.
* guix/web.scm (http-fetch): Add `buffered?' parameter.  Call
  `open-socket-for-uri' explicitly, and call `setvbuf' when BUFFERED? is
  false.  Pass the port to `http-get'.  Close it upon 301/302.
* guix/scripts/substitute-binary.scm (fetch): Add `buffered?'
  parameter.  Pass it to `http-fetch'; honor it for `file' URIs.
  (guix-substitute-binary): Call `fetch' with #:buffered? #f for port RAW.
* tests/utils.scm ("filtered-port, file"): Open FILE as unbuffered.
2013-05-15 23:40:09 +02:00
Ludovic Courtès 0332386251 substitute-binary: Work around thread-unsafe `regexp-exec'.
* guix/scripts/substitute-binary.scm (%regexp-exec-mutex): New variable.
  (string->uri): New procedure.
  (fields->alist): Wrap `regexp-exec' call in `with-mutex'.
2013-05-14 23:53:38 +02:00
Ludovic Courtès 90a1e4b303 package: Always clear the SIGINT handler.
* guix/scripts/package.scm (call-with-sigint-handler): Wrap THUNK in
  `dynamic-wind' so that the SIGINT handler is always cleared.
2013-05-14 23:52:13 +02:00
Ludovic Courtès 91fe0e20c7 ftp-client: Let callers handle `ftp-open' exceptions.
* guix/ftp-client.scm (ftp-open): Let exceptions through.
* guix/scripts/package.scm (waiting): Wrap EXP in a `dynamic-wind', so
  the line is always cleared.
2013-05-14 23:51:36 +02:00
Ludovic Courtès c0cd1b3ea7 Move record utilities to (guix records).
* guix/utils.scm (define-record-type*): Move to...
* guix/records.scm: ... here.  New file.
* guix/build-system.scm, guix/packages.scm: Use it.
* guix/gnu-maintenance.scm: Likewise.
  (official-gnu-packages)[alist->record]: Remove.
* guix/scripts/substitute-binary.scm: Likewise.
  (alist->record, object->fields): Remove.
* tests/utils.scm ("define-record-type*", "define-record-type* with
  letrec* behavior", "define-record-type* & inherit",
  "define-record-type* & inherit & letrec* behavior",
  "define-record-type* & thunked", "define-record-type* & thunked &
  default", "define-record-type* & thunked & inherited"): Move to...
* tests/records.scm: ... here.  New file.
2013-05-12 15:46:16 +02:00
Ludovic Courtès ccbce84809 tests: Add `guix hash' test.
* guix/scripts/hash.scm (guix-hash)[eof->null]: New procedure.
  Use it to convert the EOF object to the empty bytevector.
* tests/guix-hash.sh: New file.
* Makefile.am (SH_TESTS): Add it.
2013-05-11 15:09:56 +02:00
Ludovic Courtès f92300852f refresh: Add `--key-server' and `--gpg'.
* guix/scripts/refresh.scm (%options): Add `--key-server' and `--gpg'.
  (show-help): Update accordingly.
  (update-package): New procedure, formerly in `guix-refresh'.
  (guix-refresh): Use it.  Parameterize `%openpgp-key-server' and
  `%gpg-command'.
2013-05-11 14:36:58 +02:00
Ludovic Courtès 741c70c63e package: Store the output path of packages installed with `-e'.
* guix/scripts/package.scm (guix-package)[process-actions](package->tuple):
  Put the output path in the tuple, not the derivation path.
* tests/guix-package.sh: Add test.
2013-05-10 23:04:39 +02:00
Ludovic Courtès 94a4b3b9f2 package: Make sure the dependencies get built along with the manifest.
Before this, something like "guix package -i glibc" could fail because
glibc lists linux-libre-headers as a propagated input (which would be
added as a dependency in the manifest) but the linux-libre-headers
output could be unavailable, leading to an error like this:

  path `/nix/store/4v2bk8sx5cm166gks3fi3q7d9zchibnk-linux-libre-headers-3.3.8' is not valid

This patch adds such dependencies as inputs of the profile derivation.

* guix/scripts/package.scm (profile-derivation): Accept package objects
  in the `deps' field of an element of PACKAGES.  Convert them to their
  output path for BUILDER, and add them to the inputs of the
  `build-expression->derivation' call.
  (input->name+path): When INPUT doesn't contain a package object,
  return it as is.
  (guix-package)[process-actions](canonicalize-deps): Expect DEPS to
  contain package objects, and leave them as is.
2013-05-10 22:46:19 +02:00
Ludovic Courtès fe3e603d14 refresh: Gracefully handle failure to download a tarball.
* guix/scripts/refresh.scm (guix-refresh): When updating a source file,
  gracefully handle the case where TARBALL is #f.
  Reported by Nikita Karetnikov <nikita@karetnikov.org>.
2013-05-10 15:07:00 +02:00
Ludovic Courtès a81bc5312b package: Use ~/.guix-profile as the default for --search-paths.
* guix/scripts/package.scm (search-path-environment-variables): Prefer
  %USER-ENVIRONMENT-DIRECTORY when it points to PROFILE.
  (display-search-paths): Use 3 spaces for indentation.
2013-05-10 00:36:00 +02:00
Ludovic Courtès a2ed738989 package: Display the output of packages to be installed/removed.
* guix/scripts/package.scm (guix-package)[show-what-to-remove/install]:
  Display the output name.
2013-05-08 15:21:47 +02:00
Ludovic Courtès ce3b7a619d package: Preserve the installed package output when upgrading.
* guix/scripts/package.scm (guix-package)[find-package]: Add optional
  parameter `output'.  Use it.
  [process-actions]: When computing UPGRADE, pass OUTPUT to
  `find-package'.
2013-05-08 15:11:20 +02:00
Ludovic Courtès 15f67744fe package: Fix spacing in user messages.
* guix/scripts/package.scm (guix-package)[process-actions]: Fix spacing.
2013-05-07 13:23:30 +02:00
Ludovic Courtès 313109e050 refresh: Change default to not update source files.
* guix/scripts/refresh.scm (%options): Change `--dry-run' to `--update'.
  (show-help): Adjust accordingly.
  (guix-refresh): Likewise.
2013-05-06 22:31:28 +02:00
Ludovic Courtès 0734a9a813 Merge branch 'core-updates' 2013-04-30 17:06:00 +02:00
Ludovic Courtès e0fbbc889d substitute-binary: Support decompression from non-file ports.
* guix/scripts/substitute-binary.scm (filtered-port): Move to utils.scm.
  (decompressed-port): Upon "none", return '() as the second value.
  (guix-substitute-binary): Expect `decompressed-port' to return a list
  of PIDs as its second value.
* guix/utils.scm (filtered-port): New procedure.  Add case for when
  INPUT is not `file-port?'.
* tests/utils.scm ("filtered-port, file", "filtered-port, non-file"):
  New tests.
2013-04-29 23:25:19 +02:00
Ludovic Courtès 5924080dcc guix package: Add `--search-paths' & co.
* guix/scripts/package.scm (search-path-environment-variables,
  display-search-paths): New procedures.
  (show-help, %options): Add `--search-paths'.
  (guix-package)[process-actions]: Call `display-search-paths' once the
  profile is ready.
  [process-query]: Honor `search-paths'.
2013-04-28 23:19:03 +02:00
Ludovic Courtès a5975cedf2 ui: Add `args-fold*' and use it.
* guix/ui.scm (args-fold*): New procedure.
* guix/scripts/build.scm, guix/scripts/download.scm,
  guix/scripts/gc.scm, guix/scripts/hash.scm, guix/scripts/import.scm,
  guix/scripts/package.scm, guix/scripts/pull.scm,
  guix/scripts/refresh.scm: Use `args-fold*' instead of `args-fold'.
2013-04-27 16:46:39 +02:00
Ludovic Courtès 786944576c pull: Use `download-to-store'.
* guix/scripts/pull.scm (download-and-store): Remove.
  (unpack): Use `download-to-store' instead.
2013-04-27 11:40:18 +02:00
Ludovic Courtès 37a5340262 refresh: Add `--select'.
* guix/scripts/refresh.scm (%options): Add `--select'.
  (show-help): Likewise.  Augment initial help text.
  (guix-refresh)[core-package?]: New procedure.
  Use it when selecting packages.
2013-04-25 22:56:25 +02:00
Ludovic Courtès 1c9e7d65d4 web: Factorize `http-get' hackery.
This should fix `substitute-binary --query' on Guile 2.0.5.

* guix/web.scm: New file.
* Makefile.am (MODULES): Add it.
* po/POTFILES.in: Add it.
* guix/gnu-maintenance.scm (http-fetch): Remove.
  (%package-list-url): Turn into a URI.
  (official-gnu-packages): Add #:text? #t to `http-fetch' call.
* guix/scripts/substitute-binary.scm (fetch): Remove `http' case, and
  use `http-fetch' instead.
2013-04-25 22:14:51 +02:00
Ludovic Courtès 0fdd3bea58 Add `guix refresh' and related auto-update tools.
* guix/gnu-maintenance.scm (ftp-server/directory)[quirks]: Add glib.
  (package-update-path, download-tarball, package-update,
  update-package-source): New procedures.
* guix/gnupg.scm, guix/scripts/refresh.scm: New files.
* Makefile.am (MODULES): Add them.
* guix/utils.scm (file-extension): New procedure.
2013-04-25 00:13:56 +02:00
Ludovic Courtès 861693f3e7 Factorize `download-and-store'.
* guix/download.scm (download-to-store): New procedure.
* guix/scripts/download.scm (fetch-and-store): Remove.
  (guix-download): Use `download-to-store' instead.
* guix/ui.scm (call-with-temporary-output-file): Move to...
* guix/utils.scm (call-with-temporary-output-file): ... here.
2013-04-21 22:40:40 +02:00
Nikita Karetnikov 6c365eca6d Add 'guix hash'.
* guix/scripts/hash.scm: New file.
* Makefile.am (MODULES): Add it.
* po/POTFILES.in: Add it.
* doc/guix.texi (Invoking guix hash): New node.
  (Defining Packages): Add a cross-reference to the 'Invoking guix
  hash' node.
2013-04-21 19:22:14 +00:00
Nikita Karetnikov bfda2997c8 guix download: Add supported formats to '--help'.
* guix/scripts/download.scm (show-help): Add supported formats.
2013-04-21 19:04:24 +00:00
Nikita Karetnikov 98eb8cbe8d ui: Add a 'define-diagnostic' macro.
* guix/ui.scm (define-diagnostic): New macro, which is based on the
  previous version of 'warning'.
  (warning, leave): Redefine using 'define-diagnostic'.
  (report-error): New macro.
  (install-locale): Use 'warning' instead of 'format'.
  (call-with-error-handling): Adjust 'leave'.
* gnu/packages.scm (package-files): Use 'warning' instead of 'format'.
* guix/gnu-maintenance.scm (http-fetch): Use 'warning' and 'leave'.
* guix/scripts/build.scm (derivations-from-package-expressions, guix-build):
  Adjust 'leave'.
* guix/scripts/download.scm (guix-download): Adjust 'leave'.
* guix/scripts/gc.scm (size->number, %options): Adjust 'leave'.
* guix/scripts/package.scm (roll-back, guix-package): Adjust 'leave'.
* po/POTFILES.in: Add 'guix/gnu-maintenance.scm'.
2013-04-21 08:08:40 +00:00
Ludovic Courtès 4c7cacf117 substitute-binary: Remove expired cache entries once in a while.
* guix/scripts/substitute-binary.scm (%narinfo-expired-cache-entry-removal-delay):
  New variable.
  (obsolete?): New procedure, formerly in `lookup-narinfo'.
  (lookup-narinfo): Adjust accordingly.
  (remove-expired-cached-narinfos, maybe-remove-expired-cached-narinfo):
  New procedures.
  (guix-substitute-binary): Call `maybe-remove-expired-cached-narinfo'.
2013-04-20 15:12:24 +02:00
Ludovic Courtès b52cb20d43 guix package: Allow the search of the latest release to be interrupted.
* guix/scripts/package.scm (%sigint-prompt): New variable.
  (call-with-sigint-handler): New procedure.
  (waiting): Use it.
2013-04-17 22:43:14 +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
Cyril Roelandt acb6ba2567 package: allow users to upgrade the whole system by not providing a regexp.
* guix/scripts/packages.scm (guix-package) [process-actions]: When upgrading,
use "" when REGEXP is #f.
* doc/guix.texi: update the documentation accordingly.
2013-04-16 23:12:29 +02:00
Ludovic Courtès e967678ed1 substitute-binary: Skip servers that use a different store prefix.
* guix/scripts/substitute-binary.scm (fetch-narinfo): Return #f when
  CACHE uses a store directory different from (%store-prefix).
2013-04-15 23:43:13 +02:00
Ludovic Courtès 0c357a088b substitute-binary: Call `open-cache' only when needed.
* guix/scripts/substitute-binary.scm (lookup-narinfo): Force CACHE when
  passing it to `fetch-narinfo'.
  (guix-substitute-binary): Delay calls to `open-cache'.
2013-04-15 23:43:10 +02:00
Ludovic Courtès eba783b7b2 substitute-binary: Add a local cache.
* guix/scripts/substitute-binary.scm (%narinfo-cache-directory,
  %narinfo-ttl, %narinfo-negative-ttl): New variables.
  (with-atomic-file-output, object->fields, read-narinfo,
  write-narinfo, narinfo->string, string->narinfo, lookup-narinfo): New
  procedures.
  (fetch-narinfo): Adjust to use `read-narinfo'.
  (guix-substitute-binary): Ensure the existence of
  %NARINFO-CACHE-DIRECTORY.  Use `lookup-narinfo' instead of
  `fetch-narinfo'.
2013-04-15 23:42:55 +02:00
Ludovic Courtès c31d1a7860 package: Being at the empty profile is not an error.
* guix/scripts/package.scm (roll-back): Use `format', not `leave' when
  indicating "already at the empty profile".  Fixes a regression
  introduced in a2011be5df.  Reported by
  Nikita Karetnikov <nikita@karetnikov.org>.
2013-04-12 18:07:17 +02:00
Ludovic Courtès 3b82460576 guix package: Add `--no-substitutes'.
* guix/scripts/package.scm (%default-options): Add `substitutes?'.
  (show-help, %options): Add and document `--no-substitutes'.
  (guix-package): Call `set-build-options' to honor `substitutes?'.
2013-04-12 17:31:05 +02:00
Ludovic Courtès fe0cff14f6 substitute-binary: Implement `--substitute'.
This allows build outputs to be transparently downloaded from
http://hydra.gnu.org, for example.

* config-daemon.ac: Check for `gzip', `bzip2', and `xz'.
* guix/config.scm.in (%gzip, %bzip2, %xz): New variable.
* guix/scripts/substitute-binary.scm (fetch): Return SIZE as a second value.
  (<narinfo>): Change `url' to `uri'.
  (make-narinfo): Rename to...
  (narinfo-maker): ... this.  Handle relative URLs.
  (fetch-narinfo): Adjust accordingly.
  (filtered-port, decompressed-port): New procedures.
  (guix-substitute-binary): Implement the `--substitute' case.
* tests/store.scm ("substitute query"): Use (%store-prefix) instead
  of (getenv "NIX_STORE_DIR").
  ("substitute"): New test.
2013-04-12 17:31:01 +02:00
Ludovic Courtès d7c5d27795 substitute-binary: Correctly handle missing narinfos in `--query' mode.
* guix/scripts/substitute-binary.scm (guix-substitute-binary)["--query"]("have",
  "info"): Filter SUBSTITUTABLE through `narinfo?'.
2013-04-12 17:30:47 +02:00
Ludovic Courtès a2011be5df ui: Add a `warning' macro.
* guix/ui.scm (program-name, guix-warning-port): New variables.
  (warning): New macro.
  (guix-main): Parametrize PROGRAM-NAME.
* guix/scripts/build.scm, guix/scripts/download.scm,
  guix/scripts/gc.scm, guix/scripts/package.scm: Adjust to use `leave'
  and `warning' consistently.
2013-04-11 22:30:06 +02:00
Ludovic Courtès 462f8e9f33 substitute-binary: Fix communication of several store paths to the daemon.
* guix/scripts/substitute-binary.scm (guix-substitute-binary)["--query"]:
  Emit blank lines only after the complete list of store paths has been
  returned.
2013-04-04 21:47:55 +02:00
Ludovic Courtès f65cf81a3c Add preliminary binary substituter.
* guix/scripts/substitute-binary.scm: New file.
* Makefile.am (MODULES): Add it.
* nix/scripts/substitute-binary.in: New file.
* config-daemon.ac: Produce nix/scripts/substitute-binary.
* daemon.am (nodist_pkglibexec_SCRIPTS): Add
  nix/scripts/substitute-binary.
* guix/store.scm (substitutable-path-info): Use the
  `query-substitutable-path-infos' RPC.
* nix/nix-daemon/guix-daemon.cc (main): Honor `NIX_SUBSTITUTERS'.
* pre-inst-env.in: Set `NIX_SUBSTITUTERS'.
* test-env.in: Leave `NIX_SUBSTITUTERS' unchanged.  Set
  `GUIX_BINARY_SUBSTITUTE_URL, and create
  $NIX_STATE_DIR/substituter-data.
  Run `guix-daemon' within `./pre-inst-env'.
* tests/store.scm ("substitute query"): New test.
2013-04-03 22:44:39 +02:00
Ludovic Courtès fdfd3d5d9c pull: Switch to the cgit URL.
* guix/scripts/pull.scm (%snapshot-url): Switch to the cgit URL, given
  that the Hydra one is not currently available.
2013-03-31 12:46:28 +02:00
Ludovic Courtès a4f08f9258 guix package: Report packages to be removed/installed.
* guix/scripts/package.scm (guix-package)[process-actions](show-what-to-remove/install):
  New procedure.
  Call it before `show-what-to-build'.
2013-03-18 23:04:07 +01:00
Ludovic Courtès 993fb66dd2 guix package: Gracefully handle `official-gnu-packages' failure.
* guix/gnu-maintenance.scm (http-fetch): Error out when DATA is #f.
* guix/scripts/package.scm (check-package-freshness): Wrap
  `gnu-package?' call in `false-if-exception'.
  Reported by Cyril Roelandt <tipecaml@gmail.com>.
2013-03-16 00:59:19 +01:00
Ludovic Courtès ef86c39f27 ui: Gracefully report failures to connect to the daemon.
* guix/store.scm (&nix-connection-error): New condition type.
  (open-connection): Translate `system-error' during the `connect' call
  into `&nix-connection-error'.
* guix/ui.scm (call-with-error-handling): Add case for `nix-connection-error?'.
* guix/scripts/package.scm (guix-package): Move `open-connection' call
  within `with-error-handling'.
* guix/scripts/pull.scm (guix-pull): Likewise.
* guix/scripts/download.scm (guix-download): Move body within
  `with-error-handling'.
2013-03-07 19:44:14 +01:00
Ludovic Courtès 19777ae6ea guix package: Recover from freshness check transient errors.
* guix/scripts/package.scm (check-package-freshness): Ignore
  `getaddrinfo-error' and `ftp-error' exceptions.
2013-03-05 22:24:19 +01:00
Ludovic Courtès ef010c0f3d guix package: Inform about new upstream versions of GNU packages.
* guix/gnu-maintenance.scm (gnu-package?): New procedure.
* guix/scripts/package.scm (waiting): New macro.
  (check-package-freshness): New procedure.
  (guix-package)[process-actions]: Use it.
* doc/guix.texi (Invoking guix package): Mention the feature.
2013-03-05 20:35:47 +01:00
Ludovic Courtès eb0880e71d ui: Factorize `read/eval-package-expression'.
* guix/scripts/package.scm (read/eval-package-expression): Move to...
* guix/ui.scm (read/eval-package-expression): ... here.
* guix/scripts/build.scm (derivations-from-package-expressions): Use it.
2013-03-01 21:55:42 +01:00
Ludovic Courtès 5d4b411f8a guix package: Add `--install-from-expression'.
* guix/scripts/package.scm (read/eval-package-expression): New
  procedure.
  (show-help): Add `-e'.
  (%options): Likewise.
  (guix-package)[process-actions]: Handle ('install . p) pairs, where P
  is a package.
* tests/guix-package.sh: Add `boot_make_drv'.  Use `-i $boot_make_drv'
  once, and then use `-e $boot_make'.
* doc/guix.texi (Invoking guix package): Document `-e'.
2013-03-01 21:54:56 +01:00
Ludovic Courtès ba8b732d20 guix gc: Add `--references' and `--referrers'.
* guix/scripts/gc.scm (show-help): Update.
  (%options): Add `--references' and `--referrers'.
  (guix-gc)[symlink-target, store-directory]: New procedures.
  Handle the `list-references' and `list-referrers' actions.
* tests/guix-gc.sh: Add tests for `--references'.
* doc/guix.texi (Invoking guix gc): Document `--references' and
  `--referrers'.
2013-02-27 23:16:00 +01:00
Ludovic Courtès 4d60610ad7 pull: Distinguish "already up to date" from "updated".
* guix/ui.scm (show-what-to-build): Return (length req*).
* guix/scripts/pull.scm (guix-pull): Print an "already up to date"
  message when there's nothing to build.
2013-02-22 21:08:06 +01:00
Ludovic Courtès 7b50c68455 pull: Build (guix build download) first, because of the (gnutls) autoload.
* guix/scripts/pull.scm (unpack): Build (guix build download) first, as
  done in 855a8ad71d.
  Reported by Andreas Enge <andreas@enge.fr>.
2013-02-22 20:01:29 +01:00
Ludovic Courtès f651b477b7 Add "guix pull".
* guix/scripts/pull.scm: New file.
* Makefile.am (MODULES): Add it.
* doc/guix.texi (Invoking guix pull): New node.
  (Invoking guix package): Add cross-ref to it.
* guix/ui.scm (config-directory): New procedure.
* scripts/guix.in: When `GUIX_UNINSTALLED' is undefined, add
  $XDG_CONFIG_HOME/guix/latest to the search path.
* po/POTFILES.in: Add guix/scripts/pull.scm.
2013-02-20 23:47:16 +01:00
Ludovic Courtès 9bb2b96aab ui: Factorize `show-what-to-build'.
* guix/scripts/package.scm (guix-package)[show-what-to-build]: Move to..
* guix/ui.scm (show-what-to-build): ... here.  Add a `store'
  parameter'.  Adjust callers.
* guix/scripts/build.scm (guix-build): Use it.  Remove `req' and `req*'
  variables.
2013-02-20 23:46:57 +01:00
Ludovic Courtès c61b026e3a ui: Add temporary file handling and atomic symlink switch.
* guix/scripts/download.scm (call-with-temporary-output-file): Move to
  ui.scm.
* guix/scripts/package.scm (switch-symlinks): Likewise.
* guix/ui.scm (call-with-temporary-output-file, switch-symlinks): New
  procedures.
2013-02-20 23:03:24 +01:00
Ludovic Courtès fdca1c079b scripts: Remove hyphen in the command name shown by `--version'.
* guix/scripts/build.scm (%options): Remove hyphen from the name passed
  to `show-version-and-exit'.
* guix/scripts/download.scm (%options): Likewise.
* guix/scripts/gc.scm (%options): Likewise.
* guix/scripts/import.scm (%options): Likewise.
* guix/scripts/package.scm (%options): Likewise.
2013-02-17 22:19:32 +01:00
Ludovic Courtès 633f045f62 scripts: Remove initialization now redundant with `initialize-guix'.
* guix/scripts/build.scm (guix-build): Remove calls to `install-locale',
  `textdomain', etc., now redundant with `initialize-guix'.
* guix/scripts/download.scm (guix-download): Likewise.
* guix/scripts/import.scm (guix-import): Likewise.
* guix/scripts/package.scm (guix-package): Likewise.
* guix/ui.scm: Remove export of `install-locale' and `initialize-guix'.
  (initialize-guix): Add docstring.
2013-02-17 15:38:02 +01:00
Mark H Weaver e49951eb3e Replace individual scripts with master 'guix' script.
* scripts/guix.in: New script.

* Makefile.am (bin_SCRIPTS): Add 'scripts/guix'.  Remove 'guix-build',
  'guix-download', 'guix-import', 'guix-package', and 'guix-gc'.

  (MODULES): Add 'guix/scripts/build.scm', 'guix/scripts/download.scm',
  'guix/scripts/import.scm', 'guix/scripts/package.scm', and
  'guix/scripts/gc.scm'.

* configure.ac (AC_CONFIG_FILES): Add 'scripts/guix'.  Remove 'guix-build',
  'guix-download', 'guix-import', 'guix-package', and 'guix-gc'.

* guix-build.in, guix-download.in, guix-gc.in, guix-import.in,
  guix-package.in: Remove shell script boilerplate.  Move to guix-COMMAND.in
  to guix/scripts/COMMAND.scm.  Rename module from (guix-COMMAND) to
  (guix scripts COMMAND).  Change "guix-COMMAND" to "guix COMMAND" in
  usage help string.

* pre-inst-env.in: Add "@abs_top_builddir@/scripts" to the front of $PATH.
  Export $GUIX_UNINSTALLED.

* tests/guix-build.sh, tests/guix-daemon.sh, tests/guix-download.sh,
  tests/guix-gc.sh, tests/guix-package.sh: Use "guix COMMAND" instead of
  "guix-COMMAND".

* doc/guix.texi: Replace all occurrences of "guix-COMMAND" with
  "guix COMMAND".

* po/POTFILES.in: Update.
2013-02-16 22:17:37 -05:00