Skip to content

Commit 7aa03ee

Browse files
committed
mkgmap-splitter: use SRI hashes and finalAttrs pattern
Also use deps from mkgmap.passthru instead of importing via relative path.
1 parent d494497 commit 7aa03ee

2 files changed

Lines changed: 34 additions & 38 deletions

File tree

pkgs/by-name/mk/mkgmap-splitter/package.nix

Lines changed: 30 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,57 +7,53 @@
77
jre,
88
ant,
99
makeWrapper,
10+
mkgmap,
1011
stripJavaArchivesHook,
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 {
19+
stdenv.mkDerivation (finalAttrs: {
1820
pname = "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
]

0 commit comments

Comments
 (0)