mirror of
https://github.com/containers/podman.git
synced 2025-11-04 00:50:15 +08:00
vendor c/common@main
In hope to fix a CI flake. Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
2
vendor/github.com/containers/common/libimage/image.go
generated
vendored
2
vendor/github.com/containers/common/libimage/image.go
generated
vendored
@ -608,7 +608,7 @@ func (i *Image) RepoTags() ([]string, error) {
|
||||
// NamedTaggedRepoTags returns the repotags associated with the image as a
|
||||
// slice of reference.NamedTagged.
|
||||
func (i *Image) NamedTaggedRepoTags() ([]reference.NamedTagged, error) {
|
||||
var repoTags []reference.NamedTagged
|
||||
repoTags := make([]reference.NamedTagged, 0, len(i.Names()))
|
||||
for _, name := range i.Names() {
|
||||
parsed, err := reference.Parse(name)
|
||||
if err != nil {
|
||||
|
||||
6
vendor/github.com/containers/common/libimage/load.go
generated
vendored
6
vendor/github.com/containers/common/libimage/load.go
generated
vendored
@ -32,8 +32,8 @@ func (r *Runtime) Load(ctx context.Context, path string, options *LoadOptions) (
|
||||
options = &LoadOptions{}
|
||||
}
|
||||
|
||||
var loadErrors []error
|
||||
|
||||
// we have 4 functions, so a maximum of 4 errors
|
||||
loadErrors := make([]error, 0, 4)
|
||||
for _, f := range []func() ([]string, string, error){
|
||||
// OCI
|
||||
func() ([]string, string, error) {
|
||||
@ -88,6 +88,8 @@ func (r *Runtime) Load(ctx context.Context, path string, options *LoadOptions) (
|
||||
}
|
||||
|
||||
// Give a decent error message if nothing above worked.
|
||||
// we want the colon here for the multiline error
|
||||
//nolint:revive
|
||||
loadError := fmt.Errorf("payload does not match any of the supported image formats:")
|
||||
for _, err := range loadErrors {
|
||||
loadError = fmt.Errorf("%v\n * %v", loadError, err)
|
||||
|
||||
2
vendor/github.com/containers/common/libimage/normalize.go
generated
vendored
2
vendor/github.com/containers/common/libimage/normalize.go
generated
vendored
@ -115,7 +115,7 @@ type NameTagPair struct {
|
||||
func ToNameTagPairs(repoTags []reference.Named) ([]NameTagPair, error) {
|
||||
none := "<none>"
|
||||
|
||||
var pairs []NameTagPair
|
||||
pairs := make([]NameTagPair, 0, len(repoTags))
|
||||
for i, named := range repoTags {
|
||||
pair := NameTagPair{
|
||||
Name: named.Name(),
|
||||
|
||||
2
vendor/github.com/containers/common/libimage/pull.go
generated
vendored
2
vendor/github.com/containers/common/libimage/pull.go
generated
vendored
@ -413,11 +413,11 @@ func (r *Runtime) imagesIDsForManifest(manifestBytes []byte, sys *types.SystemCo
|
||||
}
|
||||
imageDigest = d
|
||||
}
|
||||
var results []string
|
||||
images, err := r.store.ImagesByDigest(imageDigest)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "listing images by manifest digest")
|
||||
}
|
||||
results := make([]string, 0, len(images))
|
||||
for _, image := range images {
|
||||
results = append(results, image.ID)
|
||||
}
|
||||
|
||||
39
vendor/github.com/containers/common/libimage/runtime.go
generated
vendored
39
vendor/github.com/containers/common/libimage/runtime.go
generated
vendored
@ -6,6 +6,7 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/containers/common/pkg/config"
|
||||
"github.com/containers/image/v5/docker/reference"
|
||||
"github.com/containers/image/v5/pkg/shortnames"
|
||||
storageTransport "github.com/containers/image/v5/storage"
|
||||
@ -22,13 +23,16 @@ import (
|
||||
var json = jsoniter.ConfigCompatibleWithStandardLibrary
|
||||
|
||||
// tmpdir returns a path to a temporary directory.
|
||||
func tmpdir() string {
|
||||
tmpdir := os.Getenv("TMPDIR")
|
||||
if tmpdir == "" {
|
||||
tmpdir = "/var/tmp"
|
||||
func tmpdir() (string, error) {
|
||||
var tmpdir string
|
||||
defaultContainerConfig, err := config.Default()
|
||||
if err == nil {
|
||||
tmpdir, err = defaultContainerConfig.ImageCopyTmpDir()
|
||||
if err == nil {
|
||||
return tmpdir, nil
|
||||
}
|
||||
}
|
||||
|
||||
return tmpdir
|
||||
return tmpdir, err
|
||||
}
|
||||
|
||||
// RuntimeOptions allow for creating a customized Runtime.
|
||||
@ -103,7 +107,11 @@ func RuntimeFromStore(store storage.Store, options *RuntimeOptions) (*Runtime, e
|
||||
systemContext = types.SystemContext{}
|
||||
}
|
||||
if systemContext.BigFilesTemporaryDir == "" {
|
||||
systemContext.BigFilesTemporaryDir = tmpdir()
|
||||
tmpdir, err := tmpdir()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
systemContext.BigFilesTemporaryDir = tmpdir
|
||||
}
|
||||
|
||||
setRegistriesConfPath(&systemContext)
|
||||
@ -224,16 +232,15 @@ func (r *Runtime) LookupImage(name string, options *LookupImageOptions) (*Image,
|
||||
}
|
||||
logrus.Debugf("Found image %q in local containers storage (%s)", name, storageRef.StringWithinTransport())
|
||||
return r.storageToImage(img, storageRef), "", nil
|
||||
} else {
|
||||
// Docker compat: strip off the tag iff name is tagged and digested
|
||||
// (e.g., fedora:latest@sha256...). In that case, the tag is stripped
|
||||
// off and entirely ignored. The digest is the sole source of truth.
|
||||
normalizedName, err := normalizeTaggedDigestedString(name)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
name = normalizedName
|
||||
}
|
||||
// Docker compat: strip off the tag iff name is tagged and digested
|
||||
// (e.g., fedora:latest@sha256...). In that case, the tag is stripped
|
||||
// off and entirely ignored. The digest is the sole source of truth.
|
||||
normalizedName, err := normalizeTaggedDigestedString(name)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
name = normalizedName
|
||||
|
||||
byDigest := false
|
||||
originalName := name
|
||||
|
||||
Reference in New Issue
Block a user