Merge pull request #90697 from lilyball/bat-extras

bat-extras: 20200408 -> 20200515-dev
This commit is contained in:
Maximilian Bosch 2020-06-18 01:34:23 +02:00 committed by GitHub
commit ee11fe8d63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,6 @@
{ stdenv, callPackage, fetchFromGitHub, bash, makeWrapper, ncurses, bat { stdenv, callPackage, fetchFromGitHub, bash, makeWrapper, bat
# batgrep and batwatch # batdiff, batgrep, and batwatch
, coreutils
, less , less
# batgrep # batgrep
, ripgrep , ripgrep
@ -10,6 +11,9 @@
, withRustFmt ? rustfmt != null, rustfmt ? null , withRustFmt ? rustfmt != null, rustfmt ? null
# batwatch # batwatch
, withEntr ? entr != null, entr ? null , withEntr ? entr != null, entr ? null
# batdiff
, gitMinimal
, withDelta ? gitAndTools?delta, gitAndTools ? null
}: }:
let let
@ -17,27 +21,25 @@ let
# This includes the complete source so the per-script derivations can run the tests. # This includes the complete source so the per-script derivations can run the tests.
core = stdenv.mkDerivation rec { core = stdenv.mkDerivation rec {
pname = "bat-extras"; pname = "bat-extras";
version = "20200408"; # there hasn't been a release since 2020-05-01 but there are important bugfixes
# to the test suite so we'll pull the latest commit as of 2020-06-17.
version = "20200515-dev"; # latest commit was dated 2020-05-15
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "eth-p"; owner = "eth-p";
repo = pname; repo = pname;
rev = "v${version}"; rev = "3029b6749f61f7514e9eef30e035cfab0e31eb1d";
sha256 = "184d5rwasfpgbj2k98alg3wy8jmzna2dgfik98w2a297ky67s51v"; sha256 = "08mb94k2n182ql97c5s5j1v7np25ivynn5g0418whrx11ra41wr7";
fetchSubmodules = true; fetchSubmodules = true;
}; };
nativeBuildInputs = [ bash makeWrapper ]; # bat needs to be in the PATH during building so EXECUTABLE_BAT picks it up
nativeBuildInputs = [ bash bat ];
dontConfigure = true; dontConfigure = true;
postPatch = '' postPatch = ''
substituteInPlace lib/constants.sh \
--replace 'EXECUTABLE_BAT="bat"' 'EXECUTABLE_BAT="${bat}/bin/bat"'
patchShebangs --build test.sh test/shimexec .test-framework/bin/best.sh patchShebangs --build test.sh test/shimexec .test-framework/bin/best.sh
wrapProgram .test-framework/bin/best.sh \
--prefix PATH : "${ncurses}/bin"
''; '';
buildPhase = '' buildPhase = ''
@ -131,17 +133,13 @@ let
stdenv.lib.optional cond dep; stdenv.lib.optional cond dep;
in in
{ {
batgrep = script "batgrep" [ less ripgrep ]; batdiff = script "batdiff" ([ less coreutils gitMinimal ] ++ optionalDep withDelta gitAndTools.delta);
batman = (script "batman" []).overrideAttrs (drv: { batgrep = script "batgrep" [ less coreutils ripgrep ];
doCheck = stdenv.isDarwin; # test fails on Linux due to SIGPIPE (eth-p/bat-extras#19) batman = script "batman" [];
}); batwatch = script "batwatch" ([ less coreutils ] ++ optionalDep withEntr entr);
batwatch = script "batwatch" ([ less ] ++ optionalDep withEntr entr); prettybat = script "prettybat" ([]
prettybat = (script "prettybat" ([]
++ optionalDep withShFmt shfmt ++ optionalDep withShFmt shfmt
++ optionalDep withPrettier nodePackages.prettier ++ optionalDep withPrettier nodePackages.prettier
++ optionalDep withClangTools clang-tools ++ optionalDep withClangTools clang-tools
++ optionalDep withRustFmt rustfmt) ++ optionalDep withRustFmt rustfmt);
).overrideAttrs (drv: {
doCheck = stdenv.isDarwin; # test fails on Linux due to SIGPIPE (eth-p/bat-extras#19)
});
} }