Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidARMagic = errors.New("invalid AR archive magic") ErrInvalidHeaderSize = errors.New("invalid header size") ErrInvalidModTime = errors.New("invalid modification time") ErrInvalidOwnerID = errors.New("invalid owner ID") ErrInvalidGroupID = errors.New("invalid group ID") ErrInvalidMode = errors.New("invalid mode") ErrInvalidSize = errors.New("invalid size") ErrARMemberTooLarge = errors.New("AR member size exceeds maximum allowed") ErrInvalidARHeaderEnd = errors.New("invalid AR header ending marker") )
Sentinel errors for AR archive parsing.
var ( ErrInvalidControlFormat = errors.New("invalid control file format") ErrMissingRequiredField = errors.New("required field not found in control file") )
Sentinel errors for control file parsing.
var ( ErrEmptyDependency = errors.New("empty dependency string") ErrInvalidVersionFormat = errors.New("invalid version constraint") ErrInvalidVersionOp = errors.New("invalid version operator") )
Sentinel errors for dependency parsing.
var ( ErrControlArchiveNotFound = errors.New("control archive not found in deb file (tried .gz, .xz, .zst)") ErrUnsupportedArchiveFormat = errors.New("unsupported control archive format") ErrFileNotFoundInTar = errors.New("file not found in tar archive") ErrControlArchiveTooLarge = errors.New("control archive exceeds max decompressed size") ErrDebFileTooLarge = errors.New("deb file exceeds max size") ErrControlFileTooLarge = errors.New("control file exceeds max size") )
Sentinel errors for deb file parsing.
Functions ¶
This section is empty.
Types ¶
type ARArchive ¶
type ARArchive struct {
Members []*ARMember
}
ARArchive represents a Debian .deb file (which is an AR archive).
func ReadARArchive ¶
ReadARArchive reads and parses an AR archive. maxMemberSize bounds the declared size of any single member (guarding against a corrupt or malicious header causing an unbounded or negative allocation); pass <= 0 to fall back to maxARMemberSize. Callers that already hold the full input in memory should pass its length so a member can never be declared larger than the remaining stream.
func (*ARArchive) GetMemberData ¶
GetMemberData retrieves member data by name.
func (*ARArchive) GetMemberReader ¶
GetMemberReader returns an io.Reader for a member.
func (*ARArchive) ListMembers ¶
ListMembers returns a list of member names.
type ControlFile ¶
ControlFile represents a Debian control file (RFC 822 format).
func ParseControlFile ¶
func ParseControlFile(r io.Reader) (*ControlFile, error)
ParseControlFile parses a Debian control file in RFC 822 format Control files use field: value format with continuation lines starting with space.
func (*ControlFile) Get ¶
func (cf *ControlFile) Get(field string) string
Get retrieves a field value.
func (*ControlFile) GetRequired ¶
func (cf *ControlFile) GetRequired(field string) (string, error)
GetRequired retrieves a required field value.
func (*ControlFile) ParsePackage ¶
func (cf *ControlFile) ParsePackage() (*Package, error)
ParsePackage extracts package metadata from a control file.
type DebFile ¶
type DebFile struct {
Package *Package
ControlFile *ControlFile
Archive *ARArchive
DataTarGz []byte
ControlTarGz []byte
}
DebFile represents a parsed .deb file.
func ParseDebFile ¶
ParseDebFile parses a .deb file and extracts metadata.
func (*DebFile) GetMetadata ¶
GetMetadata returns package metadata as a map.
type Dependency ¶
type Dependency struct {
Package string
Version string
Operator string // "", "<<", "<=", "=", ">=", ">>"
Arch string // optional architecture qualifier
Optional bool // true for Recommends/Suggests
Conflicts bool // true for Conflicts/Breaks
}
Dependency represents a single package dependency.
func (*Dependency) IsSatisfied ¶
func (d *Dependency) IsSatisfied(version string) bool
IsSatisfied checks if a dependency is satisfied by a given package version.
func (*Dependency) String ¶
func (d *Dependency) String() string
String returns the string representation of a dependency.
type DependencyGroup ¶
type DependencyGroup struct {
Dependencies []*Dependency
}
DependencyGroup represents a group of alternative dependencies (OR).
func (*DependencyGroup) String ¶
func (dg *DependencyGroup) String() string
String returns the string representation of a dependency group.
type DependencyList ¶
type DependencyList struct {
Groups []*DependencyGroup
}
DependencyList represents a list of dependency groups (AND).
func ParseDependencies ¶
func ParseDependencies(depStr string) (*DependencyList, error)
ParseDependencies parses a Debian dependency string Format: pkg1 (>= 1.0) | pkg2, pkg3 (= 2.0) Commas separate AND groups, pipes separate OR alternatives.
func (*DependencyList) GetPackages ¶
func (dl *DependencyList) GetPackages() []string
GetPackages returns a list of all package names in the dependency list.
func (*DependencyList) String ¶
func (dl *DependencyList) String() string
String returns the string representation of a dependency list.
type Package ¶
type Package struct {
Package string
Version string
Architecture string
Maintainer string
Description string
Depends string
PreDepends string
Recommends string
Suggests string
Conflicts string
Breaks string
Replaces string
Provides string
Section string
Priority string
Homepage string
Size int64
InstalledSize int64
MD5sum string
SHA1 string
SHA256 string
Filename string
Source string
SourceVersion string
Essential bool
MultiArch string
BuiltUsing string
Custom map[string]string
}
Package represents a Debian package metadata.