mpv: add test "mpv-scripts-should-not-collide"

This commit is contained in:
Peder Bergebakken Sundt 2023-06-27 08:07:07 +02:00 committed by Anderson Torres
parent 6d2647ba62
commit e994574e92

View file

@ -1,8 +1,11 @@
# Arguments that this derivation gets when it is created with `callPackage` # Arguments that this derivation gets when it is created with `callPackage`
{ stdenv { stdenv
, buildEnv
, lib , lib
, makeWrapper , makeWrapper
, mpvScripts
, symlinkJoin , symlinkJoin
, writeTextDir
, yt-dlp , yt-dlp
}: }:
@ -71,6 +74,20 @@ let
passthru.unwrapped = mpv; passthru.unwrapped = mpv;
passthru.tests.mpv-scripts-should-not-collide = buildEnv {
name = "mpv-scripts-env";
paths = lib.pipe mpvScripts [
# filters "override" "overrideDerivation" "recurseForDerivations"
(lib.filterAttrs (key: script: lib.isDerivation script))
# replaces unfree and meta.broken scripts with decent placeholders
(lib.mapAttrsToList (key: script:
if (builtins.tryEval script.outPath).success
then script
else writeTextDir "share/mpv/scripts/${script.scriptName}" "placeholder of ${script.name}"
))
];
};
postBuild = '' postBuild = ''
# wrapProgram can't operate on symlinks # wrapProgram can't operate on symlinks
rm "$out/bin/mpv" rm "$out/bin/mpv"