aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2016-08-20 21:40:59 -0400
committerMark H Weaver <mhw@netris.org>2016-08-20 21:40:59 -0400
commit1063d325ea76aa2b00dfcd3d436b16e412103df1 (patch)
treebc10be491b907bcd1e78842a3c25dc154a8cffdf /gnu/packages
parent5cbc24de44b8bff156f6bb19898261f1985b21a5 (diff)
downloadpatches-1063d325ea76aa2b00dfcd3d436b16e412103df1.tar
patches-1063d325ea76aa2b00dfcd3d436b16e412103df1.tar.gz
gnu: grep: Fix egrep/fgrep to work regardless of PATH.
* gnu/packages/base.scm (grep)[arguments]: New field. Add 'fix-egrep-and-fgrep' phase.
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/base.scm14
1 files changed, 14 insertions, 0 deletions
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 8c470c318f..58a8e52e4b 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -88,6 +88,20 @@ command-line arguments, multiple languages, and so on.")
(patches (search-patches "grep-timing-sensitive-test.patch"))))
(build-system gnu-build-system)
(native-inputs `(("perl" ,perl))) ;some of the tests require it
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (add-after 'install 'fix-egrep-and-fgrep
+ ;; Patch 'egrep' and 'fgrep' to execute 'grep' via its
+ ;; absolute file name instead of searching for it in $PATH.
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (bin (string-append out "/bin")))
+ (substitute* (list (string-append bin "/egrep")
+ (string-append bin "/fgrep"))
+ (("^exec grep")
+ (string-append "exec " bin "/grep")))
+ #t))))))
(synopsis "Print lines matching a pattern")
(description
"grep is a tool for finding text inside files. Text is found by