Commit Graph

75 Commits

Author SHA1 Message Date
Ludovic Courtès 2c74fde00e Rename 'guix substitute-binary' to 'guix substitute'.
* guix/scripts/substitute-binary.scm: Rename to...
* guix/scripts/substitute.scm: ... this.  Adjust module name, entry
  point, comments, and help string accordingly.
* nix/scripts/substitute-binary.in: Rename to...
* nix/scripts/substitute.in: ... this.
* pre-inst-env.in (NIX_SUBSTITUTERS): Adjust accordingly.
* tests/substitute-binary.scm: Rename to...
* tests/substitute.scm: ... this.  Adjust references to (guix scripts
  substitute) accordingly.
* guix/ui.scm (show-guix-help)[internal?]: Change "substitute-binary" to
  "substitute".
* Makefile.am (MODULES, SCM_TESTS): Adjust to file renames.
* daemon.am (nodist_pkglibexec_SCRIPTS): Likewise.
* config-daemon.ac: Likewise.
* guix/tests.scm (call-with-derivation-narinfo): Adjust comments and
  docstring.
2015-03-25 10:46:22 +01:00
Ludovic Courtès e9c1e22f04 ui: Add missing copyright line.
* guix/ui.scm: Add copyright line for Deck (aka. nebuli).
2015-02-26 00:04:36 +01:00
Ludovic Courtès cf6ce3e6ef ui: Honor --no-* options passed via $GUIX_BUILD_OPTIONS.
Reported by Alex Kost <alezost@gmail.com>
at <http://lists.gnu.org/archive/html/guix-devel/2015-02/msg00702.html>.

* guix/ui.scm (parse-command-line)[parse-options-from]: Add 'seeds'
  parameter.
  Thread the result of the first 'parse-options-from' call to the
  second.
2015-02-26 00:04:36 +01:00
Ludovic Courtès b3f213893b ui: Factorize command-line + env. var. option parsing.
* guix/ui.scm (%default-argument-handler, parse-command-line): New
  procedures.
  (environment-build-options): Make private.
* guix/scripts/archive.scm (guix-archive)[parse-options,
  parse-options-from]: Remove.  Use 'parse-command-line' instead.
* guix/scripts/build.scm (guix-build): Likewise.
* guix/scripts/environment.scm (guix-environment): Likewise.
* guix/scripts/package.scm (guix-package): Likewise.
* guix/scripts/system.scm (guix-system): Likewise.
* tests/ui.scm (with-environment-variable): New macro.
  ("parse-command-line"): New test.
2015-02-26 00:04:36 +01:00
Ludovic Courtès 46b23e1a43 profiles: Distinguish downgrades from upgrades.
Fixes <http://bugs.gnu.org/19764>.

* guix/profiles.scm (manifest-transaction-effects): Return downgraded
  packages as a fourth value.
* guix/ui.scm (show-manifest-transaction): Adjust accordingly.
* tests/profiles.scm ("manifest-transaction-effects and downgrades"):
  New test.
2015-02-08 19:00:39 +01:00
Ludovic Courtès b7071bc5bb ui: Properly report '&nar-error' conditions.
This is a followup to 46b8aad.

* guix/ui.scm (call-with-error-handling): Add 'nar-error?' case.
2015-02-08 19:00:39 +01:00
Ludovic Courtès 9250b30466 ui: Update copyright year in '--version' output.
* guix/ui.scm (show-version-and-exit): Increment copyright year.
2015-01-28 21:32:58 +01:00
Ludovic Courtès f304c9c237 derivations: Raise an error for references to non-existent outputs.
Fixes <http://bugs.gnu.org/19630>.
Reported by Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>.

* guix/derivations.scm (&derivation-error,
  &derivation-missing-output-error): New error conditions.
  (derivation->output-path): Raise a '&derivation-missing-output-error'
  if OUTPUT is not an output of DRV.
* guix/ui.scm (call-with-error-handling): Add case for
  'derivation-missing-output-error?'.
  (show-what-to-build): Check whether (derivation-outputs drv) is
  empty.
* tests/packages.scm ("reference to non-existent output"): Add test.
2015-01-24 22:57:49 +01:00
Ludovic Courtès 70e629f548 guix system: Improve error messages.
* guix/ui.scm (report-error): Export.
* guix/scripts/system.scm (read-operating-system): Report syntax errors
  using standard GNU format.  Report other errors using 'display-error'.
2015-01-22 22:43:46 +01:00
Ludovic Courtès e9651e39b3 derivations: Add 'substitution-oracle' and use it.
This makes 'guix environment PACKAGE' significantly faster when
substitutes are enabled.  Before that, it would lead to many invocations
of 'guix substitute-binary', one per 'derivation-prerequisites-to-build'
call.  Now, all these are replaced by a single invocation.

* guix/derivations.scm (derivation-output-paths, substitution-oracle):
  New procedures.
  (derivation-prerequisites-to-build): Replace #:use-substitutes? with
  #:substitutable?.  Remove the local 'derivation-output-paths' and
  'substitutable?'.
* guix/ui.scm (show-what-to-build): Add 'substitutable?'.  Pass it to
  'derivation-prerequisites-to-build'.
  [built-or-substitutable?]: Use it instead of 'has-substitutes?'.
* tests/derivations.scm ("derivation-prerequisites-to-build and
  substitutes"): Use #:substitutable? instead of #:use-substitutes?.
2015-01-10 00:39:59 +01:00
nebuli 16eb115ef4 guix: scripts: Add GUIX_BUILD_OPTIONS environment handling.
* doc/guix.texi (Invoking guix build): Mention 'GUIX_BUILD_OPTIONS'.
* guix/scripts/archive.scm: (append args (environment-build-options)).
* guix/scripts/build.scm: Ditto.
* guix/scripts/environment.scm: Ditto.
* guix/scripts/package.scm: Ditto.
* guix/scripts/system.scm: Ditto.
* guix/ui.scm (environment-build-options): New function.
* guix/utils.scm (arguments-from-environment-variable): New function.
* tests/guix-build.sh: Add tests.
* test-env.in: Unset GUIX_BUILD_OPTIONS.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2014-11-30 18:54:07 +01:00
Alex Kost c0c018f180 profiles: Add condition types for profiles and generations.
Suggested by Ludovic Courtès.

* guix/profiles.scm (&profile-error, &profile-not-found-error,
  &missing-generation-error): New condition types.
* guix/ui.scm (call-with-error-handling): Handle new types.
* guix/scripts/package.scm (roll-back, guix-package): Raise
  '&profile-not-found-error' where needed.
2014-10-12 08:45:37 +04:00
Alex Kost 5d7a8584f5 ui: Move 'show-manifest-transaction' from (guix profiles).
* guix/profiles.scm: Do not use (guix ui) module.
  (right-arrow, manifest-show-transaction): Move and rename to...
* guix/ui.scm (right-arrow, show-manifest-transaction): ... here.
* tests/profiles.scm ("manifest-show-transaction"): Move to...
* tests/ui.scm ("show-manifest-transaction"): ... here.
  (guile-1.8.8, guile-2.0.9): New variables.
* emacs/guix-main.scm (process-package-actions): Rename
  'manifest-show-transaction' to 'show-manifest-transaction'.
* guix/scripts/package.scm (guix-package): Likewise.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2014-10-10 00:06:35 +02:00
Ludovic Courtès 12703d0854 ui: Make sure we use the right domain for &message translation.
* guix/ui.scm (call-with-error-handling): Add %GETTEXT-DOMAIN as a
  second argument to 'gettext'.
2014-10-09 23:51:19 +02:00
Ludovic Courtès 4a44d7bbc6 ui: Recognize the same size units as Coreutils.
* guix/ui.scm (size->number): Add a bunch of large units.  Recognize
  one-letter unit names.  Change "KB" to "kB".
* tests/ui.scm ("size->number, 1T"): New test.
* doc/guix.texi (Invoking guix gc): Add cross-reference to "Block size"
  in the Coreutils manual.
  (Invoking guix system): Likewise.
2014-10-03 18:03:09 +02:00
Ludovic Courtès 5975881687 pull: Create ~/.config/guix if needed instead of bailing out gracelessly.
Previously 'guix pull' would just fail with "No such file or directory"
if ~/.config didn't already exist.

* guix/ui.scm (config-directory): Use 'mkdir-p' instead of 'mkdir'.
  Change the 'catch' handler to expect errors different from EEXIST.
2014-09-14 23:49:02 +02:00
Cyrill Schenkel 3a09e1d2e8 ui: Fix handling of periods by fill-paragraph.
Fixes <http://bugs.gnu.org/17468>.

* guix/ui.scm (fill-paragraph): Two spaces after period and no spaces before newline.
* tests/ui.scm: New test case.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2014-08-11 18:27:03 +02:00
Eric Bavier 5e6feee617 guix: package: Fix recutils output for non-package inputs.
* guix/ui.scm (package->recutils)[dependencies]: Ignore non-package inputs.
* tests/guix-package.sh: New test.
2014-07-25 07:41:57 -05:00
Ludovic Courtès 20ffce820b ui: Improve formatting of package dependencies in recutils.
* guix/ui.scm (package->recutils)[dependencies->recutils]: New
  procedure. Use it.
2014-07-25 00:29:47 +02:00
Cyril Roelandt 9c0fc27968 ui: add the "dependencies" field to package->recutils:
* guix/ui.scm (package->recutils): Print the dependencies of the package.
2014-07-21 22:17:59 +02:00
Ludovic Courtès 07254feb24 ui: Avoid circularity with (guix gexp).
Fixes a regression introduced in 56b8210 ("guix build: Allow gexps to be
passed to '-e'.")

* guix/ui.scm (%guix-user-module): Wrap in 'delay'.
  (read/eval): Adjust accordingly.
2014-06-14 23:23:56 +02:00
Ludovic Courtès 56b8210697 guix build: Allow gexps to be passed to '-e'.
* guix/ui.scm (%guix-user-module): New variable.
  (read/eval): Pass it as the second argument to 'eval'.
* guix/scripts/build.scm (options/resolve-packages): Add case for
  'gexp?'.
* tests/guix-build.sh: Add tests.
* doc/guix.texi (Invoking guix build): Document '-e gexp'.
guxi build: Allow gexps to be passed to '-e'.

* guix/ui.scm (%guix-user-module): New variable.
  (read/eval): Pass it as the second argument to 'eval'.
* guix/scripts/build.scm (options/resolve-packages): Add case for
  'gexp?'.
* tests/guix-build.sh: Add tests.
* doc/guix.texi (Invoking guix build): Document '-e gexp'.
2014-06-14 22:55:59 +02:00
Ludovic Courtès ee76417972 Separate package description translations from string translations.
* po/packages/LINGUAS, po/packages/Makevars, po/packages/POTFILES.in:
  New files.
* po/guix/Makevars (DOMAIN): Change to "guix".
  (XGETTEXT_OPTIONS): Remove "--keyword=synopsis --keyword=description".
* po/guix/POTFILES.in: Remove gnu/packages/*.scm.
* configure.ac: Change to gettext 0.18.3.  Produce
  po/packages/Makefile.in.
* Makefile.am (SUBDIRS): Add po/packages.
* guix/ui.scm (%package-text-domain): New variable.
  (P_): New procedure.
  (package->recutils): Use 'P_' instead of '_'.
* guix/scripts/package.scm (find-packages-by-description): Use 'P_'
  instead of 'gettext'.
2014-06-13 17:30:40 +02:00
Ludovic Courtès 52ddf2ae6f ui: Gracefully deal with zero-output derivations.
* guix/ui.scm (show-what-to-build)[built-or-substitutable?]: New
  procedure.  Check whether OUT is #f.
  Use it.
* tests/ui.scm ("show-what-to-build, zero outputs"): New test.
2014-05-19 23:52:40 +02:00
Ludovic Courtès ada3df03e3 monads: Hide 'derivation-expression' and 'lower-inputs'.
* guix/monads.scm: Unexport 'lower-inputs' and 'derivation-expression'.
  (text-file*): Add comment about the switch to 'gexp->derivation'.
  (lower-inputs): Add comment about its doom.
  (derivation-expression): Likewise.
* guix/gexp.scm (lower-inputs*): Rename to...
  (lower-inputs): ... this.  Update callers.
* tests/monads.scm (derivation-expression): New procedure.
* doc/guix.texi (The Store Monad): Use 'gexp->derivation' instead of
  'derivation-expression'.  Remove documentation of
  'derivation-expression'.
* guix/ui.scm (read/eval): Use THE-ROOT-MODULE so that macros are
  properly expanded.
* tests/guix-build.sh: Use 'gexp->derivation' instead of
  'derivation-expression'.monads: Hide 'derivation-expression' and 'lower-inputs'.
2014-04-28 23:41:12 +02:00
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 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
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 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 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 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 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 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 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 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 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
Nikita Karetnikov 2cd09108c9 guix package: Add '--list-generations'.
* guix/scripts/package.scm: Import (srfi srfi-19).
  (generation-time, matching-generations): New functions.
  (show-help): Add '--list-generations'.
  (%options): Likewise.
  (guix-package)[process-query]: Add support for '--list-generations'.
* guix/ui.scm: Import (srfi srfi-19) and (ice-9 regex).
  (string->generations, string->duration): New functions.
* tests/guix-package.sh: Test '--list-generations'.
* tests/ui.scm: Import (srfi srfi-19).
  Test 'string->generations' and 'string->duration'.
* doc/guix.texi (Invoking guix-package): Document '--list-generations'.
2013-09-19 11:22:31 +00:00
Ludovic Courtès 59688fc4b5 derivations: 'derivation' and related procedures return a single value.
* guix/derivations.scm (derivation->output-path,
  derivation->output-paths): New procedures.
  (derivation-path->output-path): Use 'derivation->output-path'.
  (derivation-path->output-paths): Use 'derivation->output-paths'.
  (derivation): Accept 'derivation?' objects as inputs.  Return a single
  value.
  (build-derivations): New procedure.
  (compiled-modules): Use 'derivation->output-paths'.
  (build-expression->derivation)[source-path]: Add case for when the
  input matches 'derivation?'.
  [prologue]: Accept 'derivation?' objects in INPUTS.
  [mod-dir, go-dir]: Use 'derivation->output-path'.
* guix/download.scm (url-fetch): Adjust to the single-value return.
* guix/packages.scm (package-output): Use 'derivation->output-path'.
* guix/scripts/build.scm (guix-build): When the argument is
  'derivation-path?', pass it through 'read-derivation'.
  Use 'derivation-file-name' to print out the .drv file names, and to
  register them.  Use 'derivation->output-path' instead of
  'derivation-path->output-path'.
* guix/scripts/package.scm (roll-back): Adjust to the single-value
  return.
  (guix-package): Use 'derivation->output-path'.
* guix/ui.scm (show-what-to-build): Adjust to deal with 'derivation?'
  objects instead of .drv file names.
* gnu/system/grub.scm (grub-configuration-file): Use
  'derivation->output-path' instead of 'derivation-path->output-path'.
* gnu/system/vm.scm (qemu-image, system-qemu-image): Likewise.
* tests/builders.scm, tests/derivations.scm, tests/packages.scm,
  tests/store.scm, tests/union.scm: Adjust to the new calling
  convention.
* doc/guix.texi (Defining Packages, The Store, Derivations): Adjust
  accordingly.
2013-09-18 18:49:53 +02:00
Ludovic Courtès 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
Cyril Roelandt e12b3eb93e Make "guix -h" work as "guix --help".
* guix/ui.scm (guix-main): have the same behaviour for the "-h" and "--help"
  options.
2013-08-15 21:03:32 +02:00
Ludovic Courtès e14c39291b ui: Ignore SIGPIPE and catch `system-error' exceptions.
* guix/ui.scm (initialize-guix): Call `sigaction'.
  (call-with-error-handling): Wrap `thunk' in a (catch 'system-error ...).
2013-07-12 23:01:18 +02:00
Ludovic Courtès 1a8b783470 ui: Don't make substituter-related RPCs at all when substitutes are disabled.
Reported by Nikita Karetnikov and Cyril Roelandt.

* guix/ui.scm (show-what-to-build): Call `substitutable-path-info'
  only when USE-SUBSTITUTES? is true.
2013-07-01 00:30:44 +02:00
Ludovic Courtès 89d02b98f9 ui: define-diagnostic: Don't mark `_' and `N_' as literals.
* guix/ui.scm (define-diagnostic): Use `free-identifier=?' to compare
  the user's input with `_' and `N-".  This should fix builds with Guile 2.1.
  Reported by Cojocaru Alexandru <xojoc@gmx.com>.
2013-05-30 00:49:34 +02:00
Ludovic Courtès 9b222abe03 packages: Raise an error condition a cross builder is needed but unavailable.
* guix/packages.scm (&package-cross-build-system-error): New condition type.
  (package-cross-derivation): Raise &package-cross-build-system-error
  when the build system doesn't support cross builds.
* guix/ui.scm (call-with-error-handling): Add
  package-cross-build-system-error? case.
* tests/packages.scm ("package-cross-derivation, no cross builder"): New test.
2013-05-27 23:43:00 +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 b30b13dc3d Sort commands alphabetically in "guix --help".
* guix/ui.scm (show-guix-help): Sort commands.
2013-05-14 13:37:53 +02:00
Ludovic Courtès 2b8cf44fd9 Fix "guix --help" on Guile 2.0.5.
Reported at <http://linuxfr.org/news/sortie-de-gnu-guix-0-2>.

* guix/ui.scm (command-files): Filter the result of `scandir' to make
  sure only `.scm' files are present.
2013-05-14 13:37:21 +02:00
Ludovic Courtès 25c936766e ui: Invite users to try `--help' in the error message.
* guix/ui.scm (show-guix-usage): Mention `guix --help'.
  Suggested by Mark H. Weaver.
  (run-guix-command): Invoke it when a command is not found.
  (guix-main): Adjust accordingly.
2013-05-10 23:14:26 +02:00
Ludovic Courtès e31ff8b8d0 ui: Implement `guix --help'.
* guix/ui.scm (command-files, commands, show-guix-help): New procedures.
  (guix-main): Invoke `show-guix-help' when passed `--help'.
2013-05-10 12:33:18 +02:00
Ludovic Courtès ec5d0a85eb ui: Gracefully report "command not found" errors.
* guix/ui.scm (run-guix-command): Can `resolve-interface' errors and
  report them with `leave'.  Parameterize `program-name' from here.
  (guix-main): Remove parameterization of `program-name'.
2013-05-10 12:14:01 +02:00