debext

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DebugPackageSuffix  = "-dbgsym"
	DebugPackageSection = "debug"
)
View Source
const (
	AllArchitecture    = "all"
	SourceArchitecture = "source"
)

Variables

View Source
var (
	// ErrSignatureVerificationFailed indicates a signature verification failure
	ErrSignatureVerificationFailed = errors.New("signature verification failed")
	// ErrMissingSignature indicates a file is not signed
	ErrMissingSignature = errors.New("file is not signed")
)

Functions

func GeneratePackageIndex

func GeneratePackageIndex(w io.Writer, list *deb.PackageList, isSource bool) error

GeneratePackageIndex generates a package index file (Packages or Sources) and writes to w. Set isSource to true for Sources files, false for Packages files.

func GenerateRelease

func GenerateRelease(w io.Writer, config Release) error

GenerateRelease creates a Release file using aptly's Stanza formatting and writes to w.

func GetPoolPath

func GetPoolPath(component, packageName string) string

GetPoolPath returns the pool directory path for a package. Uses Debian convention: pool/component/first-letter/package-name Packages starting with "lib" use first 4 characters (lib + one letter).

func GetSourceNameFromPackage

func GetSourceNameFromPackage(pkg *deb.Package) string

GetSourceNameFromPackage returns the source package name for a given package. If a binary package has the same name as the source, it won't have the source field set.

func IsDebugByName

func IsDebugByName(input string) bool

IsDebugByName determines if a package a debug package by its name. Try to use IsDebugPackage instead where possible.

func IsDebugPackage

func IsDebugPackage(pkg *deb.Package) bool

IsDebugPackage determines if a package is a debug package.

func IsDebugPackageByFilename

func IsDebugPackageByFilename(filename string) bool

IsDebugPackageByFilename determines if a package is a debug package by its filename. Try to use IsDebugPackage instead where possible.

func ModifyPackageStanza

func ModifyPackageStanza(pkg **deb.Package, key, value string) error

ModifyPackageStanza modifies a package's stanza field and updates the package pointer in place. This is necessary because aptly's Stanza() returns a copy, so direct modifications don't persist. The function handles both binary and source packages appropriately.

func ParseBinary

func ParseBinary(debFile string, poolPath string) (*deb.Package, error)

ParseBinary creates a *deb.Package from a .deb file with proper pool path and checksums. It parses the control file, calculates checksums, and sets the required fields.

func ParseChanges

func ParseChanges(changesFile string, verifier *Verifier) (*deb.Changes, error)

ParseChanges parses a .changes file

func ParsePackageIndex

func ParsePackageIndex(path string, isSource bool) ([]*deb.Package, error)

ParsePackageIndex parses a Packages or Sources index file and returns packages

func ParseSource

func ParseSource(dscFile string, verifier *Verifier, poolPath string) (*deb.Package, error)

ParseSource creates a *deb.Package from a .dsc file with proper directory path and checksums. It verifies the signature, parses the control file, and processes all referenced source files.

Types

type Release

type Release struct {
	Origin        string
	Label         string
	Suite         string
	Codename      string
	Date          time.Time
	Architectures []string
	Components    []string
	Description   string
	// Files maps relative paths to their checksums (following aptly's indexFiles.generatedFiles pattern)
	Files map[string]utils.ChecksumInfo
}

Release holds configuration for generating Release file

func ParseRelease

func ParseRelease(inReleaseFile string, verifier *Verifier) (*Release, error)

ParseRelease parses an InRelease file and extracts index metadata

type Repository

type Repository struct {
	// contains filtered or unexported fields
}

Repository manages packages organized by distribution and component

func NewRepository

func NewRepository() *Repository

NewRepository creates a new empty repository

func (*Repository) AddPackage

func (r *Repository) AddPackage(pkg *deb.Package, distribution string, component string) error

AddPackage adds a package to the repository. The package's architecture is managed internally by the PackageList. If component is empty, it defaults to "main".

func (*Repository) GetArchitectures

func (r *Repository) GetArchitectures(distribution, component string, includeSource bool) []string

GetArchitectures returns all architectures available for a given distribution and component. If includeSource is true, the "source" architecture will be included in the list even if no source packages exist (to support deb-src in apt sources). Following aptly's pattern, "all" architecture is always excluded from the list. Returns a sorted slice of architecture names.

func (*Repository) GetComponents

func (r *Repository) GetComponents(distribution string) []string

GetComponents returns all components available for a given distribution. Returns a sorted slice of component names.

func (*Repository) GetDistributions

func (r *Repository) GetDistributions() []string

GetDistributions returns all distributions in the repository. Returns a sorted slice of distribution names.

func (*Repository) GetLatest

func (r *Repository) GetLatest(packageName, distribution, arch string) *deb.Package

GetLatest returns the latest package by version for a specific distribution and architecture. For non-source architectures, falls back to "all" architecture if no arch-specific package exists. Returns nil if no such package exists.

func (*Repository) GetPackageList

func (r *Repository) GetPackageList(distribution, component string) *deb.PackageList

GetPackageList returns the complete package list for a specific distribution and component. Returns the full PackageList without any filtering. Callers should use aptly's Filter() method with appropriate PackageQuery to filter by architecture or other criteria. Returns nil if no packages exist for the given combination.

func (*Repository) GetPackageNames

func (r *Repository) GetPackageNames(component string) []string

GetPackageNamesForComponent returns unique package names that exist in the specified component across any distribution. Returns a sorted slice of package names.

func (*Repository) NumPackages

func (r *Repository) NumPackages() int

NumPackages returns the total number of packages across all distributions and components.

type Verifier

type Verifier struct {
	pgp.Verifier
	AcceptUnsigned   bool // Accept files without signatures
	IgnoreSignatures bool // Skip signature verification
}

Verifier wraps aptly's pgp.Verifier with configuration options

func (*Verifier) VerifyAndClear

func (v *Verifier) VerifyAndClear(file io.ReadSeeker) (io.ReadCloser, []pgp.Key, error)

VerifyAndClear verifies and extracts cleartext from a clearsigned file. The behavior depends on the verifier configuration: - If the input is not signed and AcceptUnsigned is false, it returns an error - If IgnoreSignatures is true, it extracts cleartext without verification - Otherwise, it verifies the signature before extracting cleartext

type VersionComponents

type VersionComponents struct {
	Epoch    string // Optional epoch (empty if not present)
	Upstream string // The upstream version
	Revision string // Optional Debian revision (empty if not present)
}

VersionComponents represents the parsed components of a Debian package version

func ParseVersion

func ParseVersion(version string) VersionComponents

ParseVersion parses a Debian package version string into its components. Debian version format: [epoch:]upstream-version[-debian-revision] The debian-revision is the portion after the last hyphen.

func (VersionComponents) String added in v0.0.4

func (v VersionComponents) String() string

String reconstructs the version string from its components

Jump to

Keyboard shortcuts

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