expandapk

package
v0.0.0-...-789246e Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 19 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APKExpanded

type APKExpanded struct {
	// The size in bytes of the entire apk (sum of all tar.gz file sizes)
	Size int64

	// Whether or not the apk contains a signature
	// Note: currently unused
	Signed bool

	// The package signature filename (a.k.a. ".SIGN...") in tar.gz format
	SignatureFile string

	// The control data filename (a.k.a. ".PKGINFO") in tar.gz format
	ControlFile string

	// The package data filename in .tar.gz format
	PackageFile string

	// The package data filename in .tar format.
	TarFile string

	// Expose ControlFile as an indexed FS implementation.
	ControlFS *tarfs.FS

	// Exposes TarFile as an indexed FS implementation.
	TarFS *tarfs.FS

	ControlHash []byte
	PackageHash []byte

	sync.Mutex
	// contains filtered or unexported fields
}

APKExpanded contains information about and reference to an expanded APK package. Close() deletes all temporary files and directories created during the expansion process.

func ExpandApk

func ExpandApk(ctx context.Context, source io.Reader, cacheDir string) (*APKExpanded, error)

ExpandAPK given a ready to an apk stream, normally a tar stream with gzip compression, expand it into its components.

An apk is split into either 2 or 3 file streams (2 for unsigned packages, 3 for signed).

For more info, see https://wiki.alpinelinux.org/wiki/Apk_spec:

"APK v2 packages contain two tar segments followed by a tarball each in their
own gzip stream (3 streams total). These streams contain the package signature,
control data, and package data"

Returns an APKExpanded struct containing references to the file. You *must* call APKExpanded.Close() when finished to clean up the various files.

func (*APKExpanded) APK

func (a *APKExpanded) APK() (io.ReadCloser, error)

func (*APKExpanded) Close

func (a *APKExpanded) Close() error

func (*APKExpanded) ControlData

func (a *APKExpanded) ControlData() (io.ReadSeekCloser, error)

func (*APKExpanded) PackageData

func (a *APKExpanded) PackageData() (io.ReadSeekCloser, error)

Jump to

Keyboard shortcuts

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