Commit Graph

332 Commits (6ac8aa3d750f0ff392c3c91b7710228ab6c7831a)

Author SHA1 Message Date
Cyril Roelandt 90d104ba82 guix lint: make sure check-patches retrieves patch names.
* guix/lint (check-patches): Test the output of origin-patches.
2014-10-08 03:08:19 +02:00
Alex Kost b72a312c30 guix package: Export generation procedures.
* guix/scripts/package.scm: Export 'roll-back', 'delete-generation',
  'delete-generations'.
  (link-to-empty-profile, roll-back): Add 'store' argument.
  (delete-generations): New procedure.
  (guix-package): Adjust accordingly.
  [delete-generation]: Move to the top level.  Add 'store' and 'profile'
  arguments.
  [display-and-delete]: Move to 'delete-generation'.
2014-10-05 22:17:48 +04:00
Ludovic Courtès 6d7328b2f1 pull: Add dependency on Guile-JSON.
Reported by Alex Sassmannshausen <alex.sassmannshausen@gmail.com>.

* guix/scripts/pull.scm (unpack): Add Guile-JSON to %load-path and
  %load-compiled-path.
2014-09-30 10:11:45 +02:00
David Thompson 1b3e968512 import: Add PyPI importer.
* guix/snix.scm: Delete.
* guix/import/snix.scm: New file.
* guix/import/pypi.scm: New file.
* guix/import/utils.scm: New file.
* guix/scripts/import/nix.scm: New file.
* guix/scripts/import/pypi.scm: New file.
* tests/pypi.scm: New file.
* tests/snix.scm: Import (guix import snix) module.
* guix/scripts/import.scm (%default-options, %options): Delete.
  (%standard-import-options, importers): New variables.
  (show-help): List importers.
  (guix-import): Factor out Nix-specific logic.  Delegate to correct importer
  based upon first argument.
* configure.ac (HAVE_GUILE_JSON): New conditional.
* Makefile.am (MODULES): Add new files and remove 'guix/snix.scm'.
  (SCM_TESTS): Add 'tests/pypi.scm' if guile-json is installed.
2014-09-29 19:30:28 -04:00
Ludovic Courtès 300868ba57 guix build: Add -L/--load-path as a common option.
* guix/scripts/build.scm (show-build-options-help): Document -L.
  (%standard-build-options): Add -L/--load-path.
* tests/guix-package.sh: Test it.
2014-09-24 14:06:09 +02:00
Alex Kost 886cf584db guix package: Use 'profile-generations'.
* guix/scripts/package.scm (guix-package)[process-actions]: Use
  'profile-generations' instead of the equivalent code.
2014-09-22 13:24:52 +04:00
Ludovic Courtès 46025e94cd offload: Use a total order when sorting available machines.
* guix/scripts/offload.scm (machine-less-loaded?, machine-faster?):
  Remove.
  (machine-power-factor): New procedure.
  (machine-less-loaded-or-faster?): Use it.
2014-09-20 12:23:39 +02:00
Ludovic Courtès b1fea30339 offload: Try another machine when the "best" machine is overloaded.
* guix/scripts/offload.scm (choose-build-machine): When BEST is
  overloaded, try the other machines.
2014-09-20 12:10:28 +02:00
Ludovic Courtès cb823dd279 pull: Rewrite using gexps.
* guix/scripts/pull.scm (unpack): Remove 'store' parameter.  Rewrite
  using 'gexp->derivation'.
  (what-to-build, indirect-root-added, build-and-install): New
  procedures.
  (guix-pull): Use it.
2014-09-18 18:45:00 +02:00
Ludovic Courtès 6d49355d8b activation: Honor $GUIX_NEW_SYSTEM for use by 'guix system reconfigure'.
* gnu/build/activation.scm (activate-current-system): Honor
  $GUIX_NEW_SYSTEM by default.
* guix/scripts/system.scm (switch-to-system): Set $GUIX_NEW_SYSTEM
  before loading SCRIPT.
2014-09-12 22:13:52 +02:00
Ludovic Courtès b50c5b7418 pull: Add a compilation progress report.
* guix/build/pull.scm (report-build-progress): New procedure.
  (p-for-each): Add #:progress parameter.
  [loop]: Keep track of the number of completed processes.  Tail-call
  PROGRESS at each loop iteration.
  (build-guix): Add #:debug-port parameter.  Use it for verbose
  messages.  Change 'tar' flags to 'xf'.  Around 'compile-file' call,
  bind CURRENT-WARNING-PORT to DEBUG-PORT.
* guix/scripts/pull.scm (unpack): Add #:verbose? parameter.
  [builder]: Pass #:debug-port to 'build-guix'.
  (guix-pull): Leave CURRENT-BUILD-OUTPUT-PORT unchanged.  Pass
  #:verbose? to 'unpack'.
2014-09-05 23:11:04 +02:00
Ludovic Courtès 548f7a8fa2 Move operating system helpers from (guix build …) to (gnu build …).
* guix/build/activation.scm, guix/build/install.scm,
  guix/build/linux-initrd.scm, guix/build/vm.scm: Move to...
* gnu/build: ... here.
* Makefile.am (MODULES): Remove the above guix/build/ files.
* gnu-system.am (GNU_SYSTEM_MODULES): Add the above gnu/build/ files
  here.
* gnu/services/base.scm, gnu/services/dmd.scm, gnu/system.scm,
  gnu/system/linux-initrd.scm, gnu/system/vm.scm,
  guix/scripts/system.scm: Adjust to the new module names.
2014-09-03 15:43:07 +02:00
Ludovic Courtès b002e9d08e guix lint: Remove "guix lint: " prefix from warnings.
This allows editors to parse warnings correctly.

