mirror of
https://github.com/containers/podman.git
synced 2025-12-11 09:18:34 +08:00
move formats pkg to and vendor from buildah
Signed-off-by: Qi Wang <qiwan@redhat.com>
This commit is contained in:
2
vendor/github.com/containers/buildah/imagebuildah/build.go
generated
vendored
2
vendor/github.com/containers/buildah/imagebuildah/build.go
generated
vendored
@@ -293,7 +293,7 @@ func (b *Executor) Preserve(path string) error {
|
||||
|
||||
// Try and resolve the symlink (if one exists)
|
||||
// Set archivedPath and path based on whether a symlink is found or not
|
||||
if symLink, err := ResolveSymLink(b.mountPoint, path); err == nil {
|
||||
if symLink, err := resolveSymlink(b.mountPoint, path); err == nil {
|
||||
archivedPath = filepath.Join(b.mountPoint, symLink)
|
||||
path = symLink
|
||||
} else {
|
||||
|
||||
10
vendor/github.com/containers/buildah/imagebuildah/chroot_symlink.go
generated
vendored
10
vendor/github.com/containers/buildah/imagebuildah/chroot_symlink.go
generated
vendored
@@ -24,9 +24,7 @@ func init() {
|
||||
reexec.Register(symlinkModifiedTime, resolveSymlinkTimeModified)
|
||||
}
|
||||
|
||||
// main() for grandparent subprocess. Its main job is to shuttle stdio back
|
||||
// and forth, managing a pseudo-terminal if we want one, for our child, the
|
||||
// parent subprocess.
|
||||
// main() for resolveSymlink()'s subprocess.
|
||||
func resolveChrootedSymlinks() {
|
||||
status := 0
|
||||
flag.Parse()
|
||||
@@ -57,9 +55,9 @@ func resolveChrootedSymlinks() {
|
||||
os.Exit(status)
|
||||
}
|
||||
|
||||
// ResolveSymLink (in the grandparent process) resolves any symlink in filename
|
||||
// resolveSymlink uses a child subprocess to resolve any symlinks in filename
|
||||
// in the context of rootdir.
|
||||
func ResolveSymLink(rootdir, filename string) (string, error) {
|
||||
func resolveSymlink(rootdir, filename string) (string, error) {
|
||||
// The child process expects a chroot and one path that
|
||||
// will be consulted relative to the chroot directory and evaluated
|
||||
// for any symbolic links present.
|
||||
@@ -253,7 +251,7 @@ func hasSymlink(path string) (bool, string, error) {
|
||||
}
|
||||
// if the symlink points to a relative path, prepend the path till now to the resolved path
|
||||
if !filepath.IsAbs(targetDir) {
|
||||
targetDir = filepath.Join(path, targetDir)
|
||||
targetDir = filepath.Join(filepath.Dir(path), targetDir)
|
||||
}
|
||||
// run filepath.Clean to remove the ".." from relative paths
|
||||
return true, filepath.Clean(targetDir), nil
|
||||
|
||||
Reference in New Issue
Block a user