mirror of
https://github.com/containers/podman.git
synced 2025-09-24 23:35:27 +08:00
Merge pull request #10723 from rhatdan/tmpdir
fix systemcontext to use correct TMPDIR
This commit is contained in:
2
go.mod
2
go.mod
@ -12,7 +12,7 @@ require (
|
|||||||
github.com/containernetworking/cni v0.8.1
|
github.com/containernetworking/cni v0.8.1
|
||||||
github.com/containernetworking/plugins v0.9.1
|
github.com/containernetworking/plugins v0.9.1
|
||||||
github.com/containers/buildah v1.21.1
|
github.com/containers/buildah v1.21.1
|
||||||
github.com/containers/common v0.40.0
|
github.com/containers/common v0.40.1-0.20210617134614-c6578d76fb0d
|
||||||
github.com/containers/conmon v2.0.20+incompatible
|
github.com/containers/conmon v2.0.20+incompatible
|
||||||
github.com/containers/image/v5 v5.13.2
|
github.com/containers/image/v5 v5.13.2
|
||||||
github.com/containers/ocicrypt v1.1.1
|
github.com/containers/ocicrypt v1.1.1
|
||||||
|
6
go.sum
6
go.sum
@ -221,12 +221,12 @@ github.com/containernetworking/plugins v0.9.1/go.mod h1:xP/idU2ldlzN6m4p5LmGiwRD
|
|||||||
github.com/containers/buildah v1.21.1 h1:e9LmTCUKUBLg72v5DnIOT/wc8ffkfB7LbpQBywLZo20=
|
github.com/containers/buildah v1.21.1 h1:e9LmTCUKUBLg72v5DnIOT/wc8ffkfB7LbpQBywLZo20=
|
||||||
github.com/containers/buildah v1.21.1/go.mod h1:yPdlpVd93T+i91yGxrJbW1YOWrqN64j5ZhHOZmHUejs=
|
github.com/containers/buildah v1.21.1/go.mod h1:yPdlpVd93T+i91yGxrJbW1YOWrqN64j5ZhHOZmHUejs=
|
||||||
github.com/containers/common v0.38.4/go.mod h1:egfpX/Y3+19Dz4Wa1eRZDdgzoEOeneieF9CQppKzLBg=
|
github.com/containers/common v0.38.4/go.mod h1:egfpX/Y3+19Dz4Wa1eRZDdgzoEOeneieF9CQppKzLBg=
|
||||||
github.com/containers/common v0.40.0 h1:6Q40GoVS3AI2QZbQPLRDS+K7G61JgHqlqvkOYYAJrOo=
|
github.com/containers/common v0.40.1-0.20210617134614-c6578d76fb0d h1:PaS/t2XcyxEDOr685T+3HPMyMqN99UPcj6I92nqIDH8=
|
||||||
github.com/containers/common v0.40.0/go.mod h1:qLkP2aIaPfiXJS4u/QSSNkUFEEV+dg5d6GOTKsdlZ7g=
|
github.com/containers/common v0.40.1-0.20210617134614-c6578d76fb0d/go.mod h1:+zxauZzkurY5tbQGDxrCV6rF694RX1olXyYRVJHrzWo=
|
||||||
github.com/containers/conmon v2.0.20+incompatible h1:YbCVSFSCqFjjVwHTPINGdMX1F6JXHGTUje2ZYobNrkg=
|
github.com/containers/conmon v2.0.20+incompatible h1:YbCVSFSCqFjjVwHTPINGdMX1F6JXHGTUje2ZYobNrkg=
|
||||||
github.com/containers/conmon v2.0.20+incompatible/go.mod h1:hgwZ2mtuDrppv78a/cOBNiCm6O0UMWGx1mu7P00nu5I=
|
github.com/containers/conmon v2.0.20+incompatible/go.mod h1:hgwZ2mtuDrppv78a/cOBNiCm6O0UMWGx1mu7P00nu5I=
|
||||||
github.com/containers/image/v5 v5.12.0/go.mod h1:VasTuHmOw+uD0oHCfApQcMO2+36SfyncoSahU7513Xs=
|
github.com/containers/image/v5 v5.12.0/go.mod h1:VasTuHmOw+uD0oHCfApQcMO2+36SfyncoSahU7513Xs=
|
||||||
github.com/containers/image/v5 v5.13.0/go.mod h1:GkWursKDlDcUIT7L7vZf70tADvZCk/Ga0wgS0MuF0ag=
|
github.com/containers/image/v5 v5.13.2-0.20210617132750-db0df5e0cf5e/go.mod h1:GkWursKDlDcUIT7L7vZf70tADvZCk/Ga0wgS0MuF0ag=
|
||||||
github.com/containers/image/v5 v5.13.2 h1:AgYunV/9d2fRkrmo23wH2MkqeHolFd6oQCkK+1PpuFA=
|
github.com/containers/image/v5 v5.13.2 h1:AgYunV/9d2fRkrmo23wH2MkqeHolFd6oQCkK+1PpuFA=
|
||||||
github.com/containers/image/v5 v5.13.2/go.mod h1:GkWursKDlDcUIT7L7vZf70tADvZCk/Ga0wgS0MuF0ag=
|
github.com/containers/image/v5 v5.13.2/go.mod h1:GkWursKDlDcUIT7L7vZf70tADvZCk/Ga0wgS0MuF0ag=
|
||||||
github.com/containers/libtrust v0.0.0-20190913040956-14b96171aa3b h1:Q8ePgVfHDplZ7U33NwHZkrVELsZP5fYj9pM5WBZB2GE=
|
github.com/containers/libtrust v0.0.0-20190913040956-14b96171aa3b h1:Q8ePgVfHDplZ7U33NwHZkrVELsZP5fYj9pM5WBZB2GE=
|
||||||
|
@ -7,6 +7,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
|
"github.com/containers/buildah/pkg/parse"
|
||||||
"github.com/containers/common/pkg/config"
|
"github.com/containers/common/pkg/config"
|
||||||
"github.com/containers/common/pkg/secrets"
|
"github.com/containers/common/pkg/secrets"
|
||||||
"github.com/containers/image/v5/manifest"
|
"github.com/containers/image/v5/manifest"
|
||||||
@ -268,8 +269,11 @@ func WithRegistriesConf(path string) RuntimeOption {
|
|||||||
return errors.Wrap(err, "error locating specified registries.conf")
|
return errors.Wrap(err, "error locating specified registries.conf")
|
||||||
}
|
}
|
||||||
if rt.imageContext == nil {
|
if rt.imageContext == nil {
|
||||||
rt.imageContext = &types.SystemContext{}
|
rt.imageContext = &types.SystemContext{
|
||||||
|
BigFilesTemporaryDir: parse.GetTempDir(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rt.imageContext.SystemRegistriesConfPath = path
|
rt.imageContext.SystemRegistriesConfPath = path
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/containers/buildah/pkg/parse"
|
||||||
"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/defaultnet"
|
"github.com/containers/common/pkg/defaultnet"
|
||||||
@ -381,7 +382,9 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (retErr error) {
|
|||||||
|
|
||||||
// Set up containers/image
|
// Set up containers/image
|
||||||
if runtime.imageContext == nil {
|
if runtime.imageContext == nil {
|
||||||
runtime.imageContext = &types.SystemContext{}
|
runtime.imageContext = &types.SystemContext{
|
||||||
|
BigFilesTemporaryDir: parse.GetTempDir(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
runtime.imageContext.SignaturePolicyPath = runtime.config.Engine.SignaturePolicyPath
|
runtime.imageContext.SignaturePolicyPath = runtime.config.Engine.SignaturePolicyPath
|
||||||
|
|
||||||
|
4
vendor/github.com/containers/common/libimage/download.go
generated
vendored
4
vendor/github.com/containers/common/libimage/download.go
generated
vendored
@ -11,7 +11,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// tmpdir returns a path to a temporary directory.
|
// tmpdir returns a path to a temporary directory.
|
||||||
func (r *Runtime) tmpdir() string {
|
func tmpdir() string {
|
||||||
tmpdir := os.Getenv("TMPDIR")
|
tmpdir := os.Getenv("TMPDIR")
|
||||||
if tmpdir == "" {
|
if tmpdir == "" {
|
||||||
tmpdir = "/var/tmp"
|
tmpdir = "/var/tmp"
|
||||||
@ -25,7 +25,7 @@ func (r *Runtime) tmpdir() string {
|
|||||||
func (r *Runtime) downloadFromURL(source string) (string, error) {
|
func (r *Runtime) downloadFromURL(source string) (string, error) {
|
||||||
fmt.Printf("Downloading from %q\n", source)
|
fmt.Printf("Downloading from %q\n", source)
|
||||||
|
|
||||||
outFile, err := ioutil.TempFile(r.tmpdir(), "import")
|
outFile, err := ioutil.TempFile(r.systemContext.BigFilesTemporaryDir, "import")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", errors.Wrap(err, "error creating file")
|
return "", errors.Wrap(err, "error creating file")
|
||||||
}
|
}
|
||||||
|
16
vendor/github.com/containers/common/libimage/image.go
generated
vendored
16
vendor/github.com/containers/common/libimage/image.go
generated
vendored
@ -329,17 +329,19 @@ func (i *Image) remove(ctx context.Context, rmMap map[string]*RemoveImageReport,
|
|||||||
// an `rmi foo` will not untag "foo" but instead attempt to remove the
|
// an `rmi foo` will not untag "foo" but instead attempt to remove the
|
||||||
// entire image. If there's a container using "foo", we should get an
|
// entire image. If there's a container using "foo", we should get an
|
||||||
// error.
|
// error.
|
||||||
if options.Force || referencedBy == "" || numNames == 1 {
|
if referencedBy == "" || numNames == 1 {
|
||||||
// DO NOTHING, the image will be removed
|
// DO NOTHING, the image will be removed
|
||||||
} else {
|
} else {
|
||||||
byID := strings.HasPrefix(i.ID(), referencedBy)
|
byID := strings.HasPrefix(i.ID(), referencedBy)
|
||||||
byDigest := strings.HasPrefix(referencedBy, "sha256:")
|
byDigest := strings.HasPrefix(referencedBy, "sha256:")
|
||||||
if byID && numNames > 1 {
|
if !options.Force {
|
||||||
return errors.Errorf("unable to delete image %q by ID with more than one tag (%s): please force removal", i.ID(), i.Names())
|
if byID && numNames > 1 {
|
||||||
} else if byDigest && numNames > 1 {
|
return errors.Errorf("unable to delete image %q by ID with more than one tag (%s): please force removal", i.ID(), i.Names())
|
||||||
// FIXME - Docker will remove the digest but containers storage
|
} else if byDigest && numNames > 1 {
|
||||||
// does not support that yet, so our hands are tied.
|
// FIXME - Docker will remove the digest but containers storage
|
||||||
return errors.Errorf("unable to delete image %q by digest with more than one tag (%s): please force removal", i.ID(), i.Names())
|
// does not support that yet, so our hands are tied.
|
||||||
|
return errors.Errorf("unable to delete image %q by digest with more than one tag (%s): please force removal", i.ID(), i.Names())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only try to untag if we know it's not an ID or digest.
|
// Only try to untag if we know it's not an ID or digest.
|
||||||
|
3
vendor/github.com/containers/common/libimage/runtime.go
generated
vendored
3
vendor/github.com/containers/common/libimage/runtime.go
generated
vendored
@ -84,6 +84,9 @@ func RuntimeFromStore(store storage.Store, options *RuntimeOptions) (*Runtime, e
|
|||||||
} else {
|
} else {
|
||||||
systemContext = types.SystemContext{}
|
systemContext = types.SystemContext{}
|
||||||
}
|
}
|
||||||
|
if systemContext.BigFilesTemporaryDir == "" {
|
||||||
|
systemContext.BigFilesTemporaryDir = tmpdir()
|
||||||
|
}
|
||||||
|
|
||||||
setRegistriesConfPath(&systemContext)
|
setRegistriesConfPath(&systemContext)
|
||||||
|
|
||||||
|
2
vendor/github.com/containers/common/version/version.go
generated
vendored
2
vendor/github.com/containers/common/version/version.go
generated
vendored
@ -1,4 +1,4 @@
|
|||||||
package version
|
package version
|
||||||
|
|
||||||
// Version is the version of the build.
|
// Version is the version of the build.
|
||||||
const Version = "0.40.0"
|
const Version = "0.40.1-dev"
|
||||||
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -93,7 +93,7 @@ github.com/containers/buildah/pkg/overlay
|
|||||||
github.com/containers/buildah/pkg/parse
|
github.com/containers/buildah/pkg/parse
|
||||||
github.com/containers/buildah/pkg/rusage
|
github.com/containers/buildah/pkg/rusage
|
||||||
github.com/containers/buildah/util
|
github.com/containers/buildah/util
|
||||||
# github.com/containers/common v0.40.0
|
# github.com/containers/common v0.40.1-0.20210617134614-c6578d76fb0d
|
||||||
github.com/containers/common/libimage
|
github.com/containers/common/libimage
|
||||||
github.com/containers/common/libimage/manifests
|
github.com/containers/common/libimage/manifests
|
||||||
github.com/containers/common/pkg/apparmor
|
github.com/containers/common/pkg/apparmor
|
||||||
|
Reference in New Issue
Block a user