Documentation
¶
Index ¶
- Constants
- Variables
- func GeneratePackageIndex(w io.Writer, list *deb.PackageList, isSource bool) error
- func GenerateRelease(w io.Writer, config Release) error
- func GetPoolPath(component, packageName string) string
- func GetSourceNameFromPackage(pkg *deb.Package) string
- func IsDebugByName(input string) bool
- func IsDebugPackage(pkg *deb.Package) bool
- func IsDebugPackageByFilename(filename string) bool
- func ModifyPackageStanza(pkg **deb.Package, key, value string) error
- func ParseBinary(debFile string, poolPath string) (*deb.Package, error)
- func ParseChanges(changesFile string, verifier *Verifier) (*deb.Changes, error)
- func ParsePackageIndex(path string, isSource bool) ([]*deb.Package, error)
- func ParseSource(dscFile string, verifier *Verifier, poolPath string) (*deb.Package, error)
- type Release
- type Repository
- func (r *Repository) AddPackage(pkg *deb.Package, distribution string, component string) error
- func (r *Repository) GetArchitectures(distribution, component string, includeSource bool) []string
- func (r *Repository) GetComponents(distribution string) []string
- func (r *Repository) GetDistributions() []string
- func (r *Repository) GetLatest(packageName, distribution, arch string) *deb.Package
- func (r *Repository) GetPackageList(distribution, component string) *deb.PackageList
- func (r *Repository) GetPackageNames(component string) []string
- func (r *Repository) NumPackages() int
- type Verifier
- type VersionComponents
Constants ¶
const ( DebugPackageSuffix = "-dbgsym" DebugPackageSection = "debug" )
const ( AllArchitecture = "all" SourceArchitecture = "source" )
Variables ¶
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 ¶
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 ¶
GenerateRelease creates a Release file using aptly's Stanza formatting and writes to w.
func GetPoolPath ¶
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 ¶
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 ¶
IsDebugByName determines if a package a debug package by its name. Try to use IsDebugPackage instead where possible.
func IsDebugPackage ¶
IsDebugPackage determines if a package is a debug package.
func IsDebugPackageByFilename ¶
IsDebugPackageByFilename determines if a package is a debug package by its filename. Try to use IsDebugPackage instead where possible.
func ModifyPackageStanza ¶
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 ¶
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 ¶
ParseChanges parses a .changes file
func ParsePackageIndex ¶
ParsePackageIndex parses a Packages or Sources index file and returns packages
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
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository manages packages organized by distribution and component
func (*Repository) AddPackage ¶
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