Commit Graph

351 Commits (e0fbbc889d724678e9e310432ad3a3fb8345cf9a)

Author SHA1 Message Date
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 8e77f41ede packages: Work around compiler bug in Guile 2.0.5.
* guix/packages.scm (package-field-location): Work around compiler bug
  in 2.0.5.  Reported by Andreas Enge <andreas@enge.fr>.
2013-04-27 23:02:06 +02:00
Ludovic Courtès 89be37a5a3 web: Add workaround for <http://bugs.gnu.org/13095>.
* guix/web.scm: Add workaround for <http://bugs.gnu.org/13095>.
2013-04-27 23:00:51 +02:00
Ludovic Courtès 61ef22f432 web: Add 2.0.5 workaround for responses without content-length.
* guix/web.scm (read-response-body*)[when-guile<=2.0.5]: Support
  responses without content-length.
  Reported by Andreas Enge <andreas@enge.fr>.
2013-04-27 23:00:21 +02:00
Ludovic Courtès c4ca12c15b gnu-maintenance: Fix error message of `update-package-source'.
* guix/gnu-maintenance.scm (update-package-source): In the (not loc)
  case, pass the location first and convert it to a string.
2013-04-27 22:52:43 +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 14e2afa74b ui: Use consistent spacing in `show-what-to-build' messages.
* guix/ui.scm (show-what-to-build): Use consistent spacing in "the
  following..." messages.
2013-04-27 16:37:09 +02:00
Ludovic Courtès 049b2f1d7b gnu-maintenance: Fix `latest-release' for GnuPG.
* guix/gnu-maintenance.scm (latest-release): Filter out directories
  whose name does not contain digits early in the process.  This fixes
  (latest-release "gnupg").
2013-04-27 16:26:48 +02:00
Ludovic Courtès 87dfd45594 ftp-client: `ftp-chdir' changes one step at a time.
* guix/ftp-client.scm (%char-set:not-slash): New variable.
  (ftp-chdir): Add docstring.  Change to DIR one step at a time.
  (ftp-retr): Fix indentation.
2013-04-27 16:25:54 +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 1424a96e25 web: Backport chunked encoding support for Guile <= 2.0.5.
* guix/web.scm (when-guile<=2.0.5): New macro.
  (read-chunk-header, read-chunk, read-chunk-body,
  make-chunked-input-port, read-response-body*)[when-guile<=2.0.5]: New
  procedures.
  (http-fetch): Clarify message when (not data).
2013-04-27 11:37:31 +02:00
Ludovic Courtès dfb43e45b5 gnu-maintenance: Add newline in warning messages.
* guix/gnu-maintenance.scm (download-tarball): Add newline in warning
  messages.
2013-04-25 23:07:24 +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 65b96a0c10 gnu-maintenance: Optimize `gnu-package?'.
* guix/gnu-maintenance.scm (gnu-package?): Capture a memoizing version
  of `gnu-package?'.
2013-04-25 00:13:56 +02:00
Ludovic Courtès d55a99fed3 gnu-maintenance: Optimize `release-file'.
* guix/gnu-maintenance.scm (tarball-regexp): Remove.
  (%tarball-rx): New variable.
  (release-file): Adjust to use %TARBALL-RX.
2013-04-25 00:13:56 +02:00
Ludovic Courtès cac137aa84 gnu-maintenance: Optimize `latest-release'.
* guix/gnu-maintenance.scm (tarball-regexp, sans-extension,
  release-file): New procedures.
  (%alpha-tarball-rx): New variable.
  (releases): Use them instead of local copies.
  (latest-release): Rewrite to not do a recursive search of all
  versions and instead jump directly to the latest.
