Bläddra i källkod

Merge pull request #43335 from thaJeztah/remove_deprecated_pkg

Remove deprecated packages: pkg/mount, pkg/term, pkg/locker, pkg/symlink
Sebastiaan van Stijn 3 år sedan
förälder
incheckning
f8d0102e33

+ 0 - 17
builder/dockerignore/deprecated.go

@@ -1,17 +0,0 @@
-// Package dockerignore is deprecated. Use github.com/moby/buildkit/frontend/dockerfile/dockerignore instead.
-package dockerignore
-
-import (
-	"io"
-
-	"github.com/moby/buildkit/frontend/dockerfile/dockerignore"
-)
-
-// ReadAll reads a .dockerignore file and returns the list of file patterns
-// to ignore. Note this will trim whitespace from each line as well
-// as use GO's "clean" func to get the shortest/cleanest path for each.
-//
-// Deprecated: use github.com/moby/buildkit/frontend/dockerfile/dockerignore.ReadAll instead.
-func ReadAll(reader io.Reader) ([]string, error) {
-	return dockerignore.ReadAll(reader)
-}

+ 0 - 30
pkg/locker/locker.go

@@ -1,30 +0,0 @@
-/*
-Package locker provides a mechanism for creating finer-grained locking to help
-free up more global locks to handle other tasks.
-
-The implementation looks close to a sync.Mutex, however the user must provide a
-reference to use to refer to the underlying lock when locking and unlocking,
-and unlock may generate an error.
-
-If a lock with a given name does not exist when `Lock` is called, one is
-created.
-Lock references are automatically cleaned up on `Unlock` if nothing else is
-waiting for the lock.
-*/
-package locker // import "github.com/docker/docker/pkg/locker"
-
-import (
-	"github.com/moby/locker"
-)
-
-// ErrNoSuchLock is returned when the requested lock does not exist
-// Deprecated: use github.com/moby/locker.ErrNoSuchLock
-var ErrNoSuchLock = locker.ErrNoSuchLock
-
-// Locker provides a locking mechanism based on the passed in reference name
-// Deprecated: use github.com/moby/locker.Locker
-type Locker = locker.Locker
-
-// New creates a new Locker
-// Deprecated: use github.com/moby/locker.New
-var New = locker.New

+ 0 - 67
pkg/mount/deprecated.go

@@ -1,67 +0,0 @@
-package mount // import "github.com/docker/docker/pkg/mount"
-
-// Deprecated: this package is not maintained and will be removed.
-// Use github.com/moby/sys/mount and github.com/moby/sys/mountinfo instead.
-
-import (
-	"github.com/moby/sys/mountinfo"
-)
-
-//nolint:golint
-type (
-	// FilterFunc is a type.
-	// Deprecated: use github.com/moby/sys/mountinfo instead.
-	FilterFunc = func(*Info) (skip, stop bool)
-
-	// Info is a type
-	// Deprecated: use github.com/moby/sys/mountinfo instead.
-	Info struct {
-		ID, Parent, Major, Minor                                  int
-		Root, Mountpoint, Opts, Optional, Fstype, Source, VfsOpts string
-	}
-)
-
-// Deprecated: use github.com/moby/sys/mountinfo instead.
-//nolint:golint
-var (
-	Mounted           = mountinfo.Mounted
-	PrefixFilter      = mountinfo.PrefixFilter
-	SingleEntryFilter = mountinfo.SingleEntryFilter
-	ParentsFilter     = mountinfo.ParentsFilter
-	FstypeFilter      = mountinfo.FSTypeFilter
-)
-
-// GetMounts is a function.
-//
-// Deprecated: use github.com/moby/sys/mountinfo.GetMounts() instead.
-//nolint:golint
-func GetMounts(f FilterFunc) ([]*Info, error) {
-	fi := func(i *mountinfo.Info) (skip, stop bool) {
-		return f(toLegacyInfo(i))
-	}
-
-	mounts, err := mountinfo.GetMounts(fi)
-	if err != nil {
-		return nil, err
-	}
-	mi := make([]*Info, len(mounts))
-	for i, m := range mounts {
-		mi[i] = toLegacyInfo(m)
-	}
-	return mi, nil
-}
-
-func toLegacyInfo(m *mountinfo.Info) *Info {
-	return &Info{
-		ID:         m.ID,
-		Parent:     m.Parent,
-		Major:      m.Major,
-		Minor:      m.Minor,
-		Root:       m.Root,
-		Mountpoint: m.Mountpoint,
-		Opts:       m.Options,
-		Fstype:     m.FSType,
-		Source:     m.Source,
-		VfsOpts:    m.VFSOptions,
-	}
-}

+ 0 - 19
pkg/mount/deprecated_linux.go

