Skip to content

Commit

Permalink
dockertools: tarsum: turn in to a buildInput
Browse files Browse the repository at this point in the history
  • Loading branch information
graham-at-target committed Sep 26, 2018
1 parent 725b57b commit 2bf0ee3
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions pkgs/build-support/docker/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ rec {
ln -sT ${docker.src}/components/engine/pkg/tarsum src/github.com/docker/docker/pkg/tarsum
go build
cp tarsum $out
mkdir -p $out/bin
cp tarsum $out/bin/
'';

# buildEnv creates symlinks to dirs, which is hard to edit inside the overlay VM
Expand Down Expand Up @@ -287,7 +289,7 @@ rec {
}:
runCommand "docker-layer-${name}" {
inherit baseJson contents extraCommands;
buildInputs = [ jshon rsync ];
buildInputs = [ jshon rsync tarsum ];
}
''
mkdir layer
Expand All @@ -314,11 +316,11 @@ rec {
# Compute a checksum of the tarball.
echo "Computing layer checksum..."
tarsum=$(${tarsum} < $out/layer.tar)
tarhash=$(tarsum < $out/layer.tar)
# Add a 'checksum' field to the JSON, with the value set to the
# checksum of the tarball.
cat ${baseJson} | jshon -s "$tarsum" -i checksum > $out/json
cat ${baseJson} | jshon -s "$tarhash" -i checksum > $out/json
# Indicate to docker that we're using schema version 1.0.
echo -n "1.0" > $out/VERSION
Expand Down Expand Up @@ -402,8 +404,8 @@ rec {
# Compute the tar checksum and add it to the output json.
echo "Computing checksum..."
ts=$(${tarsum} < $out/layer.tar)
cat ${baseJson} | jshon -s "$ts" -i checksum > $out/json
tarhash=$(${tarsum}/bin/tarsum < $out/layer.tar)
cat ${baseJson} | jshon -s "$tarhash" -i checksum > $out/json
# Indicate to docker that we're using schema version 1.0.
echo -n "1.0" > $out/VERSION
Expand Down

0 comments on commit 2bf0ee3

Please sign in to comment.