Commit Graph

37 Commits

Author SHA1 Message Date
Ludovic Courtès 8be3b8a39b Change default store values from /nix/store to /gnu/store.
* gnu/packages/ld-wrapper.scm (%store-directory): Change the default to
  /gnu/store.
* guix/build/utils.scm (%store-directory): New procedure.
  (remove-store-references): Use it for the default value of 'store'.
* guix/packages.scm (patch-and-repack)[builder]: Change default store to
  /gnu/store.
2014-03-10 23:54:27 +01:00
Ludovic Courtès f1352766fa utils: 'find-files' always returns a proper list.
Reported at <http://bugs.gnu.org/15608>.

* guix/build/utils.scm (find-files): Change the 'error' procedure to
  return RESULT.  Before we would end up with an improper list.
2013-10-16 15:53:59 +02:00
Ludovic Courtès 66018f1c33 utils: 'find-files' returns a sorted list.
* guix/build/utils.scm (find-files): Sort the result lexicographically.
* guix/scripts/pull.scm (unpack): Don't sort the result of 'find-files'.
2013-09-15 23:21:30 +02:00
Ludovic Courtès d475b25953 utils: Re-export `alist-cons' and `alist-delete'.
* guix/build/utils.scm: Re-export `alist-cons' and `alist-delete'.
2013-07-03 23:08:41 +02:00
Ludovic Courtès b15669f37d utils: `set-path-environment-variable' calls `unsetenv' for empty values.
* guix/build/utils.scm (set-path-environment-variable): When VALUE is
  the empty string, call `unsetenv' instead of `setenv'.
* gnu/packages/guile.scm (guile-2.0)[arguments]: Remove `unsetenv'
  trick.
2013-06-22 16:42:46 +02:00
Nikita Karetnikov 01155b1808 utils: Adjust 'wrap-program'.
* guix/build/utils.scm (wrap-program): Fix computation of PROG-REAL and
  PROG-TMP when PROG is an absolute file name.  Add "$@" in the
  generated script, and quote PROG-REAL.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2013-04-30 16:58:59 +02:00
Nikita Karetnikov 30db6af1de utils: Add 'wrap-program'.
* guix/build/utils.scm (wrap-program): New procedure.
2013-03-07 00:46:23 +01:00
Ludovic Courtès 12761f48ea utils: Add a #:follow-symlinks? parameter to `copy-recursively'.
* guix/build/utils.scm (copy-recursively): Turn `log' into a keyword
  parameter.  Add the `follow-symlinks?' parameter and honor it.
2013-03-05 19:03:39 +01:00
Ludovic Courtès e65df6a63a utils: Add `delete-file-recursively'.
* guix/build/utils.scm (delete-file-recursively): New procedure.
2013-03-05 18:53:53 +01:00
Andreas Enge ca8def6e6f Patch-shebang: Do not add space after interpreter without argument.
* guix/build/utils.scm (patch-shebang): Do not add a space after a command
  interpreter not followed by an argument; this made two tests of
  coreutils fail.
2013-02-23 23:27:46 +01:00
Andreas Enge 11996d85d3 Patch-shebang: Handle "#!/usr/bin/env command"
* guix/build/utils.scm (patch-shebang): Handle replacement of
   "#!.*/env CMD ARGS" by "#!/nix/store/path/.../to/CMD ARGS".
2013-02-23 20:32:03 +01:00
Ludovic Courtès 4155e2a909 Update license headers of builder-side code.
Change license headers with this script:

  (use-modules (guix build utils))

  (fluid-set! %default-port-encoding "UTF-8")

  (substitute* (cons "distro/packages/ld-wrapper.scm"
		     (find-files "guix/build" "\\.scm$"))
    (("^([[:graph:]]+) This file is part of Guix." _ comment-start)
     (string-append comment-start " This file is part of GNU Guix."))
    (("^([[:graph:]]+) Guix --- Nix package management.*" _ comment-start)
     (string-append comment-start
		    " GNU Guix --- Functional package management for GNU\n"))
    (("^([[:graph:]]+) Guix is " _ comment-start)
     (string-append comment-start " GNU Guix is "))
    (("^([[:graph:]]+) along with Guix." _ comment-start)
     (string-append comment-start " along with GNU Guix."))
    (("^([[:graph:]]+) Copyright \\(C\\)" _ comment-start)
     (string-append comment-start " Copyright ©")))

* distro/packages/ld-wrapper.scm, guix/build/download.scm,
  guix/build/gnu-build-system.scm, guix/build/union.scm,
  guix/build/utils.scm: Update license headers.
2013-01-05 16:08:07 +01:00
Ludovic Courtès 7584f822bf utils: Add `which'.
* guix/build/utils.scm (which): New procedure.

