Remove util.StringInSlice because it is defined in containers/common
[NO NEW TESTS NEEDED] Since this is just a code cleanup Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
parent
5500333c2e
commit
00d46292ca
|
@ -1,3 +1,4 @@
|
||||||
|
//go:build linux
|
||||||
// +build linux
|
// +build linux
|
||||||
|
|
||||||
package bind
|
package bind
|
||||||
|
@ -9,6 +10,7 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/containers/buildah/util"
|
"github.com/containers/buildah/util"
|
||||||
|
cutil "github.com/containers/common/pkg/util"
|
||||||
"github.com/containers/storage/pkg/idtools"
|
"github.com/containers/storage/pkg/idtools"
|
||||||
"github.com/containers/storage/pkg/mount"
|
"github.com/containers/storage/pkg/mount"
|
||||||
"github.com/opencontainers/runtime-spec/specs-go"
|
"github.com/opencontainers/runtime-spec/specs-go"
|
||||||
|
@ -190,11 +192,11 @@ func SetupIntermediateMountNamespace(spec *specs.Spec, bundlePath string) (unmou
|
||||||
// Decide if the mount should not be redirected to an intermediate location first.
|
// Decide if the mount should not be redirected to an intermediate location first.
|
||||||
func leaveBindMountAlone(mount specs.Mount) bool {
|
func leaveBindMountAlone(mount specs.Mount) bool {
|
||||||
// If we know we shouldn't do a redirection for this mount, skip it.
|
// If we know we shouldn't do a redirection for this mount, skip it.
|
||||||
if util.StringInSlice(NoBindOption, mount.Options) {
|
if cutil.StringInSlice(NoBindOption, mount.Options) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// If we're not bind mounting it in, we don't need to do anything for it.
|
// If we're not bind mounting it in, we don't need to do anything for it.
|
||||||
if mount.Type != "bind" && !util.StringInSlice("bind", mount.Options) && !util.StringInSlice("rbind", mount.Options) {
|
if mount.Type != "bind" && !cutil.StringInSlice("bind", mount.Options) && !cutil.StringInSlice("rbind", mount.Options) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
@ -289,7 +291,7 @@ func UnmountMountpoints(mountpoint string, mountpointsToRemove []string) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if we're also supposed to remove this thing, do that, too
|
// if we're also supposed to remove this thing, do that, too
|
||||||
if util.StringInSlice(mount.Mountpoint, mountpointsToRemove) {
|
if cutil.StringInSlice(mount.Mountpoint, mountpointsToRemove) {
|
||||||
if err := os.Remove(mount.Mountpoint); err != nil {
|
if err := os.Remove(mount.Mountpoint); err != nil {
|
||||||
return errors.Wrapf(err, "error removing %q", mount.Mountpoint)
|
return errors.Wrapf(err, "error removing %q", mount.Mountpoint)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package bind
|
package bind
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/containers/buildah/util"
|
"github.com/containers/common/pkg/util"
|
||||||
"github.com/opencontainers/runtime-spec/specs-go"
|
"github.com/opencontainers/runtime-spec/specs-go"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
"github.com/containerd/containerd/platforms"
|
"github.com/containerd/containerd/platforms"
|
||||||
"github.com/containers/buildah/define"
|
"github.com/containers/buildah/define"
|
||||||
"github.com/containers/buildah/docker"
|
"github.com/containers/buildah/docker"
|
||||||
"github.com/containers/buildah/util"
|
"github.com/containers/common/pkg/util"
|
||||||
"github.com/containers/image/v5/manifest"
|
"github.com/containers/image/v5/manifest"
|
||||||
"github.com/containers/image/v5/pkg/compression"
|
"github.com/containers/image/v5/pkg/compression"
|
||||||
"github.com/containers/image/v5/transports"
|
"github.com/containers/image/v5/transports"
|
||||||
|
|
17
util/util.go
17
util/util.go
|
@ -14,6 +14,7 @@ import (
|
||||||
"github.com/containers/buildah/define"
|
"github.com/containers/buildah/define"
|
||||||
"github.com/containers/common/libimage"
|
"github.com/containers/common/libimage"
|
||||||
"github.com/containers/common/pkg/config"
|
"github.com/containers/common/pkg/config"
|
||||||
|
"github.com/containers/common/pkg/util"
|
||||||
"github.com/containers/image/v5/docker/reference"
|
"github.com/containers/image/v5/docker/reference"
|
||||||
"github.com/containers/image/v5/pkg/shortnames"
|
"github.com/containers/image/v5/pkg/shortnames"
|
||||||
"github.com/containers/image/v5/signature"
|
"github.com/containers/image/v5/signature"
|
||||||
|
@ -44,6 +45,11 @@ var (
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// StringInSlice is deprecated, use github.com/containers/common/pkg/util.StringInSlice
|
||||||
|
func StringInSlice(s string, slice []string) bool {
|
||||||
|
return util.StringInSlice(s, slice)
|
||||||
|
}
|
||||||
|
|
||||||
// resolveName checks if name is a valid image name, and if that name doesn't
|
// resolveName checks if name is a valid image name, and if that name doesn't
|
||||||
// include a domain portion, returns a list of the names which it might
|
// include a domain portion, returns a list of the names which it might
|
||||||
// correspond to in the set of configured registries, and the transport used to
|
// correspond to in the set of configured registries, and the transport used to
|
||||||
|
@ -244,17 +250,6 @@ func Runtime() string {
|
||||||
return conf.Engine.OCIRuntime
|
return conf.Engine.OCIRuntime
|
||||||
}
|
}
|
||||||
|
|
||||||
// StringInSlice returns a boolean indicating if the exact value s is present
|
|
||||||
// in the slice slice.
|
|
||||||
func StringInSlice(s string, slice []string) bool {
|
|
||||||
for _, v := range slice {
|
|
||||||
if v == s {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetContainerIDs uses ID mappings to compute the container-level IDs that will
|
// GetContainerIDs uses ID mappings to compute the container-level IDs that will
|
||||||
// correspond to a UID/GID pair on the host.
|
// correspond to a UID/GID pair on the host.
|
||||||
func GetContainerIDs(uidmap, gidmap []specs.LinuxIDMapping, uid, gid uint32) (uint32, uint32, error) {
|
func GetContainerIDs(uidmap, gidmap []specs.LinuxIDMapping, uid, gid uint32) (uint32, uint32, error) {
|
||||||
|
|
Loading…
Reference in New Issue