Handle podman-remote --arch, --platform, --os

Podman remote should be able to handle remote specification of
arches.

Requires: https://github.com/containers/buildah/pull/3116

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh
2021-04-03 06:36:51 -04:00
committed by Ed Santiago
parent 68269a0ee1
commit b68106703e
16 changed files with 144 additions and 25 deletions

View File

@ -6,6 +6,8 @@ import (
"net/url"
"os"
"path"
"path/filepath"
"sort"
"strings"
"sync"
"syscall"
@ -474,3 +476,26 @@ func MergeEnv(defaults, overrides []string) []string {
}
return s
}
type byDestination []specs.Mount
func (m byDestination) Len() int {
return len(m)
}
func (m byDestination) Less(i, j int) bool {
return m.parts(i) < m.parts(j)
}
func (m byDestination) Swap(i, j int) {
m[i], m[j] = m[j], m[i]
}
func (m byDestination) parts(i int) int {
return strings.Count(filepath.Clean(m[i].Destination), string(os.PathSeparator))
}
func SortMounts(m []specs.Mount) []specs.Mount {
sort.Sort(byDestination(m))
return m
}