Merge pull request #294708 from TomaSajt/mkgmap

mkgmap{,-splitter}: make deterministic add missing phase hook calls

authored by Nikolay Korotkiy and committed by GitHub c2e4139f ba6a8872

+102 -68
+1 -18
pkgs/applications/misc/mkgmap/build.xml.patch
··· 1 1 --- a/build.xml (revision 4555) 2 2 +++ a/build.xml (working copy) 3 - @@ -222,13 +222,13 @@ 4 - <property name="svn.version.build" value="none"/> 5 - 6 - <propertyfile file="${build.classes}/mkgmap-version.properties"> 7 - - <entry key="svn.version" value="${svn.version.build}" /> 8 - - <entry key="build.timestamp" value="${build.timestamp}" /> 9 - + <entry key="svn.version" value="@version@" /> 10 - + <entry key="build.timestamp" value="unknown" /> 11 - </propertyfile> 3 + @@ -228,7 +228,7 @@ 12 4 </target> 13 5 14 6 <!-- Compile the product itself (no tests). --> ··· 35 27 <mkdir dir="tmp/report"/> 36 28 <junit printsummary="yes" failureproperty="junit.failure" forkmode="once"> 37 29 38 - @@ -351,7 +351,7 @@ 39 - ignoreerrors="true"/> 40 - </target> 41 - 42 - - <target name="dist" depends="build, check-version, version-file" 43 - + <target name="dist" depends="build, version-file" 44 - description="Make the distribution area"> 45 - 46 - <mkdir dir="${dist}"/>
+43 -18
pkgs/applications/misc/mkgmap/default.nix
··· 1 - { lib, stdenv 1 + { lib 2 + , stdenv 2 3 , fetchurl 3 4 , fetchsvn 4 - , substituteAll 5 5 , jdk 6 6 , jre 7 7 , ant ··· 24 24 }; 25 25 26 26 patches = [ 27 - (substituteAll { 28 - # Disable automatic download of dependencies 29 - src = ./build.xml.patch; 30 - inherit version; 31 - }) 27 + # Disable automatic download of dependencies 28 + ./build.xml.patch 29 + ./ignore-impure-test.patch 32 30 ]; 33 31 34 32 postPatch = with deps; '' 33 + # Fix the output jar timestamps for reproducibility 34 + substituteInPlace build.xml \ 35 + --replace-fail '<jar ' '<jar modificationtime="0" ' 36 + 37 + # Manually create version properties file for reproducibility 38 + mkdir -p build/classes 39 + cat > build/classes/mkgmap-version.properties << EOF 40 + svn.version=${version} 41 + build.timestamp=unknown 42 + EOF 43 + 44 + # Put pre-fetched dependencies into the right place 35 45 mkdir -p lib/compile 36 46 cp ${fastutil} lib/compile/${fastutil.name} 37 47 cp ${osmpbf} lib/compile/${osmpbf.name} ··· 53 63 54 64 nativeBuildInputs = [ jdk ant makeWrapper ]; 55 65 56 - buildPhase = "ant"; 66 + buildPhase = '' 67 + runHook preBuild 68 + ant 69 + runHook postBuild 70 + ''; 57 71 58 72 inherit doCheck; 59 73 60 - checkPhase = "ant test"; 74 + checkPhase = '' 75 + runHook preCheck 76 + ant test 77 + runHook postCheck 78 + ''; 61 79 62 80 installPhase = '' 81 + runHook preInstall 82 + 63 83 install -Dm644 dist/mkgmap.jar -t $out/share/java/mkgmap 64 84 install -Dm644 dist/doc/mkgmap.1 -t $out/share/man/man1 65 85 cp -r dist/lib/ $out/share/java/mkgmap/ 66 86 makeWrapper ${jre}/bin/java $out/bin/mkgmap \ 67 87 --add-flags "-jar $out/share/java/mkgmap/mkgmap.jar" 68 - '' + lib.optionalString withExamples '' 69 - mkdir -p $out/share/mkgmap 70 - cp -r dist/examples $out/share/mkgmap/ 88 + 89 + ${lib.optionalString withExamples '' 90 + mkdir -p $out/share/mkgmap 91 + cp -r dist/examples $out/share/mkgmap/ 92 + ''} 93 + 94 + runHook postInstall 71 95 ''; 72 96 73 97 passthru.updateScript = [ ./update.sh "mkgmap" meta.downloadPage ]; 74 98 75 99 meta = with lib; { 76 100 description = "Create maps for Garmin GPS devices from OpenStreetMap (OSM) data"; 77 - homepage = "https://www.mkgmap.org.uk/"; 78 101 downloadPage = "https://www.mkgmap.org.uk/download/mkgmap.html"; 102 + homepage = "https://www.mkgmap.org.uk/"; 103 + license = licenses.gpl2Only; 104 + mainProgram = "mkgmap"; 105 + maintainers = with maintainers; [ sikmir ]; 106 + platforms = platforms.all; 79 107 sourceProvenance = with sourceTypes; [ 80 108 fromSource 81 - binaryBytecode # deps 109 + binaryBytecode # deps 82 110 ]; 83 - license = licenses.gpl2Only; 84 - maintainers = with maintainers; [ sikmir ]; 85 - platforms = platforms.all; 86 - mainProgram = "mkgmap"; 87 111 }; 112 + 88 113 }
+20
pkgs/applications/misc/mkgmap/ignore-impure-test.patch
··· 1 + diff --git a/test/uk/me/parabola/imgfmt/app/srt/SrtCollatorTest.java b/test/uk/me/parabola/imgfmt/app/srt/SrtCollatorTest.java 2 + index e1e4ac7..954b918 100644 3 + --- a/test/uk/me/parabola/imgfmt/app/srt/SrtCollatorTest.java 4 + +++ b/test/uk/me/parabola/imgfmt/app/srt/SrtCollatorTest.java 5 + @@ -17,6 +17,7 @@ import java.text.Collator; 6 + import uk.me.parabola.mkgmap.srt.SrtTextReader; 7 + 8 + import org.junit.Before; 9 + +import org.junit.Ignore; 10 + import org.junit.Test; 11 + 12 + import static org.junit.Assert.*; 13 + @@ -111,6 +112,7 @@ public class SrtCollatorTest { 14 + * meant to be identical to the java one. 15 + */ 16 + @Test 17 + + @Ignore 18 + public void testJavaRules() { 19 + Collator collator = Collator.getInstance(); 20 +
+1 -17
pkgs/applications/misc/mkgmap/splitter/build.xml.patch
··· 1 1 --- a/build.xml (revision 597) 2 2 +++ a/build.xml (working copy) 3 - @@ -207,12 +207,12 @@ 4 - <property name="svn.version.build" value="unknown"/> 5 - 6 - <propertyfile file="${build.classes}/splitter-version.properties"> 7 - - <entry key="svn.version" value="${svn.version.build}" /> 8 - - <entry key="build.timestamp" value="${build.timestamp}" /> 9 - + <entry key="svn.version" value="@version@" /> 10 - + <entry key="build.timestamp" value="unknown" /> 3 + @@ -212,7 +212,7 @@ 11 4 </propertyfile> 12 5 </target> 13 6 ··· 25 18 <javac srcdir="${test}" destdir="${build.test-classes}" debug="yes" includeantruntime="false"> 26 19 <include name="**/*.java"/> 27 20 <classpath refid="test.classpath"/> 28 - @@ -261,7 +261,7 @@ 29 - <fail if="junit.failure" message="Test failed. See test-reports/index.html"/> 30 - </target> 31 - 32 - - <target name="dist" depends="build, check-version, version-file" description="Make the distribution area"> 33 - + <target name="dist" depends="build, version-file" description="Make the distribution area"> 34 - 35 - <mkdir dir="${dist}"/> 36 - <mkdir dir="${dist}/doc/api"/> 37 21 @@ -324,7 +324,7 @@ 38 22 </target> 39 23
+37 -15
pkgs/applications/misc/mkgmap/splitter/default.nix
··· 1 - { lib, stdenv 1 + { lib 2 + , stdenv 2 3 , fetchurl 3 4 , fetchsvn 4 - , substituteAll 5 5 , jdk 6 6 , jre 7 7 , ant ··· 23 23 }; 24 24 25 25 patches = [ 26 - (substituteAll { 27 - # Disable automatic download of dependencies 28 - src = ./build.xml.patch; 29 - inherit version; 30 - }) 31 - 26 + # Disable automatic download of dependencies 27 + ./build.xml.patch 32 28 # Fix func.SolverAndProblemGeneratorTest test 33 29 ./fix-failing-test.patch 34 30 ]; 35 31 36 32 postPatch = with deps; '' 33 + # Fix the output jar timestamps for reproducibility 34 + substituteInPlace build.xml \ 35 + --replace-fail '<jar ' '<jar modificationtime="0" ' 36 + 37 + # Manually create version properties file for reproducibility 38 + mkdir -p build/classes 39 + cat > build/classes/splitter-version.properties << EOF 40 + svn.version=${version} 41 + build.timestamp=unknown 42 + EOF 43 + 44 + # Put pre-fetched dependencies into the right place 37 45 mkdir -p lib/compile 38 46 cp ${fastutil} lib/compile/${fastutil.name} 39 47 cp ${osmpbf} lib/compile/${osmpbf.name} ··· 52 60 53 61 nativeBuildInputs = [ jdk ant makeWrapper ]; 54 62 55 - buildPhase = "ant"; 63 + buildPhase = '' 64 + runHook preBuild 65 + ant 66 + runHook postBuild 67 + ''; 56 68 57 69 inherit doCheck; 58 70 59 - checkPhase = "ant run.tests && ant run.func-tests"; 71 + checkPhase = '' 72 + runHook preCheck 73 + ant run.tests 74 + ant run.func-tests 75 + runHook postCheck 76 + ''; 60 77 61 78 installPhase = '' 79 + runHook preInstall 80 + 62 81 install -Dm644 dist/splitter.jar -t $out/share/java/splitter 63 82 install -Dm644 doc/splitter.1 -t $out/share/man/man1 64 83 cp -r dist/lib/ $out/share/java/splitter/ 65 84 makeWrapper ${jre}/bin/java $out/bin/splitter \ 66 85 --add-flags "-jar $out/share/java/splitter/splitter.jar" 86 + 87 + runHook postInstall 67 88 ''; 68 89 69 90 passthru.updateScript = [ ../update.sh "mkgmap-splitter" meta.downloadPage ]; 70 91 71 92 meta = with lib; { 72 93 description = "Utility for splitting OpenStreetMap maps into tiles"; 94 + downloadPage = "https://www.mkgmap.org.uk/download/splitter.html"; 73 95 homepage = "https://www.mkgmap.org.uk/"; 74 - downloadPage = "https://www.mkgmap.org.uk/download/splitter.html"; 96 + license = licenses.gpl2Only; 97 + mainProgram = "splitter"; 98 + maintainers = with maintainers; [ sikmir ]; 99 + platforms = platforms.all; 75 100 sourceProvenance = with sourceTypes; [ 76 101 fromSource 77 - binaryBytecode # deps 102 + binaryBytecode # deps 78 103 ]; 79 - license = licenses.gpl2Only; 80 - maintainers = with maintainers; [ sikmir ]; 81 - platforms = platforms.all; 82 104 }; 83 105 }