Commit Graph

157 Commits

Author SHA1 Message Date
Ludovic Courtès
bdff90a16a guix build: Move 'set-build-options' call earlier.
* guix/scripts/build.scm (guix-build): Move 'set-build-options' call
  before 'show-what-to-build'.
2014-02-12 00:03:20 +01:00
Ludovic Courtès
92cb2e2888 offload: Have 'build-machines' honor its argument.
* guix/scripts/offload.scm (build-machines): Honor FILE.
2014-02-02 01:32:50 +01:00
Ludovic Courtès
a76611c435 offload: Do not try to retrieve anything upon build failure.
* guix/scripts/offload.scm (offload): Add 'log-port' keyword parameter.
  Handle log display here.  Return the result of (close-pipe pipe).
  (process-request): Adjust 'offload' call site accordingly.  Call
  'retrieve-files' only when 'offload' returns zero; exit when 'offload'
  returns non-zero.
2014-01-27 21:32:59 +01:00
Ludovic Courtès
49e6291a7a Add 'guix offload' as a daemon build hook.
* nix/nix-daemon/guix-daemon.cc (GUIX_OPT_NO_BUILD_HOOK): New macro.
  (options): Add '--no-build-hook'.
  (parse_opt): Handle it.
  (main)[HAVE_DAEMON_OFFLOAD_HOOK]: Set 'useBuildHook' by default.
  Set $NIX_BUILD_HOOK to our offload hook unless otherwise specified.
  [!HAVE_DAEMON_OFFLOAD_HOOK]: Clear 'useBuildHook'.
* pre-inst-env.in: Set and export NIX_BUILD_HOOK.
* nix/scripts/offload.in, guix/scripts/offload.scm: New files.
* guix/ui.scm (show-guix-help)[internal?]: Add "offload".
* config-daemon.ac: Call 'GUIX_CHECK_UNBUFFERED_CBIP'.
  Instantiate 'nix/scripts/offload'.  Set 'BUILD_DAEMON_OFFLOAD'
  conditional, and optionally define 'HAVE_DEAMON_OFFLOAD_HOOK' cpp
  macro.
* daemon.am (nodist_pkglibexec_SCRIPTS)[BUILD_DAEMON_OFFLOAD]: Add it.
* Makefile.am (MODULES)[BUILD_DAEMON_OFFLOAD]: Add
  'guix/scripts/offload.scm'.
  (EXTRA_DIST)[!BUILD_DAEMON_OFFLOAD]: Likewise.
* m4/guix.m4 (GUIX_CHECK_UNBUFFERED_CBIP): New macro.
* doc/guix.texi (Setting Up the Daemon): Move most of the body to...
  (Build Environment Setup): ... this.  New subsection.
  (Daemon Offload Setup): New subsection.
2014-01-24 00:01:50 +01:00
Ludovic Courtès
d28684b5a5 pki: Factorize signature manipulation procedures.
* guix/pki.scm (signature-subject, signature-signed-data,
  valid-signature?): New procedures.
* guix/scripts/authenticate.scm (guix-authenticate): Adjust to use
  them.
2014-01-24 00:01:49 +01:00
Ludovic Courtès
d43eb499a6 Update 'nix-upstream' sub-module; adjust build system, doc, and substituter.
* nix-upstream: Update sub-module.
* daemon.am (libutil_a_SOURCES): Add affinity.cc.
  (libutil_headers): Add affinity.hh.
  (libexec_PROGRAMS, nix_setuid_helper_SOURCES,
  nix_setuid_helper_CPPFLAGS, nix_setuid_helper_LDADD): Remove.
* doc/guix.texi (Setting Up the Daemon): Remove paragraph about
  'nix-setuid-helper'.
* guix/scripts/substitute-binary.scm (guix-substitute-binary): Exit 0 when
  %CACHE-URL has an HTTP scheme and looking up its host fails.
  Always print a newline to stdout when starting.
2014-01-18 22:32:50 +01:00
Ludovic Courtès
eb9a9feefd guix package: Gracefully handle EPIPE on '--search'.
* guix/scripts/package.scm (guix-package): Wrap body of 'search' in
  'leave-on-EPIPE'.
2014-01-13 18:51:07 +01:00
Ludovic Courtès
80d0447c95 config: '%state-directory' always honors $NIX_STATE_DIR.
* guix/config.scm.in (%state-directory): Honor $NIX_STATE_DIR.
* guix/scripts/package.scm (%profile-directory): Use %state-directory
  directly.
* guix/store.scm (%default-socket-path, log-file): Likewise.
2014-01-08 21:12:55 +01:00
Ludovic Courtès
87236aed77 archive: Add '--missing'.
* guix/scripts/archive.scm (show-help, %options): Add '--missing'.
  (guix-archive)[lines]: New procedure.
  Use it to honor '--missing'.
* tests/guix-archive.sh: Add tests.
* doc/guix.texi (Invoking guix archive): Document '--missing'.
2014-01-06 22:25:29 +01:00
Ludovic Courtès
590e4154b6 archive: Make sure $sysconfdir/guix exists.
* guix/pki.scm (ensure-acl): Make sure the directory of %ACL-FILE
  exists.
* guix/scripts/archive.scm (generate-key-pair): Likewise for
  %PUBLIC-KEY-FILE.
2014-01-05 23:40:06 +01:00
Ludovic Courtès
425b0bfc2e guix build: Add '--no-build-hook'.
* guix/scripts/build.scm (%default-options): Add 'build-hook?' pair.
  (show-help, %options): Add --no-build-hook.
  (guix-build): Pass the 'build-hook?' value to 'set-build-options'.
* doc/guix.texi (Invoking guix build): Document '--no-build-hook'.
2014-01-05 22:58:32 +01:00
Ludovic Courtès
1a43e4dc57 guix package: Gracefully deal with EPIPE on stdout for --list-*.
* guix/scripts/package.scm (leave-on-EPIPE): New macro.
  (guix-package): Use it for 'list-installed', 'list-available', and
  '--list-generations'.
* tests/guix-package.sh: Add test.
2014-01-04 22:45:33 +01:00
Ludovic Courtès
f82cc5fdbe archive: Add '--authorize'.
* guix/scripts/archive.scm (authorize-key): New procedure.
  (guix-archive): Call it when OPTS contains 'authorize-key'.
* tests/guix-archive.sh: Add test with invalid public key.
* guix/pki.scm: Export '%acl-file'.
* doc/guix.texi (Invoking guix archive): Make it clear that '--import'
  works only with authorized keys.  Document '--authorize'.
2013-12-30 23:18:52 +01:00
Ludovic Courtès
554f26ece3 archive: Add '--generate-key'.
* guix/pk-crypto.scm (error-source, error-string): New procedures.
* guix/pki.scm (%private-key-file): New variable.
* guix/scripts/archive.scm (show-help): Document '--generate-key'.
  (%options): Add "generate-key".
  (generate-key-pair): New procedure.
  (guix-archive): Call 'generate-key' when OPTS contains a
  'generate-key' pair.
* doc/guix.texi (Setting Up the Daemon): Suggest generating a key pair.
  (Invoking guix archive): Document '--generate-key'.
2013-12-30 22:57:37 +01:00
Ludovic Courtès
c909dab269 authenticate: Consistently use 'leave' for fatal error reporting.
* guix/scripts/authenticate.scm (guix-authenticate): Replace all uses of
  'format' + 'exit' with 'leave'.
2013-12-30 18:23:44 +01:00
Ludovic Courtès
96e5085c81 authenticate: Disallow imports signed with unauthorized keys.
* guix/scripts/authenticate.scm (signature-sexp): Remove.
  (guix-authenticate): Upon '-verify', check whether the signature's
  public key passes 'authorized-key?'.
2013-12-29 15:57:24 +01:00
Ludovic Courtès
04d4c8a439 Move 'with-atomic-file-output' to (guix utils).
* guix/scripts/substitute-binary.scm (with-atomic-file-output): Move to...
* guix/utils.scm (with-atomic-file-output): ... here.
2013-12-29 15:57:24 +01:00
Ludovic Courtès
6df1fb8991 authenticate: Store the public key as part of the signature.
* guix/scripts/authenticate.scm (signature-sexp): New procedure.
  (guix-authenticate): Use it to produce the signature.  Adjust
  verification code accordingly.
