Help us shape the future of Go! Take the 2026 Go Developer Survey

apt

package
v1.27.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinaryPackage

type BinaryPackage struct {
	// mandatory
	Filename string
	Size     string

	// optional
	BinaryPackage  string
	MD5sum         string
	SHA1           string
	SHA256         string
	DescriptionMD5 string
	Depends        []string `delim:", " strip:"\n\r\t "`
	InstalledSize  string   `control:"Installed-Size"`
	Package        string
	Architecture   string
	Version        string
	Section        string
	Maintainer     string
	Homepage       string
	Description    string
	Tag            string
	Author         string
	Name           string
}

BinaryPackage represents all the entry of the Packages file

type Index

type Index struct {
	Type     string
	Binaries []BinaryPackage
}

Index contains the content of Packages files

func ParsePackageIndex

func ParsePackageIndex(r io.Reader, mtype string) (*Index, error)

ParsePackageIndex parses the Packages file (also if compressed)

type IndexHash

type IndexHash struct {
	Hash string
	Size int64
	Path string
}

IndexHash contains hash and size of a Packages file

func (*IndexHash) UnmarshalControl

func (i *IndexHash) UnmarshalControl(data string) error

UnmarshalControl tells how to unmarshal the control files

type Release

type Release struct {
	// Optional
	Description string `control:"Description"`
	Origin      string `control:"Origin"`
	Label       string `control:"Label"`
	Version     string `control:"Version"`
	Suite       string `control:"Suite"`
	Codename    string `control:"Codename"`

	Components    []string `control:"Components"`
	Architectures []string `control:"Architectures"`

	Date         string      `control:"Date"`
	ValidUntil   string      `control:"Valid-Until"`
	PackagePaths []string    `control:"-"`
	MD5Sum       []IndexHash `control:"MD5Sum" delim:"\n" strip:"\n\r\t "`
	SHA1         []IndexHash `control:"SHA1" delim:"\n" strip:"\n\r\t "`
	SHA256       []IndexHash `control:"SHA256" delim:"\n" strip:"\n\r\t "`
}

Release represents the Release file

func ParseRelease

func ParseRelease(r io.Reader) (*Release, error)

ParseRelease parses the Release file of a repository

type Repository

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

Repository is the object that represents an APT repository

func NewRepository

func NewRepository(ctx context.Context, root string, suite string, userAgent string) (*Repository, error)

NewRepository creates a new Repository object

func (*Repository) ForceIndexURL

func (r *Repository) ForceIndexURL(u string)

ForceIndexURL force the URL of the Packages file to parse bypassing the parsing of the Release

func (*Repository) GetArchitectures

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

GetArchitectures returns the architectures found in the Release file

func (*Repository) GetDistribution

func (r *Repository) GetDistribution() string

GetDistribution returns the distribution

func (*Repository) GetIndex

func (r *Repository) GetIndex() *Index

GetIndex returns the parsed Index object

func (*Repository) GetIndexURL

func (r *Repository) GetIndexURL() string

GetIndexURL returns the URL of the Packages file

func (*Repository) GetPackages

func (r *Repository) GetPackages() ([]BinaryPackage, error)

GetPackages returns the binary packages from the Packages file

func (*Repository) GetRelease

func (r *Repository) GetRelease() *Release

GetRelease returns the parsed Release object

func (*Repository) GetReleaseURL

func (r *Repository) GetReleaseURL() string

GetReleaseURL returns the URL of the Release file

func (*Repository) IsFlat

func (r *Repository) IsFlat() bool

IsFlat returns true is the repository is a flat repo

func (*Repository) ReloadPackages

func (r *Repository) ReloadPackages() error

ReloadPackages parses again the Packages file

func (*Repository) SetArchitecture

func (r *Repository) SetArchitecture(arch string) error

SetArchitecture sets the architecture to parse the corrispondent Packages file

Jump to

Keyboard shortcuts

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