Merge pull request #294708 from TomaSajt/mkgmap

mkgmap{,-splitter}: make deterministic add missing phase hook calls
This commit is contained in:
Nikolay Korotkiy 2024-03-11 00:38:26 +04:00 committed by GitHub
commit c2e4139f04
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 102 additions and 68 deletions

View file

@ -1,14 +1,6 @@
--- a/build.xml (revision 4555) --- a/build.xml (revision 4555)
+++ a/build.xml (working copy) +++ a/build.xml (working copy)
@@ -222,13 +222,13 @@ @@ -228,7 +228,7 @@
<property name="svn.version.build" value="none"/>
<propertyfile file="${build.classes}/mkgmap-version.properties">
- <entry key="svn.version" value="${svn.version.build}" />
- <entry key="build.timestamp" value="${build.timestamp}" />
+ <entry key="svn.version" value="@version@" />
+ <entry key="build.timestamp" value="unknown" />
</propertyfile>
</target> </target>
<!-- Compile the product itself (no tests). --> <!-- Compile the product itself (no tests). -->
@ -35,12 +27,3 @@
<mkdir dir="tmp/report"/> <mkdir dir="tmp/report"/>
<junit printsummary="yes" failureproperty="junit.failure" forkmode="once"> <junit printsummary="yes" failureproperty="junit.failure" forkmode="once">
@@ -351,7 +351,7 @@
ignoreerrors="true"/>
</target>
- <target name="dist" depends="build, check-version, version-file"
+ <target name="dist" depends="build, version-file"
description="Make the distribution area">
<mkdir dir="${dist}"/>

View file

@ -1,7 +1,7 @@
{ lib, stdenv { lib
, stdenv
, fetchurl , fetchurl
, fetchsvn , fetchsvn
, substituteAll
, jdk , jdk
, jre , jre
, ant , ant
@ -24,14 +24,24 @@ stdenv.mkDerivation rec {
}; };
patches = [ patches = [
(substituteAll { # Disable automatic download of dependencies
# Disable automatic download of dependencies ./build.xml.patch
src = ./build.xml.patch; ./ignore-impure-test.patch
inherit version;
})
]; ];
postPatch = with deps; '' postPatch = with deps; ''
# Fix the output jar timestamps for reproducibility
substituteInPlace build.xml \
--replace-fail '<jar ' '<jar modificationtime="0" '
# Manually create version properties file for reproducibility
mkdir -p build/classes
cat > build/classes/mkgmap-version.properties << EOF
svn.version=${version}
build.timestamp=unknown
EOF
# Put pre-fetched dependencies into the right place
mkdir -p lib/compile mkdir -p lib/compile
cp ${fastutil} lib/compile/${fastutil.name} cp ${fastutil} lib/compile/${fastutil.name}
cp ${osmpbf} lib/compile/${osmpbf.name} cp ${osmpbf} lib/compile/${osmpbf.name}
@ -53,36 +63,51 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ jdk ant makeWrapper ]; nativeBuildInputs = [ jdk ant makeWrapper ];
buildPhase = "ant"; buildPhase = ''
runHook preBuild
ant
runHook postBuild
'';
inherit doCheck; inherit doCheck;
checkPhase = "ant test"; checkPhase = ''
runHook preCheck
ant test
runHook postCheck
'';
installPhase = '' installPhase = ''
runHook preInstall
install -Dm644 dist/mkgmap.jar -t $out/share/java/mkgmap install -Dm644 dist/mkgmap.jar -t $out/share/java/mkgmap
install -Dm644 dist/doc/mkgmap.1 -t $out/share/man/man1 install -Dm644 dist/doc/mkgmap.1 -t $out/share/man/man1
cp -r dist/lib/ $out/share/java/mkgmap/ cp -r dist/lib/ $out/share/java/mkgmap/
makeWrapper ${jre}/bin/java $out/bin/mkgmap \ makeWrapper ${jre}/bin/java $out/bin/mkgmap \
--add-flags "-jar $out/share/java/mkgmap/mkgmap.jar" --add-flags "-jar $out/share/java/mkgmap/mkgmap.jar"
'' + lib.optionalString withExamples ''
mkdir -p $out/share/mkgmap ${lib.optionalString withExamples ''
cp -r dist/examples $out/share/mkgmap/ mkdir -p $out/share/mkgmap
cp -r dist/examples $out/share/mkgmap/
''}
runHook postInstall
''; '';
passthru.updateScript = [ ./update.sh "mkgmap" meta.downloadPage ]; passthru.updateScript = [ ./update.sh "mkgmap" meta.downloadPage ];
meta = with lib; { meta = with lib; {
description = "Create maps for Garmin GPS devices from OpenStreetMap (OSM) data"; description = "Create maps for Garmin GPS devices from OpenStreetMap (OSM) data";
homepage = "https://www.mkgmap.org.uk/";
downloadPage = "https://www.mkgmap.org.uk/download/mkgmap.html"; downloadPage = "https://www.mkgmap.org.uk/download/mkgmap.html";
sourceProvenance = with sourceTypes; [ homepage = "https://www.mkgmap.org.uk/";
fromSource
binaryBytecode # deps
];
license = licenses.gpl2Only; license = licenses.gpl2Only;
mainProgram = "mkgmap";
maintainers = with maintainers; [ sikmir ]; maintainers = with maintainers; [ sikmir ];
platforms = platforms.all; platforms = platforms.all;
mainProgram = "mkgmap"; sourceProvenance = with sourceTypes; [
fromSource
binaryBytecode # deps
];
}; };
} }