* distro/packages/lsh.scm (lsh): Use `which' instead of `search-path'.
* distro/packages/perl.scm (perl): Likewise.
* distro/packages/attr.scm (attr): Likewise.
2013-01-05 16:02:32 +01:00
Ludovic Courtès 93b0357575 utils: Use binary I/O primitives for `remove-store-references'.
* guix/build/utils.scm (fold-port-matches)[get-char]: New procedure.
  (remove-store-references): Use `put-u8' and `put-bytevector'.
2013-01-01 23:12:34 +01:00
Ludovic Courtès bc5bf85fa2 utils: Restore the mtime/atime of patched files.
* guix/build/utils.scm (set-file-time): New procedure.
  (patch-shebang): New `keep-mtime?' parameter; call `set-file-time'
  when it's true.
  (patch-makefile-SHELL): Likewise.
2012-12-31 01:17:43 +01:00
Ludovic Courtès c089511288 build-system/gnu: Patch shebangs in all the source; patch SHELL in makefiles.
* guix/build/utils.scm (call-with-ascii-input-file): New procedure.
  (patch-shebang): Use it.
  (patch-makefile-SHELL): New procedure.
* guix/build/gnu-build-system.scm (patch-source-shebangs): Patch all the
  files, not just executables; remove `po/Makefile.in.in' patching.
  (patch-generated-files): Rename to...
  (patch-generated-file-shebangs): ... this.  Patch executables and
  makefiles.
  (%standard-phases): Adjust accordingly.

* distro/packages/autotools.scm (libtool): Remove call to `patch-shebang'.
* distro/packages/base.scm (gcc-4.7): Likewise.
  (guile-final): Remove hack to skip `test-command-line-encoding2'.
* distro/packages/bash.scm (bash): Remove `pre-configure-phase'.
* distro/packages/readline.scm (readline): Likewise.
* distro/packages/ncurses.scm (ncurses): Remove `pre-install-phase'.
2012-12-21 22:31:25 +01:00
Ludovic Courtès a18b4d085b utils: Add a `progress' parameter to `dump-port'.
* guix/build/utils.scm (dump-port): Add a `progress' keyword parameter.
  Call it after each transfer.
2012-12-20 01:38:56 +01:00
Ludovic Courtès d008415219 build-system/gnu: Patch shebangs in executable source files.
This allows many packages to build in a chroot that lacks /bin and
thus /bin/sh.

* guix/build/gnu-build-system.scm (patch-source-shebangs): New
  procedure.
  (%standard-phases): Add it.
* guix/build/utils.scm (executable-file?): New procedure.
* distro/packages/perl.scm (perl): Don't use /bin/sh to run `Configure'.
2012-12-15 16:35:26 +01:00
Ludovic Courtès 74baf333bf utils: Make the buffer size of `dump-port' a parameter.
* guix/build/utils.scm (dump-port): Make `buffer-size' a keyword
  parameter.
2012-12-15 15:54:29 +01:00
Ludovic Courtès 20d83444dd utils: Remove special `substitute*' syntax for lists of files.
* guix/build/utils.scm (substitute*): Remove special syntax for
  list-of-files; instead, check whether FILE is `list?' at run time.

* distro/packages/base.scm (gcc-4.7, %binutils-static): Adjust
  accordingly.
2012-10-26 09:07:37 +02:00
Ludovic Courtès 4c261f4169 utils: Add `find-files'.
* guix/build/utils.scm (find-files): New procedure.
2012-10-17 23:25:25 +02:00
Ludovic Courtès c0746cc9db utils: Add `copy-recursively'; use it.
* guix/build/utils.scm (copy-recursively): New procedure.

* distro/packages/base.scm (%guile-static-stripped): Use it.
2012-10-17 23:25:25 +02:00
Ludovic Courtès 7da95264f1 utils: Add `mkdir-p'; use it.
* guix/build/utils.scm (mkdir-p): New procedure.

* distro/packages/base.scm (gnu-make-boot0, gcc-boot0-wrapped,
  ld-wrapper-boot3, %static-binaries, %guile-static-stripped): Use it.
* distro/packages/typesetting.scm (lout): Likewise.
2012-10-17 23:25:25 +02:00
Ludovic Courtès 91133c2d71 utils: Add `fold-port-matches' and `remove-store-references'.
* guix/build/utils.scm (fold-port-matches, remove-store-references): New
  procedures.