* guix/scripts/lint.scm (emit-warning): Use 'format' instead of
  'warning', to avoid the "guix lint: " prefix in messages.
* tests/lint.scm (call-with-warnings): Indent.
2014-09-03 15:43:07 +02:00
Cyril Roelandt b4f5e0e87c scripts: add guix lint
* guix/scripts/lint.scm: New file. Defines a 'lint' tool for Guix packages.
* tests/lint.scm: New file.
* Makefile.am (MODULES, SCM_TESTS): Add them.
* po/guix/Makevars: Update appropriately.
* po/guix/POTFILES.in: Update appropriately.
* doc/guix.texi: Document "guix lint".
2014-09-03 02:07:07 +02:00
Cyril Roelandt 5e3b388b51 Move specification->package to gnu/packages.scm.
* guix/scripts/build.scm (specification->package): Move from here...
* gnu/packages.scm: ... to here.
2014-09-03 02:07:07 +02:00
Ludovic Courtès 4720f524fc guix package: Fix search path lookup when an obsolete version is installed.
Before that, 'guix package --search-paths' would not work if, say,
'foo-0.2' is installed but the distro provides 'foo-0.3'.

* guix/scripts/package.scm (search-path-environment-variables)[manifest-entry->package]:
  Handle the case where 'find-best-packages-by-name' returns '().
2014-08-31 22:17:56 +02:00
Ludovic Courtès b9a31d90e9 offload: Ignore EEXIST when registering a .drv as a GC root.
Fixes <http://bugs.gnu.org/18115>.
Reported by Mark H Weaver <mhw@netris.org>.

* guix/scripts/offload.scm (register-gc-root)[script]: Wrap 'symlink'
  call in "catch 'system-error", and ignore EEXIST errors.
2014-08-29 14:53:15 +02:00
Ludovic Courtès b1e48f222b offload: Ignore unreachable machines.
Fixes <http://bugs.gnu.org/18070>.
Reported by Andreas Enge <andreas@enge.fr>.

* guix/scripts/offload.scm (remote-pipe): Augment docstring.
  (machine-load): Return +inf.0 instead of 1 if MACHINE does not respond
  or responds badly.
2014-08-29 14:37:58 +02:00
Ludovic Courtès bdb36958fb gnu: Split (gnu packages base), adding (gnu packages commencement).
* gnu/packages/base.scm (gnu-make-boot0, diffutils-boot0,
  findutils-boot0, %boot0-inputs, nix-system->gnu-triplet, boot-triplet,
  binutils-boot0, gcc-boot0, perl-boot0, linux-libre-headers-boot0,
  texinfo-boot0, %boot1-inputs, glibc-final-with-bootstrap-bash,
  cross-gcc-wrapper, static-bash-for-glibc, glibc-final,
  gcc-boot0-wrapped, %boot2-inputs, binutils-final, libstdc++,
  gcc-final, ld-wrapper-boot3, %boot3-inputs, bash-final, %boot4-inputs,
  guile-final, gnu-make-final, ld-wrapper, coreutils-final, grep-final,
  %boot5-inputs, %final-inputs, canonical-package, gcc-toolchain,
  gcc-toolchain-4.8, gcc-toolchain-4.9): Move to...
* gnu/packages/commencement.scm: ... here.  New file.
* gnu-system.am (GNU_SYSTEM_MODULES): Add it.
* build-aux/check-final-inputs-self-contained.scm: Adjust accordingly.
* gnu/packages/cross-base.scm: Likewise.
* gnu/packages/make-bootstrap.scm: Likewise.
* guix/build-system/cmake.scm (cmake-build): Likewise.
* guix/build-system/gnu.scm (standard-packages, gnu-build,
  gnu-cross-build): Likewise.
* guix/build-system/perl.scm (perl-build): Likewise.
* guix/build-system/python.scm (python-build): Likewise.
* guix/build-system/trivial.scm (guile-for-build): Likewise.
* guix/download.scm (url-fetch): Likewise.
* guix/gexp.scm (default-guile): Likewise.
* guix/git-download.scm (git-fetch): Likewise.
* guix/monads.scm (run-with-store): Likewise.
* guix/packages.scm (default-guile): Likewise.
* guix/scripts/package.scm (guix-package): Likewise.
* guix/scripts/refresh.scm: Likewise.
* guix/svn-download.scm (svn-fetch): Likewise.
* tests/builders.scm (%bootstrap-inputs, %bootstrap-search-paths):
  Likewise.
* tests/packages.scm ("GNU Make, bootstrap"): Likewise.
* tests/guix-package.sh: Likewise.
* gnu/services/base.scm: Use 'canonical-package' instead of xxx-final.
* gnu/services/xorg.scm: Likewise.
* gnu/system/vm.scm: Likewise.
* guix/scripts/pull.scm (guix-pull): Likewise.
2014-08-28 09:21:54 +02:00
Ludovic Courtès 79ee406d51 profiles: Produce a top-level Info 'dir' file.
Fixes <http://bugs.gnu.org/18305>.
Reported by Brandon Invergo <brandon@gnu.org>.

* guix/profiles.scm (manifest-inputs, info-dir-file): New procedures.
  (profile-derivation): Use them.  Add #:info-dir? parameter and honor
  it.
* guix/scripts/package.scm (guix-package): Call 'profile-derivation'
  with #:info-dir? #f when the 'bootstrap? option is set.
* tests/profiles.scm ("profile-derivation"): Pass #:info-dir? #f.
2014-08-23 22:33:03 +02:00
Alex Kost 4ea444198d Move 'check-package-freshness' from 'guix package' to 'packages'.
* guix/scripts/package.scm (%sigint-prompt, call-with-sigint-handler)
  (waiting, ftp-open*, check-package-freshness): Move to...
