1 { hello, checkpointBuildTools, runCommand, texinfo, stdenv, rsync }:
3 baseHelloArtifacts = checkpointBuildTools.prepareCheckpointBuild hello;
4 patchedHello = hello.overrideAttrs (old: {
5 buildInputs = [ texinfo ];
6 src = runCommand "patch-hello-src" { } ''
9 tar xf ${hello.src} --strip-components=1
10 patch -p1 < ${./hello.patch}
13 checkpointBuiltHello = checkpointBuildTools.mkCheckpointBuild patchedHello baseHelloArtifacts;
15 checkpointBuiltHelloWithCheck = checkpointBuiltHello.overrideAttrs (old: {
18 echo "checking if unchanged source file is not recompiled"
19 [ "$(stat --format="%Y" lib/exitfail.o)" = "$(stat --format="%Y" ${baseHelloArtifacts}/outputs/lib/exitfail.o)" ]
23 baseHelloRemoveFileArtifacts = checkpointBuildTools.prepareCheckpointBuild (hello.overrideAttrs (old: {
24 patches = [ ./hello-additionalFile.patch ];
27 preparedHelloRemoveFileSrc = runCommand "patch-hello-src" { } ''
30 tar xf ${hello.src} --strip-components=1
31 patch -p1 < ${./hello-additionalFile.patch}
34 patchedHelloRemoveFile = hello.overrideAttrs (old: {
35 buildInputs = [ texinfo ];
36 src = runCommand "patch-hello-src" { } ''
39 ${rsync}/bin/rsync -cutU --chown=$USER:$USER --chmod=+w -r ${preparedHelloRemoveFileSrc}/* .
40 patch -p1 < ${./hello-removeFile.patch}
44 checkpointBuiltHelloWithRemovedFile = checkpointBuildTools.mkCheckpointBuild patchedHelloRemoveFile baseHelloRemoveFileArtifacts;
47 name = "patched-hello-returns-correct-output";
51 echo "testing output of hello binary"
52 [ "$(${checkpointBuiltHelloWithCheck}/bin/hello)" = "Hello, incremental world!" ]
53 echo "testing output of hello with removed file"
54 [ "$(${checkpointBuiltHelloWithRemovedFile}/bin/hello)" = "Hello, incremental world!" ]