@@ -1,19 +0,0 @@
-package mount // import "github.com/docker/docker/pkg/mount"
-
-import (
-	sysmount "github.com/moby/sys/mount"
-)
-
-// Deprecated: use github.com/moby/sys/mount instead.
-//nolint:golint
-var (
-	MakeMount       = sysmount.MakeMount
-	MakeShared      = sysmount.MakeShared
-	MakeRShared     = sysmount.MakeRShared
-	MakePrivate     = sysmount.MakePrivate
-	MakeRPrivate    = sysmount.MakeRPrivate
-	MakeSlave       = sysmount.MakeSlave
-	MakeRSlave      = sysmount.MakeRSlave
-	MakeUnbindable  = sysmount.MakeUnbindable
-	MakeRUnbindable = sysmount.MakeRUnbindable
-)

+ 0 - 53
pkg/mount/deprecated_unix.go

@@ -1,53 +0,0 @@
-//go:build !darwin && !windows
-// +build !darwin,!windows
-
-package mount // import "github.com/docker/docker/pkg/mount"
-
-// Deprecated: this package is not maintained and will be removed.
-// Use github.com/moby/sys/mount and github.com/moby/sys/mountinfo instead.
-
-import (
-	sysmount "github.com/moby/sys/mount"
-)
-
-// Deprecated: use github.com/moby/sys/mount instead.
-//nolint:golint
-var (
-	Mount            = sysmount.Mount
-	ForceMount       = sysmount.Mount // a deprecated synonym
-	Unmount          = sysmount.Unmount
-	RecursiveUnmount = sysmount.RecursiveUnmount
-)
-
-// Deprecated: use github.com/moby/sys/mount instead.
-//nolint:golint
-const (
-	RDONLY      = sysmount.RDONLY
-	NOSUID      = sysmount.NOSUID
-	NOEXEC      = sysmount.NOEXEC
-	SYNCHRONOUS = sysmount.SYNCHRONOUS
-	NOATIME     = sysmount.NOATIME
-	BIND        = sysmount.BIND
-	DIRSYNC     = sysmount.DIRSYNC
-	MANDLOCK    = sysmount.MANDLOCK
-	NODEV       = sysmount.NODEV
-	NODIRATIME  = sysmount.NODIRATIME
-	UNBINDABLE  = sysmount.UNBINDABLE
-	RUNBINDABLE = sysmount.RUNBINDABLE
-	PRIVATE     = sysmount.PRIVATE
-	RPRIVATE    = sysmount.RPRIVATE
-	SHARED      = sysmount.SHARED
-	RSHARED     = sysmount.RSHARED
-	SLAVE       = sysmount.SLAVE
-	RSLAVE      = sysmount.RSLAVE
-	RBIND       = sysmount.RBIND
-	RELATIME    = sysmount.RELATIME
-	REMOUNT     = sysmount.REMOUNT
-	STRICTATIME = sysmount.STRICTATIME
-)
-
-// Deprecated: use github.com/moby/sys/mount instead.
-//nolint:golint
-var (
-	MergeTmpfsOptions = sysmount.MergeTmpfsOptions
-)

+ 0 - 12
pkg/symlink/deprecated.go

@@ -1,12 +0,0 @@
-package symlink // import "github.com/docker/docker/pkg/symlink"
-
-import "github.com/moby/sys/symlink"
-
-var (
-	// EvalSymlinks is deprecated and moved to github.com/moby/sys/symlink
-	// Deprecated: use github.com/moby/sys/symlink.EvalSymlinks instead
-	EvalSymlinks = symlink.EvalSymlinks
-	// FollowSymlinkInScope is deprecated and moved to github.com/moby/sys/symlink
-	// Deprecated: use github.com/moby/sys/symlink.FollowSymlinkInScope instead
-	FollowSymlinkInScope = symlink.FollowSymlinkInScope
-)

+ 0 - 84
pkg/term/deprecated.go

@@ -1,84 +0,0 @@
-// Package term provides structures and helper functions to work with
-// terminal (state, sizes).
-//
-// Deprecated: use github.com/moby/term instead
-package term // import "github.com/docker/docker/pkg/term"
-
-import (
-	"github.com/moby/term"
-)
-
-// EscapeError is special error which returned by a TTY proxy reader's Read()
-// method in case its detach escape sequence is read.
-// Deprecated: use github.com/moby/term.EscapeError
-type EscapeError = term.EscapeError
-
-// State represents the state of the terminal.
-// Deprecated: use github.com/moby/term.State
-type State = term.State
-
-// Winsize represents the size of the terminal window.
-// Deprecated: use github.com/moby/term.Winsize
-type Winsize = term.Winsize
-
-var (
-	// ASCII list the possible supported ASCII key sequence
-	ASCII = term.ASCII
-
-	// ToBytes converts a string representing a suite of key-sequence to the corresponding ASCII code.
-	// Deprecated: use github.com/moby/term.ToBytes
-	ToBytes = term.ToBytes
-
-	// StdStreams returns the standard streams (stdin, stdout, stderr).
-	// Deprecated: use github.com/moby/term.StdStreams
-	StdStreams = term.StdStreams
-
-	// GetFdInfo returns the file descriptor for an os.File and indicates whether the file represents a terminal.
-	// Deprecated: use github.com/moby/term.GetFdInfo
-	GetFdInfo = term.GetFdInfo
-
-	// GetWinsize returns the window size based on the specified file descriptor.
-	// Deprecated: use github.com/moby/term.GetWinsize
-	GetWinsize = term.GetWinsize
-
-	// IsTerminal returns true if the given file descriptor is a terminal.
-	// Deprecated: use github.com/moby/term.IsTerminal
-	IsTerminal = term.IsTerminal
-
-	// RestoreTerminal restores the terminal connected to the given file descriptor
-	// to a previous state.
-	// Deprecated: use github.com/moby/term.RestoreTerminal
-	RestoreTerminal = term.RestoreTerminal
-
-	// SaveState saves the state of the terminal connected to the given file descriptor.
-	// Deprecated: use github.com/moby/term.SaveState
-	SaveState = term.SaveState
-
-	// DisableEcho applies the specified state to the terminal connected to the file
-	// descriptor, with echo disabled.
-	// Deprecated: use github.com/moby/term.DisableEcho
-	DisableEcho = term.DisableEcho
-
-	// SetRawTerminal puts the terminal connected to the given file descriptor into
-	// raw mode and returns the previous state. On UNIX, this puts both the input
-	// and output into raw mode. On Windows, it only puts the input into raw mode.
-	// Deprecated: use github.com/moby/term.SetRawTerminal
-	SetRawTerminal = term.SetRawTerminal
-
-	// SetRawTerminalOutput puts the output of terminal connected to the given file
-	// descriptor into raw mode. On UNIX, this does nothing and returns nil for the
-	// state. On Windows, it disables LF -> CRLF translation.
-	// Deprecated: use github.com/moby/term.SetRawTerminalOutput
-	SetRawTerminalOutput = term.SetRawTerminalOutput
-
-	// MakeRaw puts the terminal connected to the given file descriptor into raw
-	// mode and returns the previous state of the terminal so that it can be restored.
-	// Deprecated: use github.com/moby/term.MakeRaw
-	MakeRaw = term.MakeRaw
-
-	// NewEscapeProxy returns a new TTY proxy reader which wraps the given reader
-	// and detects when the specified escape keys are read, in which case the Read
-	// method will return an error of type EscapeError.
-	// Deprecated: use github.com/moby/term.NewEscapeProxy
-	NewEscapeProxy = term.NewEscapeProxy
-)

+ 0 - 21
pkg/term/deprecated_unix.go

@@ -1,21 +0,0 @@
-//go:build !windows
-// +build !windows
-
-package term // import "github.com/docker/docker/pkg/term"
-
-import (
-	"github.com/moby/term"
-)
-
-// Termios is the Unix API for terminal I/O.
-// Deprecated: use github.com/moby/term.Termios
-type Termios = term.Termios
-
-var (
-	// ErrInvalidState is returned if the state of the terminal is invalid.
-	ErrInvalidState = term.ErrInvalidState
-
-	// SetWinsize tries to set the specified window size for the specified file descriptor.
-	// Deprecated: use github.com/moby/term.GetWinsize
-	SetWinsize = term.SetWinsize
-)

+ 0 - 35
pkg/term/windows/deprecated.go

@@ -1,35 +0,0 @@
-//go:build windows
-// +build windows
-
-// Package windowsconsole implements ANSI-aware input and output streams for use
-// by the Docker Windows client. When asked for the set of standard streams (e.g.,
-// stdin, stdout, stderr), the code will create and return pseudo-streams that
-// convert ANSI sequences to / from Windows Console API calls.
-//
-// Deprecated: use github.com/moby/term/windows instead
-package windowsconsole // import "github.com/docker/docker/pkg/term/windows"
-
-import (
-	windowsconsole "github.com/moby/term/windows"
-)
-
-var (
-	// GetHandleInfo returns file descriptor and bool indicating whether the file is a console.
-	// Deprecated: use github.com/moby/term/windows.GetHandleInfo
-	GetHandleInfo = windowsconsole.GetHandleInfo
-
-	// IsConsole returns true if the given file descriptor is a Windows Console.
-	// The code assumes that GetConsoleMode will return an error for file descriptors that are not a console.
-	// Deprecated: use github.com/moby/term/windows.IsConsole
-	IsConsole = windowsconsole.IsConsole
-
-	// NewAnsiReader returns an io.ReadCloser that provides VT100 terminal emulation on top of a
-	// Windows console input handle.
-	// Deprecated: use github.com/moby/term/windows.NewAnsiReader
-	NewAnsiReader = windowsconsole.NewAnsiReader
-
-	// NewAnsiWriter returns an io.Writer that provides VT100 terminal emulation on top of a
-	// Windows console output handle.
-	// Deprecated: use github.com/moby/term/windows.NewAnsiWriter
-	NewAnsiWriter = windowsconsole.NewAnsiWriter
-)

+ 0 - 3
pkg/term/windows/windows_test.go

@@ -1,3 +0,0 @@
-// This file is necessary to pass the Docker tests.
-
-package windowsconsole // import "github.com/docker/docker/pkg/term/windows"