Commit Graph

653 Commits

Author SHA1 Message Date
Ludovic Courtès 6237b9fa39 edit: Honor $VISUAL.
Suggested by Andreas Enge <andreas@enge.fr>.

* guix/scripts/edit.scm (%editor): Honor 'VISUAL' before 'EDITOR'.
  (show-help): Adjust accordingly.
* doc/guix.texi (Invoking guix edit): Likewise.
2015-11-11 23:29:20 +01:00
Ludovic Courtès 14649b8cdb refresh: Avoid non-literal format string.
Reported by Mathieu Lirzin <mthl@gnu.org>.

* guix/scripts/refresh.scm (guix-refresh): Rewrite 'list-dependent?'
  report to avoid nested 'N_' calls.
2015-11-11 22:10:21 +01:00
Ludovic Courtès fc2d233964 guix package: '--search-paths' can report combined search paths.
Partly fixes <http://bugs.gnu.org/20255>.

* guix/scripts/package.scm (search-path-environment-variables): Change
  'profile' to 'profiles'; expect it to be a list.
  (display-search-paths): Likewise.
  (%default-options): Remove 'profile' entry.
  (%options) <--profile>: Keep previous values associated with 'profile'
  in RESULT.
  (guix-package)[process-actions, process-query]: Handle the possible
  lack of 'profile' pair in OPTS.
2015-11-11 00:37:50 +01:00
Ludovic Courtès b68d2dbf08 refresh: Discard PyPI updater when Guile-JSON is missing.
Reported by Sleep_Walker and Mathieu Lirzin <mthl@gnu.org>.

* guix/scripts/refresh.scm (maybe-updater, list-updaters): New macros.
  (%updaters): Use 'list-updaters' instead of 'list'.  Make
  %PYPI-UPDATER conditional.
2015-11-08 22:21:19 +01:00
Ludovic Courtès 650f1615de edit: Improve error reporting when $EDITOR is not found.
Reported by Benno Evers <benno@bmevers.de>
at <https://lists.gnu.org/archive/html/guix-devel/2015-11/msg00125.html>.

* guix/scripts/edit.scm (guix-edit): Wrap 'execl' call in 'catch'.
  Provide more meaningful error message.
2015-11-05 12:04:26 +01:00
Ludovic Courtès 67c920fa5d edit: Lift helper procedure.
* guix/scripts/edit.scm (package->location-specification): New
  procedure, with code formerly...
  (guix-edit): ... here.  Use it.
2015-11-05 12:01:26 +01:00
Ludovic Courtès 5453de3dd8 import: hackage: Fix invalid use of 'leave'.
Reported by Paul van der Walt <paul@denknerd.org>
in <http://bugs.gnu.org/21829>.

* guix/scripts/import/hackage.scm (guix-import-hackage): Add missing
  argument in call to 'leave'.
2015-11-04 23:54:12 +01:00
David Thompson d431b23240 scripts: container: Fix 'exec' command line parsing.
* guix/scripts/container/exec.scm (partition-args): Reimplement such
  that all args up to and including the PID are returned as the first of
  the two values.
2015-11-03 18:05:43 -05:00
Cyril Roelandt bab020d7ca import: pypi: add updater
* guix/import/pypi.scm (guix-package->pypi-name,
  latest-release): New procedures.
  (%pypi-updater): New variable.
* guix/scripts/refresh.scm (%updaters): Add %PYPI-UPDATER.
* doc/guix.texi (Invoking guix refresh): Mention PyPI
2015-11-03 23:41:25 +01:00
David Thompson 00bfa7ea25 scripts: environment: Display friendly container error messages.
* guix/scripts/environment.scm (assert-container-features): New
  procedure.
  (guix-environment): Use it.
2015-11-03 11:41:04 -05:00
Ludovic Courtès a70436183a guix system: Always build grub.cfg for 'init' and 'reconfigure'.
Fixes <http://bugs.gnu.org/21068>.
Reported by Germano Gabbianelli <tyrion.mx@gmail.com>
and Mark H Weaver <mhw@netris.org>.

* guix/scripts/system.scm (perform-action): Always add GRUB.CFG to DRVS
  for 'init' and 'reconfigure'.

Co-authored-by: Mark H Weaver <mhw@netris.org>
2015-11-02 22:49:04 +01:00
Ludovic Courtès d62e201cfd services: Add 'system-service-type'.
* gnu/services.scm (system-derivation): New procedure.
  (system-service-type): New variable.
  (boot-script-entry): New procedure.
  (boot-service-type): Extend SYSTEM-SERVICE-TYPE.
  (etc-entry): New procedure.
  (etc-service-type): Extend SYSTEM-SERVICE-TYPE.
  (fold-services): Change default #:target-type to SYSTEM-SERVICE-TYPE.
* gnu/system.scm (operating-system-directory-base-entries): New procedure.
  (essential-services): Use it.  Add an instance of
  SYSTEM-SERVICE-TYPE.
  (operating-system-boot-script): Pass #:target-type to 'fold-services'.
  (operating-system-derivation): Rewrite in terms of 'fold-services'.
* gnu/system/linux-container.scm (system-container): Remove.
  (container-script): Use 'operating-system-derivation'.
* guix/scripts/system.scm (export-extension-graph): Replace
  BOOT-SERVICE-TYPE by SYSTEM-SERVICE-TYPE.
* doc/images/service-graph.dot: Add 'system' node and edges.
* doc/guix.texi (Service Composition): Mention SYSTEM-SERVICE-TYPE.
  (Service Reference): Document it.  Update 'fold-services'
  documentation.
2015-11-02 22:25:11 +01:00
David Thompson 7241c2fae6 scripts: environment: Ignore user shell when spawning container.
* guix/scripts/environment.scm (%default-options): Remove 'exec'
  association.
  (guix-environment): If the user didn't specify a command, use the
  default shell, or use /bin/sh when a container is requested.
2015-11-02 08:30:54 -05:00
Alex Kost 6407ce8ea1 emacs: Add completions for '--type' option of 'refresh' popup.
* guix/scripts/refresh.scm: Export '%updaters'.
* emacs/guix-main.scm (refresh-updater-names): New procedure.
* emacs/guix-base.el (guix-refresh-updater-names): New function.
* emacs/guix-read.el (guix-read-refresh-updater-names,
  guix-read-refresh-updater-names-string): New functions.
* emacs/guix-command.el (guix-command-improve-refresh-argument): Use
  'guix-read-refresh-updater-names-string'.
2015-11-02 15:51:40 +03:00
David Thompson 32efa254a8 scripts: Add 'container' subcommand.
* guix/scripts/container.scm: New file.
* guix/scripts/container/exec.scm: New file.
* po/guix/POTFILES.in: Add them.
* Makefile.am (MODULES): Add them.
* doc/guix.texi (Invoking guix container): New section.
2015-11-01 18:20:04 -05:00
Alex Kost fbd213a83f guix system: Fix typo in --help message.
* guix/scripts/system.scm (show-help): Align 'container' the same way as
  other actions.
2015-10-31 23:21:23 +03:00
David Thompson c9c282cea0 scripts: environment: Allow lists of packages in expressions.
* guix/scripts/environment.scm (options/resolve-packages): Match against
  lists of packages when evaluating expressions.
* tests/guix-environment.sh: Add test.
* doc/guix.texi ("invoking guix environment"): Add docs.
2015-10-30 21:02:51 -04:00
David Thompson 1c8a81b1af scripts: system: Add 'container' action.
* guix/scripts/system.scm (show-help): Display 'container' action.
  (system-derivation-for-action, guix-system): Add 'container' case.
  (perform-action): Skip GRUB config generation when building a container.
* doc/guix.texi (Invoking guix system): Document it.
2015-10-30 13:22:59 -04:00
David Thompson cc90fbbf39 scripts: environment: Allow mixing regular and ad-hoc packages.
This patch changes the --ad-hoc flag to be positional.  That is, the
packages that appear before --ad-hoc are interpreted as packages whose
inputs should be in the environment; the packages that appear after are
interpreted as packages to be directly added to the environment.

