mirror of
https://github.com/mudler/luet.git
synced 2025-09-22 11:38:12 +00:00
update vendor
This commit is contained in:
26
vendor/github.com/google/go-containerregistry/pkg/v1/tarball/image.go
generated
vendored
26
vendor/github.com/google/go-containerregistry/pkg/v1/tarball/image.go
generated
vendored
@@ -23,13 +23,15 @@ import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
|
||||
"github.com/google/go-containerregistry/internal/gzip"
|
||||
"github.com/google/go-containerregistry/pkg/name"
|
||||
v1 "github.com/google/go-containerregistry/pkg/v1"
|
||||
"github.com/google/go-containerregistry/pkg/v1/partial"
|
||||
"github.com/google/go-containerregistry/pkg/v1/types"
|
||||
"github.com/google/go-containerregistry/pkg/v1/v1util"
|
||||
)
|
||||
|
||||
type image struct {
|
||||
@@ -68,6 +70,22 @@ func ImageFromPath(path string, tag *name.Tag) (v1.Image, error) {
|
||||
return Image(pathOpener(path), tag)
|
||||
}
|
||||
|
||||
// LoadManifest load manifest
|
||||
func LoadManifest(opener Opener) (Manifest, error) {
|
||||
m, err := extractFileFromTar(opener, "manifest.json")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer m.Close()
|
||||
|
||||
var manifest Manifest
|
||||
|
||||
if err := json.NewDecoder(m).Decode(&manifest); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return manifest, nil
|
||||
}
|
||||
|
||||
// Image exposes an image from the tarball at the provided path.
|
||||
func Image(opener Opener, tag *name.Tag) (v1.Image, error) {
|
||||
img := &image{
|
||||
@@ -148,7 +166,7 @@ func (i *image) areLayersCompressed() (bool, error) {
|
||||
return false, err
|
||||
}
|
||||
defer blob.Close()
|
||||
return v1util.IsGzipped(blob)
|
||||
return gzip.Is(blob)
|
||||
}
|
||||
|
||||
func (i *image) loadTarDescriptorAndConfig() error {
|
||||
@@ -216,6 +234,10 @@ func extractFileFromTar(opener Opener, filePath string) (io.ReadCloser, error) {
|
||||
return nil, err
|
||||
}
|
||||
if hdr.Name == filePath {
|
||||
if hdr.Typeflag == tar.TypeSymlink || hdr.Typeflag == tar.TypeLink {
|
||||
currentDir := filepath.Dir(filePath)
|
||||
return extractFileFromTar(opener, path.Join(currentDir, hdr.Linkname))
|
||||
}
|
||||
close = false
|
||||
return tarFile{
|
||||
Reader: tf,
|
||||
|
Reference in New Issue
Block a user