Skip to content

Commit afd5fed

Browse files
committed
mkgmap, mkgmap-splitter: migrate to by-name
1 parent d685b4f commit afd5fed

13 files changed

Lines changed: 165 additions & 167 deletions

File tree

pkgs/applications/misc/mkgmap/testinputs.nix

Lines changed: 0 additions & 68 deletions
This file was deleted.

pkgs/applications/misc/mkgmap/splitter/build.xml.patch renamed to pkgs/by-name/mk/mkgmap-splitter/build.xml.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@
3535
+ <target name="run.func-tests" depends="compile,compile.tests" description="Run the functional tests">
3636
<mkdir dir="tmp/report"/>
3737
<junit printsummary="yes" failureproperty="junit.failure" forkmode="once">
38-
38+

pkgs/applications/misc/mkgmap/splitter/fix-failing-test.patch renamed to pkgs/by-name/mk/mkgmap-splitter/fix-failing-test.patch

File renamed without changes.

pkgs/applications/misc/mkgmap/splitter/default.nix renamed to pkgs/by-name/mk/mkgmap-splitter/package.nix

Lines changed: 31 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -8,56 +8,52 @@
88
ant,
99
makeWrapper,
1010
stripJavaArchivesHook,
11+
mkgmap,
1112
doCheck ? true,
1213
}:
14+
1315
let
14-
deps = import ../deps.nix { inherit fetchurl; };
16+
inherit (mkgmap) deps;
1517
testInputs = import ./testinputs.nix { inherit fetchurl; };
1618
in
17-
stdenv.mkDerivation rec {
18-
pname = "splitter";
19+
stdenv.mkDerivation (finalAttrs: {
20+
pname = "mkgmap-splitter";
1921
version = "654";
2022

2123
src = fetchsvn {
2224
url = "https://svn.mkgmap.org.uk/mkgmap/splitter/trunk";
23-
rev = version;
24-
sha256 = "sha256-y/pl8kIQ6fiF541ho72LMgJFWJdkUBqPToQGCGmmcfg=";
25+
rev = finalAttrs.version;
26+
hash = "sha256-y/pl8kIQ6fiF541ho72LMgJFWJdkUBqPToQGCGmmcfg=";
2527
};
2628

2729
patches = [
28-
# Disable automatic download of dependencies
2930
./build.xml.patch
30-
# Fix func.SolverAndProblemGeneratorTest test
3131
./fix-failing-test.patch
3232
];
3333

34-
postPatch =
35-
with deps;
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
34+
postPatch = ''
35+
mkdir -p build/classes
36+
cat > build/classes/splitter-version.properties << EOF
37+
svn.version=${finalAttrs.version}
38+
build.timestamp=unknown
39+
EOF
4340
44-
# Put pre-fetched dependencies into the right place
45-
mkdir -p lib/compile
46-
cp ${fastutil} lib/compile/${fastutil.name}
47-
cp ${osmpbf} lib/compile/${osmpbf.name}
48-
cp ${protobuf} lib/compile/${protobuf.name}
49-
cp ${xpp3} lib/compile/${xpp3.name}
50-
''
51-
+ lib.optionalString doCheck ''
52-
mkdir -p lib/test
53-
cp ${junit} lib/test/${junit.name}
54-
cp ${hamcrest-core} lib/test/${hamcrest-core.name}
41+
mkdir -p lib/compile
42+
cp ${deps.fastutil} lib/compile/${deps.fastutil.name}
43+
cp ${deps.osmpbf} lib/compile/${deps.osmpbf.name}
44+
cp ${deps.protobuf} lib/compile/${deps.protobuf.name}
45+
cp ${deps.xpp3} lib/compile/${deps.xpp3.name}
46+
''
47+
+ lib.optionalString doCheck ''
48+
mkdir -p lib/test
49+
cp ${deps.junit} lib/test/${deps.junit.name}
50+
cp ${deps.hamcrest-core} lib/test/${deps.hamcrest-core.name}
5551
56-
mkdir -p test/resources/in/osm
57-
${lib.concatMapStringsSep "\n" (res: ''
58-
cp ${res} test/resources/in/${builtins.replaceStrings [ "__" ] [ "/" ] res.name}
59-
'') testInputs}
60-
'';
52+
mkdir -p test/resources/in/osm
53+
${lib.concatMapStringsSep "\n" (res: ''
54+
cp ${res} test/resources/in/${builtins.replaceStrings [ "__" ] [ "/" ] res.name}
55+
'') testInputs}
56+
'';
6157

6258
nativeBuildInputs = [
6359
jdk
@@ -94,9 +90,9 @@ stdenv.mkDerivation rec {
9490
'';
9591

9692
passthru.updateScript = [
97-
../update.sh
93+
./update.sh
9894
"mkgmap-splitter"
99-
meta.downloadPage
95+
finalAttrs.meta.downloadPage
10096
];
10197

10298
meta = {
@@ -112,4 +108,4 @@ stdenv.mkDerivation rec {
112108
binaryBytecode # deps
113109
];
114110
};
115-
}
111+
})
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
{ fetchurl }:
22
let
33
fetchTestInput =
4-
{ res, sha256 }:
4+
{ res, hash }:
55
fetchurl {
6-
inherit sha256;
6+
inherit hash;
77
url = "https://www.mkgmap.org.uk/testinput/${res}";
88
name = builtins.replaceStrings [ "/" ] [ "__" ] res;
99
};
1010
in
1111
[
1212
(fetchTestInput {
1313
res = "osm/alaska-2016-12-27.osm.pbf";
14-
sha256 = "0hmb5v71a1bxgvrg1cbfj5l27b3vvdazs4pyggpmhcdhbwpw7ppm";
14+
hash = "sha256-9d7DL1+wMVjve/4S/VXbe6wjaJFusfDyfn0FFc4uq0I=";
1515
})
1616
(fetchTestInput {
1717
res = "osm/hamburg-2016-12-26.osm.pbf";
18-
sha256 = "08bny4aavwm3z2114q99fv3fi2w905zxi0fl7bqgjyhgk0fxjssf";
18+
hash = "sha256-TmvZHZgPevnwOtSB2H8BiYvoxnYpYRKC+KPyrRTxdiE=";
1919
})
2020
]

pkgs/applications/misc/mkgmap/build.xml.patch renamed to pkgs/by-name/mk/mkgmap/build.xml.patch

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
--- a/build.xml (revision 4555)
2-
+++ a/build.xml (working copy)
3-
@@ -228,7 +228,7 @@
1+
--- a/build.xml
2+
+++ b/build.xml
3+
@@ -228,8 +228,7 @@
44
</target>
55

66
<!-- Compile the product itself (no tests). -->
77
- <target name="compile" depends="prepare, resolve-compile"
8-
+ <target name="compile" depends="prepare"
9-
description="main compilation">
8+
- description="main compilation">
9+
+ <target name="compile" depends="prepare" description="main compilation">
1010

1111
<javac srcdir="${src}" destdir="${build.classes}" encoding="utf-8" debug="true" includeantruntime="false">
12-
@@ -263,7 +263,7 @@
12+
<include name="**/*.java" />
13+
@@ -264,7 +263,7 @@
1314
</target>
1415

1516
<!-- Compile the test classes -->
@@ -18,7 +19,7 @@
1819
<mkdir dir="${build.test}" />
1920
<javac srcdir="${test}" destdir="${build.test}" encoding="utf-8" debug="true" includeantruntime="false">
2021
<include name="**/*.java" />
21-
@@ -271,7 +271,7 @@
22+
@@ -275,7 +274,7 @@
2223
</javac>
2324
</target>
2425

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.
Lines changed: 39 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -11,56 +11,52 @@
1111
doCheck ? true,
1212
withExamples ? false,
1313
}:
14+
1415
let
1516
deps = import ./deps.nix { inherit fetchurl; };
1617
testInputs = import ./testinputs.nix { inherit fetchurl; };
1718
in
18-
stdenv.mkDerivation rec {
19+
stdenv.mkDerivation (finalAttrs: {
1920
pname = "mkgmap";
2021
version = "4924";
2122

2223
src = fetchsvn {
2324
url = "https://svn.mkgmap.org.uk/mkgmap/mkgmap/trunk";
24-
rev = version;
25-
sha256 = "sha256-4DGGAWgyIvK5pcopwlO4YDGDc73lOsL0Ljy/kFUY2As=";
25+
rev = finalAttrs.version;
26+
hash = "sha256-4DGGAWgyIvK5pcopwlO4YDGDc73lOsL0Ljy/kFUY2As=";
2627
};
2728

2829
patches = [
29-
# Disable automatic download of dependencies
3030
./build.xml.patch
3131
./ignore-impure-test.patch
3232
];
3333

34-
postPatch =
35-
with deps;
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
45-
mkdir -p lib/compile
46-
cp ${fastutil} lib/compile/${fastutil.name}
47-
cp ${osmpbf} lib/compile/${osmpbf.name}
48-
cp ${protobuf} lib/compile/${protobuf.name}
49-
''
50-
+ lib.optionalString doCheck ''
51-
mkdir -p lib/test
52-
cp ${fastutil} lib/test/${fastutil.name}
53-
cp ${osmpbf} lib/test/${osmpbf.name}
54-
cp ${protobuf} lib/test/${protobuf.name}
55-
cp ${jaxb-api} lib/test/${jaxb-api.name}
56-
cp ${junit} lib/test/${junit.name}
57-
cp ${hamcrest-core} lib/test/${hamcrest-core.name}
58-
59-
mkdir -p test/resources/in/img
60-
${lib.concatMapStringsSep "\n" (res: ''
61-
cp ${res} test/resources/in/${builtins.replaceStrings [ "__" ] [ "/" ] res.name}
62-
'') testInputs}
63-
'';
34+
postPatch = ''
35+
mkdir -p build/classes
36+
cat > build/classes/mkgmap-version.properties << EOF
37+
svn.version=${finalAttrs.version}
38+
build.timestamp=unknown
39+
EOF
40+
41+
mkdir -p lib/compile
42+
cp ${deps.fastutil} lib/compile/${deps.fastutil.name}
43+
cp ${deps.osmpbf} lib/compile/${deps.osmpbf.name}
44+
cp ${deps.protobuf} lib/compile/${deps.protobuf.name}
45+
''
46+
+ lib.optionalString doCheck ''
47+
mkdir -p lib/test
48+
cp ${deps.fastutil} lib/test/${deps.fastutil.name}
49+
cp ${deps.osmpbf} lib/test/${deps.osmpbf.name}
50+
cp ${deps.protobuf} lib/test/${deps.protobuf.name}
51+
cp ${deps.jaxb-api} lib/test/${deps.jaxb-api.name}
52+
cp ${deps.junit} lib/test/${deps.junit.name}
53+
cp ${deps.hamcrest-core} lib/test/${deps.hamcrest-core.name}
54+
55+
mkdir -p test/resources/in/img
56+
${lib.concatMapStringsSep "\n" (res: ''
57+
cp ${res} test/resources/in/${builtins.replaceStrings [ "__" ] [ "/" ] res.name}
58+
'') testInputs}
59+
'';
6460

6561
nativeBuildInputs = [
6662
jdk
@@ -100,11 +96,14 @@ stdenv.mkDerivation rec {
10096
runHook postInstall
10197
'';
10298

103-
passthru.updateScript = [
104-
./update.sh
105-
"mkgmap"
106-
meta.downloadPage
107-
];
99+
passthru = {
100+
inherit deps;
101+
updateScript = [
102+
./update.sh
103+
"mkgmap"
104+
finalAttrs.meta.downloadPage
105+
];
106+
};
108107

109108
meta = {
110109
description = "Create maps for Garmin GPS devices from OpenStreetMap (OSM) data";
@@ -119,5 +118,4 @@ stdenv.mkDerivation rec {
119118
binaryBytecode # deps
120119
];
121120
};
122-
123-
}
121+
})

0 commit comments

Comments
 (0)