alpine

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 29 Imported by: 0

Documentation

Overview

Package alpine implements Alpine APK v2 package and index metadata.

Index

Constants

View Source
const (
	KindIndex        = "alpine.index"
	IndexName        = "APKINDEX.tar.gz"
	PropName         = "alpine.name"
	PropVersion      = "alpine.version"
	PropBranch       = "alpine.branch"
	PropComponent    = "alpine.repository"
	PropArchitecture = "alpine.architecture"
)

Variables

This section is empty.

Functions

func EncodeIndex

func EncodeIndex(
	entries []Package,
	description, keyName string,
	key *rsa.PrivateKey,
) ([]byte, error)

EncodeIndex writes the APKINDEX.tar.gz stream, optionally prepending a signature stream using the same RSA wire form as abuild-sign. The key name must match the basename placed in the client's /etc/apk/keys directory.

func ParseIndexPath

func ParseIndexPath(p string) (branch, component, arch string, ok bool)

ParseIndexPath recognizes the branch/component/architecture APKINDEX layout.

func ParsePath

func ParsePath(p string) (branch, component, arch, file string, ok bool)

ParsePath accepts the branch/component/architecture/name-version.apk layout documented by Artifactory. It does not infer identity from a filename alone.

func Serves

func Serves(t repo.PackageType) bool

func SigningKey

func SigningKey(
	ctx context.Context,
	st store.Store,
	c repo.Config,
) (string, *rsa.PrivateKey, error)

SigningKey selects the repository's configured apk signing pair. Virtual repositories use keyPair; local and federated repositories use the primary keypair shared with Artifactory's public-key download endpoint.

Types

type Handler

type Handler struct{ generic.Handler }

func (Handler) Admit

func (Handler) Admit(
	ctx context.Context, env format.Env, c repo.Config, w format.Write,
) (format.Write, error)

func (Handler) Classify

func (Handler) Classify(_ repo.Config, path string) format.Class

func (Handler) Deleted

func (Handler) Deleted(
	ctx context.Context,
	env format.Env,
	c repo.Config,
	removed []types.Item,
) error

func (Handler) Deleting

func (Handler) Deleting(ctx context.Context, env format.Env, c repo.Config, it types.Item) error

func (Handler) Deployed

func (Handler) Deployed(ctx context.Context, env format.Env, c repo.Config, it types.Item) error

func (Handler) Inspect

func (Handler) Inspect(
	ctx context.Context, env format.Env, _ repo.Config, w format.Write,
) (any, error)

func (Handler) Owed

func (Handler) Owed(c repo.Config, cached bool, path string) []format.WorkRef

func (Handler) Reindex

func (Handler) Reindex(ctx context.Context, env format.Env, c repo.Config) error

func (Handler) Work

func (Handler) Work(ctx context.Context, env format.Env, work types.WorkItem) error

Work derives every current architecture index from the stored packages. A single repository work key coalesces bursts of writes and restores, and a rerun reads the committed tree afresh.

func (Handler) WorkKinds

func (Handler) WorkKinds() []string

type Package

type Package struct {
	Name, Version, Architecture  string
	Branch, Component            string
	Path                         string
	ArchiveSize                  int64
	InstalledSize                int64
	Description, URL, License    string
	Origin, Maintainer, Commit   string
	BuildTime                    int64
	Depends, Provides, InstallIf []string
	ControlSHA1                  string
	IndexRaw                     string
}

Package is the native metadata extracted from a validated APK v2 archive.

func DecodeIndex

func DecodeIndex(ctx context.Context, body []byte, indexPath string) ([]Package, error)

DecodeIndex validates an apk v2 index and returns the exact package records. Source records remain byte-for-byte intact when a virtual index is rebuilt.

func ReadPackage

func ReadPackage(ctx context.Context, body io.ReadSeeker, size int64, p string) (Package, error)

ReadPackage validates the bounded control streams and the optional datahash, then extracts only metadata that belongs in APKINDEX. The caller provides the stored blob, so the same check can guard local and remote data.

func (Package) IndexRecord

func (p Package) IndexRecord() string

IndexRecord renders the apk-tools v2 one-letter metadata fields. Values come from bounded .PKGINFO parsing, not from client-supplied index text.

Jump to

Keyboard shortcuts

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