From e94f1b45efd69a6ad89b28dd4944a2bc6e825007 Mon Sep 17 00:00:00 2001 From: Claudio Bley Date: Fri, 1 Jul 2022 15:31:42 +0200 Subject: [PATCH] lesspipe: 1.85 -> 2.05 (#178581) Co-authored-by: Sandro --- pkgs/tools/misc/lesspipe/default.nix | 47 ++++++++++--------- pkgs/tools/misc/lesspipe/fix-paths.patch | 22 --------- .../lesspipe/override-shell-detection.patch | 12 ----- 3 files changed, 25 insertions(+), 56 deletions(-) delete mode 100644 pkgs/tools/misc/lesspipe/fix-paths.patch delete mode 100644 pkgs/tools/misc/lesspipe/override-shell-detection.patch diff --git a/pkgs/tools/misc/lesspipe/default.nix b/pkgs/tools/misc/lesspipe/default.nix index 8977f9013959..0f2d4e4fe11c 100644 --- a/pkgs/tools/misc/lesspipe/default.nix +++ b/pkgs/tools/misc/lesspipe/default.nix @@ -1,34 +1,37 @@ -{ lib, stdenv, fetchFromGitHub, substituteAll, perl, file, ncurses, bash }: +{ lib, stdenv, fetchFromGitHub, substituteAll, makeWrapper, perl, procps, file, gnused, bash }: stdenv.mkDerivation rec { pname = "lesspipe"; - version = "1.85"; - - nativeBuildInputs = [ perl ]; - buildInputs = [ perl bash ]; - strictDeps = true; - preConfigure = '' - patchShebangs --build configure - ''; - configureFlags = [ "--shell=${bash}/bin/bash" "--yes" ]; - configurePlatforms = []; - dontBuild = true; + version = "2.05"; src = fetchFromGitHub { owner = "wofr06"; repo = "lesspipe"; - rev = version; - sha256 = "1v1jdkdq1phc93gdr6mjlk98gipxrkkq4bj8kks0kfdvjgdwkdaa"; + rev = "v${version}"; + sha256 = "sha256-mRgOndoDpyMnlj/BIoqwpZzuth4eA6yoB2VFZOigRw4="; }; - patches = [ - (substituteAll { - src = ./fix-paths.patch; - file = "${file}/bin/file"; - tput = "${ncurses}/bin/tput"; - }) - ./override-shell-detection.patch - ]; + nativeBuildInputs = [ perl makeWrapper ]; + buildInputs = [ perl bash ]; + strictDeps = true; + + postPatch = '' + patchShebangs --build configure + substituteInPlace configure --replace '/etc/bash_completion.d' '/share/bash-completion/completions' + ''; + + configureFlags = [ "--shell=${bash}/bin/bash" "--prefix=/" ]; + configurePlatforms = [ ]; + + dontBuild = true; + + installFlags = [ "DESTDIR=$(out)" ]; + + postInstall = '' + for f in lesspipe.sh lesscomplete; do + wrapProgram "$out/bin/$f" --prefix-each PATH : "${lib.makeBinPath [ file gnused procps ]}" + done + ''; meta = with lib; { description = "A preprocessor for less"; diff --git a/pkgs/tools/misc/lesspipe/fix-paths.patch b/pkgs/tools/misc/lesspipe/fix-paths.patch deleted file mode 100644 index 1bffcf53c827..000000000000 --- a/pkgs/tools/misc/lesspipe/fix-paths.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/lesspipe.sh.in -+++ b/lesspipe.sh.in -@@ -48,8 +48,8 @@ if [[ "$LESS_ADVANCED_PREPROCESSOR" = '' ]]; then - fi - - filecmd() { -- file -L -s "$@" -- file -L -s -i "$@" 2> /dev/null | sed -n 's/.*charset=/;/p' | tr a-z A-Z -+ @file@ -L -s "$@" -+ @file@ -L -s -i "$@" 2> /dev/null | sed -n 's/.*charset=/;/p' | tr a-z A-Z - } - - sep=: # file name separator -@@ -546,7 +546,7 @@ isfinal() { - - # color requires -r or -R when calling less - typeset COLOR -- if [[ $(tput colors) -ge 8 && ("$LESS" = *-*r* || "$LESS" = *-*R*) ]]; then -+ if [[ $(@tput@ colors) -ge 8 && ("$LESS" = *-*r* || "$LESS" = *-*R*) ]]; then - COLOR="--color=always" - fi - diff --git a/pkgs/tools/misc/lesspipe/override-shell-detection.patch b/pkgs/tools/misc/lesspipe/override-shell-detection.patch deleted file mode 100644 index 08ef7e07b7cd..000000000000 --- a/pkgs/tools/misc/lesspipe/override-shell-detection.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/configure -+++ b/configure -@@ -101,7 +101,8 @@ - open OUT, ">lesspipe.sh.tmp"; - my $in = 1; - my $anyin; --my $shell = check_shell_vers(); -+my $shell = $opt_shell; -+print OUT "#!$shell\n"; - # ask if syntax highlighting should be included - $ifsyntax = ''; - if ($opt_yes) {