mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2025-01-19 05:57:04 +01:00
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.
This commit is contained in:
parent
312543dcfc
commit
7584f822bf
4 changed files with 17 additions and 15 deletions
|
@ -56,12 +56,9 @@ (define-public attr
|
||||||
'check
|
'check
|
||||||
(lambda _
|
(lambda _
|
||||||
;; Use the right shell.
|
;; Use the right shell.
|
||||||
(let ((bash (search-path (search-path-as-string->list
|
(substitute* "test/run"
|
||||||
(getenv "PATH"))
|
(("/bin/sh")
|
||||||
"bash")))
|
(which "bash")))
|
||||||
(substitute* "test/run"
|
|
||||||
(("/bin/sh")
|
|
||||||
(string-append bash "/bin/bash"))))
|
|
||||||
|
|
||||||
(system* "make" "tests" "-C" "test")
|
(system* "make" "tests" "-C" "test")
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*-
|
;;; 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.
|
;;; This file is part of Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -114,8 +114,7 @@ (define-public lsh
|
||||||
(substitute* "src/testsuite/login-auth-test"
|
(substitute* "src/testsuite/login-auth-test"
|
||||||
(("/bin/cat")
|
(("/bin/cat")
|
||||||
;; Use the right path to `cat'.
|
;; Use the right path to `cat'.
|
||||||
(search-path (search-path-as-string->list (getenv "PATH"))
|
(which "cat"))))
|
||||||
"cat"))))
|
|
||||||
%standard-phases)))
|
%standard-phases)))
|
||||||
(home-page "http://www.lysator.liu.se/~nisse/lsh/")
|
(home-page "http://www.lysator.liu.se/~nisse/lsh/")
|
||||||
(synopsis
|
(synopsis
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*-
|
;;; 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.
|
;;; This file is part of Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -46,13 +46,11 @@ (define-public perl
|
||||||
'configure
|
'configure
|
||||||
(lambda* (#:key inputs outputs #:allow-other-keys)
|
(lambda* (#:key inputs outputs #:allow-other-keys)
|
||||||
(let ((out (assoc-ref outputs "out"))
|
(let ((out (assoc-ref outputs "out"))
|
||||||
(libc (assoc-ref inputs "libc"))
|
(libc (assoc-ref inputs "libc")))
|
||||||
(pwd (search-path (search-path-as-string->list
|
|
||||||
(getenv "PATH"))
|
|
||||||
"pwd")))
|
|
||||||
;; Use the right path for `pwd'.
|
;; Use the right path for `pwd'.
|
||||||
(substitute* "dist/Cwd/Cwd.pm"
|
(substitute* "dist/Cwd/Cwd.pm"
|
||||||
(("/bin/pwd") pwd))
|
(("/bin/pwd")
|
||||||
|
(which "pwd")))
|
||||||
|
|
||||||
(zero?
|
(zero?
|
||||||
(system* "./Configure"
|
(system* "./Configure"
|
||||||
|
|
|
@ -36,6 +36,8 @@ (define-module (guix build utils)
|
||||||
set-path-environment-variable
|
set-path-environment-variable
|
||||||
search-path-as-string->list
|
search-path-as-string->list
|
||||||
list->search-path-as-string
|
list->search-path-as-string
|
||||||
|
which
|
||||||
|
|
||||||
alist-cons-before
|
alist-cons-before
|
||||||
alist-cons-after
|
alist-cons-after
|
||||||
alist-replace
|
alist-replace
|
||||||
|
@ -214,6 +216,12 @@ (define* (set-path-environment-variable env-var sub-directories input-dirs
|
||||||
(format #t "environment variable `~a' set to `~a'~%"
|
(format #t "environment variable `~a' set to `~a'~%"
|
||||||
env-var value)))
|
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.
|
;;; Phases.
|
||||||
|
|
Loading…
Reference in a new issue