Merge pull request #299207 from afh/fix-vnu-version

validator-nu: fix version output and modernize package
This commit is contained in:
Nick Cao 2024-04-14 21:38:14 -04:00 committed by GitHub
commit 29084fa04b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -6,6 +6,7 @@
, python3 , python3
, stdenvNoCC , stdenvNoCC
, lib , lib
, testers
}: }:
let let
@ -40,29 +41,43 @@ let
}; };
in in
stdenvNoCC.mkDerivation rec { stdenvNoCC.mkDerivation (finalAttrs: {
inherit pname version src; inherit pname version src;
nativeBuildInputs = [ git jdk_headless makeWrapper python3 ]; nativeBuildInputs = [ git jdk_headless makeWrapper python3 ];
postPatch = ''
substituteInPlace build/build.py --replace-warn \
'validatorVersion = "%s.%s.%s" % (year, month, day)' \
'validatorVersion = "${finalAttrs.version}"'
'';
buildPhase = '' buildPhase = ''
ln -s '${deps}/dependencies' '${deps}/extras' . ln -s '${deps}/dependencies' '${deps}/extras' .
JAVA_HOME='${jdk_headless}' python checker.py build JAVA_HOME='${jdk_headless}' python checker.py build
''; '';
installPhase = '' installPhase = ''
runHook preInstall
mkdir -p "$out/bin" "$out/share/java" mkdir -p "$out/bin" "$out/share/java"
mv build/dist/vnu.jar "$out/share/java/" mv build/dist/vnu.jar "$out/share/java/"
makeWrapper "${jre_headless}/bin/java" "$out/bin/vnu" \ makeWrapper "${jre_headless}/bin/java" "$out/bin/vnu" \
--add-flags "-jar '$out/share/java/vnu.jar'" --add-flags "-jar '$out/share/java/vnu.jar'"
runHook postInstall
''; '';
meta = with lib; { passthru.tests.version = testers.testVersion {
package = finalAttrs.finalPackage;
};
meta = {
description = "Helps you catch problems in your HTML/CSS/SVG"; description = "Helps you catch problems in your HTML/CSS/SVG";
homepage = "https://validator.github.io/validator/"; homepage = "https://validator.github.io/validator/";
license = licenses.mit; license = lib.licenses.mit;
maintainers = with maintainers; [ andersk ivan ]; maintainers = with lib.maintainers; [ andersk ivan ];
mainProgram = "vnu"; mainProgram = "vnu";
sourceProvenance = with sourceTypes; [ binaryBytecode fromSource ]; sourceProvenance = with lib.sourceTypes; [ binaryBytecode fromSource ];
}; };
} })