فهرست منبع

Merge pull request #21190 from runcom/cleanup

*: remove unused stuff
Sebastiaan van Stijn 9 سال پیش
والد
کامیت
68ca76320f
4فایلهای تغییر یافته به همراه0 افزوده شده و 65 حذف شده
  1. 0 40
      builder/dockerfile/internals_unix.go
  2. 0 8
      builder/dockerfile/internals_windows.go
  3. 0 6
      container/container.go
  4. 0 11
      layer/filestore_test.go

+ 0 - 40
builder/dockerfile/internals_unix.go

@@ -1,40 +0,0 @@
-// +build !windows
-
-package dockerfile
-
-import (
-	"os"
-	"path/filepath"
-)
-
-func fixPermissions(source, destination string, uid, gid int, destExisted bool) error {
-	// If the destination didn't already exist, or the destination isn't a
-	// directory, then we should Lchown the destination. Otherwise, we shouldn't
-	// Lchown the destination.
-	destStat, err := os.Stat(destination)
-	if err != nil {
-		// This should *never* be reached, because the destination must've already
-		// been created while untar-ing the context.
-		return err
-	}
-	doChownDestination := !destExisted || !destStat.IsDir()
-
-	// We Walk on the source rather than on the destination because we don't
-	// want to change permissions on things we haven't created or modified.
-	return filepath.Walk(source, func(fullpath string, info os.FileInfo, err error) error {
-		// Do not alter the walk root iff. it existed before, as it doesn't fall under
-		// the domain of "things we should chown".
-		if !doChownDestination && (source == fullpath) {
-			return nil
-		}
-
-		// Path is prefixed by source: substitute with destination instead.
-		cleaned, err := filepath.Rel(source, fullpath)
-		if err != nil {
-			return err
-		}
-
-		fullpath = filepath.Join(destination, cleaned)
-		return os.Lchown(fullpath, uid, gid)
-	})
-}

+ 0 - 8
builder/dockerfile/internals_windows.go

@@ -1,8 +0,0 @@
-// +build windows
-
-package dockerfile
-
-func fixPermissions(source, destination string, uid, gid int, destExisted bool) error {
-	// chown is not supported on Windows
-	return nil
-}

+ 0 - 6
container/container.go

@@ -301,12 +301,6 @@ func (container *Container) ConfigPath() (string, error) {
 	return container.GetRootResourcePath(configFileName)
 }
 
-// Returns true if the container exposes a certain port
-func (container *Container) exposes(p nat.Port) bool {
-	_, exists := container.Config.ExposedPorts[p]
-	return exists
-}
-
 // StartLogger starts a new logger driver for the container.
 func (container *Container) StartLogger(cfg containertypes.LogConfig) (logger.Logger, error) {
 	c, err := logger.GetLogDriver(cfg.Type)

+ 0 - 11
layer/filestore_test.go

@@ -47,17 +47,6 @@ func assertNotDirectoryError(t *testing.T, err error) {
 	}
 }
 
-func assertPermissionError(t *testing.T, err error) {
-	perr, ok := err.(*os.PathError)
-	if !ok {
-		t.Fatalf("Unexpected error %#v, expected path error", err)
-	}
-
-	if perr.Err != syscall.EACCES {
-		t.Fatalf("Unexpected error %s, expected %s", perr.Err, syscall.EACCES)
-	}
-}
-
 func TestCommitFailure(t *testing.T) {
 	fms, td, cleanup := newFileMetadataStore(t)
 	defer cleanup()