~ruther/guix-local

7584f822bf076f4fc8aef9c1f4d48c179fe15fc3 — Ludovic Courtès 13 years ago 312543d
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.
4 files changed, 17 insertions(+), 15 deletions(-)

M distro/packages/attr.scm
M distro/packages/lsh.scm
M distro/packages/perl.scm
M guix/build/utils.scm
M distro/packages/attr.scm => distro/packages/attr.scm +3 -6
@@ 56,12 56,9 @@
          'check
          (lambda _
            ;; Use the right shell.
            (let ((bash (search-path (search-path-as-string->list
                                      (getenv "PATH"))
                                     "bash")))
              (substitute* "test/run"
                (("/bin/sh")
                 (string-append bash "/bin/bash"))))
            (substitute* "test/run"
              (("/bin/sh")
               (which "bash")))

            (system* "make" "tests" "-C" "test")


M distro/packages/lsh.scm => distro/packages/lsh.scm +2 -3
@@ 1,5 1,5 @@
;;; Guix --- Nix package management from Guile.         -*- coding: utf-8 -*-
;;; Copyright (C) 2012 Ludovic Courtès <ludo@gnu.org>
;;; Copyright (C) 2012, 2013 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of Guix.
;;;


@@ 114,8 114,7 @@
          (substitute* "src/testsuite/login-auth-test"
            (("/bin/cat")
             ;; Use the right path to `cat'.
             (search-path (search-path-as-string->list (getenv "PATH"))
                          "cat"))))
             (which "cat"))))
        %standard-phases)))
    (home-page "http://www.lysator.liu.se/~nisse/lsh/")
    (synopsis

M distro/packages/perl.scm => distro/packages/perl.scm +4 -6
@@ 1,5 1,5 @@
;;; Guix --- Nix package management from Guile.         -*- coding: utf-8 -*-
;;; Copyright (C) 2012 Ludovic Courtès <ludo@gnu.org>
;;; Copyright (C) 2012, 2013 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of Guix.
;;;


@@ 46,13 46,11 @@
          'configure
          (lambda* (#:key inputs outputs #:allow-other-keys)
            (let ((out  (assoc-ref outputs "out"))
                  (libc (assoc-ref inputs "libc"))
                  (pwd  (search-path (search-path-as-string->list
                                      (getenv "PATH"))
                                     "pwd")))
                  (libc (assoc-ref inputs "libc")))
              ;; Use the right path for `pwd'.
              (substitute* "dist/Cwd/Cwd.pm"
                (("/bin/pwd") pwd))
                (("/bin/pwd")
                 (which "pwd")))

              (zero?
               (system* "./Configure"

M guix/build/utils.scm => guix/build/utils.scm +8 -0
@@ 36,6 36,8 @@
            set-path-environment-variable
            search-path-as-string->list
            list->search-path-as-string
            which

            alist-cons-before
            alist-cons-after
            alist-replace


@@ 214,6 216,12 @@ SEPARATOR-separated path accordingly.  Example:
   (format #t "environment variable `~a' set to `~a'~%"
           env-var value)))

(define (which program)
  "Return the complete file name for PROGRAM as found in $PATH, or #f if
PROGRAM could not be found."
  (search-path (search-path-as-string->list (getenv "PATH"))
               program))


;;;
;;; Phases.