Documentation
¶
Overview ¶
Package debian implements Debian package and repository metadata.
Index ¶
- Constants
- func ByHashMetadataPath(p string) (string, bool)
- func GzipIndex(body []byte) ([]byte, error)
- func Packages(entries []IndexedBinary) ([]byte, error)
- func PackagesIndexPath(p string) bool
- func Release(distribution string, components, architectures []string, ...) ([]byte, error)
- func ReleaseMetadataPath(p string) bool
- func Serves(t repo.PackageType) bool
- func Sources(entries []IndexedSource) ([]byte, error)
- func SourcesIndexPath(p string) bool
- func ValidBinaryPath(p string) bool
- func ValidSourcePath(p string) bool
- func ValidateReleaseMetadata(p string, body []byte) error
- func WithSnapshotDelete(ctx context.Context) context.Context
- func WithSnapshotWrite(ctx context.Context) context.Context
- type Binary
- type Handler
- func (Handler) Admit(ctx context.Context, env format.Env, c repo.Config, w format.Write) (format.Write, error)
- func (Handler) Classify(_ repo.Config, path string) format.Class
- func (Handler) Deleted(ctx context.Context, env format.Env, c repo.Config, removed []types.Item) error
- func (Handler) Deleting(ctx context.Context, env format.Env, c repo.Config, it types.Item) error
- func (Handler) Deployed(ctx context.Context, env format.Env, c repo.Config, it types.Item) error
- func (Handler) Inspect(ctx context.Context, env format.Env, _ repo.Config, w format.Write) (any, error)
- func (Handler) Owed(c repo.Config, cached bool, path string) []format.WorkRef
- func (Handler) Reindex(ctx context.Context, env format.Env, c repo.Config) error
- func (Handler) Work(ctx context.Context, env format.Env, work types.WorkItem) error
- func (Handler) WorkKinds() []string
- type IndexedBinary
- type IndexedSource
- type PackageIndexRef
- type PackageRecord
- type ReleaseEntry
- type SignedRelease
- type Source
- type SourceArchive
- type SourceIndexRecord
- type SourcePart
Constants ¶
const ( KindIndex = "debian.index" KindReindexNoProps = "debian.reindex-no-props" )
const ( PropDistribution = "deb.distribution" PropComponent = "deb.component" PropArchitecture = "deb.architecture" PropName = "deb.name" PropVersion = "deb.version" )
Variables ¶
This section is empty.
Functions ¶
func ByHashMetadataPath ¶
ByHashMetadataPath names a checksum-addressed Packages or Sources index.
func GzipIndex ¶
GzipIndex compresses apt index text with a stable header for reproducible Release checksums and by-hash URLs.
func Packages ¶
func Packages(entries []IndexedBinary) ([]byte, error)
Packages writes one binary-architecture index in stable package order. Architecture-independent packages belong in binary-all and in each architecture supported by the distribution.
func PackagesIndexPath ¶
PackagesIndexPath accepts only the apt binary-index layout this adapter understands. The same grammar guards remote metadata and virtual reads.
func Release ¶
func Release( distribution string, components, architectures []string, generated []ReleaseEntry, at time.Time, ) ([]byte, error)
Release builds the checksummed metadata apt verifies before accepting a Packages index. Signing this body produces InRelease and Release.gpg.
func ReleaseMetadataPath ¶
ReleaseMetadataPath names one of the metadata files apt checks before it accepts indexes for a distribution.
func Serves ¶
func Serves(t repo.PackageType) bool
func Sources ¶
func Sources(entries []IndexedSource) ([]byte, error)
Sources emits the deb-src index with server-computed checksums. Client supplied Directory, Files and Checksums fields never reach the output.
func SourcesIndexPath ¶
SourcesIndexPath accepts apt source indexes for one distribution/component.
func ValidBinaryPath ¶
ValidBinaryPath reports whether a repository-relative path can safely appear as the Filename of a binary package in an apt index.
func ValidSourcePath ¶
ValidSourcePath reports whether a repository-relative descriptor path can safely appear in a Sources index.
func ValidateReleaseMetadata ¶
ValidateReleaseMetadata bounds upstream metadata before cache publication. Apt verifies the OpenPGP signature with its configured key; this checks the control structure and checksum paths so malformed bytes do not enter cache.
func WithSnapshotDelete ¶
WithSnapshotDelete permits deleting a complete snapshot folder.
Types ¶
type Binary ¶
Binary is the metadata in a validated .deb control archive. Control holds the original deb822 fields for the Packages index, including continuation lines, so package-specific fields are not silently discarded.
type Handler ¶
type IndexedBinary ¶
IndexedBinary binds a validated control record to the exact stored item and its server-computed digests. The upload cannot supply these values.
type IndexedSource ¶
type IndexedSource struct {
Source Source
Path string
Size int64
Checksums types.Checksums
Archives []SourceArchive
}
IndexedSource binds a parsed .dsc to the stored bytes for it and each named archive. Source records are emitted only after all declared bytes match.
type PackageIndexRef ¶
PackageIndexRef binds a Packages representation to the SHA256 and size declared by its member Release file.
func ReleaseIndexRefs ¶
func ReleaseIndexRefs(distribution string, body []byte) ([]PackageIndexRef, error)
ReleaseIndexRefs returns every checksum-bound metadata path in a Release. Snapshot creation uses these declarations to materialize an immutable view.
func ReleasePackageIndexes ¶
func ReleasePackageIndexes(distribution string, body []byte) ([]PackageIndexRef, error)
ReleasePackageIndexes selects the plain Packages index for each advertised component and architecture, falling back to gzip when plain is absent. The caller must compare the fetched bytes with each declared digest.
func (PackageIndexRef) BasePath ¶
func (r PackageIndexRef) BasePath() string
BasePath is the uncompressed Packages or Sources path for a Release member.
type PackageRecord ¶
type PackageRecord struct {
Name, Version, Architecture string
Filename, SHA256 string
Size int64
Raw []byte
}
PackageRecord is a validated stanza in an upstream Packages index. Raw retains package fields for virtual index composition, while Filename and SHA256 bind the advertised download to one repository-relative artifact.
func DecodePackagesIndex ¶
func DecodePackagesIndex(body []byte) ([]PackageRecord, error)
DecodePackagesIndex accepts the plain and mandatory gzip index encodings. The bound applies after decompression, so a small compressed bomb cannot enter the remote cache or a virtual index.
func ParsePackagesIndex ¶
func ParsePackagesIndex(body []byte) ([]PackageRecord, error)
ParsePackagesIndex checks the complete apt Packages representation before it can be cached or combined into a virtual index. A malformed stanza must not make apt resolve a package that the registry cannot safely address.
type ReleaseEntry ¶
ReleaseEntry is a path under dists/<distribution> and its generated body.
type SignedRelease ¶
SignedRelease is the two signatures apt can verify beside Release.
func SignRelease ¶
func SignRelease(body []byte, armoredPrivate, passphrase string) (SignedRelease, error)
SignRelease binds an apt Release file to the repository's configured GPG private key. Callers publish all three files in one derivation cycle.
type Source ¶
type Source struct {
Name, Version, Format string
Control []byte
Parts []SourcePart
}
Source is the parsed source control file and its declared archive parts.
type SourceIndexRecord ¶
type SourceIndexRecord struct {
Files []string
}
SourceIndexRecord lists the artifact paths advertised by one validated Sources stanza. It lets the HTTP layer enforce read permissions before exposing a source index to an apt client.
func DecodeSourcesIndex ¶
func DecodeSourcesIndex(body []byte) ([]SourceIndexRecord, error)
DecodeSourcesIndex bounds and validates plain or gzip apt source indexes.
type SourcePart ¶
SourcePart is one archive named by a .dsc file. Its declarations are not trusted until the repository has compared them to stored server checksums.