vendor of containers/common

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh
2023-09-20 08:09:54 -04:00
parent e80d9b7f85
commit 73dc72f80d
24 changed files with 257 additions and 230 deletions

View File

@@ -5,7 +5,7 @@ import (
"fmt"
"github.com/containers/common/libnetwork/types"
"github.com/containers/common/pkg/util"
"github.com/containers/common/pkg/detach"
)
var (
@@ -93,7 +93,7 @@ var (
// ErrDetach indicates that an attach session was manually detached by
// the user.
ErrDetach = util.ErrDetach
ErrDetach = detach.ErrDetach
// ErrWillDeadlock indicates that the requested operation will cause a
// deadlock. This is usually caused by upgrade issues, and is resolved

View File

@@ -14,7 +14,7 @@ import (
"github.com/containers/buildah"
"github.com/containers/buildah/pkg/util"
cutil "github.com/containers/common/pkg/util"
"github.com/containers/common/pkg/version"
"github.com/containers/image/v5/pkg/sysregistriesv2"
"github.com/containers/podman/v4/libpod/define"
"github.com/containers/podman/v4/libpod/linkmode"
@@ -243,14 +243,14 @@ func (r *Runtime) storeInfo() (*define.StoreInfo, error) {
for _, o := range r.store.GraphOptions() {
split := strings.SplitN(o, "=", 2)
if strings.HasSuffix(split[0], "mount_program") {
version, err := cutil.ProgramVersion(split[1])
ver, err := version.Program(split[1])
if err != nil {
logrus.Warnf("Failed to retrieve program version for %s: %v", split[1], err)
}
program := map[string]interface{}{}
program["Executable"] = split[1]
program["Version"] = version
program["Package"] = cutil.PackageVersion(split[1])
program["Version"] = ver
program["Package"] = version.Package(split[1])
graphOptions[split[0]] = program
} else {
graphOptions[split[0]] = split[1]

View File

@@ -13,7 +13,7 @@ import (
"github.com/containers/common/pkg/apparmor"
"github.com/containers/common/pkg/cgroups"
"github.com/containers/common/pkg/seccomp"
"github.com/containers/common/pkg/util"
"github.com/containers/common/pkg/version"
"github.com/containers/podman/v4/libpod/define"
"github.com/containers/podman/v4/pkg/rootless"
"github.com/opencontainers/selinux/go-selinux"
@@ -62,28 +62,28 @@ func (r *Runtime) setPlatformHostInfo(info *define.HostInfo) error {
slirp4netnsPath, _ = r.config.FindHelperBinary(libpod.BinaryName, true)
}
if slirp4netnsPath != "" {
version, err := util.ProgramVersion(slirp4netnsPath)
ver, err := version.Program(slirp4netnsPath)
if err != nil {
logrus.Warnf("Failed to retrieve program version for %s: %v", slirp4netnsPath, err)
}
program := define.SlirpInfo{
Executable: slirp4netnsPath,
Package: util.PackageVersion(slirp4netnsPath),
Version: version,
Package: version.Package(slirp4netnsPath),
Version: ver,
}
info.Slirp4NetNS = program
}
pastaPath, _ := r.config.FindHelperBinary(pasta.BinaryName, true)
if pastaPath != "" {
version, err := util.ProgramVersion(pastaPath)
ver, err := version.Program(pastaPath)
if err != nil {
logrus.Warnf("Failed to retrieve program version for %s: %v", pastaPath, err)
}
program := define.PastaInfo{
Executable: pastaPath,
Package: util.PackageVersion(pastaPath),
Version: version,
Package: version.Package(pastaPath),
Version: ver,
}
info.Pasta = program
}

View File

@@ -14,8 +14,8 @@ import (
"syscall"
"github.com/containers/common/pkg/config"
"github.com/containers/common/pkg/detach"
"github.com/containers/common/pkg/resize"
"github.com/containers/common/pkg/util"
"github.com/containers/podman/v4/libpod/define"
"github.com/containers/podman/v4/pkg/errorhandling"
"github.com/moby/term"
@@ -235,7 +235,7 @@ func setupStdioChannels(streams *define.AttachStreams, conn *net.UnixConn, detac
go func() {
var err error
if streams.AttachInput {
_, err = util.CopyDetachable(conn, streams.InputStream, detachKeys)
_, err = detach.Copy(conn, streams.InputStream, detachKeys)
}
stdinDone <- err
}()

View File

@@ -23,8 +23,9 @@ import (
"time"
"github.com/containers/common/pkg/config"
"github.com/containers/common/pkg/detach"
"github.com/containers/common/pkg/resize"
cutil "github.com/containers/common/pkg/util"
"github.com/containers/common/pkg/version"
conmonConfig "github.com/containers/conmon/runner/config"
"github.com/containers/podman/v4/libpod/define"
"github.com/containers/podman/v4/libpod/logs"
@@ -583,7 +584,7 @@ func (r *ConmonOCIRuntime) HTTPAttach(ctr *Container, req *http.Request, w http.
if detachKeys != nil {
detachString = *detachKeys
}
detach, err := processDetachKeys(detachString)
isDetach, err := processDetachKeys(detachString)
if err != nil {
return err
}
@@ -735,7 +736,7 @@ func (r *ConmonOCIRuntime) HTTPAttach(ctr *Container, req *http.Request, w http.
// Next, STDIN. Avoid entirely if attachStdin unset.
if attachStdin {
go func() {
_, err := cutil.CopyDetachable(conn, httpBuf, detach)
_, err := detach.Copy(conn, httpBuf, isDetach)
logrus.Debugf("STDIN copy completed")
stdinChan <- err
}()
@@ -943,8 +944,8 @@ func (r *ConmonOCIRuntime) ExitFilePath(ctr *Container) (string, error) {
// RuntimeInfo provides information on the runtime.
func (r *ConmonOCIRuntime) RuntimeInfo() (*define.ConmonInfo, *define.OCIRuntimeInfo, error) {
runtimePackage := cutil.PackageVersion(r.path)
conmonPackage := cutil.PackageVersion(r.conmonPath)
runtimePackage := version.Package(r.path)
conmonPackage := version.Package(r.conmonPath)
runtimeVersion, err := r.getOCIRuntimeVersion()
if err != nil {
return nil, nil, fmt.Errorf("getting version of OCI runtime %s: %w", r.name, err)

View File

@@ -12,8 +12,8 @@ import (
"time"
"github.com/containers/common/pkg/config"
"github.com/containers/common/pkg/detach"
"github.com/containers/common/pkg/resize"
cutil "github.com/containers/common/pkg/util"
"github.com/containers/podman/v4/libpod/define"
"github.com/containers/podman/v4/pkg/errorhandling"
"github.com/containers/podman/v4/pkg/lookup"
@@ -606,7 +606,7 @@ func attachExecHTTP(c *Container, sessionID string, r *http.Request, w http.Resp
if attachStdin {
go func() {
logrus.Debugf("Beginning STDIN copy")
_, err := cutil.CopyDetachable(conn, httpBuf, detachKeys)
_, err := detach.Copy(conn, httpBuf, detachKeys)
logrus.Debugf("STDIN copy completed")
stdinChan <- err
}()