apt

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2025 License: GPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDownServer       error = errors.New("server is shutdown or not avaible")
	ErrPackagesNotFound error = errors.New("packages not found")
)

Functions

This section is empty.

Types

type AptRelease

type AptRelease struct {
	Origin        string            `json:"origin"`
	Label         string            `json:"label"`
	Suite         string            `json:"suite"`
	Codename      string            `json:"codename,omitempty"`
	Date          time.Time         `json:"date,omitzero"`
	AcquireByHash bool              `json:"acquire-by-hash"`
	Archs         []string          `json:"architectures,omitempty"`
	Components    []string          `json:"components,omitempty"`
	Description   string            `json:"description,omitempty"`
	Extra         map[string]string `json:"extra,omitempty"`
	MD5           ReleaseSum        `json:"md5,omitempty"`
	SHA1          ReleaseSum        `json:"sha1,omitempty"`
	SHA256        ReleaseSum        `json:"sha256,omitempty"`
	SHA512        ReleaseSum        `json:"sha512,omitempty"`
}

Release file from dists/<Suite>/Release, dists/<Suite>/InRelease or dists/<Suite>/Release.gpg

type AptSource

type AptSource struct {
	Enabled    bool              `json:"enabled"`             // Repository is enabled
	Types      []string          `json:"source_type"`         // Files origem, example: deb, deb-src
	URIs       []*url.URL        `json:"uris"`                // Repository Root URL
	Suites     []string          `json:"suites"`              // Repository suite or dist name
	Components []string          `json:"components"`          // Repository Components
	SignedBy   string            `json:"signed_by,omitempty"` // GPG Key path
	Arch       string            `json:"arch,omitempty"`      // Arch to get Packages
	Extra      map[string]string `json:"extra"`               // Other options
}

APT repository source from sources.list(5) or deb822 file

func ParseDeb822

func ParseDeb822(r io.Reader) (sources []*AptSource, err error)

Return source list in deb822 file format

func ParseOneLine

func ParseOneLine(r io.Reader) (sources []*AptSource, err error)

Return source list from one line style

func ParseSourcelist

func ParseSourcelist(body string) (sources []*AptSource, err error)

Process Debian sources in one line or deb822 styles

func (AptSource) Release

func (apt AptSource) Release() (SuiteAptRelease, error)

Get *AptRelease from AptSource.Suites

type HttpError added in v0.0.2

type HttpError http.Response

Extends response error

func (HttpError) Error added in v0.0.2

func (errHttp HttpError) Error() string

type ReleaseSum

type ReleaseSum map[string][]Sum

ReleaseSum represents a mapping from a string key (such as a file name or section name) to a slice of Sum values, where each Sum contains checksum information for the corresponding entry. This is typically used to store and organize checksums for files listed in an APT Release file.

func SumLines

func SumLines(data string) (ReleaseSum, error)

SumLines parses a string containing multiple checksum lines (typically from a Debian Release file) and returns a ReleaseSum map containing the parsed sums. Each line is expected to contain a hash, a size, and a filename, separated by spaces. The function splits each line, extracts the hash, size, and file name, and appends the result to the ReleaseSum map keyed by the file name without its extension. Returns an error if any size value cannot be parsed as an integer.

type SuiteAptRelease

type SuiteAptRelease map[string]*AptRelease

type Sum

type Sum struct {
	File string
	Hash string
	Size int64
}

Files sum from Release

func (Sum) IsBinaryPackage

func (sum Sum) IsBinaryPackage() bool

func (Sum) Pkgs

func (sum Sum) Pkgs(SuiteName string, AptSrc *AptSource) iter.Seq2[*dpkg.Package, error]

Return packages from sum file

Jump to

Keyboard shortcuts

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