lesspipe: 1.85 -> 2.05 (#178581)

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
This commit is contained in:
Claudio Bley 2022-07-01 15:31:42 +02:00 committed by GitHub
parent bc061bead1
commit e94f1b45ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 56 deletions

View File

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

View File

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

View File

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