tarball

package
v0.0.0-...-f4cebfc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WorkdirError int = 1 + iota
	TarTimeoutError
	DownloadError
	URLHandlerError
	SourcePathError
	UserNotAllowedError
	EmptyGitRepositoryError
)

Variables

View Source
var DefaultExclusionPattern = regexp.MustCompile(`(^|/)\.git(/|$)`)

DefaultExclusionPattern is the pattern of files that will not be included in a tar file when creating one. By default it is any file inside a .git metadata directory

Functions

func NewFileSystem

func NewFileSystem() *fs

NewFileSystem creates a new instance of the default FileSystem implementation

func NewTarTimeoutError

func NewTarTimeoutError() error

NewTarTimeoutError returns a new error which indicates there was a problem when sending or receiving tar stream

Types

type ChmodAdapter

type ChmodAdapter struct {
	*tar.Writer
	NewFileMode     int64
	NewExecFileMode int64
	NewDirMode      int64
}

ChmodAdapter changes the mode of files and directories inline as a tarfile is being written

func (ChmodAdapter) WriteHeader

func (a ChmodAdapter) WriteHeader(hdr *tar.Header) error

WriteHeader changes the mode of files and directories inline as a tarfile is being written

type Error

type Error struct {
	Message    string
	Details    error
	ErrorCode  int
	Suggestion string
}

Error represents an error thrown during S2I execution

func (Error) Error

func (s Error) Error() string

Error returns a string for a given error

type RenameAdapter

type RenameAdapter struct {
	*tar.Writer
	Old string
	New string
}

RenameAdapter renames files and directories inline as a tarfile is being written

func (RenameAdapter) WriteHeader

func (a RenameAdapter) WriteHeader(hdr *tar.Header) error

WriteHeader renames files and directories inline as a tarfile is being written

type TapArchiver

type TapArchiver struct {
	// contains filtered or unexported fields
}

stiTar is an implementation of the Tar interface

func New

func New() *TapArchiver

New creates a new Tar

func NewParanoid

func NewParanoid() *TapArchiver

NewParanoid creates a new Tar that has restrictions on what it can do while extracting files.

func (TapArchiver) Chmod

func (h TapArchiver) Chmod(file string, mode os.FileMode) error

Chmod sets the file mode

func (*TapArchiver) CreateTarFile

func (t *TapArchiver) CreateTarFile(base, dir string) (string, error)

CreateTarFile creates a tar file from the given directory while excluding files that match the given exclusion pattern It returns the name of the created file

func (*TapArchiver) CreateTarStream

func (t *TapArchiver) CreateTarStream(dir string, includeDirInPath bool, writer io.Writer) error

CreateTarStream calls CreateTarStreamToTarWriter with a nil logger

func (*TapArchiver) CreateTarStreamReader

func (t *TapArchiver) CreateTarStreamReader(dir string, includeDirInPath bool) io.ReadCloser

CreateTarStreamReader returns an io.ReadCloser from which a tar stream can be read. The tar stream is created using CreateTarStream.

func (*TapArchiver) CreateTarStreamToTarWriter

func (t *TapArchiver) CreateTarStreamToTarWriter(dir string, includeDirInPath bool, tarWriter *tar.Writer, logger io.Writer) error

CreateTarStreamToTarWriter creates a tar stream on the given writer from the given directory while excluding files that match the given exclusion pattern.

func (*TapArchiver) ExtractTarStream

func (t *TapArchiver) ExtractTarStream(dir string, reader io.Reader) error

ExtractTarStream calls ExtractTarStreamFromTarReader with a default reader and nil logger

func (*TapArchiver) ExtractTarStreamFromTarReader

func (t *TapArchiver) ExtractTarStreamFromTarReader(dir string, tarReader *tar.Reader, logger io.Writer) error

ExtractTarStreamFromTarReader extracts files from a given tar stream. Times out if reading from the stream for any given file exceeds the value of timeout

func (*TapArchiver) ExtractTarStreamWithLogging

func (t *TapArchiver) ExtractTarStreamWithLogging(dir string, reader io.Reader, logger io.Writer) error

ExtractTarStreamWithLogging calls ExtractTarStreamFromTarReader with a default reader

func (*TapArchiver) SetExclusionPattern

func (t *TapArchiver) SetExclusionPattern(p *regexp.Regexp)

SetExclusionPattern sets the exclusion pattern for tar creation. The exclusion pattern always uses UNIX-style (/) path separators, even on Windows.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL