pkg/system: move CheckSystemDriveAndRemoveDriveLetter to pkg/archive

This one is a "bit" fuzzy, as it may not be _directly_ related to `archive`,
but it's always used _in combination_ with the archive package, so moving it
there.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-10-08 15:28:31 +02:00
parent c4872b4519
commit fb77973201
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
6 changed files with 7 additions and 12 deletions

View file

@ -6,7 +6,6 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/system"
"github.com/pkg/errors"
)
@ -18,8 +17,8 @@ func (container *Container) ResolvePath(path string) (resolvedPath, absPath stri
if container.BaseFS == "" {
return "", "", errors.New("ResolvePath: BaseFS of container " + container.ID + " is unexpectedly empty")
}
// Check if a drive letter supplied, it must be the system drive.
path, err = system.CheckSystemDriveAndRemoveDriveLetter(path)
// Check if a drive letter supplied, it must be the system drive. No-op except on Windows
path, err = archive.CheckSystemDriveAndRemoveDriveLetter(path)
if err != nil {
return "", "", err
}

View file

@ -14,7 +14,6 @@ import (
"github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/chrootarchive"
"github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/system"
)
// containerStatPath stats the filesystem resource at the specified path in this
@ -172,7 +171,7 @@ func (daemon *Daemon) containerExtractToDir(container *container.Container, path
path = filepath.FromSlash(path)
// Check if a drive letter supplied, it must be the system drive. No-op except on Windows
path, err = system.CheckSystemDriveAndRemoveDriveLetter(path)
path, err = archive.CheckSystemDriveAndRemoveDriveLetter(path)
if err != nil {
return err
}

View file

@ -1,4 +1,4 @@
package system // import "github.com/docker/docker/pkg/system"
package archive
// CheckSystemDriveAndRemoveDriveLetter verifies that a path, if it includes a drive letter,
// is the system drive.

View file

@ -1,7 +1,7 @@
//go:build !windows
// +build !windows
package system // import "github.com/docker/docker/pkg/system"
package archive
// checkSystemDriveAndRemoveDriveLetter is the non-Windows implementation
// of CheckSystemDriveAndRemoveDriveLetter

View file

@ -1,4 +1,4 @@
package system // import "github.com/docker/docker/pkg/system"
package archive
import (
"fmt"

View file

@ -1,7 +1,4 @@
//go:build windows
// +build windows
package system // import "github.com/docker/docker/pkg/system"
package archive
import (
"testing"