* tests/store.scm ("import corrupt path"): Adjust test accordingly.
2013-12-29 15:57:23 +01:00
Ludovic Courtès
b0a33ac157 pk-crypto: Rename 'gcry-sexp' to 'canonical-sexp'.
* guix/pk-crypto.scm: Rename procedures, variables, etc. from
  'gcry-sexp' to 'canonical-sexp'.  Add comment with references.
* guix/scripts/authenticate.scm, tests/pk-crypto.scm: Adjust
  accordingly.
2013-12-29 15:57:23 +01:00
Ludovic Courtès
760c60d684 Add 'guix archive'.
* guix/scripts/archive.scm, tests/guix-archive.sh: New files.
* Makefile.am (MODULES): Add 'archive.scm'.
  (SH_TESTS): Add 'guix-archive.sh'.
* doc/guix.texi (Invoking guix archive): New section.
* guix/scripts/build.scm: Export 'derivation-from-expression'.
* guix/scripts/package.scm: Export 'specification->package+output'.
2013-12-22 01:08:21 +01:00
Ludovic Courtès
81fa80b245 guix build: Improve procedural decomposition.
* guix/scripts/build.scm (%store): Remove.
  (derivation-from-expression): Add 'store' parameter.  Adjust caller
  accordingly.
  (register-root): New procedure, formerly within 'guix-build'.
  (options->derivations): New procedure, formerly inline within
  'guix-build'.
  (guix-build): Adjust accordingly.
2013-12-21 22:53:58 +01:00
Ludovic Courtès
3f26bfc18a Factorize package search between 'guix package' and 'guix build'.
* guix/scripts/package.scm (newest-available-packages): Remove.
  (find-best-packages-by-name): Move to...
* gnu/packages.scm (find-best-packages-by-name): ... here.
  (find-newest-available-packages): Memoize.
* guix/scripts/build.scm (specification->package): New procedure,
  formerly called 'find-package' within 'guix-build'.
  (guix-build): Adjust accordingly.
2013-12-21 22:36:32 +01:00
Ludovic Courtès
526382ff92 daemon: Implement signed archive import/export.
* guix/scripts/authenticate.scm, nix/scripts/guix-authenticate.in,
  tests/signing-key.pub, tests/signing-key.sec: New files.
* po/POTFILES.in: Add 'guix/scripts/authenticate.scm'.
* guix/store.scm (dump-port): New procedure.
  (process-stderr): Add 'user-port' optional parameter.  Handle
  the %STDERR-WRITE and %STDERR-READ cases as expected.
  (import-paths, export-path, export-paths): New procedures.