* tests/build-utils.scm ("fold-port-matches", "fold-port-matches,
  trickier", "fold-port-matches, with unmatched chars"): New tests.
2012-10-16 23:01:01 +02:00
Ludovic Courtès dcd7290654 utils: Add `with-atomic-file-replacement'.
* guix/build/utils.scm (with-atomic-file-replacement): New procedure.
  (substitute): Use it.
2012-10-16 17:31:16 +02:00
Ludovic Courtès 9d9ef458e8 utils: Make `set-path-environment-variable' verbose.
* guix/build/utils.scm (set-path-environment-variable): Print ENV-VAR
  and its value.
2012-09-06 22:57:46 +02:00
Ludovic Courtès 8197c978ef utils: Change `substitute*' to allow iteration over several matches.
* guix/build/utils.scm (substitute): Do not pass the OUT to PROC; use
  `list-matches' instead of `regexp-exec' and pass a list of matches to
  PROC. Expect PROC to return a string, and output that.  Fold over
  RX+PROC in order.  Use `(read-line p 'concat)' to include the trailing
  delimiter in LINE.
  (substitute*): Produce code to iterate over the matches, and return a
  string, which includes anything from the original line that's in
  between matches.

* distro/base.scm (gcc-4.7, glibc): Adjust accordingly: remove use
  of (ice-9 regex) and `regexp-substitute/global'; return a string.
2012-09-01 19:21:31 +02:00
Ludovic Courtès 8773648e35 utils: Change `substitute*' to accept a list of files to patch.
* guix/build/utils.scm (substitute*): Support a list of files as the
  first argument.
2012-08-25 13:12:45 +02:00
Ludovic Courtès 525a59d6d3 utils: Add a `path' argument to `patch-shebang'.
* guix/build/utils.scm (patch-shebang): Add an optional `path'
  parameter.  Change SHEBANG-RX to match the whole interpreter file
  name.  Don't patch when BIN and CMD are the same.  Add docstring.
2012-08-19 23:04:03 +02:00
Ludovic Courtès ebe2f31f19 utils: Add `patch-shebang'.
* guix/build/utils.scm (search-path-as-string->list): New procedure.
  (dump-port, patch-shebang): New procedures.
2012-08-19 17:41:30 +02:00
Ludovic Courtès d9dbab18e2 utils: Have `substitute' restore the file's permission bits.
* guix/build/utils.scm (substitute): Restore FILE's mode before renaming
  TEMPLATE.
2012-07-07 18:11:52 +02:00
Ludovic Courtès 4fa697e932 utils: Change `substitute' and `substitute*' to work with several regexps.
* guix/build/utils.scm (substitute): Change to accept a `pattern+procs'
  parameter.  Iterate over it.
  (substitute*): Adjust accordingly.

* distro/base.scm (guile-1.8): Adjust accordingly.
2012-07-07 17:12:04 +02:00
Ludovic Courtès 10c87717bd utils: Introduce `substitute*', for easier sed-like syntax.
* guix/build/utils.scm (let-matches, substitute*): New macros.

* distro/base.scm (guile-1.8): Use `substitute*' instead of
  `substitute'.  Remove the #:modules argument.
2012-07-07 16:25:10 +02:00
Ludovic Courtès 8e6ecb1400 utils: Make sure `substitute' writes all its output.
* guix/build/utils.scm (substitute): Close OUT before renaming it.
2012-07-06 00:51:55 +02:00
Ludovic Courtès b0e0d0e99f Add builder-side utilities for phases, stream editing, & co.
* guix/build/utils.scm (with-directory-excursion): New macro.
  (alist-cons-before, alist-cons-after, alist-replace): New procedures.
  (substitute): New procedure.

* tests/build-utils.scm: New file.

* Makefile.am (TESTS): Add `tests/build-utils.scm'.
2012-07-05 00:13:30 +02:00
Ludovic Courtès 9f55cf8d56 Remove leftover debugging expressions.
* guix/build/utils.scm (directory-exists?): Remove leftover debugging
  expressions.
2012-06-16 16:16:16 +02:00
Ludovic Courtès c36db98c8e Add supporting tools for the GNU Build System.
* guix/derivations.scm (build-expression->derivation): Add all of INPUTS
  as inputs to the final derivation.

* guix/build/gnu-build-system.scm, guix/build/utils.scm,
  guix/gnu-build-system.scm: New files.

* tests/builders.scm ("gnu-build"): New test.
2012-06-13 17:03:34 +02:00