View file

@ -0,0 +1,20 @@
diff --git a/test/uk/me/parabola/imgfmt/app/srt/SrtCollatorTest.java b/test/uk/me/parabola/imgfmt/app/srt/SrtCollatorTest.java
index e1e4ac7..954b918 100644
--- a/test/uk/me/parabola/imgfmt/app/srt/SrtCollatorTest.java
+++ b/test/uk/me/parabola/imgfmt/app/srt/SrtCollatorTest.java
@@ -17,6 +17,7 @@ import java.text.Collator;
import uk.me.parabola.mkgmap.srt.SrtTextReader;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.*;
@@ -111,6 +112,7 @@ public class SrtCollatorTest {
* meant to be identical to the java one.
*/
@Test
+ @Ignore
public void testJavaRules() {
Collator collator = Collator.getInstance();

View file

@ -1,13 +1,6 @@
--- a/build.xml (revision 597) --- a/build.xml (revision 597)
+++ a/build.xml (working copy) +++ a/build.xml (working copy)
@@ -207,12 +207,12 @@ @@ -212,7 +212,7 @@
<property name="svn.version.build" value="unknown"/>
<propertyfile file="${build.classes}/splitter-version.properties">
- <entry key="svn.version" value="${svn.version.build}" />
- <entry key="build.timestamp" value="${build.timestamp}" />
+ <entry key="svn.version" value="@version@" />
+ <entry key="build.timestamp" value="unknown" />
</propertyfile> </propertyfile>
</target> </target>
@ -25,15 +18,6 @@
<javac srcdir="${test}" destdir="${build.test-classes}" debug="yes" includeantruntime="false"> <javac srcdir="${test}" destdir="${build.test-classes}" debug="yes" includeantruntime="false">
<include name="**/*.java"/> <include name="**/*.java"/>
<classpath refid="test.classpath"/> <classpath refid="test.classpath"/>
@@ -261,7 +261,7 @@
<fail if="junit.failure" message="Test failed. See test-reports/index.html"/>
</target>
- <target name="dist" depends="build, check-version, version-file" description="Make the distribution area">
+ <target name="dist" depends="build, version-file" description="Make the distribution area">
<mkdir dir="${dist}"/>
<mkdir dir="${dist}/doc/api"/>
@@ -324,7 +324,7 @@ @@ -324,7 +324,7 @@
</target> </target>

View file

@ -1,7 +1,7 @@
{ lib, stdenv { lib
, stdenv
, fetchurl , fetchurl
, fetchsvn , fetchsvn
, substituteAll
, jdk , jdk
, jre , jre
, ant , ant
@ -23,17 +23,25 @@ stdenv.mkDerivation rec {
}; };
patches = [ patches = [
(substituteAll { # Disable automatic download of dependencies
# Disable automatic download of dependencies ./build.xml.patch
src = ./build.xml.patch;
inherit version;
})
# Fix func.SolverAndProblemGeneratorTest test # Fix func.SolverAndProblemGeneratorTest test
./fix-failing-test.patch ./fix-failing-test.patch
]; ];
postPatch = with deps; '' postPatch = with deps; ''
# Fix the output jar timestamps for reproducibility
substituteInPlace build.xml \
--replace-fail '<jar ' '<jar modificationtime="0" '
# Manually create version properties file for reproducibility
mkdir -p build/classes
cat > build/classes/splitter-version.properties << EOF
svn.version=${version}
build.timestamp=unknown
EOF
# Put pre-fetched dependencies into the right place
mkdir -p lib/compile mkdir -p lib/compile
cp ${fastutil} lib/compile/${fastutil.name} cp ${fastutil} lib/compile/${fastutil.name}
cp ${osmpbf} lib/compile/${osmpbf.name} cp ${osmpbf} lib/compile/${osmpbf.name}
@ -52,32 +60,46 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ jdk ant makeWrapper ]; nativeBuildInputs = [ jdk ant makeWrapper ];
buildPhase = "ant"; buildPhase = ''
runHook preBuild
ant
runHook postBuild
'';
inherit doCheck; inherit doCheck;
checkPhase = "ant run.tests && ant run.func-tests"; checkPhase = ''
runHook preCheck
ant run.tests
ant run.func-tests
runHook postCheck
'';
installPhase = '' installPhase = ''
runHook preInstall
install -Dm644 dist/splitter.jar -t $out/share/java/splitter install -Dm644 dist/splitter.jar -t $out/share/java/splitter
install -Dm644 doc/splitter.1 -t $out/share/man/man1 install -Dm644 doc/splitter.1 -t $out/share/man/man1
cp -r dist/lib/ $out/share/java/splitter/ cp -r dist/lib/ $out/share/java/splitter/
makeWrapper ${jre}/bin/java $out/bin/splitter \ makeWrapper ${jre}/bin/java $out/bin/splitter \
--add-flags "-jar $out/share/java/splitter/splitter.jar" --add-flags "-jar $out/share/java/splitter/splitter.jar"
runHook postInstall
''; '';
passthru.updateScript = [ ../update.sh "mkgmap-splitter" meta.downloadPage ]; passthru.updateScript = [ ../update.sh "mkgmap-splitter" meta.downloadPage ];
meta = with lib; { meta = with lib; {
description = "Utility for splitting OpenStreetMap maps into tiles"; description = "Utility for splitting OpenStreetMap maps into tiles";
homepage = "https://www.mkgmap.org.uk/";
downloadPage = "https://www.mkgmap.org.uk/download/splitter.html"; downloadPage = "https://www.mkgmap.org.uk/download/splitter.html";
sourceProvenance = with sourceTypes; [ homepage = "https://www.mkgmap.org.uk/";
fromSource
binaryBytecode # deps
];
license = licenses.gpl2Only; license = licenses.gpl2Only;
mainProgram = "splitter";
maintainers = with maintainers; [ sikmir ]; maintainers = with maintainers; [ sikmir ];
platforms = platforms.all; platforms = platforms.all;
sourceProvenance = with sourceTypes; [
fromSource
binaryBytecode # deps
];
}; };
} }