* gnu/packages.scm: ... here.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2014-08-20 10:55:29 +02:00
Alex Kost 89caec6920 guix package: Use 'manifest-transaction'.
* guix/scripts/package.scm (guix-package)[process-actions]: Use
  'manifest-transaction' instead of the equivalent code.
  (show-what-to-remove/install): Remove.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2014-08-19 22:58:22 +02:00
Ludovic Courtès dfd1d5edf6 guix package: Remove leftover internal procedure.
Reported by Alex Kost <alezost@gmail.com>.

* guix/scripts/package.scm (guix-package)[process-actions]: Remove
  'same-package?'.
2014-08-12 21:51:45 +02:00
Ludovic Courtès f48624fc68 guix package: Use 'manifest-add'.
* guix/scripts/package.scm (guix-package)[process-actions]: Use
  'manifest-add' instead of the equivalent code.
2014-08-12 16:10:32 +02:00
Ludovic Courtès 3d6e65d529 guix package: Remove dead code and unused variables.
Suggested by Alex Kost <alezost@gmail.com>.

* guix/scripts/package.scm (options->installable)[deduplicate]: Remove.
  [packages-to-upgrade]: Remove unused variable 'newest'.
  (roll-back): Remove unused variable 'manifest'.
  (guix-package): Remove unused variables 'guile-missing?', 'verbose?',
  and 'packages'.
2014-08-11 19:03:29 +02:00
Ludovic Courtès 462f5ccade profiles: Add 'package->manifest-entry'.
Suggested by Alex Kost <alezost@gmail.com>.

* guix/scripts/package.scm (options->installable)[package->manifest-entry]:
  Move to (guix profiles).
  [package->manifest-entry*]: New procedure.
  Use it.
* guix/profiles.scm (package->manifest-entry): New procedure.
* tests/profiles.scm (guile-for-build): New variable.
  Call '%guile-for-build'.
  ("profile-derivation"): New test.
2014-07-26 22:57:00 +02:00
Ludovic Courtès 4ca0b4101d profiles: Get rid of the 'inputs' field of 'manifest-entry'.
* guix/profiles.scm (<manifest-entry>)[inputs]: Remove.
  (profile-derivation): Rely on 'item' and 'deps' instead of 'inputs'.
  Adjust 'builder' accordingly.
* guix/scripts/package.scm (options->installable)[package->manifest-entry]:
  Remove 'inputs' field.  Change 'dependencies' field to contain
  packages.
2014-07-26 22:56:59 +02:00
Ludovic Courtès a54c94a40d profiles: Switch to gexps.
* guix/profiles.scm (<manifest-entry>)[path]: Rename to...
  [item]: ... this.  Update users.
  (manifest->sexp): Rename to...
  (manifest->gexp): ... this.  Return a gexp.
  (lower-input): Remove.
  (profile-derivation): Remove 'store' parameter, and turn into a
  monadic procedure.
  [inputs]: New variable.
  [builder]: Turn into a gexp.
  Replace call to 'build-expression->derivation' with call to
  'gexp->derivation'.
* guix/scripts/package.scm (link-to-empty-profile): Adjust call to
  'profile-derivation', and wrap it in 'run-with-store'.
  (show-what-to-remove/install): Rename 'path' to 'item'.  Check whether
  ITEM is a package, and return its output path if it is.
  (input->name+path): Remove.
  (options->installable): Set 'item' to P.
  (guix-package): Adjust call to 'profile-derivation'.
* tests/profiles.scm (guile-2.0.9): Change 'path' to 'item'.
2014-07-26 22:56:59 +02:00
Ludovic Courtès 48704e5b5c profiles: Do away with 'manifest=?'.
* guix/profiles.scm (manifest=?): Remove.
* guix/scripts/package.scm (readlink*): New procedure.
  (guix-package)[process-actions]: Use 'readlink*' and compare the
  profile to be built, PROF, with PROFILE to determine whether there's
  nothing to be done.
2014-07-26 22:56:59 +02:00
Ludovic Courtès 720ee245da guix system: Protect against changes to $PATH when activating the system.
Partly fixes <http://bugs.gnu.org/18082>.
Reported by Mark H Weaver <mhw@netris.org>.

* guix/scripts/system.scm (save-environment-excursion): New macro.
  (switch-to-system): Wrap 'primitive-load' call in it.
2014-07-23 18:20:56 +02:00
Ludovic Courtès b6debdaa22 guix system: Fix type error in 'reconfigure'.
Partly fixes <http://bugs.gnu.org/18082>.
Reported by Mark H Weaver <mhw@netris.org>.

* guix/scripts/system.scm (perform-action) <reconfigure>: Pass the
  output file name of GRUB.CFG to 'install-grub'.
2014-07-23 18:20:56 +02:00
Cyril Roelandt 2aa6efb0b9 guix package: add a "show" option.
* doc/guix.texi: Update the documentation.
* guix/scripts/package.scm: Add a "show" option.
* tests/guix-package.sh: Add a test for the "show" option.
2014-07-21 22:18:03 +02:00
Ludovic Courtès 65ea711189 guix refresh: Use (ice-9 format).
* guix/scripts/refresh.scm: Use (ice-9 format).
2014-07-20 22:39:02 +02:00
Ludovic Courtès 8334cf5b5c guix system: Factorize 'copy-closure'.
* guix/scripts/system.scm (copy-closure): Rename to...
  (copy-item): ... this.
  (copy-closure): New procedure.
  (install): Use it, and remove redundant code.
