Merge pull request #254409 from anund/fix_less_pipe_dependency

lesspipe: validate and add script dependencies
This commit is contained in:
Sandro 2024-02-27 22:26:55 +01:00 committed by GitHub
commit 4e6ae964ae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,4 +1,22 @@
{ lib, stdenv, fetchFromGitHub, makeWrapper, perl, procps, file, gnused, bash, binutils }:
{ lib
, stdenv
, fetchFromGitHub
, makeWrapper
, perl
, procps
, bash
# shell referenced dependencies
, resholve
, binutils-unwrapped
, file
, gnugrep
, coreutils
, gnused
, gnutar
, iconv
, ncurses
}:
stdenv.mkDerivation rec {
pname = "lesspipe";
@ -28,9 +46,65 @@ stdenv.mkDerivation rec {
installFlags = [ "DESTDIR=$(out)" ];
postInstall = ''
for f in lesspipe.sh lesscomplete; do
wrapProgram "$out/bin/$f" --prefix-each PATH : "${lib.makeBinPath [ binutils file gnused procps ]}"
done
# resholve doesn't see strings in an array definition
substituteInPlace $out/bin/lesspipe.sh --replace 'nodash strings' "nodash ${binutils-unwrapped}/bin/strings"
${resholve.phraseSolution "lesspipe.sh" {
scripts = [ "bin/lesspipe.sh" ];
interpreter = "${bash}/bin/bash";
inputs = [
coreutils
file
gnugrep
gnused
gnutar
iconv
procps
ncurses
];
keep = [ "$prog" "$c1" "$c2" "$c3" "$c4" "$c5" "$cmd" "$colorizer" "$HOME" ];
fake = {
# script guards usage behind has_cmd test function, it's safe to leave these external and optional
external = [
"cpio" "isoinfo" "cabextract" "bsdtar" "rpm2cpio" "bsdtar" "unzip" "ar" "unrar" "rar" "7zr" "7za" "isoinfo"
"gzip" "bzip2" "lzip" "lzma" "xz" "brotli" "compress" "zstd" "lz4"
"archive_color" "bat" "batcat" "pygmentize" "source-highlight" "vimcolor" "code2color"
"w3m" "lynx" "elinks" "html2text" "dtc" "pdftotext" "pdftohtml" "pdfinfo" "ps2ascii" "procyon" "ccze"
"mdcat" "pandoc" "docx2txt" "libreoffice" "pptx2md" "mdcat" "xlscat" "odt2txt" "wvText" "antiword" "catdoc"
"broken_catppt" "sxw2txt" "groff" "mandoc" "unrtf" "dvi2tty" "pod2text" "perldoc" "h5dump" "ncdump" "matdump"
"djvutxt" "openssl" "gpg" "plistutil" "plutil" "id3v2" "csvlook" "jq" "zlib-flate" "lessfilter"
] ++ lib.optional stdenv.isDarwin [
# resholve only identifies this on darwin
# call site is gaurded by || so it's safe to leave dynamic
"locale"
];
builtin = [ "setopt" ];
};
execer = [
"cannot:${iconv}/bin/iconv"
];
}}
${resholve.phraseSolution "lesscomplete" {
scripts = [ "bin/lesscomplete" ];
interpreter = "${bash}/bin/bash";
inputs = [
coreutils
file
gnugrep
gnused
gnutar
];
keep = [ "$prog" "$c1" "$c2" "$c3" "$c4" "$c5" "$cmd" ];
fake = {
# script guards usage behind has_cmd test function, it's safe to leave these external and optional
external = [
"cpio" "isoinfo" "cabextract" "bsdtar" "rpm2cpio" "bsdtar" "unzip" "ar" "unrar" "rar" "7zr" "7za" "isoinfo"
"gzip" "bzip2" "lzip" "lzma" "xz" "brotli" "compress" "zstd" "lz4"
];
builtin = [ "setopt" ];
};
}}
'';
meta = with lib; {