mirror of
https://github.com/containers/podman.git
synced 2025-08-24 10:04:57 +08:00

Update to the latest c/{common,image} which inclused an update to docker v28, that update is NOT backwards compatible so I had to fix a few types. NOTE: handler.ExecCreateConfig is used directly by the bindings. Thus this is an API break for pkg/bindings. Including docker types as part of any stable pkg/bindings API was a very bad idea. I see no way to avoid that unless we never want to docker v28, which is not easy as the update comes in from c/image and maybe other packages. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
31 lines
724 B
Go
31 lines
724 B
Go
package internal
|
|
|
|
import (
|
|
"maps"
|
|
"slices"
|
|
|
|
v1 "github.com/opencontainers/image-spec/specs-go/v1"
|
|
)
|
|
|
|
// DeepCopyDescriptor copies a Descriptor, deeply copying its contents
|
|
func DeepCopyDescriptor(original *v1.Descriptor) *v1.Descriptor {
|
|
tmp := *original
|
|
if original.URLs != nil {
|
|
tmp.URLs = slices.Clone(original.URLs)
|
|
}
|
|
if original.Annotations != nil {
|
|
tmp.Annotations = maps.Clone(original.Annotations)
|
|
}
|
|
if original.Data != nil {
|
|
tmp.Data = slices.Clone(original.Data)
|
|
}
|
|
if original.Platform != nil {
|
|
tmpPlatform := *original.Platform
|
|
if original.Platform.OSFeatures != nil {
|
|
tmpPlatform.OSFeatures = slices.Clone(original.Platform.OSFeatures)
|
|
}
|
|
tmp.Platform = &tmpPlatform
|
|
}
|
|
return &tmp
|
|
}
|