mirror of
https://github.com/containers/podman.git
synced 2025-11-14 18:19:20 +08:00
update c/common
Update containers common to the latest HEAD. Some bug fixes in libimage forced us to have a clearer separation between ordinary images and manifest lists. Hence, when looking up manifest lists without recursing into any of their instances, we need to use `LookupManifestList()`. Also account for some other changes in c/common (e.g., the changed order in the security labels). Further vendor the latest HEAD from Buildah which is required to get the bud tests to pass. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
This commit is contained in:
37
vendor/github.com/containers/storage/pkg/idtools/idtools.go
generated
vendored
37
vendor/github.com/containers/storage/pkg/idtools/idtools.go
generated
vendored
@@ -323,3 +323,40 @@ func SafeLchown(name string, uid, gid int) error {
|
||||
}
|
||||
return checkChownErr(os.Lchown(name, uid, gid), name, uid, gid)
|
||||
}
|
||||
|
||||
type sortByHostID []IDMap
|
||||
|
||||
func (e sortByHostID) Len() int { return len(e) }
|
||||
func (e sortByHostID) Swap(i, j int) { e[i], e[j] = e[j], e[i] }
|
||||
func (e sortByHostID) Less(i, j int) bool { return e[i].HostID < e[j].HostID }
|
||||
|
||||
type sortByContainerID []IDMap
|
||||
|
||||
func (e sortByContainerID) Len() int { return len(e) }
|
||||
func (e sortByContainerID) Swap(i, j int) { e[i], e[j] = e[j], e[i] }
|
||||
func (e sortByContainerID) Less(i, j int) bool { return e[i].ContainerID < e[j].ContainerID }
|
||||
|
||||
// IsContiguous checks if the specified mapping is contiguous and doesn't
|
||||
// have any hole.
|
||||
func IsContiguous(mappings []IDMap) bool {
|
||||
if len(mappings) < 2 {
|
||||
return true
|
||||
}
|
||||
|
||||
var mh sortByHostID = mappings[:]
|
||||
sort.Sort(mh)
|
||||
for i := 1; i < len(mh); i++ {
|
||||
if mh[i].HostID != mh[i-1].HostID+mh[i-1].Size {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
var mc sortByContainerID = mappings[:]
|
||||
sort.Sort(mc)
|
||||
for i := 1; i < len(mc); i++ {
|
||||
if mc[i].ContainerID != mc[i-1].ContainerID+mc[i-1].Size {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user