* guix/scripts/environment.scm (tag-package-arg, compact): New
  procedures.
  (%options): Tweak the handlers for --load and --expression options.
  (options/resolve-packages): Preserve package mode tag.
  (parse-args): Tweak argument handler to use package tagging procedure.
  (guix-environment): Apply ad-hoc behavior on a per package basis.
* tests/guix-environment.sh: Add test.
* doc/guix.texi ("invoking guix environment"): Document new behavior of
  --ad-hoc.
2015-10-29 16:24:12 -04:00
Alex Kost 7191adc5cf refresh: Support comma-separated updater types.
* guix/scripts/refresh.scm (%options): Handle comma-separated types for
  '--type' option.
  (guix-refresh): Adjust accordingly.
  (show-help): Likewise.
* doc/guix.texi (Invoking guix refresh): Document it.
2015-10-28 21:51:59 +03:00
Ludovic Courtès fd688c82bf ui: Add 'make-regexp*'.
Fixes <http://bugs.gnu.org/21773>.
Reported by Jan Synáček <jan.synacek@gmail.com>.

* guix/ui.scm (make-regexp*): New procedure.
* guix/scripts/package.scm (options->installable, guix-package): Use it
  when processing user-provided regexps.
2015-10-28 15:53:17 +01:00
Ludovic Courtès fb4bf72be3 store: Use the daemon's substitute URLs by default.
Partly fixes <http://bugs.gnu.org/20217>.

* guix/store.scm (set-build-options): Change #:substitute-urls to
  default to #f.  Send the 'substitute-urls' pair only if
  SUBSTITUTE-URLS is true.
* guix/scripts/build.scm (set-build-options-from-command-line): Do not
  default to %DEFAULT-SUBSTITUTE-URLS for #:substitute-urls.
* guix/scripts/size.scm (%default-options): Remove 'substitute-urls'.
2015-10-28 15:31:44 +01:00
David Thompson 34a1783fc1 scripts: build: Add --file option.
* guix/scripts/build.scm (show-help): Add help text for --file option.
  (%options): Add --file option.
  (options/resolve-packages): Handle 'file' options.
* tests/guix-build.sh: Add tests.
* doc/guix.texi ("invoking guix build"): Add doc.
2015-10-28 08:40:16 -04:00
Ludovic Courtès 55b2fc1877 substitute: Honor all the specified server URLs.
* guix/scripts/substitute.scm (lookup-narinfos/diverse): New procedure.
  (lookup-narinfo): Use it.
  (process-query): Change #:cache-url to #:cache-urls.
  [valid?]: Remove 'narinfo?' check, which is no longer necessary.
  Use 'lookup-narinfos/diverse' instead of 'lookup-narinfos'.
  (process-substitution): Change #:cache-url to #:cache-urls.
  (%cache-url): Rename to...
  (%cache-urls): ... this.  Turn into a list.
  (guix-substitute): Remove 'getaddrinfo' test with early exit.  Adjust
  calls to 'process-query' and 'process-substitution'.
* tests/substitute.scm: Change '%cache-url' to '%cache-urls'.
2015-10-28 12:04:03 +01:00
Ludovic Courtès a89dde1ed8 substitute: 'lookup-narinfos' returns exactly a list of narinfos.
* guix/scripts/substitute.scm (lookup-narinfos): Filter out #f values
  from CACHED, such that the end result is exactly a list of narinfos,
  not interspersed with #f.
* guix/scripts/challenge.scm (discrepancies): Assume REMOTE is a list of
  narinfos.
2015-10-28 12:04:03 +01:00
Ludovic Courtès f151298fa0 substitute: 'http-multiple-get' follows 'fold' style.
* guix/scripts/substitute.scm (http-multiple-get): Add 'seed'
  parameter.  Call PROC in 'fold' style.
  (fetch-narinfos)[handle-narinfo-response]: Adjust accordingly.
  Update 'http-multiple-get' call accordingly.
2015-10-28 12:04:03 +01:00
Alex Kost 6ffa706b6d refresh: Add '--list-updaters' option.
* guix/scripts/refresh.scm (list-updaters-and-exit): New procedure.
  (%options, show-help): Add '--list-updaters' option.
* doc/guix.texi (Invoking guix refresh): Document it.
2015-10-27 21:54:57 +03:00
Ludovic Courtès 06d45f4566 profiles: Add generation manipulation procedures.
* guix/scripts/package.scm (delete-generations): Use
  'delete-generation*' instead of 'delete-generation'.
  (guix-package)[process-actions]: Use 'roll-back*' instead of
  'roll-back' and 'switch-to-generation*' instead of
  'switch-to-generation'.
  (link-to-empty-profile, switch-to-generation,
  switch-to-previous-generation, roll-back, delete-generation): Move
  to...
* guix/profiles.scm: ... here.  Adjust to not print messages and to
  return values that can be used by user interfaces.
* guix/ui.scm (display-generation-change, roll-back*,
  switch-to-generation*, delete-generation*): New procedures.
2015-10-27 00:01:20 +01:00
Ludovic Courtès 3bb168b099 utils: Add 'switch-symlinks', moved from (guix ui).
* guix/ui.scm (switch-symlinks): Move to...
* guix/utils.scm: ... here.  New procedure.
* guix/scripts/pull.scm: Use it.
2015-10-27 00:01:20 +01:00
Ludovic Courtès 65797bfffd guix system: Add the 'list-generations' command.
* guix/scripts/system.scm (display-system-generation, list-generations):
  New procedures.
  (process-action): Clarify docstring.
  (process-command): New procedure.
  (guix-system)[parse-sub-command]: Add 'list-generations'
  Call 'process-command' instead of 'process-action'.
* doc/guix.texi (Using the Configuration System): Mention generations,
  rollback, and 'list-generations'.
  (Invoking guix system): Document 'list-generations'.
2015-10-27 00:01:20 +01:00
Ludovic Courtès 5b516ef369 guix system: Factorize boot parameter parsing.
* guix/scripts/system.scm (<boot-parameters>): New record type.
  (read-boot-parameters): New procedure.
  (previous-grub-entries)[system->grub-entry]: Use it.
2015-10-27 00:01:20 +01:00
Ludovic Courtès ad18c7e64c ui: Add procedures to display a profile generation.
* guix/scripts/package.scm (guix-package)[process-query](list-generations):
  Move part of the body to 'delete-generation' and
  'display-profile-content'.
* guix/ui.scm (display-generation, display-profile-content): New
  procedures.
2015-10-27 00:01:20 +01:00
Ludovic Courtès d50cb56d9b utils: Add 'readlink*'.
* guix/scripts/package.scm (readlink*): Move to...
* guix/utils.scm (readlink*): ... here.  New procedure.
2015-10-27 00:01:20 +01:00
Ludovic Courtès deaab8e314 guix system: Extract action processing.
* guix/scripts/system.scm (process-action): New procedure.  Extracted
  from...
  (guix-system): ... here.  Use it.
2015-10-27 00:01:20 +01:00
Ludovic Courtès e49de93aa5 ui: Add 'matching-generations'.
* guix/scripts/package.scm (matching-generations): Move to...
* guix/ui.scm (matching-generations): ... here.
2015-10-27 00:01:20 +01:00
David Thompson f535dcbe19 scripts: environment: Add --container option.
* guix/scripts/system.scm (specification->file-system-mapping): Move from
  here...
* guix/ui.scm (specification->file-system-mapping): ... to here.
* guix/scripts/enviroment.scm (show-help): Show help for new options.
  (%options): Add --container --network, --expose, and --share options.
  (%network-configuration-files): New variable.
  (launch-environment, launch-environment/container, requisites*,
  inputs->requisites): New procedures.
  (guix-environment): Spawn new process in a container when requested.
* doc/guix.texi (Invoking guix environment): Document it.
* tests/guix-environment-container.sh: New file.
* Makefile.am (SH_TESTS): Add it.
2015-10-25 20:27:19 -04:00
Paul van der Walt 8e01e30077 import: hackage: Fix grammar.
Minor clarification regarding the test-dependencies command line option.

