opkg

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: 26 Imported by: 0

Documentation

Overview

Package opkg reads bounded IPK archives and their control metadata.

Index

Constants

View Source
const (
	KindIndex        = "opkg.index"
	PropName         = "opkg.name"
	PropVersion      = "opkg.version"
	PropArchitecture = "opkg.architecture"
	PropFeed         = "opkg.feed"
)
View Source
const (
	PackagesName     = "Packages"
	PackagesGzipName = "Packages.gz"
	ReleaseName      = "Release"
	SignatureName    = "Packages.sig"
)

Variables

This section is empty.

Functions

func Digest

func Digest(body []byte) string

func EncodeIndex

func EncodeIndex(packages []Package, feed string) (map[string][]byte, error)

EncodeIndex creates a deterministic Packages/Packages.gz pair for one feed.

func Feed

func Feed(p string) string

func FeedPath

func FeedPath(p string) (string, bool)

func IndexPath

func IndexPath(feed, name string) string

func IsIndex

func IsIndex(p string) bool

func Serves

func Serves(t repo.PackageType) bool

func SignFeed

func SignFeed(ctx context.Context, st store.Store, c repo.Config, files map[string][]byte) error

SignFeed signs the uncompressed Packages bytes, which the opkg client verifies before trusting the package digests inside the feed.

func ValidPath

func ValidPath(p string) bool

ValidPath accepts feed-relative IPK names. Artifactory's documented upload example allows my-app.ipk, while canonical OpenWrt names include identity.

func ValidateRelease

func ValidateRelease(body []byte) error

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, p 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, p 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

func (Handler) WorkKinds

func (Handler) WorkKinds() []string

type Package

type Package struct {
	Name, Version, Architecture            string
	Description, Maintainer                string
	Depends, Provides, Conflicts, Replaces string
	Section, Priority, Source, License     string
	Path, SHA256, MD5                      string
	Size                                   int64
}

Package is the metadata that opkg reads from an IPK's CONTROL/control. Checksums and archive size come from the stored blob, never from the control.

func DecodeIndex

func DecodeIndex(body []byte, indexPath string) ([]Package, error)

DecodeIndex rejects metadata that could make a client fetch a package outside its feed, confuse a virtual member selection, or skip integrity checks. gzip is selected from the requested resource, not content sniffing.

func ReadPackage

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

ReadPackage accepts OpenWrt's gzip(tar) IPK and the older ar container. Both must contain one debian-binary, one control.tar.gz, and one data.tar.gz.

Jump to

Keyboard shortcuts

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