tarball

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2024 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	SourceDateEpoch time.Time
	OverrideUIDGID  bool
	UID             int
	GID             int
	OverrideUname   string
	OverrideGname   string
	SkipClose       bool
	UseChecksums    bool
	// contains filtered or unexported fields
}

func NewContext

func NewContext(opts ...Option) (*Context, error)

Generates a new context from a set of options.

func (*Context) WriteArchive deprecated

func (c *Context) WriteArchive(dst io.Writer, src fs.FS) error

WriteArchive writes a tarball to the provided io.Writer from the provided fs.FS. To override permissions, set the OverridePerms when creating the Context. If you need to get multiple filesystems, merge them prior to calling WriteArchive.

Deprecated: Use WriteTargz or WriteTar instead.

func (*Context) WriteTar

func (c *Context) WriteTar(ctx context.Context, dst io.Writer, src fs.FS, userinfosrc fs.FS) error

WriteTar writes a tarball to the provided io.Writer from the provided fs.FS. To override permissions, set the OverridePerms when creating the Context. If you need to get multiple filesystems, merge them prior to calling WriteArchive. userinfosrc should be a fs which can provide an optionally provide an etc/passwd and etc/group file. The etc/passwd and etc/group file provide username and group name mappings for the tar.

func (*Context) WriteTargz

func (c *Context) WriteTargz(ctx context.Context, dst io.Writer, src fs.FS, userinfofs fs.FS) error

WriteTargz writes a gzipped tarball to the provided io.Writer from the provided fs.FS. To override permissions, set the OverridePerms when creating the Context. If you need to get multiple filesystems, merge them prior to calling WriteArchive. userinfosrc should be a fs which can provide an optionally provide an etc/passwd and etc/group file. The etc/passwd and etc/group file provide username and group name mappings for the tar.

type Option

type Option func(*Context) error

func WithOverrideGname

func WithOverrideGname(gname string) Option

WithOverrideGname sets the Gname to use with Context.

func WithOverridePerms

func WithOverridePerms(files []tar.Header) Option

WithOverridePerms sets the UID/GID and file permissions to override with for specific files Context.

func WithOverrideUIDGID

func WithOverrideUIDGID(uid, gid int) Option

WithOverrideUIDGID sets the UID/GID to override with for all files for Context.

func WithOverrideUname

func WithOverrideUname(uname string) Option

WithOverrideUname sets the Uname to use with Context.

func WithRemapGIDs

func WithRemapGIDs(gids map[int]int) Option

WithRemapGIDs sets a GID remapping in the Context.

func WithRemapUIDs

func WithRemapUIDs(uids map[int]int) Option

WithRemapUIDs sets a UID remapping in the Context.

func WithSkipClose

func WithSkipClose(skipClose bool) Option

WithSkipClose is used to determine whether the tar stream should be closed. For concatenated tar streams such as APKv2 containers, only the final tar stream should be closed.

func WithSourceDateEpoch

func WithSourceDateEpoch(t time.Time) Option

Sets SourceDateEpoch for Context.

func WithUseChecksums

func WithUseChecksums(useChecksums bool) Option

WithUseChecksums is used to determine whether the tar stream should have the APK-TOOLS.checksum.SHA1 extension.

Jump to

Keyboard shortcuts

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