From dff2a23749a6b7c949146d7850f514cd74e3a8d7 Mon Sep 17 00:00:00 2001 From: Lorenzo Fontana Date: Fri, 29 Sep 2017 02:55:35 +0200 Subject: [PATCH] Cleaning dead code out of the builder Signed-off-by: Lorenzo Fontana --- builder/dockerfile/clientsession.go | 1 - builder/dockerfile/copy_windows.go | 5 +++++ builder/dockerfile/evaluator.go | 7 ------- builder/dockerfile/imagecontext.go | 1 - builder/dockerfile/internals.go | 6 ------ builder/fscache/fscache.go | 1 - builder/remotecontext/tarsum.go | 14 -------------- 7 files changed, 5 insertions(+), 30 deletions(-) diff --git a/builder/dockerfile/clientsession.go b/builder/dockerfile/clientsession.go index 9a5411685a..2ef5bf5462 100644 --- a/builder/dockerfile/clientsession.go +++ b/builder/dockerfile/clientsession.go @@ -41,7 +41,6 @@ func (cst *ClientSessionTransport) Copy(ctx context.Context, id fscache.RemoteId type ClientSessionSourceIdentifier struct { includePatterns []string caller session.Caller - sharedKey string uuid string } diff --git a/builder/dockerfile/copy_windows.go b/builder/dockerfile/copy_windows.go index dcf4c5acfb..f7fc6e0329 100644 --- a/builder/dockerfile/copy_windows.go +++ b/builder/dockerfile/copy_windows.go @@ -8,6 +8,11 @@ import ( "github.com/docker/docker/pkg/idtools" ) +var pathBlacklist = map[string]bool{ + "c:\\": true, + "c:\\windows": true, +} + func fixPermissions(source, destination string, rootIDs idtools.IDPair, overrideSkip bool) error { // chown is not supported on Windows return nil diff --git a/builder/dockerfile/evaluator.go b/builder/dockerfile/evaluator.go index cd4f513fad..40af56604b 100644 --- a/builder/dockerfile/evaluator.go +++ b/builder/dockerfile/evaluator.go @@ -203,13 +203,6 @@ func (s *dispatchState) hasFromImage() bool { return s.imageID != "" || (s.baseImage != nil && s.baseImage.ImageID() == "") } -func (s *dispatchState) isCurrentStage(target string) bool { - if target == "" { - return false - } - return strings.EqualFold(s.stageName, target) -} - func (s *dispatchState) beginStage(stageName string, image builder.Image) { s.stageName = stageName s.imageID = image.ImageID() diff --git a/builder/dockerfile/imagecontext.go b/builder/dockerfile/imagecontext.go index 084255d173..2301d1aab4 100644 --- a/builder/dockerfile/imagecontext.go +++ b/builder/dockerfile/imagecontext.go @@ -18,7 +18,6 @@ type imageSources struct { byImageID map[string]*imageMount mounts []*imageMount getImage getAndMountFunc - cache pathCache // TODO: remove } // TODO @jhowardmsft LCOW Support: Eventually, platform can be moved to options.Options.Platform, diff --git a/builder/dockerfile/internals.go b/builder/dockerfile/internals.go index 4c82e61588..be46d3186d 100644 --- a/builder/dockerfile/internals.go +++ b/builder/dockerfile/internals.go @@ -29,12 +29,6 @@ import ( "github.com/pkg/errors" ) -// For Windows only -var pathBlacklist = map[string]bool{ - "c:\\": true, - "c:\\windows": true, -} - // Archiver defines an interface for copying files from one destination to // another using Tar/Untar. type Archiver interface { diff --git a/builder/fscache/fscache.go b/builder/fscache/fscache.go index 880cc9d10d..7cb4c5cbe9 100644 --- a/builder/fscache/fscache.go +++ b/builder/fscache/fscache.go @@ -217,7 +217,6 @@ func syncFrom(ctx context.Context, cs *cachedSourceRef, transport Transport, id } type fsCacheStore struct { - root string mu sync.Mutex sources map[string]*cachedSource db *bolt.DB diff --git a/builder/remotecontext/tarsum.go b/builder/remotecontext/tarsum.go index 370f13d80b..78f7470b37 100644 --- a/builder/remotecontext/tarsum.go +++ b/builder/remotecontext/tarsum.go @@ -1,7 +1,6 @@ package remotecontext import ( - "fmt" "os" "sync" @@ -133,19 +132,6 @@ func (cs *CachableSource) Close() error { return nil } -func (cs *CachableSource) normalize(path string) (cleanpath, fullpath string, err error) { - cleanpath = cs.root.Clean(string(cs.root.Separator()) + path)[1:] - fullpath, err = cs.root.ResolveScopedPath(path, true) - if err != nil { - return "", "", fmt.Errorf("Forbidden path outside the context: %s (%s)", path, fullpath) - } - _, err = cs.root.Lstat(fullpath) - if err != nil { - return "", "", convertPathError(err, path) - } - return -} - // Hash returns a hash for a single file in the source func (cs *CachableSource) Hash(path string) (string, error) { n := cs.getRoot()