Browse Source

pkg/containerfs: Trim away Driver interface part 1

The Driver interface was required for Linux Containers on Windows, which
is no longer supported.

Signed-off-by: Cory Snider <csnider@mirantis.com>
Cory Snider 2 years ago
parent
commit
4d48c00f94

+ 2 - 1
builder/remotecontext/lazycontext.go

@@ -3,6 +3,7 @@ package remotecontext // import "github.com/docker/docker/builder/remotecontext"
 import (
 import (
 	"encoding/hex"
 	"encoding/hex"
 	"os"
 	"os"
+	"runtime"
 	"strings"
 	"strings"
 
 
 	"github.com/docker/docker/builder"
 	"github.com/docker/docker/builder"
@@ -88,7 +89,7 @@ func (c *lazySource) prepareHash(relPath string, fi os.FileInfo) (string, error)
 // handle UUID paths in windows.
 // handle UUID paths in windows.
 func Rel(basepath containerfs.ContainerFS, targpath string) (string, error) {
 func Rel(basepath containerfs.ContainerFS, targpath string) (string, error) {
 	// filepath.Rel can't handle UUID paths in windows
 	// filepath.Rel can't handle UUID paths in windows
-	if basepath.OS() == "windows" {
+	if runtime.GOOS == "windows" {
 		pfx := basepath.Path() + `\`
 		pfx := basepath.Path() + `\`
 		if strings.HasPrefix(targpath, pfx) {
 		if strings.HasPrefix(targpath, pfx) {
 			p := strings.TrimPrefix(targpath, pfx)
 			p := strings.TrimPrefix(targpath, pfx)

+ 3 - 2
pkg/containerfs/archiver.go

@@ -6,6 +6,7 @@ import (
 	"io"
 	"io"
 	"os"
 	"os"
 	"path/filepath"
 	"path/filepath"
+	"runtime"
 	"time"
 	"time"
 
 
 	"github.com/docker/docker/pkg/archive"
 	"github.com/docker/docker/pkg/archive"
@@ -109,7 +110,7 @@ func (archiver *Archiver) CopyFileWithTar(src, dst string) (retErr error) {
 
 
 	// The original call was system.MkdirAll, which is just
 	// The original call was system.MkdirAll, which is just
 	// os.MkdirAll on not-Windows and changed for Windows.
 	// os.MkdirAll on not-Windows and changed for Windows.
-	if dstDriver.OS() == "windows" {
+	if runtime.GOOS == "windows" {
 		// Now we are WCOW
 		// Now we are WCOW
 		if err := system.MkdirAll(filepath.Dir(dst), 0700); err != nil {
 		if err := system.MkdirAll(filepath.Dir(dst), 0700); err != nil {
 			return err
 			return err
@@ -144,7 +145,7 @@ func (archiver *Archiver) CopyFileWithTar(src, dst string) (retErr error) {
 			hdr.AccessTime = time.Time{}
 			hdr.AccessTime = time.Time{}
 			hdr.ChangeTime = time.Time{}
 			hdr.ChangeTime = time.Time{}
 			hdr.Name = dstDriver.Base(dst)
 			hdr.Name = dstDriver.Base(dst)
-			if dstDriver.OS() == "windows" {
+			if runtime.GOOS == "windows" {
 				hdr.Mode = int64(chmodTarEntry(os.FileMode(hdr.Mode)))
 				hdr.Mode = int64(chmodTarEntry(os.FileMode(hdr.Mode)))
 			} else {
 			} else {
 				hdr.Mode = int64(os.FileMode(hdr.Mode))
 				hdr.Mode = int64(os.FileMode(hdr.Mode))

+ 0 - 16
pkg/containerfs/containerfs.go

@@ -2,7 +2,6 @@ package containerfs // import "github.com/docker/docker/pkg/containerfs"
 
 
 import (
 import (
 	"path/filepath"
 	"path/filepath"
-	"runtime"
 
 
 	"github.com/containerd/continuity/driver"
 	"github.com/containerd/continuity/driver"
 	"github.com/containerd/continuity/pathdriver"
 	"github.com/containerd/continuity/pathdriver"
@@ -28,13 +27,6 @@ type ContainerFS interface {
 // Driver combines both continuity's Driver and PathDriver interfaces with a Platform
 // Driver combines both continuity's Driver and PathDriver interfaces with a Platform
 // field to determine the OS.
 // field to determine the OS.
 type Driver interface {
 type Driver interface {
-	// OS returns the OS where the rootfs is located. Essentially, runtime.GOOS.
-	OS() string
-
-	// Architecture returns the hardware architecture where the
-	// container is located.
-	Architecture() string
-
 	// Driver & PathDriver provide methods to manipulate files & paths
 	// Driver & PathDriver provide methods to manipulate files & paths
 	driver.Driver
 	driver.Driver
 	pathdriver.PathDriver
 	pathdriver.PathDriver
@@ -76,11 +68,3 @@ func (l *local) ResolveScopedPath(path string, rawPath bool) (string, error) {
 	}
 	}
 	return symlink.FollowSymlinkInScope(filepath.Join(l.path, cleanedPath), l.path)
 	return symlink.FollowSymlinkInScope(filepath.Join(l.path, cleanedPath), l.path)
 }
 }
-
-func (l *local) OS() string {
-	return runtime.GOOS
-}
-
-func (l *local) Architecture() string {
-	return runtime.GOARCH
-}