* guix/scripts/import/hackage.scm (show-help): Minor grammatical fix.
2015-10-23 09:10:52 +02:00
Ludovic Courtès d882c235d9 import: cran: Add updater.
* guix/import/cran.scm (downloads->url, nodes->text): New procedures.
  (cran-sxml->sexp): Use them.  Remove equivalent local code.
  (latest-release, cran-package?): New procedures.
  (%cran-updater): New variable.
* guix/scripts/refresh.scm (%updaters): Add %CRAN-UPDATER.
* doc/guix.texi (Invoking guix refresh): Mention CRAN.
2015-10-21 14:44:41 +02:00
Ludovic Courtès 577e750580 refresh: Remove exception catch-all.
* guix/scripts/refresh.scm (update-package): Remove 'catch #t'.
2015-10-21 14:44:41 +02:00
Ludovic Courtès bcb571cba4 refresh: Add '--type' option.
* guix/scripts/refresh.scm (%options, show-help): Add --type.
  (lookup-updater): New procedure.
  (update-package): Add 'updaters' parameter and honor it.
  (guix-refresh)[options->updaters]: New procedure.
  Use it, and honor --type.
2015-10-21 14:44:41 +02:00
Ludovic Courtès a7aac93625 import: elpa: Add updater.
* guix/import/elpa.scm (latest-release, package-from-gnu.org?): New
  procedures.
  (%elpa-updater): New variable.
* guix/scripts/refresh.scm (%updaters): Add %ELPA-UPDATER.
2015-10-21 14:44:38 +02:00
Ludovic Courtès 0a7c5a09fe gnu-maintenance: Generalize, leading to (guix upstream).
* guix/gnu-maintenance.scm (<gnu-release>): Remove.
  (coalesce-releases): Move to upstream.scm.  Rename to
  'coalesce-sources'; adjust callers.
  (releases, latest-release): Return <upstream-source> objects instead
  of <gnu-release> objects.
  (latest-release*, non-emacs-gnu-package?): New procedures.
  (gnu-release-archive-types): Remove.
  (%gnu-updater): New variable.
  (package-update-path, download-tarball, package-update,
  update-package-source): Move to...
* guix/upstream.scm: ... here.  New file.
* Makefile.am (MODULES): Add it.
* po/guix/POTFILES.in: Replace gnu-maintenance.scm with upstream.scm.
* guix/scripts/refresh.scm (%updaters): New variable.
  (update-package): Adjust to new 'package-update' interface.
  (guix-refresh): Adjust to new 'package-update-path'.  Remove
  'false-if-exception' around it.
2015-10-21 14:43:34 +02:00
Ludovic Courtès d23c20f1d0 Add 'guix challenge'.
* guix/scripts/challenge.scm, tests/challenge.scm: New files.
* Makefile.am (MODULES): Add the former.
  (SCM_TESTS): Add the latter.
* doc.am (SUBCOMMANDS): Add 'challenge'.
* doc/guix.texi (Substitutes): Add xref to 'guix challenge'.
  (Invoking guix challenge): New node.
* doc/contributing.texi (Submitting Patches): Add note about using 'guix
  challenge'.
* po/guix/POTFILES.in: Add guix/scripts/challenge.scm.
2015-10-20 00:57:36 +02:00
Ludovic Courtès ea0c6e0507 substitute: Expose narinfo access.
* guix/scripts/substitute.scm: Export <narinfo> accessors.
  (narinfo-hash->sha256): New procedure.
  (cache-narinfo!): Ignore EACCES exceptions.
2015-10-19 23:12:34 +02:00
Ludovic Courtès c6f8e9dd64 guix archive: Add '--extract'.
* guix/scripts/archive.scm (show-help, %options): Add --extract.
  (guix-archive): Honor it.
* tests/guix-archive.sh: Test it.
* doc/guix.texi (Invoking guix archive): Document it.
2015-10-19 10:10:47 +02:00
Ludovic Courtès 6f305ea5fd guix system: Add 'dmd-graph' command.
* guix/scripts/system.scm (dmd-service-node-label,
  dmd-service-node-type, export-dmd-graph): New procedures.
  (show-help): Add 'dmd-graph'.
  (guix-system)[parse-sub-command]: Likewise.
  Honor it.
* doc/guix.texi (Invoking guix system): Document it.
  (dmd Services): Add an illustration and explanation.
* doc/images/dmd-graph.dot: New file.
* doc.am (DOT_FILES): Add it.
2015-10-14 21:39:06 +02:00
Ludovic Courtès d6c3267a32 guix system: Add 'extension-graph' command.
* guix/scripts/system.scm (service-node-label, service-node-type,
  export-extension-graph): New procedures.
  (guix-system)[parse-sub-command]: Add 'extension-graph'.
  Honor it.
  (show-help): Add 'extension-graph'.
* doc/guix.texi (Invoking guix system): Document it.
  (Service Composition): Add cross-reference.
2015-10-14 21:39:05 +02:00
Ludovic Courtès a64cd7b65f graph: 'export-graph' takes a #:reverse-edges? parameter.
* guix/scripts/graph.scm (export-graph): Add #:reverse-edges? parameter
  and honor it.
2015-10-14 21:39:05 +02:00
Ludovic Courtès f3f427c2e9 guix system: Add '--derivation'.
* guix/scripts/system.scm (perform-action): Add #:derivations-only?
  parameter and honor it.
  (show-help, %options): Add '--derivation'.
  (guix-system): Pass #:derivations-only? to 'perform-action'.
* tests/guix-system.sh: Test it.
* doc/guix.texi (Invoking guix system): Document it.
2015-10-10 22:46:15 +02:00
David Thompson 1de2fe95e0 scripts: environment: Use system* instead of system.
This allows for direct program invokation without needing a shell to act
as a command interpreter.

* guix/scripts/environment.scm (%default-shell): New variable.
  (show-help): Adjust description.  Remove '--exec' reference.
  (%default-options): Use '%default-shell'.
  (%options): Adjust '--exec' to run command via the default shell.
  (parse-args): New procedure.
  (guix-environment): Use 'parse-args'.  Use 'system*' instead of
  'system'.
* tests/guix-environment.sh: Add test for '--' command invokation.
* doc/guix.texi ("Invoking guix environment"): Use new syntax.  Remove
  '--exec' documentation.
2015-10-09 12:17:01 -04:00
Alex Kost e04741f160 lint: Export 'run-checkers'.
* guix/scripts/lint.scm (run-checkers): Export.  Make 'checkers'
  argument optional.
2015-10-09 16:17:45 +03:00
Ludovic Courtès cf4e7083ed publish: Fix file descriptor leak.
A client closing the connection while reading from a /nar URL would
leave an open file descriptor in the server.  This patch fixes it.

* guix/scripts/publish.scm (swallow-EPIPE): New macro.
  (http-write): Use it around 'write-file' call.
2015-10-06 23:51:04 +02:00
Ludovic Courtès 30d9aa5422 guix gc: Add '--list-failures' and '--clear-failures'.
Suggested by Mark H Weaver <mhw@netris.org>.

* guix/scripts/gc.scm (show-help, %options): Add --list-failures and
  --clear-failures.
  (guix-gc): Honor them.
* doc/guix.texi (Invoking guix gc): Document them.
  (Invoking guix-daemon): Mention them.
2015-09-28 22:54:04 +02:00
Mathieu Lirzin cd8b7cfb3f lint: Fix 'check-texinfo-markup'.
Fixes a regression introduced in 5d8d8f3.

* guix/scripts/lint.scm (check-description-style): When no exception is
  thrown in 'check-texinfo-markup', return the rendered description.
2015-09-28 00:23:12 +02:00
Mathieu Lirzin 5d8d8f3b0a lint: Improve 'check-texinfo-markup'.
* guix/scripts/lint.scm (check-description-style): Set 'field' parameter
  when emitting a warning in 'check-texinfo-markup'.  Catch any error
  that may occur in during the 'texi->plain-text' conversion.  This is a
  followup to commit 2748ee3.