2013-04-25 00:13:56 +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 f903dc056a packages: Use `read' and source properties for `package-field-location'.
* guix/packages.scm (package-field-location): Rewrite using `read' and
  source properties.  Change to return #f upon failure.
* tests/packages.scm ("package-field-location"): Check for #f upon failure.
* build-aux/sync-synopses.scm: Adjust accordingly.
2013-04-25 00:13:56 +02:00
Ludovic Courtès 5fe21fbeef utils: Fix column number returned by `source-properties->location'.
* guix/utils.scm (source-properties->location): Use COL, not COL + 1.
2013-04-25 00:13:56 +02:00
Ludovic Courtès d66c70967f packages: Add `package-field-location'.
* guix/packages.scm (package-field-location): New procedure.
* build-aux/sync-synopses.scm: Use it instead of `package-location'.
* tests/packages.scm ("package-field-location"): New test.
2013-04-22 23:07:13 +02:00
Ludovic Courtès b2a886f6c7 ui: Move macro definitions before any use.
* guix/ui.scm (define-diagnostic, warning, report-error, leave): Move
  definitions before any use.  Reported by Nikita Karetnikov.
  (install-locale): Move back close to `initialize-guix'.
2013-04-22 13:24:39 +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
Ludovic Courtès 238328c990 ui: Move definition of `install-locale' after that of the `warning' macro.
* guix/ui.scm (install-locale): Move definition after that of `warning'.
2013-04-21 11:53:06 +02: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 f286f71634 snix: Prefer synopses from the Womb rather than from Nixpkgs.
* guix/snix.scm (snix-derivation->guix-package): When NAME is
  in (official-gnu-packages), use this synopsis instead of the one from
  Nixpkgs.
2013-04-20 11:52:50 +02:00
Ludovic Courtès 0ff3e3aa9b daemon: Gracefully handle cases where the daemon does not return a status code.
* guix/store.scm (process-stderr): Check for EOF before doing (read-int p).
2013-04-20 10:53:31 +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 801486fe46 ui: Fix format string in `warning'.
* guix/ui.scm (warning)[augmented-format-string]: Add missing ~*.
2013-04-17 18:02:48 +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 04fd96cac3 utils: Add `fold2'.
* gnu/packages.scm (fold2): Remove.
* guix/utils.scm (fold2): New procedure.  Generalization of the above to
  one and two lists.
* tests/utils.scm ("fold2, 1 list", "fold2, 2 lists"): New tests.
2013-04-14 16:56:08 +02:00
Ludovic Courtès 9adb6934f4 store: Remove unneeded and conflicting import.
* guix/store.scm: Remove unneeded (ice-9 rdelim) import.  In Guile 2.0.9
  that module exports `read-string', which conflicts with that of (guix
  serialization).
2013-04-12 18:22:41 +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 8f3114b7a4 nar: Add support for symlinks.
* guix/nar.scm (write-file): Add case for type `symlink'.
  (restore-file): Likewise.
* tests/nar.scm (random-file-size, make-file-tree, delete-file-tree,
  with-file-tree, file-tree-equal?, make-random-bytevector,
  populate-file): New procedures.
  (%test-dir): New variable.
  ("write-file + restore-file"): Use `%test-dir' and `file-tree-equal?'.
  ("write-file + restore-file with symlinks"): New test.
2013-04-12 14:42:56 +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 53c63ee937 nar: Implement restoration from Nar.
* guix/nar.scm (&nar-error, &nar-read-error): New condition types.
  (dump): New procedure.
  (write-contents)[dump]: Remove.  Use the one above instead.
  (read-contents, write-file, restore-file): New procedures.
  (%archive-version-1): New variable.
2013-04-08 23:21:38 +02:00
Ludovic Courtès 0f41c26f9b Add (guix nar) and (guix serialization).
* guix/store.scm (write-int, read-int, write-long-long, read-long-long,
  write-padding, write-string, read-string, read-latin1-string,
  write-string-list, read-string-list, write-store-path,
  read-store-path, write-store-path-list, read-store-path-list): Move to
  serialization.scm.
  (write-contents, write-file): Move to nar.scm.
* guix/nar.scm, guix/serialization.scm: New files.
* Makefile.am (MODULES): Add them.
2013-04-04 22:29:08 +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 2c6ab6ccd4 store: Add `store-path-hash-part'.
* guix/store.scm (store-path-hash-part): New procedure.
* tests/store.scm ("store-path-hash-part", "store-path-hash-part #f"):
  New tests.
2013-04-01 17:35:27 +02:00