DisnixWebService: make deterministic and clean up

This commit is contained in:
TomaSajt 2024-03-10 12:49:45 +01:00
parent 2d5db19dff
commit 6ab1bed5eb
No known key found for this signature in database
GPG Key ID: F011163C050122A1

View File

@ -1,13 +1,13 @@
{lib, stdenv, fetchFromGitHub, fetchpatch, apacheAnt, jdk, axis2, dbus_java }: { lib, stdenv, fetchFromGitHub, fetchpatch, ant, jdk, xmlstarlet, axis2, dbus_java }:
stdenv.mkDerivation rec { stdenv.mkDerivation (finalAttrs: {
pname = "DisnixWebService"; pname = "DisnixWebService";
version = "0.10.1"; version = "0.10.1";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "svanderburg"; owner = "svanderburg";
repo = "DisnixWebService"; repo = "DisnixWebService";
rev = "refs/tags/DisnixWebService-${version}"; rev = "DisnixWebService-${finalAttrs.version}";
hash = "sha256-zcYr2Ytx4pevSthTQLpnQ330wDxN9dWsZA20jbO6PxQ="; hash = "sha256-zcYr2Ytx4pevSthTQLpnQ330wDxN9dWsZA20jbO6PxQ=";
}; };
@ -20,26 +20,47 @@ stdenv.mkDerivation rec {
}) })
]; ];
buildInputs = [ apacheAnt jdk ]; nativeBuildInputs = [
PREFIX = "\${env.out}"; ant
AXIS2_LIB = "${axis2}/lib"; jdk
AXIS2_WEBAPP = "${axis2}/webapps/axis2"; xmlstarlet
DBUS_JAVA_LIB = "${dbus_java}/share/java"; ];
env = {
PREFIX = "\${env.out}";
AXIS2_LIB = "${axis2}/lib";
AXIS2_WEBAPP = "${axis2}/webapps/axis2";
DBUS_JAVA_LIB = "${dbus_java}/share/java";
};
prePatch = '' prePatch = ''
# add modificationtime="0" to the <jar> and <war> tasks to achieve reproducibility
xmlstarlet ed -L -a "//jar|//war" -t attr -n "modificationtime" -v "0" build.xml
sed -i -e "s|#JAVA_HOME=|JAVA_HOME=${jdk}|" \ sed -i -e "s|#JAVA_HOME=|JAVA_HOME=${jdk}|" \
-e "s|#AXIS2_LIB=|AXIS2_LIB=${axis2}/lib|" \ -e "s|#AXIS2_LIB=|AXIS2_LIB=${axis2}/lib|" \
scripts/disnix-soap-client scripts/disnix-soap-client
''; '';
buildPhase = "ant";
installPhase = "ant install"; buildPhase = ''
runHook preBuild
ant
runHook postBuild
'';
installPhase = ''
runHook preInstall
ant install
runHook postIntall
'';
meta = { meta = {
description = "A SOAP interface and client for Disnix"; description = "A SOAP interface and client for Disnix";
mainProgram = "disnix-soap-client"; mainProgram = "disnix-soap-client";
homepage = "https://github.com/svanderburg/DisnixWebService"; homepage = "https://github.com/svanderburg/DisnixWebService";
changelog = "https://github.com/svanderburg/DisnixWebService/blob/DisnixWebService-${version}/NEWS.txt"; changelog = "https://github.com/svanderburg/DisnixWebService/blob/${finalAttrs.src.rev}/NEWS.txt";
license = lib.licenses.mit; license = lib.licenses.mit;
maintainers = [ lib.maintainers.sander ]; maintainers = [ lib.maintainers.sander ];
platforms = lib.platforms.linux; platforms = lib.platforms.linux;
}; };
} })