2015-09-26 15:10:13 +02:00
Ludovic Courtès 5ef9d7deea offload: Use gzip instead of xz for compression on the master.
* guix/scripts/offload.scm (send-files): Use gzip --fast instead of xz.
2015-09-25 22:35:35 +02:00
Mathieu Lirzin 23464bfd99 lint: Accept '`' character.
* guix/scripts/lint.scm (properly-starts-sentence?): Match Texinfo
  highlighting commands as a sentence start.
2015-09-24 22:55:59 +02:00
Mathieu Lirzin 2748ee3bcf lint: Check non-translated package descriptions.
* guix/ui.scm (texi->plain-text): Export.
* guix/scripts/lint.scm (check-description-style): Use it instead of
  'package-description-string'.
2015-09-24 22:46:20 +02:00
Alex Kost 430505eba3 scripts: Add 'build-package'.
* guix/scripts/system.scm (maybe-build): Move to ...
* guix/scripts.scm: ...here.
  (build-package): New procedure.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2015-09-22 22:05:10 +03:00
Ludovic Courtès e0566f12f8 lint: Report lonely parentheses.
* guix/scripts/lint.scm (%hanging-paren-rx): New variable.
  (report-lone-parentheses): New procedure.
  (%formatting-reporters): Use it.
* tests/lint.scm ("formatting: lonely parentheses"): New test.
2015-09-18 21:54:04 +02:00
Alex Kost fa394eb99c ui: Add 'show-derivation-outputs'.
* guix/scripts/build.scm (guix-build): Extract code from here and move to...
* guix/ui.scm (show-derivation-outputs): ... here.  New procedure.
2015-09-18 21:42:06 +03:00
Alex Kost 88981dd3e2 Add (guix scripts).
* guix/ui.scm: Add missing copyright lines.
  (args-fold*, environment-build-options, %default-argument-handler,
  parse-command-line): Move to ...
* guix/scripts.scm: ...here.  New file.
* guix/scripts/archive.scm: Use it.
* guix/scripts/build.scm: Likewise.
* guix/scripts/download.scm: Likewise.
* guix/scripts/edit.scm: Likewise.
* guix/scripts/environment.scm: Likewise.
* guix/scripts/gc.scm: Likewise.
* guix/scripts/graph.scm: Likewise.
* guix/scripts/hash.scm: Likewise.
* guix/scripts/import/cpan.scm: Likewise.
* guix/scripts/import/cran.scm: Likewise.
* guix/scripts/import/elpa.scm: Likewise.
* guix/scripts/import/gem.scm: Likewise.
* guix/scripts/import/gnu.scm: Likewise.
* guix/scripts/import/hackage.scm: Likewise.
* guix/scripts/import/nix.scm: Likewise.
* guix/scripts/import/pypi.scm: Likewise.
* guix/scripts/lint.scm: Likewise.
* guix/scripts/package.scm: Likewise.
* guix/scripts/publish.scm: Likewise.
* guix/scripts/pull.scm: Likewise.
* guix/scripts/refresh.scm: Likewise.
* guix/scripts/size.scm: Likewise.
* guix/scripts/system.scm: Likewise.
* tests/ui.scm (with-environment-variable, "parse-command-line",
  "parse-command-line and --no options"): Move to ...
* tests/scripts.scm: ...here.  New file.
* Makefile.am (MODULES): Add guix/scripts.scm.
  (SCM_TESTS): Add tests/scripts.scm.
* po/guix/POTFILES.in: Add guix/scripts.scm.
2015-09-18 21:42:06 +03:00
Steve Sprang a8be7b9a7a substitute: Improve readability of download progress report.
* guix/build/download.scm
  (string-pad-middle, store-url-abbreviation, store-path-abbreviation):
  New procedures.
  (progress-proc): Add #:abbreviation parameter and use it.  Generate a
  better indeterminate progress string.
* guix/scripts/substitute.scm (assert-valid-narinfo): Add newlines to output.
  (process-substitution): Use byte-count->string and store-path-abbreviation.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2015-09-16 23:50:12 +02:00
Mathieu Lirzin 3500e659f1 lint: Add 'check-texinfo-markup' checker.
* guix/script/lint.scm (check-description-style): Check for invalid
  Texinfo markup.
* tests/lint.scm: Test it.
2015-09-15 19:01:23 +02:00
Eric Bavier 50f5c46d06 guix: lint: Check for meaningful origin file names.
* guix/scripts/lint.scm (check-source-file-name): New procedure.
  (%checkers): Add 'source-file-name' checker.
* tests/lint.scm ("source-file-name", "source-file-name: v prefix")
  ("source-file-name: valid", "source-file-name: bad checkout")
  ("source-file-name: good checkout"): New tests.
* doc/guix.texi (Invoking guix lint): Mention file name check.
2015-09-14 18:03:33 -05:00
Eric Bavier 3b4d01035f guix: packages: Add origin-actual-file-name.
* guix/scripts/graph.scm (uri->file-name, node-full-name): Move origin file
  name logic to...
* guix/packages.scm (origin-actual-file-name): ...here.
* tests/packages.scm ("origin-actual-file-name")
  ("origin-actual-file-name, file-name"): New tests.
2015-09-14 18:02:37 -05:00
Ludovic Courtès d89e0990f5 guix system: Gracefully handle incomplete commands.
Fixes <http://bugs.gnu.org/21451>.
Reported by Steve Sprang <steve.sprang@gmail.com>.

* guix/scripts/system.scm (guix-system)[option-arguments]: Error out
  when ACTION is #f.
2015-09-15 00:04:27 +02:00
Ludovic Courtès 3f208ad758 guix build: '--log-file' can return URLs.
* guix/scripts/build.scm (%default-log-urls): New variable.
  (log-url): New procedure.
  (guix-build): Use it.
* doc/guix.texi (Invoking guix build): Document it.
2015-09-10 23:14:16 +02:00
Ludovic Courtès ef30b974c9 pull: Update to the new cgit snapshot URL.
* guix/scripts/pull.scm (%snapshot-url): Update to the new URL.
2015-09-10 08:49:36 +02:00
Ludovic Courtès 52b9efe337 lint: Add 'license' checker.
* guix/scripts/lint.scm (check-license): New procedure.
  (%checkers): Add 'license' checker.
* tests/lint.scm ("license: invalid license"): New test.
2015-09-06 12:36:15 +02:00
Ludovic Courtès 9d2f48df02 publish: Gracefully handle the lack of a deriver.
* guix/scripts/publish.scm (narinfo-string): Catch 'system-error' around
  'load-derivation' call; return BASE-INFO upon ENOENT.  This allows us
  to return the narinfo even if DERIVER is missing.  Before that, the
  exception would be uncaught, leading to 500 Internal Error on the
  client side.
2015-09-04 00:13:05 +02:00
Ludovic Courtès 4c8f997a7d graph: Add '--expression'.
* guix/scripts/graph.scm (%options, show-help): Add '--expression'.
  (guix-graph): Call 'read/eval-package-expression' for 'expression'
  pairs in OPTS.
* tests/guix-graph.sh: Add tests.
* doc/guix.texi (Invoking guix graph): Document it.
2015-09-02 23:40:07 +02:00
Ricardo Wurmus e1248602f9 import: Add 'cran' importer.
* guix/import/cran.scm: New file.
* guix/scripts/import.scm: Add "cran" to 'importers'.
* guix/scripts/import/cran.scm: New file.
* tests/cran.scm: New file.
* Makefile.am (MODULES): Add 'guix/import/cran.scm' and
  'guix/scripts/import/cran.scm'.
  (SCM_TESTS): Add 'tests/cran.scm'.
* doc/guix.texi (Invoking guix import): Document it.
* po/guix/POTFILES.in: Add 'guix/scripts/import/cran.scm'.
2015-08-31 15:39:34 +02:00
Alex Kost c1a8c5ab1c guix graph: Export node types and <node-type> accessors.
* guix/scripts/graph.scm (%node-types, node-type, node-type?,
  node-type-identifier, node-type-label, node-type-edges,
  node-type-convert, node-type-name, node-type-description): Export.
