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.
master
Ludovic Courtès 2013-01-05 16:02:32 +01:00
parent 312543dcfc
commit 7584f822bf
4 changed files with 17 additions and 15 deletions

View File

@ -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")

View File

@ -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

View File

@ -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"

View File

@ -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.