2014-07-20 22:39:02 +02:00
Eric Bavier 7d193ec348 guix: refresh: Add --list-dependent option.
* guix/packages.scm (package-direct-inputs): New procedure.
* gnu/packages.scm (vhash-refq, package-direct-dependents)
  (package-transitive-dependents, package-covering-dependents): New procedures.
* guix/scripts/refresh.scm (%options, show-help, guix-refresh): Add
  --list-dependent option.
* doc/guix.texi (Invoking guix refresh): Document '--list-dependent' option.
2014-07-20 11:36:09 -05:00
Ludovic Courtès a52127c052 guix system: init: Always use /var/guix as the target state directory.
Fixes <http://bugs.gnu.org/18049>.
Reported by Marek Benc <merkur32@gmail.com>.

* guix/scripts/system.scm (copy-closure): Pass #:state-directory to
  'register-path'.
2014-07-18 20:40:51 +02:00
Eric Bavier 49d91de763 guix: refresh: Correctly identify invalid package names.
* guix/scripts/refresh.scm (guix-refresh): Check for null list
  returned by find-packages-by-name rather than #f.
2014-07-15 00:10:10 -05:00
Ludovic Courtès 3942305eb1 guix system: reconfigure: Always use "/" as GRUB's target file system.
* guix/scripts/system.scm (perform-action) <reconfigure>: Wrap
  'install-grub' call in 'false-if-exception'.  Always use "/" as the
  target.
2014-07-14 16:14:15 +02:00
Ludovic Courtès 314a83ef1e guix system: Fix return value for 'reconfigure'.
* guix/scripts/system.scm (perform-action) <reconfigure>: Add missing
  'return' expression.
2014-07-13 23:44:37 +02:00
Ludovic Courtès 8e42796bdc guix system: Convert to monadic style.
* guix/scripts/system.scm (references*, topologically-sorted*,
  show-what-to-build*): New procedures.
  (copy-closure): Turn into a monadic procedure.
  (install): Likewise, and adjust parameter list.
  (switch-to-system): Likewise.
  (system-derivation-for-action, grub.cfg, maybe-build, perform-action):
  New procedures.
  (guix-system): Use them.
2014-07-13 16:37:11 +02:00
Ludovic Courtès df2ce34385 guix system: Add '--system' option.
* guix/scripts/system.scm (switch-to-system): Add #:system parameter;
  pass it to 'run-with-store'.
  (%options): Add '--system'.
  (guix-system): Pass the 'system' option to 'run-with-store',
  'package-derivation', and 'switch-to-system' calls.
* doc/guix.texi (Invoking guix system): Document '--system' and
  '--image-size'.
2014-07-08 23:42:35 +02:00
Taylan Ulrich Bayirli/Kammer 6879fe235c guix package: Try $LOGNAME in addition to $USER.
Fixes <http://bugs.gnu.org/17946>.

Notoriously, cron jobs may set LOGNAME only and not USER.  See
e.g. crontab(5) under Debian 7 (wheezy).

* guix/scripts/package.scm (%profile-directory)
(guix-package): Also try LOGNAME if USER is unset.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2014-07-05 15:09:43 +02:00
Ludovic Courtès 88371f0d7d guix package: Do the right thing for '-p ~/.guix-profile'.
Fixes <http://bugs.gnu.org/17939>.
Reported by Taylan Ulrich Bayirli/Kammer <taylanbayirli@gmail.com>.

* guix/scripts/package.scm (canonicalize-profile): New procedure.
  (%options): Use it for --profile.
* tests/guix-package.sh: Add test.
2014-07-05 14:56:08 +02:00
Ludovic Courtès f2c403eab6 system: Install /var/guix/profiles/system-1-link on new systems.
* guix/build/install.scm (directives): Add /var/guix/profiles/system.
  (populate-root-file-system): Add 'system' parameter.  Create
  /var/guix/profiles/system-1-link.
* guix/scripts/system.scm (install): Pass OS-DIR to
  'populate-root-file-system'.
* guix/build/vm.scm (initialize-root-partition): Add #:system-directory
  parameter, and pass it to 'populate-root-file-system'.
  (initialize-hard-disk): Add #:system-directory parameter, and pass it
  to 'initialize-root-partition'.
* gnu/system/vm.scm (qemu-image): Add #:os-derivation parameter and pass
  it to 'initialize-hard-disk'.
  (system-disk-image, system-qemu-image,
  system-qemu-image/shared-store): Pass #:os-derivation to 'qemu-image.
2014-06-27 19:06:08 +02:00
Ludovic Courtès b25937e318 guix system: Add 'reconfigure' action.
* guix/scripts/system.scm (%system-profile): New variable.
  (switch-to-system, previous-grub-entries): New procedures.
  (unless-file-not-found): New macro.
  (show-help): Add 'reconfigure'.
  (guix-system): Handle it.
* gnu/system.scm: Export 'operating-system-activation-script'.
* doc/guix.texi (Invoking guix system): Document it.
2014-06-27 00:12:40 +02:00
Ludovic Courtès c1202fb1f9 guix {system,offload}: Improve reporting of syntax errors.
* guix/scripts/system.scm (read-operating-system) <catch handler>: Add
  case for 'syntax-error'.  Correct message for default case.
* guix/scripts/offload.scm (build-machines) <catch handler>: Add case
  for 'syntax-error'.
* tests/guix-system.sh: New file.
* Makefile.am (SH_TESTS): Add it.
2014-06-27 00:12:40 +02:00
Ludovic Courtès cadf6cb4cf guix system: Gracefully handle 'install-grub' errors.
* guix/scripts/system.scm (install): Wrap 'install-grub' call in
  'false-if-exception'.  This is a followup to 641f9a2a.