2015-08-30 18:26:02 +03:00
Alex Kost 521a11e0a6 guix lint: Export checkers and <lint-checker> accessors.
* guix/scripts/lint.scm (%checkers, lint-checker, lint-checker?,
  lint-checker-name, lint-checker-description, lint-checker-check):
  Export.
2015-08-30 18:26:01 +03:00
Ludovic Courtès 3d20ebd6cb refresh: Add missing newline in warning message.
Reported by karhunkynsi on #guix.

* guix/scripts/refresh.scm (update-package): Add missing newline in
  string literal passed to 'warning'.
2015-08-29 23:56:47 +02:00
David Thompson 3aae8145a7 import: Add Ruby gem importer.
* gnu/scripts/import.scm (importers): Add "gem".
* gnu/import/gem.scm: New file.
* gnu/scripts/import/gem.scm: New file.
* Makefile.am (MODULES): Add them.
* guix.texi ("invoking guix import"): Document it.
2015-08-27 19:45:06 -04:00
Ludovic Courtès 888569161c Add 'guix graph'.
* guix/scripts/graph.scm, tests/graph.scm, tests/guix-graph.sh,
  doc/images/coreutils-bag-graph.dot, doc/images/coreutils-graph.dot: New
  files.
* Makefile.am (MODULES): Add guix/scripts/graph.scm.
  (SH_TESTS): Add tests/guix-graph.sh.
  (SCM_TESTS): Add tests/graph.scm.
* doc.am (DOT_FILES, DOT_VECTOR_GRAPHICS): New variables.
  (EXTRA_DIST): Use them.
  (dist_infoimage_DATA): Use $(DOT_FILES).
  (pdf-local, info-local, ps-local): Likewise.
* doc/guix.texi (Packages with Multiple Outputs): Add cross-reference to 'guix
  graph'.
  (Invoking guix gc): Likewise.
  (Invoking guix graph): New section.
2015-08-27 00:49:23 +02:00
David Thompson 0d2794005c scripts: package: Add --install-from-file option.
* guix/scripts/package.scm (show-help): Add help text for --install-from-file
  option.
  (%options): Add --install-from-file option.
* tests/guix-package.sh: Test it.
* doc/guix.texi ("invoking guix package"): Document it.
* doc/package-hello.scm: New file.
* doc.am (EXTRA_DIST): Add it.
2015-08-19 22:23:59 -04:00
Ludovic Courtès 83bde59fb3 size: Get the item's size from the daemon rather than compute it.
This removes all I/O, which obviously makes things faster.

* guix/scripts/size.scm (file-size, store-item-exists?): Remove.
  (query-path-info*): New procedure.
  (file-size*): Rename to...
  (file-size): ... this; adjust caller.  Use 'query-path-info*' instead of
  'file-size'.
2015-08-19 11:39:18 +02:00
Ludovic Courtès 40a7d4e58b lint: Add 'formatting' checker.
* guix/scripts/lint.scm (report-tabulations, report-trailing-white-space,
  report-long-line, report-formatting-issues, check-formatting): New
  procedures.
  (%formatting-reporters): New variable.
  (%checkers): Add 'formatting' checker.
