Add support for image name history

We leverage the containers/storage image history tracking feature to
show the previously used image names when running:
`podman images --history`

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
This commit is contained in:
Sascha Grunert
2019-11-26 16:08:04 +01:00
parent aef38585ed
commit 63e46cc85c
24 changed files with 346 additions and 40 deletions

View File

@@ -16,6 +16,7 @@ import (
"io"
"os"
"path/filepath"
"strings"
"syscall"
"time"
@@ -97,7 +98,7 @@ func legacyCopy(srcFile io.Reader, dstFile io.Writer) error {
func copyXattr(srcPath, dstPath, attr string) error {
data, err := system.Lgetxattr(srcPath, attr)
if err != nil {
if err != nil && err != unix.EOPNOTSUPP {
return err
}
if data != nil {
@@ -271,6 +272,19 @@ func doCopyXattrs(srcPath, dstPath string) error {
return err
}
xattrs, err := system.Llistxattr(srcPath)
if err != nil && err != unix.EOPNOTSUPP {
return err
}
for _, key := range xattrs {
if strings.HasPrefix(key, "user.") {
if err := copyXattr(srcPath, dstPath, key); err != nil {
return err
}
}
}
// We need to copy this attribute if it appears in an overlay upper layer, as
// this function is used to copy those. It is set by overlay if a directory
// is removed and then re-created and should not inherit anything from the