2014-06-24 22:11:12 +02:00
Ludovic Courtès f513527a8e Merge branch 'core-updates' 2014-06-20 23:44:42 +02:00
Ludovic Courtès 00fe93338d substitute-binary: Warn about uninitialized ACL.
* guix/scripts/substitute-binary.scm (guix-substitute-binary): Call
  'check-acl-initialized'.
  (check-acl-initialized): Don't rely on 'equal?' to compare keys.
  Instead, convert keys to strings.
2014-06-19 23:35:41 +02:00
Ludovic Courtès eef4096c14 guix system: 'init' makes sure the target store directory exists.
* guix/scripts/system.scm (install): Before calling 'copy-closure', make
  sure directory (%store-prefix) under TARGET exists.
2014-06-19 23:35:41 +02:00
Ludovic Courtès 2eea253f4d substitute-binary: Avoid the term "narinfo" in user messages.
* guix/scripts/substitute-binary.scm (assert-valid-narinfo): Change
  message to avoid the term "narinfo".
2014-06-17 00:30:16 +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 b6b097ac81 guix build: Only 'guix build' sets #:print-build-trace.
This makes 'guix package' et al. slightly less verbose, by not emitting
"@ substituter-started" lines and similar.

* guix/scripts/build.scm (set-build-options-from-command-line): Pass
  #:print-build-trace.
  (%default-options): Add 'print-build-trace?'.
2014-06-09 18:55:48 +02:00
Ludovic Courtès fb729425dc guix system: Add 'disk-image' action.
* guix/scripts/system.scm (show-help): Add 'disk-image'.
  (guix-system)[parse-options]: Support 'disk-image' action.
  [option-arguments]: Likewise.
  Handle the 'disk-image' action.
* doc/guix.texi (Invoking guix system): Document 'disk-image'.
2014-05-22 23:24:13 +02:00
Ludovic Courtès 79b0d4e104 guix system: Check whether we are installing to /.
* guix/scripts/system.scm (install): Check whether TARGET is / and warn.
2014-05-19 23:52:40 +02:00
Ludovic Courtès c56d19fb11 guix system: Factorize out closure copy.
* guix/scripts/system.scm (copy-closure): New procedure.
  (install): Use it.
2014-05-19 23:52:40 +02:00
Ludovic Courtès c79d54fe41 guix system: 'guix system init' installs GRUB by default.
* guix/scripts/system.scm (install): Add #:grub?, #:grub.cfg, and
  #:device parameters; honor them.
  (show-help): Document '--no-grub'.
  (%options): Add '--no-grub'.
  (%default-options): Add 'install-grub?'.
  (guix-system): Honor 'install-grub?' option from OPTS.  Adjust
  'install' call accordingly.
* doc/guix.texi (Invoking guix system): Document '--no-grub'.
2014-05-19 23:52:39 +02:00
Ludovic Courtès 72b9d60df4 guix system: Add 'init' sub-command.
* guix/scripts/system.scm (install): New procedure.
  (guix-system)[parse-option]: Remove check for extraneous arguments.
  [match-pair, option-arguments]: New procedures.
  Use 'option-arguments'.  Honor 'init'.
  (show-help): Document 'init'.
* doc/guix.texi (Invoking guix system): Document 'init'.
2014-05-18 22:27:23 +02:00
Ludovic Courtès 7889394e05 guix system: Add 'build' action.
* guix/scripts/system.scm (show-help): Document 'build' action.
  (guix-system): Honor 'build' action.
* doc/guix.texi (Invoking guix system): Add 'build' action.
2014-05-16 21:56:00 +02:00
Ludovic Courtès 4cca91832b authenticate: Add compatibility hack for Guile 2.0.5.
* guix/scripts/authenticate.scm (%default-port-conversion-strategy): New
  variable.  Reported by Andreas Enge <andreas@enge.fr>.
2014-05-16 10:22:19 +02:00
Ludovic Courtès 6ef3644e34 pk-crypto: Add pretty-printer to 'gcry-error' exceptions.
* guix/pk-crypto.scm (string->canonical-sexp, sign, generate-key): Pass
  the procedure name as the first argument to 'throw'.
  (gcrypt-error-printer): New procedure.
  <top level>: Add call to 'set-exception-printer!'.
* guix/nar.scm (restore-one-item): Add 'proc' parameter to 'catch'
  handler for 'gcry-error.
* guix/scripts/archive.scm (%options, generate-key-pair, authorize-key):
  Likewise.
* guix/scripts/substitute-binary.scm (narinfo-signature->canonical-sexp):
  Likewise.
2014-04-22 11:41:52 +02:00
Ludovic Courtès 6f69588529 authenticate: Allow signatures with binary data to be written to stdout.
Fixes <http://bugs.gnu.org/17312>.

* guix/scripts/authenticate.scm (guix-authenticate): Add calls to
  'set-port-encoding!' and 'set-port-conversion-strategy!'.  Wrap body
  in 'with-fluids' form that sets '%default-port-encoding' and
  '%default-port-conversion-strategy'.
