mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-30 23:28:04 +08:00
Merge pull request #31 from tonistiigi/platforms-fixes
fixes for managing platforms
This commit is contained in:
@@ -62,7 +62,7 @@ type Inputs struct {
|
||||
type DriverInfo struct {
|
||||
Driver driver.Driver
|
||||
Name string
|
||||
Platform []string // TODO: specs.Platform
|
||||
Platform []specs.Platform
|
||||
Err error
|
||||
}
|
||||
|
||||
|
@@ -1,32 +0,0 @@
|
||||
package build
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/containerd/containerd/platforms"
|
||||
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
)
|
||||
|
||||
func ParsePlatformSpecs(platformsStr []string) ([]specs.Platform, error) {
|
||||
if len(platformsStr) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
out := make([]specs.Platform, 0, len(platformsStr))
|
||||
for _, s := range platformsStr {
|
||||
parts := strings.Split(s, ",")
|
||||
if len(parts) > 1 {
|
||||
p, err := ParsePlatformSpecs(parts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
out = append(out, p...)
|
||||
continue
|
||||
}
|
||||
p, err := platforms.Parse(s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
out = append(out, platforms.Normalize(p))
|
||||
}
|
||||
return out, nil
|
||||
}
|
Reference in New Issue
Block a user