* tests/lint.scm ("formatting: tabulation", "formatting: trailing white
  space", "formatting: long line", "formatting: alright"): New tests.
* doc/guix.texi (Invoking guix lint): Mention the 'formatting' checker.
2015-08-19 11:39:17 +02:00
Alex Kost 1d3eaef90c import: elpa: Fix typo.
Reported by Eric Dvorsak <eric@dvorsak.fr> on #guix.

* guix/scripts/import/elpa.scm (%default-options): Remove redundant
  quote which led to an error if --archive option was not specified.
2015-08-10 15:46:10 +03:00
Ludovic Courtès 69b4ffcfbd Fix typos in translatable strings.
Reported by Anders Jonsson <anders.jonsson@norsjovallen.se>.

* gnu/packages/backup.scm, gnu/packages/databases.scm,
  gnu/packages/linux.scm, gnu/packages/perl.scm,
  gnu/packages/web.scm, guix/scripts/lint.scm,
  guix/scripts/publish.scm: Fix typos in translatable strings.
2015-07-23 09:42:23 +02:00
Ludovic Courtès d490d06e0f size: Add '--substitute-urls' option.
* guix/scripts/size.scm (show-help, %options): Add --substitute-urls.
  (%default-options): Add 'substitute-urls'.
  (guix-size): Honor it.
* doc/guix.texi (Invoking guix size): Document it.
2015-07-22 22:56:41 +02:00
Ludovic Courtès 2c59cbc26a import: hackage: Remove reference to unbound variable.
* guix/scripts/import/hackage.scm (guix-import-hackage): Fix error message for
  imports from stdin, which referred to unbound variable 'package-name'.
2015-07-22 22:56:41 +02:00
Ludovic Courtès 1acd8d22af size: Remove leftover 'pk'.
* guix/scripts/size.scm (profile->page-map): Remove leftover 'pk'.
2015-07-22 22:56:41 +02:00
Ludovic Courtès 94080a7263 publish: Do not load archive content in memory.
Previously, before replying to a /nar/* request, 'guix publish' would first
build up the whole nar into memory (as a consequence of
<http://bugs.gnu.org/21093>), which obviously doesn't scale.

* guix/scripts/publish.scm (render-nar): Return STORE-PATH instead of a
  procedure that calls 'write-file'.
  (sans-content-length): New procedure.
  (http-write): For 'x-nix-archive', don't call '%http-write'.  Instead, call
  'write-file' right from here, using BODY as the file name.
2015-07-20 00:37:47 +02:00
Ludovic Courtès 7f23fb0088 publish: Serve /nar requests in a separate thread.
* guix/scripts/publish.scm (%http-write): New variable.
  (http-write): New procedure.
  (concurrent-http-server): New variable.
  (run-publish-server): Use it.
2015-07-19 23:59:29 +02:00
Ludovic Courtès 3b307162e8 publish: Write hashes in nix-base32 format.
* guix/scripts/publish.scm (narinfo-string): Use
  'bytevector->nix-base32-string', not 'bytevector->base32-string'.
2015-07-18 00:14:04 +02:00
Ludovic Courtès ee2a6304f3 system: Add 'kernel-arguments' field.
* gnu/system.scm (<operating-system>)[kernel-arguments]: New field.
  (operating-system-grub.cfg): Honor it.
  (operating-system-parameters-file): Add 'kernel-arguments' to the parameters
  file.
* guix/scripts/system.scm (previous-grub-entries)[system->grub-entry]: Read
  the 'kernel-arguments' field of the parameters file, when available.
* gnu/system/vm.scm (system-qemu-image/shared-store-script):
  Use (operating-system-kernel-arguments os) in '-append'.
* doc/guix.texi (operating-system Reference): Document it.
2015-07-17 01:11:06 +02:00
Ludovic Courtès d2f2c8f126 size: Gracefully handle EPIPE.
* guix/scripts/size.scm (guix-size): Wrap body in 'leave-on-EPIPE'.
2015-07-15 23:57:01 +02:00
Ludovic Courtès df36e62938 ui: Add 'leave-on-EPIPE'.
* guix/scripts/package.scm (leave-on-EPIPE): Move to...
* guix/ui.scm (leave-on-EPIPE): ... here.
2015-07-15 23:57:01 +02:00
Ludovic Courtès ef8f910fce substitute: Improve functional decomposition.
* guix/scripts/substitute.scm (display-narinfo-data,
  process-query, process-substitution): New procedures.  Code moved from...
  (guix-substitute): ... here.  Use them.
2015-07-13 18:29:01 +02:00
Ludovic Courtès f8a8e0fe16 guix build: Add '--substitute-urls' client option.
* guix/scripts/build.scm (%standard-build-options,
  show-build-options-help): Add --substitute-urls=URLS.
  (set-build-options-from-command-line): Honor it.
* guix/store.scm (%default-substitute-urls): Make public.
* doc/guix.texi (Substitutes): Add xref to the client --substitute-urls
  option.
  (Invoking guix build): Document it.
  (Invoking guix-daemon): Add 'daemon-substitute-urls' anchor.
2015-07-13 18:29:01 +02:00
Ludovic Courtès 24f5aaaf24 substitute: Honor "substitute-urls" option passed by "untrusted" clients.
* guix/scripts/substitute.scm (or*): New macro.
  (%cache-url): Honor "untrusted-substitute-urls".
* guix/tests.scm (%test-substitute-urls): New variable.
  (open-connection-for-tests): Use it.
* tests/derivations.scm ("derivation-prerequisites-to-build and substitutes",
  "derivation-prerequisites-to-build and substitutes, non-substitutable
  build", "derivation-prerequisites-to-build and substitutes, local build"):
  Pass it to 'set-build-options'.
* tests/guix-daemon.sh: Likewise.
* tests/store.scm ("substitute query, alternating URLs"): New test.
  ("substitute query", "substitute", "substitute + build-things with output
  path", "substitute, corrupt output hash", "substitute --fallback"): Pass
  #:substitute-urls to 'set-build-options'.
2015-07-13 18:29:01 +02:00
Ludovic Courtès 895d1eda54 substitute: Store cached narinfo in cache-specific sub-directories.
This ensures that switching between different substitute servers doesn't lead
to a polluted narinfo cache.

* guix/scripts/substitute.scm (narinfo-cache-file): Add 'cache-url'
  parameter.  Add the base32 of CACHE-URL as a sub-directory under
  %NARINFO-CACHE-DIRECTORY.  Update callers.
  (cached-narinfo): Likewise.  Call 'mkdir-p' on the dirname of the cache
  file.  Update callers.
  (remove-expired-cached-narinfos): Add 'directory' parameter and use it
  instead of %NARINFO-CACHE-DIRECTORY.
  (narinfo-cache-directories): New procedure.
  (maybe-remove-expired-cached-narinfo): Call 'remove-expired-cached-narinfos'
  for each item returned by 'narinfo-cache-directories'.
2015-07-13 18:29:01 +02:00
Ludovic Courtès 074efd63a8 substitute: Pass the cache URL instead of <cache> objects.
* guix/scripts/substitute.scm (<cache>): Rename to...
  (<cache-info>): ... this.
  (open-cache): Rename to...
  (download-cache-info): ... this.  Return a <cache-info> or #f.
  (open-cache*): Remove.
  (cache-narinfo!): Take a URL instead of a <cache> as the first parameter.
  (fetch-narinfos): Likewise.  Call 'download-cache-info'.  Remove use of
  'force'.
  (guix-substitute): Replace calls to 'open-cache*' with %CACHE-URL.
2015-07-13 18:29:01 +02:00
Ludovic Courtès e4e099feca substitute: Remove unneeded conditionals.
* guix/scripts/substitute.scm (guix-substitute): Remove unneeded (if cache
  ...) forms since CACHE is always true (it's a promise.)
2015-07-13 18:29:01 +02:00
Alex Kost 663d0733c8 guix lint: Remove duplicated module lines.
* guix/scripts/lint.scm (guix): Remove duplicated lines for using
  'srfi-34' and 'srfi-35' modules.  These lines were introduced twice by
  commits b210b35 and 002c57c.
2015-07-13 10:20:34 +03:00
Ludovic Courtès b19649a132 offload: Add 'ssh-options' field to <build-machine>.
* guix/scripts/offload.scm (<build-machine>)[ssh-options]: New field.
  (remote-pipe): Use it.
  (send-files): Likewise.
2015-07-09 11:59:26 +02:00
Federico Beffa 7f74a931dd import: Add 'elpa' importer.
* guix/import/elpa.scm: New file.
* guix/scripts/import.scm: Add "elpa" to 'importers'.
* guix/scripts/import/elpa.scm: New file.
* Makefile.am (MODULES): Add 'guix/import/elpa.scm' and
  'guix/scripts/import/elpa.scm'.
  (SCM_TESTS): Add 'tests/elpa.scm'.
* doc/guix.texi (Invoking guix import): Document it.
* tests/elpa.scm: New file.
* po/guix/POTFILES.in: Add 'guix/scripts/import/elpa.scm'.
2015-07-08 10:53:05 +02:00
David Thompson 9110c2e942 gnu: system: Move <file-system-mapping> into (gnu system file-systems).
* gnu/system/vm.scm (<file-system-mapping>, %store-mapping): Move from here...
* gnu/system/file-systems.scm: ...to here.
* guix/scripts/system.scm: Import (gnu system file-systems).
2015-07-07 21:20:59 -04:00
Andy Patterson 075d99f195 substitute: Avoid infinite loop when updating the substitute list.
Reported
at <http://lists.gnu.org/archive/html/guix-devel/2015-07/msg00119.html>.

* guix/scripts/substitute.scm (http-multiple-get): When RESP has "Connection:
  close", consume HEAD anyway; always call PROC to read from BODY.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2015-07-07 01:04:02 +02:00
Cyril Roelandt d2cef629fd scripts: environment: Return the exit status of the command.
* guix/scripts/environment.scm (guix-environment): Return the exit
  status of the command.
2015-07-02 21:47:24 +02:00
Ludovic Courtès 28de8d258b environment: Define 'GUIX_ENVIRONMENT'.
* guix/scripts/environment.scm (create-environment): Define 'GUIX_ENVIRONMENT'.
* doc/guix.texi (Invoking guix environment): Document it.
* gnu/system/shadow.scm (default-skeletons): Adjust 'PS1' depending on whether
  'GUIX_ENVIRONMENT' is defined.
2015-07-01 23:29:49 +02:00
Ludovic Courtès d70389c423 environment: Improve error reporting for '-l'.
This fixes two problems:

  1. Load errors would print an ugly backtrace.
  2. When FILE was an absolute name, 'load' was passed an incorrect file
     name.

* guix/scripts/environment.scm (options/resolve-packages): Use 'load*' instead
  of 'load'.
2015-07-01 23:29:49 +02:00
Ludovic Courtès 417c39f132 environment: For --ad-hoc, allow users to specify an output.
* guix/scripts/environment.scm (package+propagated-inputs): Add 'output'
  parameter.  Use it in return value.
  (options/resolve-packages): Use 'append-map' instead of 'map'.  For 'load'
  and 'expression', return all the outputs of the resulting package.  For
  'package', use 'specification->package+output' instead of
  'specification->package'.
  (guix-environment): Adjust uses of PACKAGES accordingly.
* doc/guix.texi (Invoking guix environment): Document it.
* tests/guix-environment.sh: Add test for --ad-hoc guile-bootstrap:out.
2015-07-01 23:29:49 +02:00
Ludovic Courtès ce367ef3a9 environment: Add --system.
* guix/scripts/environment.scm (show-help, %options): Add -s/--system.
  (%default-options): Add 'system' pair.
  (guix-environment): Pass 'system' value from OPTS to 'lower-inputs'.
* doc/guix.texi (Invoking guix environment): Document it.
2015-07-01 23:29:49 +02:00
Ludovic Courtès 6b6298ae39 environment: Add only the specified outputs of the dependencies.
Before that, 'guix environment guile' (for instance) would define environment
variables that would refer to the "include" output of Bash, the "debug" output
of libgc, etc., even though these are not listed as inputs in the recipe of
'guile'.

* guix/gexp.scm (lower-inputs): Export.
* guix/scripts/environment.scm (evaluate-input-search-paths): Remove
  'derivations' parameter; add 'search-paths'.  Expect 'inputs' to be
  a list of tuples.  Adjust callers.
  (create-environment): Remove 'derivations' parameter; add 'search-paths'.
  (show-search-paths): Likewise.
  (package+propagated-inputs): New procedure.
  (packages->transitive-inputs, packages+propagated-inputs): Remove.
  (build-inputs): Expect INPUTS to be a list of derivation tuples.
  (guix-environment): Compute INPUTS using 'package+propagated-inputs',
  'package->bag', and 'bag-transitive-inputs'.  Move 'run-with-store' higher.
* tests/guix-environment.sh: Add test with FINDUTILS-BOOT0.
2015-07-01 23:29:49 +02:00
Ludovic Courtès a8f996c605 size: Add '--map-file' option.
* guix/scripts/size.scm (profile->page-map): New procedures.
  (show-help, %options):  Add --map-file.
  (guix-size): Honor it.
* doc/guix.texi (Invoking guix size): Document it.
* doc/images/coreutils-size-map.png: New file.
* doc.am (dist_infoimage_DATA): Add it.
2015-06-21 23:39:12 +02:00
Ludovic Courtès a8aa84af39 size: Remove unused variables.
* guix/scripts/size.scm (ensure-store-item): Remove #:dry-run? parameter.
  (%options): Remove 'dry-run?' variable.
2015-06-21 23:39:11 +02:00
Ludovic Courtès fcc58db68b Add 'guix size'.
* guix/scripts/size.scm: New file.
* Makefile.am (MODULES): Add it.
  (SCM_TESTS): Add tests/size.scm.
* doc.am (SUBCOMMANDS): Add 'size'.
* po/guix/POTFILES.in: Add guix/scripts/size.scm.
* tests/size.scm: New file.
* doc/guix.texi (Packages with Multiple Outputs): Add xref to "Invoking guix
  size".
  (Invoking guix size): New node.
  (Invoking guix gc): Add index for "closure" and xref to the above.
* doc/contributing.texi (Submitting Patches): Use @enumerate for the check
  list.  Add item about 'guix size'.
2015-06-18 00:36:09 +02:00
Ludovic Courtès 39bee8a293 Add 'guix edit'.
* guix/scripts/edit.scm: New file.
* Makefile.am (MODULES): Add it.
* doc.am (SUBCOMMANDS): Add 'edit'.
* doc/guix.texi (Defining Packages): Add xref to "Invoking guix edit".
  (Invoking guix edit): New node.
* po/guix/POTFILES.in: Add it.
2015-06-18 00:25:49 +02:00
Ludovic Courtès 84189ebc66 Move 'specification->package+output' to (gnu packages).
* guix/scripts/package.scm (specification->package+output): Move to...
* gnu/packages.scm (specification->package+output): ... here
* guix/scripts/archive.scm (guix): Adjust accordingly.
2015-06-18 00:25:48 +02:00
Mark H Weaver 2c04921634 offload: Fix sorting bug in 'choose-build-machine'.
* guix/scripts/offload.scm (choose-build-machine)[undecorate]: Return the
  boolean result of pred instead of the best machine+slot.
2015-06-17 15:33:08 -04:00
Ludovic Courtès a43b55f1a6 guix build: Allow directories to be passed to --with-source.
* guix/scripts/build.scm (package-with-source)[tarball-base-name]: Gracefully
  handle file names that lack an extension.
  Pass #:recursive? #t to 'download-to-store'.
* guix/download.scm (download-to-store): Add #:recursive? parameter and pass
  it to 'add-to-store'.
* doc/guix.texi (Invoking guix build): Add an example of --with-source with a
  directory.
2015-06-11 11:19:12 +02:00
Ludovic Courtès c2590362ad environment: Connect to the store after the command line has been parsed.
* guix/scripts/environment.scm (guix-environment): Call 'parse-command-line'
  outside of 'with-store'.  This allows things like --help to run even if the
  daemon is not running.
2015-06-11 11:09:12 +02:00
Ludovic Courtès 78acff7c11 guix system: init: Overwrite the items in the target store.
Fixes <http://bugs.gnu.org/20722>.
Reported by Eric Bavier <ericbavier@openmailbox.org>.

* guix/scripts/system.scm (copy-item): Check whether DEST exists and remove it
  if it does.
2015-06-10 10:31:47 +02:00
Federico Beffa a415474873 import: hackage: Refactor parsing code and add new options.
* guix/import/cabal.scm: New file.
* guix/import/hackage.scm: Update to use the new Cabal parsing module.
* tests/hackage.scm: Update tests.
* guix/scripts/import/hackage.scm: Add new '--cabal-environment' and '--stdin'
  options.
* doc/guix.texi: ... and document them.
* Makefile.am (MODULES): Add 'guix/import/cabal.scm',
  'guix/import/hackage.scm' and 'guix/scripts/import/hackage.scm'.
  (SCM_TESTS): Add 'tests/hackage.scm'.
2015-06-09 09:48:38 +02:00
Alex Kost 2a4e2e4b01 guix: Clean up --help messages.
* guix/scripts/import.scm (show-help): Add newline before a list of
  importers.
* guix/scripts/lint.scm (show-help): Split a long description line.
* guix/scripts/package.scm (show-help): Improve docstrings for --install
  and --remove options.
* guix/scripts/system.scm (show-help): Format actions the same way as
  guix commands and importers are formatted.
2015-06-08 11:46:05 +03:00
Ludovic Courtès 7770aafc75 guix gc: Add '--verify'.
* guix/scripts/gc.scm (show-help, %options): Add --verify.
  (guix-gc): Handle it.
* doc/guix.texi (Invoking guix gc): Document --verify, and move --optimize
  description right below it.
2015-06-06 19:05:56 +02:00
Alex Kost d2aa12250e guix package: Fix typo in --help message.
* guix/scripts/package.scm (show-help): Align '--show' option properly.
2015-06-06 18:32:03 +03:00
Ludovic Courtès 2b5115f8ba lint: source: Warn only when all the URIs are unreachable.
* guix/scripts/lint.scm (call-with-accumulated-warnings): New procedure.
  (with-accumulated-warnings): New macro.
  (check-source): Add 'try-uris' and use it.  Emit warnings only upon
  failure.
2015-05-31 23:25:46 +02:00
Ludovic Courtès 91a0b9cc0b lint: 'validate-uri' really returns #f on failure.
* guix/scripts/lint.scm (validate-uri): Always return #f on failure.
2015-05-31 23:13:09 +02:00
Alex Kost 307153c1ef emacs: Report about "search paths" after operation.
* guix/scripts/package.scm: Export 'display-search-paths'.
* emacs/guix-main.scm (process-package-actions): Use it.
2015-05-29 20:54:54 +03:00
David Thompson a54bd6d72d guix environment: Add --ad-hoc option.
* guix/scripts/environment.scm (%options): Add "ad-hoc" option.
  (show-help): Display help for "--ad-hoc".
  (packages+propagated-inputs): New procedure.
  (guix-environment): Create ad hoc environment when asked.
* doc/guix.texi ("invoking guix environment"): Document it.
2015-05-28 20:52:52 -04:00
Cyrill Schenkel cdb5b075d5 gc: ignore trailing slash or subdirectories for `guix gc -d'
Fixes <http://bugs.gnu.org/19757>.

* guix/scripts/gc.scm (guix-gc): Convert paths to direct store paths.
* guix/store.scm (direct-store-path): Get rid of subdirectories in store path.
* tests/guix-gc.sh: New tests.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2015-05-26 22:26:01 +02:00
Ludovic Courtès db030303b8 guix system: Add '--on-error'.
* guix/ui.scm (load*): Add #:on-error parameter.
  [tag, error-string]: New variables.
  Wrap 'load' call in 'call-with-prompt'.  Pass TAG to 'make-stack'.  Honor
  ON-ERROR after 'report-load-error' call.
  (report-load-error): Change to not exit on error.  Make private.
* guix/scripts/system.scm (show-help, %options): Add --on-error.
  (guix-system): Use 'load*' and pass it #:on-error.
2015-05-25 22:52:41 +02:00
Ludovic Courtès 5f1087c481 guix package: --manifest DTRT when combined with --dry-run.
* guix/scripts/package.scm (guix-package)[process-actions]: Process 'manifest
  action regardless of whether 'dry-run? is set.  Adjust the message
  accordingly.
* tests/guix-package.sh: Add error-reporting test.
2015-05-25 21:34:23 +02:00
Ludovic Courtès f245b03deb guix system: init: Copy the closure of 'grub.cfg', not that of the system.
Fixes <http://bugs.gnu.org/20591>.
Reported by Daniel Pimentel <d4n1@openmailbox.org>.

* guix/scripts/system.scm (install): Copy the closure of GRUB.CFG rather than
  that of OS-DIR.
2015-05-24 17:20:24 +02:00
Ludovic Courtès 328639e48f guix system: Always add zero previous entries in grub.cfg for 'init'.
* guix/scripts/system.scm (grub.cfg): Remove.
  (perform-action): Call 'operating-system-grub.cfg' with the empty list as
  the 2nd argument when ACTION is 'init.
2015-05-24 17:15:16 +02:00
Ludovic Courtès 4a35a866be guix system: init: Make sure the target is root-owned.
Suggested by Mark H Weaver <mhw@netris.org>.

* guix/scripts/system.scm (install): Add 'chown' and 'chmod' calls for TARGET
  when running as root, and warn otherwise.
2015-05-24 00:26:12 +02:00
Ludovic Courtès a4b1a6b65e guix package: Adjust --help message.
* guix/scripts/package.scm (show-help): Add KIND parameter for
  --search-paths as a followup to dbc31ab.
2015-05-21 21:33:18 +02:00
David Thompson 2d977638c9 scripts: Move 'set-build-options-from-command-line*' to (guix scripts build) module.
* guix/scripts/build.scm (set-build-options-from-command-line*): New
  procedure.
* guix/scripts/environment.scm (set-build-options-from-command-line*): Delete.
2015-05-21 08:29:47 -04:00
David Thompson 4d043ab628 ui: Deduplicate 'show-what-to-build*'.
* guix/ui.scm (show-what-to-build*): New procedure.
* guix/scripts/environment.scm (show-what-to-build*): Delete.
* guix/scripts/system.scm (show-what-to-build*): Likewise.
* build-aux/make-binary-tarball.scm (show-what-to-build*): Likewise.
2015-05-21 08:29:47 -04:00
David Thompson 1b6764477f package: Add --manifest option.
* guix/scripts/package.scm (show-help): Add help text.
  (%options): Add manifest option.
  (guix-package): Add manifest option handler.
* doc/guix.texi ("Invoking guix package"): Document it.
* tests/guix-package.sh: Add test.
2015-05-20 12:13:04 -04:00
David Thompson 7ea1432e22 ui: Factorize user-provided Scheme file loading.
* guix/ui.scm (make-user-module, load*): New procedures.
* guix/scripts/system.scm (%user-module): Define in terms of
  'make-user-module'.
  (read-operating-system): Define in terms of load*'.
2015-05-20 12:13:04 -04:00
Ludovic Courtès dbc31ab25c guix package: Add optional argument to --search-paths.
* guix/scripts/package.scm (search-path-environment-variables): Add #:kind
  parameter.  Pass it to 'environment-variable-definition'.
  (display-search-paths): Add #:kind parameter and pass it to
  'search-path-environment-variables'.
  (%options): Add an optional parameter for "--search-paths".
  (guix-package)[process-query]: Handle it.
* tests/guix-package-net.sh: Adjust existing test.
* tests/guix-package.sh: Adjust existing tests and add new test.
* doc/guix.texi (Invoking guix package): Document it.
2015-05-20 12:13:39 +02:00
Ludovic Courtès 755e1147aa guix package: --search-paths mentions $PATH.
* guix/scripts/package.scm (search-path-environment-variables): Add $PATH to
  SEARCH-PATHS.
2015-05-20 12:13:38 +02:00
Ludovic Courtès 38d2778608 guix gc: Add '--optimize'.
* guix/scripts/gc.scm (show-help, %options): Add --optimize.
  (guix-gc): Handle it.
2015-05-19 16:09:58 +02:00
Ludovic Courtès 9e2292ef3d publish: Add '--listen'.
* guix/scripts/publish.scm (show-help, %options): Add --listen.
  (getaddrinfo*): New procedure.
  (%default-options): Add 'address'.
  (open-server-socket): Replace 'addr' and 'port' with 'address', a
  sockaddr.
  (guix-publish): Adjust accordingly.  Augment "publishing" message with
  the actual address.
* doc/guix.texi (Invoking guix publish): Document it.
2015-05-12 21:22:52 +02:00
Ludovic Courtès 5463fe512a publish: Add '--user' option.
* guix/scripts/publish.scm (show-help): Add --user.
  (%options): Likewise.
  (run-publish-server): Change 'port' parameter to 'socket'.  Pass
  #:socket instead of #:addr and #:port to 'run-server'.  Update caller
  accordingly.
  (open-server-socket, gather-user-privileges): New procedures.
  (guix-publish): Use them.  Force %PRIVATE-KEY and %PUBLIC-KEY early
  on.  Warn when running as root.
* doc/guix.texi (Invoking guix publish): Document --user.
2015-05-12 21:22:52 +02:00
Ludovic Courtès 09d809db6a Remove assorted Guile 2.0.5 workarounds.
* guix/scripts/authenticate.scm (%default-port-conversion-strategy):
  Remove.
* guix/scripts/substitute.scm (fetch): Remove 2.0.5 special cases.
* guix/serialization.scm (write-file): Remove 'scandir' workaround.
* guix/ui.scm (command-files): Likewise.
2015-05-10 11:07:51 +02:00
Ludovic Courtès 7623848343 download: Work around Guile small-receive-buffer bug.
Previously, code using directly (guix build download) was still affected
by <http://bugs.gnu.org/15368>.  This includes source derivations, the
'guix download' command, and (guix gnu-maintenance).

'guix substitute' was unaffected since it used (guix http-client), which
already had the fix.

* guix/http-client.scm (open-socket-for-uri): Remove.
  (http-fetch): Remove #:buffered? argument to 'open-socket-for-uri';
  use 'setvbuf' instead.
* guix/scripts/substitute.scm (fetch): Likewise.
* guix/build/download.scm (open-socket-for-uri): New procedure, taken
  from guix/http-client.scm, but without the #:buffered? parameter.
2015-05-06 10:31:11 +02:00
Ludovic Courtès 8e3a3bc290 environment: Move iteration outside of 'for-each-search-path'.
* guix/search-paths.scm (search-path-definition): New procedure.
* guix/scripts/environment.scm (for-each-search-path): Rename to...
  (evaluate-input-search-paths): ... this.  Remove 'proc' and 'pure?'
  parameters, and return directly the list of search-path/value pairs.
  (create-environment): Use 'for-each' and 'evaluate-input-search-paths'
  instead of 'for-each-search-path'.
  (show-search-paths): Use 'for-each', 'search-path-definition', and
  'evaluate-search-paths' instead of 'for-each-search-path'.
2015-05-05 15:13:59 +02:00
Ludovic Courtès b9ea6c6bf4 environment: Use 'evaluate-search-paths'.
This allows 'guix environment' to correctly handle non-directory
and/or pattern search-path specifications, such as that for
'XML_CATALOG_FILES'.

* guix/scripts/environment.scm (for-each-search-path): Use
  'evaluate-search-paths' instead of 'search-path-as-list' & co.
2015-05-05 15:13:59 +02:00
Ludovic Courtès fdfa753c69 search-paths: Define the 'PATH' environment variable.
* guix/search-paths.scm ($PATH): New variable.
* guix/scripts/environment.scm (for-each-search-path): Use it.
2015-05-05 15:13:58 +02:00
Ludovic Courtès 369149995c search-paths: 'evaluate-search-paths' can be passed a list of directories.
* guix/search-paths.scm (evaluate-search-paths): Change 'directory' to
  'directories', and adjust 'search-path-as-list' accordingly.
* guix/scripts/package.scm (search-path-environment-variables): Adjust
  call accordingly.
2015-05-05 15:13:58 +02:00
Ludovic Courtès 099a2c7055 environment: Use (guix search-paths).
* guix/scripts/environment.scm: Use (guix search-paths).  Fixes a
  regression introduced in e89431b.
2015-05-05 11:01:08 +02:00
Ludovic Courtès 441cfb420a search-paths: 'evaluate-search-paths' now returns spec/value pairs.
* guix/search-paths.scm (evaluate-search-paths): Return
  specification/value pairs instead of variable/value pairs.
* guix/scripts/package.scm (search-path-environment-variables): Adjust
  accordingly.  Pass #:separator to 'environment-variable-definition'.
2015-05-04 23:30:52 +02:00