Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit 1219e45

Browse files
author
Erik Hollensbe
committed
utils/tarsum* -> pkg/tarsum
Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
1 parent 403df17 commit 1219e45

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

builder/builder.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"github.com/docker/docker/pkg/parsers"
2727
"github.com/docker/docker/pkg/symlink"
2828
"github.com/docker/docker/pkg/system"
29+
"github.com/docker/docker/pkg/tarsum"
2930
"github.com/docker/docker/registry"
3031
"github.com/docker/docker/runconfig"
3132
"github.com/docker/docker/utils"
@@ -50,7 +51,7 @@ type buildFile struct {
5051
config *runconfig.Config
5152

5253
contextPath string
53-
context *utils.TarSum
54+
context *tarsum.TarSum
5455

5556
verbose bool
5657
utilizeCache bool
@@ -555,7 +556,7 @@ func (b *buildFile) runContextCommand(args string, allowRemote bool, allowDecomp
555556
if err != nil {
556557
return err
557558
}
558-
tarSum := &utils.TarSum{Reader: r, DisableCompression: true}
559+
tarSum := &tarsum.TarSum{Reader: r, DisableCompression: true}
559560
if _, err := io.Copy(ioutil.Discard, tarSum); err != nil {
560561
return err
561562
}
@@ -777,7 +778,7 @@ func (b *buildFile) Build(context io.Reader) (string, error) {
777778
return "", err
778779
}
779780

780-
b.context = &utils.TarSum{Reader: decompressedStream, DisableCompression: true}
781+
b.context = &tarsum.TarSum{Reader: decompressedStream, DisableCompression: true}
781782
if err := archive.Untar(b.context, tmpdirPath, nil); err != nil {
782783
return "", err
783784
}

utils/tarsum.go renamed to pkg/tarsum/tarsum.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
package utils
1+
package tarsum
22

33
import (
44
"bytes"
55
"compress/gzip"
66
"crypto/sha256"
77
"encoding/hex"
8-
"github.com/docker/docker/vendor/src/code.google.com/p/go/src/pkg/archive/tar"
98
"hash"
109
"io"
1110
"sort"
1211
"strconv"
1312
"strings"
13+
14+
"github.com/docker/docker/utils"
15+
"github.com/docker/docker/vendor/src/code.google.com/p/go/src/pkg/archive/tar"
1416
)
1517

1618
type TarSum struct {
@@ -168,11 +170,11 @@ func (ts *TarSum) Sum(extra []byte) string {
168170
h.Write(extra)
169171
}
170172
for _, sum := range sums {
171-
Debugf("-->%s<--", sum)
173+
utils.Debugf("-->%s<--", sum)
172174
h.Write([]byte(sum))
173175
}
174176
checksum := "tarsum+sha256:" + hex.EncodeToString(h.Sum(nil))
175-
Debugf("checksum processed: %s", checksum)
177+
utils.Debugf("checksum processed: %s", checksum)
176178
return checksum
177179
}
178180

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package utils
1+
package tarsum
22

33
import (
44
"bytes"

registry/registry.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"github.com/docker/docker/dockerversion"
2727
"github.com/docker/docker/pkg/httputils"
2828
"github.com/docker/docker/pkg/parsers/kernel"
29+
"github.com/docker/docker/pkg/tarsum"
2930
"github.com/docker/docker/utils"
3031
)
3132

@@ -638,7 +639,7 @@ func (r *Registry) PushImageLayerRegistry(imgID string, layer io.Reader, registr
638639

639640
utils.Debugf("[registry] Calling PUT %s", registry+"images/"+imgID+"/layer")
640641

641-
tarsumLayer := &utils.TarSum{Reader: layer}
642+
tarsumLayer := &tarsum.TarSum{Reader: layer}
642643
h := sha256.New()
643644
h.Write(jsonRaw)
644645
h.Write([]byte{'\n'})

0 commit comments

Comments
 (0)