Documentation
¶
Index ¶
Constants ¶
const (
DPKG_DATABASE = "/var/lib/dpkg/status"
)
Variables ¶
var ( ErrDebHeader = errors.New("go-apt/dpkg: invalid debian package (ar magic header not matched)") ErrNoControlFile = errors.New("go-apt/dpkg: failed to find control.tar file") ErrNoDpkgStatusFile = errors.New("go-apt/dpkg: failed to read " + DPKG_DATABASE + " file") ErrNoFilenameAvailable = errors.New("go-apt/dpkg: no Filename available for this package") )
Functions ¶
This section is empty.
Types ¶
type DebPackage ¶
DebPackage represents the metadata of a Debian package https://salsa.debian.org/dpkg-team/dpkg/-/blob/main/lib/dpkg/parse.c?ref_type=heads#L53
func (*DebPackage) CalcSize ¶
func (dp *DebPackage) CalcSize()
CalcSize calculates the size of the package file
func (*DebPackage) CalculateAllHashes ¶
func (dp *DebPackage) CalculateAllHashes() error
CalculateAllHashes calculates the MD5, SHA1, and SHA256 hashes of the package content
func (*DebPackage) HasFilename ¶
func (dp *DebPackage) HasFilename() bool
HasFilename checks if the DebPackage has a filename
func (*DebPackage) MD5sum ¶
func (dp *DebPackage) MD5sum() string
MD5sum returns the MD5 hash of the package content
func (*DebPackage) SHA1sum ¶
func (dp *DebPackage) SHA1sum() string
SHA1sum returns the SHA1 hash of the package content
func (*DebPackage) SHA256sum ¶
func (dp *DebPackage) SHA256sum() string
SHA256sum returns the SHA256 hash of the package content
func (*DebPackage) ShortDescription ¶
func (dp *DebPackage) ShortDescription() string
ShortDescription returns the short description of the package
type Dpkg ¶
type Dpkg struct {
StatusFileLocation string
}
Dpkg represents a Debian package manager
func (*Dpkg) CompareVersions ¶
CompareVersions compares Debian package versions based on https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-version
func (*Dpkg) Info ¶
func (d *Dpkg) Info(debFile string) (*DebPackage, error)
Info retrieves the metadata of a Debian package
func (*Dpkg) IsDebFile ¶
IsDebFile checks if the file is a valid .deb package https://manpages.debian.org/buster/dpkg-dev/deb.5.en.html#FORMAT
func (*Dpkg) List ¶
func (d *Dpkg) List() ([]DebPackage, error)
List lists packages from the default dpkg database
type PackagesScanner ¶
type PackagesScanner struct {
RootDir string
Arch string
Type string
Hashes []HASH
Multiversion bool
}
PackagesScanner represents a scanner for Debian packages
func NewPackagesScanner ¶
func NewPackagesScanner(dir string) *PackagesScanner
NewPackagesScanner creates a new instance of PackagesScanner
func (*PackagesScanner) ScanPackages ¶
func (ps *PackagesScanner) ScanPackages() ([]byte, error)
ScanPackages scans the directory for packages matching the criteria