vendor: bump c/common to v0.49.2-0.20220929111928-2d1b45ae2423

[NO NEW TESTS NEEDED]
[NO TESTS NEEDED]

Signed-off-by: Aditya R <arajan@redhat.com>
This commit is contained in:
Aditya R
2022-09-29 18:20:00 +05:30
parent b7eee0b2ce
commit f00ceaabd4
26 changed files with 243 additions and 114 deletions

View File

@@ -6,6 +6,7 @@ import (
"runtime"
"github.com/containerd/containerd/platforms"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/sirupsen/logrus"
)
@@ -20,9 +21,18 @@ const (
)
// NormalizePlatform normalizes (according to the OCI spec) the specified os,
// arch and variant. If left empty, the individual item will not be normalized.
// arch and variant. If left empty, the individual item will be normalized.
func NormalizePlatform(rawOS, rawArch, rawVariant string) (os, arch, variant string) {
rawPlatform := toPlatformString(rawOS, rawArch, rawVariant)
platformSpec := v1.Platform{
OS: rawOS,
Architecture: rawArch,
Variant: rawVariant,
}
normalizedSpec := platforms.Normalize(platformSpec)
if normalizedSpec.Variant == "" && rawVariant != "" {
normalizedSpec.Variant = rawVariant
}
rawPlatform := toPlatformString(normalizedSpec.OS, normalizedSpec.Architecture, normalizedSpec.Variant)
normalizedPlatform, err := platforms.Parse(rawPlatform)
if err != nil {
logrus.Debugf("Error normalizing platform: %v", err)
@@ -38,7 +48,7 @@ func NormalizePlatform(rawOS, rawArch, rawVariant string) (os, arch, variant str
arch = normalizedPlatform.Architecture
}
variant = rawVariant
if rawVariant != "" {
if rawVariant != "" || (rawVariant == "" && normalizedPlatform.Variant != "") {
variant = normalizedPlatform.Variant
}
return os, arch, variant

View File

@@ -11,6 +11,7 @@ import (
"sync"
"syscall"
"github.com/containers/storage/pkg/homedir"
"github.com/containers/storage/pkg/unshare"
"github.com/sirupsen/logrus"
)
@@ -31,7 +32,10 @@ func GetRuntimeDir() (string, error) {
var rootlessRuntimeDirError error
rootlessRuntimeDirOnce.Do(func() {
runtimeDir := os.Getenv("XDG_RUNTIME_DIR")
runtimeDir, err := homedir.GetRuntimeDir()
if err != nil {
logrus.Debug(err)
}
if runtimeDir != "" {
st, err := os.Stat(runtimeDir)
if err != nil {