* tests/store.scm ("export/import several paths", "import corrupt
  path"): New tests.
* Makefile.am (MODULES): Add 'guix/scripts/authenticate.scm'.
  (EXTRA_DIST): Add 'tests/signing-key.{pub,sec}'.
* daemon.am (libstore_a_CPPFLAGS)[-DNIX_CONF_DIR]: Change 'NIX_CONF_DIR'
  to .../guix.  Change 'OPENSSL_PATH' to 'guix-authenticate'.
* config-daemon.ac: Instantiate 'nix/scripts/guix-authenticate'.
* nix/nix-daemon/guix-daemon.cc (main): Augment $PATH to include
  'settings.nixLibexecDir'.
* test-env.in: Export 'NIX_CONF_DIR' and 'NIX_LIBEXEC_DIR'.  Populate
  $NIX_CONF_DIR.
2013-12-20 17:17:42 +01:00
Ludovic Courtès
3dbeecd2ff pull: Move build code to (guix build pull).
* guix/build/pull.scm: New file.
* Makefile.am (MODULES): Add it.
* guix/scripts/pull.scm (unpack): Use it.
2013-12-16 23:26:48 +01:00
Mark H Weaver
6447738c01 guix package: allow multiple arguments after -i, -r, and -u.
* guix/scripts/package.scm (%options): Adapt option processors to accept and
  return a second seed value: 'arg-handler', which handles bare arguments (if
  not false).  The install, remove, and upgrade option processors return an
  arg-handler that repeat the same operation.  All other option processors
  return #f as the arg-handler.  Make the arguments to install and remove
  optional.  The upgrade option processor deletes (upgrade . #f) from the
  alist before adding a new entry.
  (guix-package): Procedures passed to 'args-fold*' accept the new seed value
  'arg-handler'.  The 'operand-proc' uses 'arg-handler' (if not false).

* doc/guix.texi (Invoking guix package): Update docs.

* tests/guix-package.sh: Add test.
2013-12-14 16:25:02 -05:00
Ludovic Courtès
52a79f1e73 pull: Compile guix/ files before gnu/ files.
* guix/scripts/pull.scm (unpack)[builder]: Build files under guix/
  before files under gnu/.
2013-12-14 16:48:38 +01:00
Ludovic Courtès
ca6c4fa190 pull: Compile files in parallel.
* guix/scripts/pull.scm (unpack)[builder](compile-file*): Remove.
  (call-with-process, p-for-each): New procedures.  Use them to compile
  files in parallel.
2013-12-14 16:32:42 +01:00
Ludovic Courtès
0c2e1dd45d pull: Limit memory usage when compiling.
Reported by Arne Babenhauserheide <arne.babenhauserheide@kit.edu>.

* guix/scripts/pull.scm (unpack)[builder](compile-file*): Change to run
  'compile-file' in a child process.  This limits memory usage; before
  that memory usage was proportional to the number of files to compile.
2013-12-14 16:32:42 +01:00
Ludovic Courtès
dd1a5a152c derivations: Use more keyword parameters for 'build-expression->derivation'.
* guix/derivations.scm (build-expression->derivation): Turn 'system' and
  'inputs' into keyword parameters.
  Adjust callers accordingly.
* gnu/system/linux.scm, gnu/system/vm.scm, guix/build-system/cmake.scm,
  guix/build-system/gnu.scm, guix/build-system/perl.scm,
  guix/build-system/python.scm, guix/build-system/trivial.scm,
  guix/download.scm, guix/packages.scm, guix/profiles.scm,
  guix/scripts/pull.scm, tests/derivations.scm, tests/guix-build.sh,
  tests/monads.scm, tests/store.scm, tests/union.scm: Adjust users of
  'build-expression->derivation' and 'derivation-expression'
  accordingly.
* doc/guix.texi (Derivations): Adjust 'build-expression->derivation'
  documentation accordingly.
  (The Store Monad): Likewise for 'derivation-expression'.
2013-12-04 16:07:53 +01:00
Ludovic Courtès
de6792699e substitute-binary: Work around Guile 2.0.5's broken 'n-par-map'.
* guix/scripts/substitute-binary.scm (n-par-map*): New procedure.
  (guix-substitute-binary): Use it instead of 'n-par-map'.
  Reported by Nikita Karetnikov and Eric Bavier.
2013-11-26 22:20:39 +01:00
Ludovic Courtès
b874f305e5 guix package: Honor the current output when upgrading.
* guix/scripts/package.scm (specification->package+output): Pass OUTPUT
  to 'package-specification->name+version+output'.
2013-11-24 15:30:06 +01:00
Ludovic Courtès
ac5de156ae guix build: '-e' can be passed a monadic thunk.
* guix/ui.scm (read/eval): New procedure.
  (read/eval-package-expression): Use it.
* guix/scripts/build.scm (derivations-from-package-expressions): Rename to...
  (derivation-from-expression): ... this.  Accept procedures, under the
  assumption that they are monadic thunk.
  (show-help): Adjust accordingly.
  (guix-build): Ditto.
* tests/guix-build.sh: Add test.
* doc/guix.texi (Invoking guix build): Augment description of '-e'.
2013-11-18 23:08:20 +01:00
Ludovic Courtès
c509bf8c87 substitute-binary: Adjust timeout handling for Guile > 2.0.9.
* guix/scripts/substitute-binary.scm (with-timeout): Update comment to
  mention the fix's commit ID.
  (fetch): In the 'with-timeout' handler, close PORT only one Guile
  versions < 2.0.9.39.  Before that, on Guile >= 2.0.9.39, the HTTP
  client would end up trying to read from a closed file descriptor.
2013-11-14 01:09:07 +01:00
Ludovic Courtès
bf4211523b guix build: Add '--log-file'.
* guix/scripts/build.scm (show-help): Add '--log-file'.
  (%options): Likewise.
  (guix-build): Set %FILE-PORT-NAME-CANONICALIZATION.  Honor '--log-file'.
* tests/guix-build.sh: Add '--log-file' tests.
* doc/guix.texi (Invoking guix build): Document '--log-file'.
2013-11-12 01:06:45 +01:00
Ludovic Courtès
50dc48922c substitute-binary: Increase lookup concurrency to reduce latency.
* guix/scripts/substitute-binary.scm (%lookup-threads): New variable.
  (guix-substitute-binary): Use 'n-par-map' instead of 'par-map' for
  batch 'lookup-narinfo' calls.
2013-11-08 22:47:02 +01:00
Ludovic Courtès
45b418d634 guix package: Show the output name of what's being removed.
* guix/scripts/package.scm (show-what-to-remove/install): Show the
  output name of packages being removed.
2013-11-01 23:59:25 +01:00
Ludovic Courtès
1b5ba6b1e9 guix package: Fix indentation of "will be removed" messages.
* guix/scripts/package.scm (show-what-to-remove/install): Remove extra
  indentation from the removal sentences.
2013-11-01 23:21:01 +01:00
Ludovic Courtès
a20787706c guix package: Allow removal of a specific package output.
Fixes <http://bugs.gnu.org/15756>.

* guix/profiles.scm (<manifest-pattern>): New record type.
  (remove-manifest-entry): Remove.
  (entry-predicate, manifest-matching-entries): New procedures.
  (manifest-remove): Accept a list of <manifest-pattern>.
  (manifest-installed?): Replace 'name' parameter by 'pattern', a
  <manifest-pattern>.
* guix/scripts/package.scm (options->removable): Return a list of
  <manifest-pattern>.
  (guix-package)[process-action]: Use 'manifest-matching-entries' to
  compute the list of packages to remove.
* tests/profiles.scm: New file.
* Makefile.am (SCM_TESTS): Add it.
2013-11-01 23:21:01 +01:00
Ludovic Courtès
537630c5a7 guix package: Separate '--remove' option processing.
* guix/scripts/package.scm (options->removable): New procedure.
  (guix-package)[process-actions]: Use it.  Rename 'remove*' to 'remove'
  and 'install*' to 'install'.
2013-11-01 23:21:00 +01:00
Ludovic Courtès
2876b98925 ui: Factorize package specification parsing.
* guix/ui.scm (package-specification->name+version+output): New
  procedure.
* guix/scripts/package.scm (specification->package+output): Use it.
* tests/ui.scm ("package-specification->name+version+output"): New test.
2013-11-01 23:21:00 +01:00
Ludovic Courtès
cc4ecc2d88 Add (guix profiles).
* guix/scripts/package.scm (show-what-to-remove/install): New procedure,
  moved from...
  (guix-package): ... here.
  (<manifest>, make-manifest, <manifest-entry>,
  profile-manifest, manifest->sexp, sexp->manifest, read-manifest,
  write-manifest, remove-manifest-entry, manifest-remove,
  manifest-installed?, manifest=?, profile-regexp, generation-numbers,
  previous-generation-number, profile-derivation, generation-number,
  generation-file-name, generation-time, lower-input): Move to...
* guix/profiles.scm: ... here.  New file.
* Makefile.am (MODULES): Add it.
2013-11-01 23:21:00 +01:00
Ludovic Courtès
477d30d0d8 guix package: Factorize generation file name computation.
* guix/scripts/package.scm (generation-file-name): New procedure.
  Change all occurrences of (format #f "~a-~a-link" profile number) to
  use it.
2013-10-30 22:09:33 +01:00
Ludovic Courtès
1fcc3ba309 guix package: Specify inputs for each manifest entry.
* guix/scripts/package.scm (<manifest-entry>): Add 'inputs' field.
  (manifest=?, lower-input): New procedure.
  (profile-derivation)[builder]: Add #:log-port argument to
  'union-build'.
  [ensure-valid-input]: Remove.
  Add each entry's inputs to the input list.
  (options->installable): Return just the list of entries.
  [package->manifest-entry]: Set 'inputs' field.
  [canonicalize-deps]: Rename to...
  [deduplicate]: ... this.  Remove input fiddling.
  (guix-package)[process-actions]: Use 'manifest=?' to compare the new
  and old manifests.  Pass directly PROF-DRV to 'show-what-to-build'.
  Pass #:print-build-trace #f to 'set-build-options'.
2013-10-30 22:09:33 +01:00
Ludovic Courtès
d595e456c1 guix package: Always use the term "profile", not "user environment".
* guix/scripts/package.scm (%user-environment-directory): Rename to...
  (%user-profile-directory): ... this.  Update users accordingly.
  (profile-derivation): Use the term "profile" instead of "user
  environment", and use "profile" as the derivation name.
2013-10-30 22:09:32 +01:00
Ludovic Courtès
f067fc3e77 guix package: Introduce <manifest> and <manifest-entry> types.
* guix/scripts/package.scm (<manifest>, <manifest-entry>): New record
  types.
  (make-manifest, read-manifest, manifest->sexp, sexp->manifest,
  read-manifest, write-manifest, remove-manifest-entry, manifest-remove,
  manifest-installed?): New procedures.
  (profile-derivation): Take a manifest as the second parameter.  Use
  'manifest->sexp'.  Expect <manifest-entry> objects instead of
  "tuples".  Adjust callers accordingly.
  (search-path-environment-variables): Changes 'packages' parameter to
  'entries'.  Rename 'package-in-manifest->package' to
  'manifest-entry->package'; expect <manifest-entry> objects.
  (display-search-paths): Rename 'packages' to 'entries'.
  (options->installable): Change 'installed' to 'manifest'.  Have
  'canonicalize-deps' return name/path tuples instead of raw packages.
  Rename 'package->tuple' to 'package->manifest-entry'.  Use
  <manifest-entry> objects instead of tuples.
  (guix-package)[process-actions]: Likewise.  Rename 'packages' to
  'entries'.
  [process-query]: Use 'manifest-entries' instead of
  'manifest-packages'.
2013-10-30 22:09:32 +01:00
Ludovic Courtès
edac884624 guix package: Better separate option processing.
* guix/scripts/package.scm (find-package): Rename to...
  (specification->package+output): ... this.  Rename 'name' parmameter
  to 'spec'.  Return a package and output name instead of a tuple.
  (options->installable): New procedure
  (guix-package)[process-actions]: Use it, and remove corresponding
  code.
2013-10-30 22:09:32 +01:00
Ludovic Courtès
d46d8794a1 guix package: Declutter the entry point.
* guix/scripts/package.scm (newest-available-packages,
  find-best-packages-by-name, find-package, upgradeable?): New
  procedures, moved from...
  (guix-package): ... here.
2013-10-29 22:03:02 +01:00
Ludovic Courtès
b2ba65c897 guix package: '--search' matches against package names.
* guix/scripts/package.scm (find-packages-by-description): Return
  packages whose name matches RX.
2013-10-15 22:59:50 +02:00
Ludovic Courtès
178f77b2d2 pull: Compile modules correctly regardless of the compilation order.
* guix/scripts/pull.scm (unpack)[builder]: Work around
  <http://bugs.gnu.org/15602>.
2013-10-13 22:50:11 +02:00
Ludovic Courtès
52af657aee pull: Simplify the builder.
* guix/scripts/pull.scm (unpack)[builder]: Use 'copy-recursively' and
  'copy-file' instead of 'file-system-fold'.
2013-10-13 01:14:21 +02:00