about summary refs log tree commit diff
path: root/pkgs/tools/misc/txt2man
diff options
context:
space:
mode:
authorManav Rathi <mx4492@gmail.com>2016-09-08 15:25:00 +0530
committerBjørn Forsman <bjorn.forsman@gmail.com>2016-09-08 13:01:55 +0200
commit440d721915c0f44261b3635bfbced5c6bb3f8d7d (patch)
tree951a0e2d83ebb4b843ec61e0983dc6850ea7e3b5 /pkgs/tools/misc/txt2man
parent7a5f7dc6a241ae715350bdd5e3c422422b479b90 (diff)
txt2man: mention runtime dependencies on gawk and coreutils
The commit message in 1a2b47463b45c2b05ec80ade28781afc986576af is
incorrect -- the package seemed to work because only the help message
was invoked:

    result/bin/txt2man -h

To guard against such trivial successes, this commit introduces a
test.
Diffstat (limited to 'pkgs/tools/misc/txt2man')
-rw-r--r--pkgs/tools/misc/txt2man/default.nix24
1 files changed, 22 insertions, 2 deletions
diff --git a/pkgs/tools/misc/txt2man/default.nix b/pkgs/tools/misc/txt2man/default.nix
index 3c894611f692d..29bd3235dfb9c 100644
--- a/pkgs/tools/misc/txt2man/default.nix
+++ b/pkgs/tools/misc/txt2man/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ stdenv, fetchurl, coreutils, gawk }:
 
 stdenv.mkDerivation rec {
   name = "txt2man-1.5.6";
@@ -12,7 +12,27 @@ stdenv.mkDerivation rec {
     makeFlags=prefix="$out"
   '';
 
-  meta = { 
+  patchPhase = ''
+    for f in bookman src2man txt2man; do
+        substituteInPlace $f --replace "gawk" "${gawk}/bin/gawk"
+
+        substituteInPlace $f --replace "(date" "(${coreutils}/bin/date"
+        substituteInPlace $f --replace "=cat" "=${coreutils}/bin/cat"
+        substituteInPlace $f --replace "cat <<" "${coreutils}/bin/cat <<"
+        substituteInPlace $f --replace "expand" "${coreutils}/bin/expand"
+        substituteInPlace $f --replace "(uname" "(${coreutils}/bin/uname"
+    done
+  '';
+
+  doCheck = true;
+
+  checkPhase = ''
+    # gawk and coreutils are part of stdenv but will not
+    # necessarily be in PATH at runtime.
+    sh -c 'unset PATH; printf hello | ./txt2man'
+  '';
+
+  meta = {
     description = "Convert flat ASCII text to man page format";
     homepage = http://mvertes.free.fr/;
     license = stdenv.lib.licenses.gpl2;