* tests/guix-authenticate.sh: Add test.
* tests/pk-crypto.scm ("hash corrupt due to restrictive locale
  encoding"): Add reference to bug.
2014-04-22 11:30:58 +02:00
Ludovic Courtès 30ce8012cd offload: '{send,receive}-files' wait for completion of the transfer.
Fixes situations where the remote 'guix build' is invoked before the
.drv has been completely copied, as reported at
<https://lists.gnu.org/archive/html/guix-devel/2014-04/msg00174.html>.

In some cases 'send-files' would return before the other end is done
importing the files, and so the subsequent 'guix build' invocation would
just miss the .drv file it refers to.

* guix/utils.scm (call-with-decompressed-port): Don't close PORT.
  (call-with-compressed-output-port): Likewise.
* tests/utils.scm ("compressed-output-port + decompressed-port"): Adjust
  accordingly.
* guix/scripts/offload.scm (send-files): Add explicit (close-pipe pipe)
  call.
  (retrieve-files): Likewise.
2014-04-14 00:24:24 +02:00
Ludovic Courtès 66ef541147 offload: Better synchronize with remote invocation of 'guix archive --missing'.
* guix/scripts/offload.scm (send-files)[missing-files]: Call 'waitpid'
  after reading all of MISSING.
2014-04-14 00:17:43 +02:00
Ludovic Courtès 2e7b5cea8c guix system: Add 'vm-image' action and '--image-size' option.
* guix/scripts/system.scm (%options): Add --image-size.
  (%default-options): Add 'image-size'.
  (guix-system)[parse-options]: Handle the 'vm-image' action.
  Honor them.
  (show-help): Update accordingly.
* doc/guix.texi (Invoking guix system): Add 'vm-image'.
2014-04-09 01:20:19 +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 c950141495 offload: Remove all the GC roots in case of multiple-output derivations.
* guix/scripts/offload.scm (remove-gc-root): Rename to...
  (remove-gc-roots): ... this.
  [builder]: Use 'scandir' and remove all the files starting with
  %GC-ROOT-FILE.
  (transfer-and-offload): Adjust to renaming; remove
  'false-if-exception' wraps.
2014-04-08 13:48:30 +02:00
Ludovic Courtès a4b42825a1 offload: Bail out when failing to register a GC root on the build machine.
* guix/scripts/offload.scm (register-gc-root): Call 'leave' when
  'close-pipe' returns non-zero.
2014-04-08 10:09:27 +02:00
Ludovic Courtès 731b996255 hydra: Add 'qemu-image' job.
* build-aux/hydra/demo-os.scm: New file.
* Makefile.am (EXTRA_DIST): Add it.
* build-aux/hydra/gnu-system.scm (qemu-jobs): New procedure.
  (hydra-jobs): Use it.
* guix/scripts/system.scm (read-operating-system): Export.
2014-04-05 22:40:16 +02:00
Ludovic Courtès 512314d738 guix package: Fix indentation of packages to remove.
* guix/scripts/package.scm (show-what-to-remove/install): Add space when
  showing packages to remove.
2014-04-05 21:04:17 +02:00
Ludovic Courtès ded1012f3c pki: Introduce 'write-acl', and fix wrong conversion in 'ensure-acl'.
* guix/pki.scm (write-acl): New procedure.
  (ensure-acl): Use it.  Fixes a regression introduced in 39831f1,
  whereby 'ensure-acl' would yield a wrong-type-arg error.
* guix/scripts/archive.scm (authorize-key): Use 'write-acl'.
2014-04-04 00:23:17 +02:00
Ludovic Courtès 4b00f3434e offload: Prevent the '.drv' and build result from being GC'd.
Before that, there was a small time window during which the GC could
wipe the .drv (before 'guix build' has been called), or the build
result (before 'retrieve-files' has started.)

* guix/scripts/offload.scm (remote-pipe): Add #:quote? parameter and
  honor it.
  (%gc-root-file): New variable.
  (register-gc-root, remove-gc-root): New procedures.
  (offload): Adjust comment.  Run 'guix build' with '-r %GC-ROOT-FILE'.
  (transfer-and-offload): Call 'register-gc-root' before
  sending (derivation-file-name DRV).  Call 'remove-gc-root' after the
  call to 'offload' or 'retrieve-files'.
  (send-files): Call 'remote-pipe' with #:quote? #f.
  (retrieve-files): Likewise.
2014-04-03 23:55:51 +02:00
Ludovic Courtès 27c68457d9 guix package: 'search-path-environment-variables' traverses module tree once.
* guix/scripts/package.scm (search-path-environment-variables)[manifest-entry->package]:
  Use 'find-best-packages-by-name' instead of 'find-packages-by-name'.
  On a profile with 140 packages, this reduces execution time of this
  procedure from 5.8 seconds to 2.9 seconds (50% improvement.)
2014-04-02 16:07:40 +02:00
Ludovic Courtès d2952326ae guix package: Register non-default profiles as GC roots.
* guix/scripts/package.scm (maybe-register-gc-root): New procedure.
* tests/guix-package.sh (profile): Grep the output of "guix gc
  --list-live" in a couple of places.
2014-04-02 16:07:40 +02:00
Ludovic Courtès 39831f1663 pki: Keep ACL in native sexp format to speed up 'authorized-key?'.
* guix/pki.scm (acl-entry-sexp, acl-sexp): Remove.
  (public-keys->acl, current-acl): Return a native sexp.
  (acl->public-keys, authorized-key?): Expect ACL to be a native sexp.
* guix/scripts/archive.scm (authorize-key): Convert ACL to
  canonical-sexp when writing it.
2014-04-01 23:47:51 +02:00
Ludovic Courtès 57832f2ce7 substitute-binary: Avoid consing 'regexp-exec' arguments.
* guix/scripts/substitute-binary.scm (regexp-exec): Change formals
  to (rx str . rest).
2014-04-01 23:47:51 +02:00
Ludovic Courtès c6e9485924 substitute-binary: Avoid reloading the ACL repeatedly.
* guix/scripts/substitute-binary.scm (guix-substitute-binary) <--query>:
  Cache the result of (current-acl); pass it to 'valid-narinfo?' calls.
  This saves 12% wall-clock time for "guix build emacs -n".
2014-04-01 23:47:51 +02:00
Ludovic Courtès e4687a5e68 Use 'signature-case' in (guix nar) and 'substitute-binary'.
* guix/nar.scm (restore-file-set)[assert-valid-signature]: Rewrite in
  terms of 'signature-case'.
* guix/scripts/substitute-binary.scm (narinfo-signature->canonical-sexp):
  Call 'leave' instead of 'raise' when SIGNATURE is invalid.
  (&nar-signature-error, &nar-invalid-hash-error): Remove.
  (assert-valid-signature): Add 'narinfo' parameter; remove 'port'.
  Rewrite in terms of 'signature-case' and 'leave'.  Mention NARINFO's
  URI in error messages.  Adjust caller.
  (narinfo-sha256): New procedure.
  (assert-valid-narinfo): Use it.
  (valid-narinfo?): Rewrite using 'narinfo-sha256' and
  'signature-case'.
* tests/substitute-binary.scm (assert-valid-signature,
  test-error-condition): Remove.
  ("corrupt signature data", "unauthorized public key", "invalid
  signature"): Remove.
2014-03-31 23:47:02 +02:00
Ludovic Courtès 8146fdb334 substitute-binary: Notify of valid signatures.
* guix/scripts/substitute-binary.scm (assert-valid-narinfo): Add
  #:verbose? parameter; when true, write "found valid signature".
  (valid-narinfo?): Pass #:verbose? #f.
2014-03-31 21:59:14 +02:00
Ludovic Courtès de28fefd77 guix archive: Make sure $sysconfdir/guix exists in '--authorize'.
* guix/scripts/archive.scm (authorize-key): Add 'mkdir-p' call.
  Reported by Alex Sassmannshausen <alex.sassmannshausen@gmail.com>.
2014-03-31 21:59:14 +02:00
Ludovic Courtès 36b5851df6 offload: Exit with code 100 upon build failures.
* guix/scripts/offload.scm (transfer-and-offload): Exit with code 100
  upon build failure.
2014-03-31 10:57:28 +02:00
Ludovic Courtès cdea30e061 substitute-binary: Defer narinfo authentication and authorization checks.
* guix/scripts/substitute-binary.scm (narinfo-signature->canonical-sexp):
  Catch 'gcry-error' around 'string->canonical-sexp' call, and re-raise
  as a SRFI-35 &message and &nar-signature-error.
  (narinfo-maker): Handle when SIGNATURE is #f or an invalid canonical
  sexp.
  (&nar-signature-error, &nar-invalid-hash-error): New variables.
  (assert-valid-signature): Use them.  Expect 'signature' to be a
  canonical sexp.
  (read-narinfo): Remove authentication and authorization checks.
  (%signature-line-rx): New variable.
  (assert-valid-narinfo, valid-narinfo?): New procedures.
  (guix-substitute-binary): Wrap body in 'with-error-handling'.
  [valid?]: New procedure.
  <--query>: Show only store items of narinfos that match
  'valid-narinfo?'.
  <--substitute>: Call 'assert-valid-narinfo'.
* tests/substitute-binary.scm (test-error*): Use 'test-equal'.
  (%keypair): Remove.
  (%public-key, %private-key): Load from signing-key.{pub,sec}.
  (signature-body): Add #:public-key parameter.
  (call-with-narinfo): New procedure.
  (with-narinfo): New macro.
  ("corrupt signature data", "unauthorized public key", "invalid
  signature"): Make the first argument to 'assert-valid-signature' a
  canonical sexp.
  ("invalid hash", "valid read-narinfo", "valid write-narinfo"):
  Remove.
  ("query narinfo with invalid hash", "query narinfo signed with
  authorized key", "query narinfo signed with unauthorized key",
  "substitute, invalid hash", "substitute, unauthorized key"): New
  tests.
2014-03-30 22:32:11 +02:00
Ludovic Courtès 00230df107 substitute-binary: Store the cache's URI in the local cached narinfo.
* guix/scripts/substitute-binary.scm (<narinfo>)[uri-base]: New field.
  (narinfo-maker): Pass CACHE-URL as the 'uri-base' value.
  (string->narinfo): Add 'cache-uri' parameter.
  (lookup-narinfo)[cache-entry]: Switch to version 1.  Add 'cache-uri'
  field.  Adjust body accordingly.
  (remove-expired-cached-narinfos): Switch to version 1 by default.
2014-03-30 12:02:10 +02:00
Nikita Karetnikov e9c6c58418 substitute-binary: Support the Signature field of a narinfo file.
* guix/scripts/substitute-binary.scm (<narinfo>): Add the 'signature'
  and 'contents' fields.
  (narinfo-signature->canonical-sexp): New function.
  (narinfo-maker): Add the 'signature' argument and use it.
  (assert-valid-signature): New function.
  (read-narinfo): Support the Signature field.
  (write-narinfo): Use 'narinfo-contents'.
  (%allow-unauthenticated-substitutes?): New variable.
* guix/base64.scm, tests/base64.scm, tests/substitute-binary.scm: New files.
* Makefile.am (SCM_TESTS): Add tests/base64.scm and
  tests/substitute-binary.scm.
  (MODULES): Add guix/base64.scm.
* test-env.in: Set 'GUIX_ALLOW_UNAUTHENTICATED_SUBSTITUTES'.
2014-03-30 12:02:10 +02:00
Ludovic Courtès 07fb21b231 offload: Remove erroneous 'close-pipe' call.
* guix/scripts/offload.scm (send-files): Remove 'close-pipe' call from
  'guard' handler ('pipe' here referred to Guile's 'pipe' procedure.)
2014-03-26 16:27:46 +01:00
Ludovic Courtès 6c41cce0be offload: Wait for the processes involved in 'guix archive --missing'.
* guix/scripts/offload.scm (send-files): Keep the second return value of
  'filtered-port'.  Call 'waitpid' on it.
2014-03-26 16:27:46 +01:00
Ludovic Courtès 236e66481d offload: Allow one transfer in each direction simultaneously.
* guix/scripts/offload.scm (transfer-and-offload): Use 'upload' lock
  instead of 'bandwidth' around 'send-files' calls, and 'download' lock
  around 'retrieve-files' call.
2014-03-26 15:06:52 +01:00
Ludovic Courtès 3dfd8af534 offload: Disable SSH-level compression.
* guix/scripts/offload.scm (remote-pipe): Remove '-z' lsh command line
  argument.  This makes transfers almost an order of magnitude slower.
  OpenSSH's ssh(1) man page notes: "Compression is desirable on modem lines
  and other slow connections, but will only slow down things on fast
  networks."  See also
  <http://www.spikelab.org/blog/transfer-largedata-scp-tarssh-tarnc-compared.html>.
2014-03-26 15:06:52 +01:00
Ludovic Courtès 8b7af63754 offload: Compress files being sent/retrieved.
* guix/scripts/offload.scm (send-files): Add "xz -dc |" to the remote
  pipe command.  Pass PIPE through 'call-with-compressed-output-port'.
  Remove 'close-pipe' call.
  (retrieve-files): Add "| xz -c" to the remote pipe command.  Pass PIPE
  through 'call-with-decompressed-port'.  Remove 'close-pipe' call.
2014-03-24 22:20:54 +01:00
Ludovic Courtès 9b0a2233db authenticate: Support reading the hash or key from stdin.
* guix/scripts/authenticate.scm (guix-authenticate): Add clauses
  for ("rsautl" "-sign" "-inkey" key) and ("rsautl" "-verify" "-inkey" _
  "-pubin").
* tests/guix-authenticate.sh (hash): Add test using -sign and -verify in
  a pipeline.
2014-03-22 22:57:10 +01:00
Ludovic Courtès 9dbe6e43ea authenticate: Move actual work to separate procedures.
* guix/scripts/authenticate.scm (read-canonical-sexp): Change to expect
  a port instead of a file name.
  (read-hash-data): Likewise.
  (sign-with-key, validate-signature): New procedures.
  (guix-authenticate): Rewrite in terms of these two procedures.
2014-03-22 22:57:10 +01:00
Ludovic Courtès 7a8024a33a utils: Add 'decompressed-port' and 'compressed-port'.
* guix/utils.scm (decompressed-port, compressed-port): New procedures.
* guix/scripts/substitute-binary.scm (decompressed-port): Remove.
  (guix-substitute-binary): Pass a symbol or #f as the first argument to
  'decompress-port'.
* tests/utils.scm ("compressed-port, decompressed-port, non-file"): New
  test.
2014-03-22 22:57:09 +01:00
Ludovic Courtès 1fda6840a8 pk-crypto: Don't use Ed25519 when libgcrypt is older than 1.6.0.
* guix/pk-crypto.scm (gcrypt-version): New procedure.
* guix/scripts/archive.scm (%key-generation-parameters): New variable.
  (%options) <generate-key>: Use it.
* tests/pk-crypto.scm ("sign + verify, Ed25519"): Skip if using gcrypt < 1.6.0.
2014-03-20 23:06:47 +01:00
Ludovic Courtès d81195bffd offload: Send build logs to file descriptor 4.
* guix/scripts/offload.scm (with-error-to-port): New macro.
  (remote-pipe): Add #:error-port parameter.  Use 'with-error-to-port'
  around 'open-pipe*' call.
  (build-log-port): New procedure.
  (offload): Change #:log-port to default to (build-log-port).  Call
  'remote-pipe' with #:error-port LOG-PORT.
2014-03-19 23:12:06 +01:00
Ludovic Courtès 19ee8c7dc5 substitute-binary: Quietly handle 404s when fetching narinfos.
* guix/scripts/substitute-binary.scm (fetch): Add #:quiet-404?
  parameter.  Upon &http-get-error, re-raise C if the QUIET-404? is
  true and the code is 404.
  (fetch-narinfo): Pass #:quiet-404? #t.
2014-03-19 22:26:08 +01:00
Ludovic Courtès 32a1eb8025 pk-crypto: Use RFC6979 when signing with an ECC or DSA key.
* guix/pk-crypto.scm (bytevector->hash-data): Add #:key-type parameter.
  Use the 'pkcs1' flag when KEY-TYPE is 'rsa', and 'rfc6979' when
  KEY-TYPE is 'ecc' or 'dsa'.
  (key-type): New procedure.
* guix/scripts/authenticate.scm (read-hash-data): Add 'key-type'
  parameter.  Pass it to 'bytevector->hash-data'.  Adjust caller
  accordingly.
* tests/pk-crypto.scm (%ecc-key-pair): New variable.
  ("key-type"): New test.
  ("sign + verify"): Pass #:key-type to 'bytevector->hash-data'.
  ("sign + verify, Ed25519"): New test.
2014-03-19 21:40:10 +01:00
Ludovic Courtès 1cbfce1669 guix archive: Generate curve Ed25519 keys by default.
* guix/scripts/archive.scm (%options) <generate-key>: Default to curve
  Ed25519.  Suggested by Christian Grothoff <grothoff@in.tum.de>.
2014-03-17 23:49:35 +01:00
Ludovic Courtès d0a850698a guix archive: Improve '--generate-key' error reporting.
* guix/scripts/archive.scm (%options) <generate-key>: Report the error
  source and string when 'string->canonical-sexp' fails.
2014-03-17 23:47:18 +01:00
Ludovic Courtès 1a8ea0a188 offload: Fix 'choose-build-machine' for several machines.
* guix/scripts/offload.scm (choose-build-machine)[undecorate]: Turn into
  a two-argument procedure.
2014-03-13 22:57:21 +01:00