apt

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 24 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package apt is a client for Debian apt repositories that needs no apt installation: it refreshes package indexes, reads them, resolves dependencies and downloads packages with their integrity enforced.

Sources

ParseSourcesList and ParseSources822 turn the text of sources.list and deb822 .sources files into Source values; LoadSources reads them from a file and a directory the caller names. The package never looks at /etc/apt on its own: every path is an option.

Updating

Update fetches the Release of every source (InRelease, or Release with Release.gpg), verifies its signature with deb.Trust against the keyring named by the source's Signed-By option or UpdateOptions.DefaultKeyrings, rejects an expired Release, then downloads the Packages index of each component and architecture, checking its size and SHA-256 against the verified Release. The indexes land in UpdateOptions.ListsDir under apt's own file names, so that apt itself can read them too. A signature that is present and wrong is always an error; a missing trust anchor, an unknown signer or an unsigned repository is accepted only with UpdateOptions.AllowUnverified.

Reading

Load builds a Cache from a lists directory, and optionally a dpkg status file, whose path the caller gives. A Cache keeps every version of every package the indexes carry, per name and architecture, and the versions the status file says are installed. Lookup answers with the highest version, Versions with all of them.

ResolveDeps works out what installing some packages would add, after apt's rules: version constraints (<<, <=, =, >=, >>) are honoured with deb.CompareVersions; alternatives are tried in order, an installed or already selected one first; a virtual package is met by its providers, a versioned dependency only by a versioned Provides; Pre-Depends count as Depends; a package that Conflicts with or Breaks an installed or selected one, or the other way round, is refused with a ConflictError; and Multi-Arch foreign, allowed and same decide which architecture meets a dependency, with "name:any", "name:native" and "name:arch" as apt reads them. An installed package whose version a dependency finds too old is upgraded if the indexes carry a newer one, else the dependency is unsatisfiable. The result is deterministic. Where it differs from apt (it never removes an installed package, and does not model pins) is listed on ResolveDeps.

Downloading

Cache.Download and Cache.DownloadClosure fetch .deb files into a directory. Each file is checked against the SHA-256 and size of the index while it is written, and a file that fails is not left behind. The result is a normal .deb for deb.ParseDebFileAt.

Transfers use the httpclient and download packages: size caps, retry with backoff, and a single retry over https when a plain http fetch fails transiently.

Index

Examples

Constants

View Source
const MaxDebBytes int64 = 2 << 30

MaxDebBytes caps one .deb download. Real packages top out around 500 MB; 2 GiB leaves room while still stopping an unbounded mirror stream.

View Source
const MaxSourcesFileBytes = 1 << 20

MaxSourcesFileBytes caps one sources.list or deb822 .sources file read by LoadSources.

Variables

View Source
var (
	// ErrTooLarge reports input over a size limit.
	ErrTooLarge = errors.New("apt: input too large")
	// ErrIntegrity reports a downloaded file whose size or digest differs from
	// what the verified Release or the package index declared.
	ErrIntegrity = errors.New("apt: integrity check failed")
	// ErrNoPackagesIndex reports a component and architecture that the Release
	// does not list. apt treats that as nothing to fetch.
	ErrNoPackagesIndex = errors.New("apt: no Packages index listed")
	// ErrNoSources reports an update without any source.
	ErrNoSources = errors.New("apt: no sources configured")
	// ErrNoListsDir reports an update without a lists directory.
	ErrNoListsDir = errors.New("apt: no lists directory given")
	// ErrPackageNotFound reports a package that is not in the index, or has no
	// downloadable file.
	ErrPackageNotFound = errors.New("apt: package not found in index")
	// ErrNoBaseURL reports an indexed package whose repository URL is unknown,
	// so it cannot be downloaded.
	ErrNoBaseURL = errors.New("apt: package has no repository URL")
	// ErrInvalidIndexEntry reports an index entry that cannot be downloaded
	// safely: a malformed SHA256, an out-of-range Size, or an unsafe Filename.
	ErrInvalidIndexEntry = errors.New("apt: invalid package index entry")
	// ErrDependencyDepth is returned by ResolveDeps for a dependency chain
	// deeper than maxResolveDepth, which only a hostile or corrupt index
	// produces.
	ErrDependencyDepth = errors.New("apt: dependency chain too deep")
	// ErrResolveLimit is returned by ResolveDeps when backtracking over
	// alternatives and versions exceeds its step budget, which only a hostile
	// or corrupt index produces.
	ErrResolveLimit = errors.New("apt: dependency resolution exceeded its step limit")
	// ErrUnsatisfiable is matched by an [UnsatisfiedError]: a dependency no
	// available package satisfies.
	ErrUnsatisfiable = errors.New("apt: unsatisfiable dependency")
	// ErrConflict is matched by a [ConflictError]: a package that conflicts
	// with, or breaks, an installed or selected one.
	ErrConflict = errors.New("apt: conflicting packages")
)

Functions

func ArchFromGoarch

func ArchFromGoarch(goarch string) string

ArchFromGoarch maps a runtime.GOARCH value to the Debian architecture name.

func BaseURLs

func BaseURLs(sources []Source) map[string]string

BaseURLs maps the encoded host-and-path prefix of apt's list file names to the URL of the source. Of several sources with the same prefix the last wins.

func IsVerificationError

func IsVerificationError(err error) bool

IsVerificationError reports whether err is solely a signature verification failure (unknown signer or no trust anchor) and not a network or I/O error. A caller that already fetched enough indexes can downgrade such an error to a warning.

For the UpdateError that Update returns, "solely" means every failure in it is one: a network error next to a trust error is not downgraded.

func ListFileName

func ListFileName(baseURL, suite, relPath string) string

ListFileName returns the name apt stores relPath of a repository under: ("https://archive.ubuntu.com/ubuntu/", "jammy", "main/binary-amd64/Packages.xz") gives "archive.ubuntu.com_ubuntu_dists_jammy_main_binary-amd64_Packages.xz". It returns "" for a URL that does not parse.

func LoadKeyring

func LoadKeyring(signedBy string, defaults []string) (*gpg.Keyring, error)

LoadKeyring returns the trust anchor of a source.

With a signedBy path (the Signed-By option) it loads exactly that keyring file or directory of keyrings. A path that is missing, or that holds no key, is an error that wraps deb.ErrNoTrustAnchor.

Without one it takes the union of every usable key found in defaults, which are keyring files or directories such as /etc/apt/trusted.gpg.d, in the same way apt trusts them. Paths that do not exist or cannot be parsed are skipped, as apt does; no key at all is deb.ErrNoTrustAnchor.

func Update

func Update(ctx context.Context, sources []Source, opts UpdateOptions) (int, error)

Update fetches the binary Packages index of every component and architecture of every source, verifies the Release signature and every index's size and SHA-256 against it, and writes the indexes to opts.ListsDir.

Sources whose Release does not list an index for a component and architecture are skipped silently, as apt does. It returns how many (source, component, architecture) indexes are now in place, whether fetched or already current, and an *UpdateError holding everything that failed: a partial failure still reports the successes. Use IsVerificationError to tell trust failures from network ones.

Types

type Cache

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

Cache is an in-memory index of package metadata, merged from apt package indexes and the dpkg status database. Every version of a package that any index carries is kept, grouped by name and architecture. It is safe for concurrent use.

func Load

func Load(opts LoadOptions) (*Cache, error)

Load reads the apt indexes of opts.ListsDir, then the dpkg status database of opts.StatusFile.

Every version of a package that an index carries is kept. A stanza without Version, or whose relation fields do not parse, is skipped.

Like apt itself, Load tolerates what it cannot read: a missing directory, an unreadable or corrupt index. The returned Cache is never nil and holds everything that did load; the error, when not nil, joins one error per file that did not, so a caller can warn about them.

func NewCache

func NewCache(hostArch string) *Cache

NewCache returns an empty cache. hostArch is the architecture packages are looked up for when a name carries no qualifier; empty selects the one of the running program.

func (*Cache) AddEntry

func (c *Cache) AddEntry(info *PackageInfo)

AddEntry adds a version of a package. An entry with the same name, architecture and version replaces the old one; another version is kept next to the others. Use it to set a cache up by hand, before it is shared.

func (*Cache) CapabilityCount

func (c *Cache) CapabilityCount() int

CapabilityCount is the number of virtual package names (Provides) known.

func (*Cache) Download

func (c *Cache) Download(ctx context.Context, destDir string, pkgs []string, opts DownloadOptions) error

Download fetches the named packages into destDir, each as the base name of its index Filename. A name may carry an architecture qualifier and a version constraint ("gcc-11:arm64 (= 11.3.0-1)"); the highest version that meets it is fetched, the highest of all without one. The size and SHA-256 of the index are enforced while the file is written, and a file that fails the check is not left behind.

Every package is resolved and validated before any transfer starts, so an unknown package, a package without a repository URL, or a malformed index entry (missing or invalid SHA256, Size out of range, unsafe Filename) fails the call at once. Transfers then run to completion; the error of the first failing package, in argument order, is returned.

A plain-http transfer that fails with a transient error is retried once over https.

func (*Cache) DownloadClosure

func (c *Cache) DownloadClosure(
	ctx context.Context, destDir string, seeds []string, opts DownloadOptions,
) (resolved []*PackageInfo, unresolved []string, err error)

DownloadClosure resolves the transitive closure of the seed names with ResolveDeps, downloads every resulting .deb into destDir, and returns the resolved packages in dependency order (dependencies first) and the names that could not be resolved.

Installed packages are skipped, and so are their dependencies: as with apt, an installed package is taken to have its own met. A dependency an installed package would meet only for another architecture (a cross build reading the dependencies of a foreign library) is still resolved, since the installed one does not satisfy it.

func (*Cache) HostArch

func (c *Cache) HostArch() string

HostArch is the architecture unqualified names resolve to.

func (*Cache) InstalledNames

func (c *Cache) InstalledNames() map[string]bool

InstalledNames returns the names, without architecture qualifier, of the packages the dpkg status database reports as installed. A name counts when at least one architecture of it is installed.

Cross-build extractors use it to avoid overlaying a foreign-architecture payload on host binaries whose path is shared between architectures (/usr/bin/sudo is one file, and may be in use).

func (*Cache) Lookup

func (c *Cache) Lookup(name string) (PackageInfo, bool)

Lookup returns the highest installable version of the named package. The name may carry an architecture qualifier ("gcc-11:arm64"). Without one, or when the qualified package is missing, it tries the bare name (architecture all), the host architecture, then any architecture. A package that is only installed, with no index version, is returned too, with HasCandidate false.

func (*Cache) PackageCount

func (c *Cache) PackageCount() int

PackageCount is the number of packages in the cache, counting a name on two architectures twice and every version of one once.

func (*Cache) ResolveDeps

func (c *Cache) ResolveDeps(seeds []string) ([]*PackageInfo, []string, error)

ResolveDeps resolves what installing seeds would add. It returns the packages to download, dependencies before dependents (Pre-Depends and Depends alike, in the order they are written), and the names that neither a package nor a Provides of the index covers.

A seed is a dependency in control-file syntax: "foo", "foo:arm64", "foo (>= 1.2)", "a | b"; one seed string may hold several, comma separated. A malformed one fails with an error wrapping deb.ErrInvalidControlFormat. A seed also asks for the newest version, as apt-get install does: an installed package with a newer version in the index is listed again, to be upgraded. A seed qualified with an architecture that has no such package falls back to the host architecture, then to any.

The resolution follows apt, over every version the indexes carry:

  • A dependency is met by an installed or already selected package first, in the order of its alternatives; only then is a package chosen, the first alternative that can be installed, and of it the highest version that satisfies the constraint ("<<", "<=", "=", ">=", ">>"). Versions older than the installed one are not offered, and an installed package is upgraded only when a dependency needs it.
  • A virtual package is met by a package that Provides it. A versioned dependency is met only by a versioned Provides ("foo (= 1.2)"), never by a bare one (Debian Policy 7.5). Among providers the higher Priority wins, then the one read last from the indexes, as apt does.
  • A package that Conflicts with or Breaks an installed or selected one, or the other way round, is refused and the next candidate is tried; when none is left the error is a *ConflictError inside an *UnsatisfiedError. Unlike apt, installed packages are never removed.
  • Multi-Arch: a dependency of an architecture A package is met by an A or all package, or by a Multi-Arch: foreign package of any architecture (the host's is preferred); "name:any" only by Multi-Arch: allowed; "name:native" by the host architecture; "name:arch" by that one. Dependencies are read for the architecture of the package that declares them.

Differences from apt-get install --no-install-recommends, on purpose:

  • apt looks only at the candidate (the highest version), so a constraint it fails ("foo (<< 3)" with 3 available) is unsatisfiable to it; here the highest version that does satisfy it is taken.
  • apt resolves a clash with an installed package by removing it, and a Breaks by upgrading or removing the broken one. Here the candidate is refused and the next one tried, and the clash is an error when none is left; nothing is ever removed or upgraded to make room.
  • Pin priorities and apt's pkgProblemResolver scoring are not modelled, nor is the ordering of configuration (Pre-Depends loops).

A dependency that no candidate satisfies fails with an *UnsatisfiedError (ErrUnsatisfiable); an installed package a new version would break counts as one too. A name the index does not know at all is not an error: it is listed in the second result. The result is deterministic. A chain deeper than a few thousand packages fails with ErrDependencyDepth, and a hostile index that makes backtracking explode with ErrResolveLimit.

Example
package main

import (
	"fmt"

	"github.com/M0Rf30/pkgformat/deb"
	"github.com/M0Rf30/pkgformat/deb/apt"
)

func main() {
	c := apt.NewCache("amd64")

	depends, err := deb.ParseRelations("libfoo (>= 2.0), mta | postfix, unknown-tool")
	if err != nil {
		fmt.Println(err)

		return
	}

	for _, p := range []*apt.PackageInfo{
		{Name: "app", Architecture: "amd64", HasCandidate: true, Version: "1.0",
			Filename: "pool/main/a/app/app_1.0_amd64.deb", Depends: depends},
		{Name: "libfoo", Architecture: "amd64", HasCandidate: true, Version: "1.9",
			Filename: "pool/main/libf/libfoo/libfoo_1.9_amd64.deb"},
		{Name: "libfoo", Architecture: "amd64", HasCandidate: true, Version: "2.1",
			Filename: "pool/main/libf/libfoo/libfoo_2.1_amd64.deb"},
		{Name: "exim4", Architecture: "amd64", HasCandidate: true, Version: "4.96",
			Filename: "pool/main/e/exim4/exim4_4.96_amd64.deb",
			Provides: []deb.Relation{{Name: "mta"}}},
	} {
		c.AddEntry(p)
	}

	order, unresolved, err := c.ResolveDeps([]string{"app"})
	if err != nil {
		fmt.Println(err)

		return
	}

	for _, p := range order {
		fmt.Println(p.Name, p.Version)
	}

	fmt.Println("unresolved:", unresolved)
}
Output:
libfoo 2.1
exim4 4.96
app 1.0
unresolved: [unknown-tool]

func (*Cache) ResolveVirtual

func (c *Cache) ResolveVirtual(name string) string

ResolveVirtual returns the name of the concrete package ResolveDeps prefers for a virtual package (the highest priority, then the provider read last), or name itself when it is a real package (it has a candidate) or unknown.

func (*Cache) Versions added in v0.3.1

func (c *Cache) Versions(name string) []PackageInfo

Versions returns every known version of the named package, the highest first, from the first architecture Lookup would find it under.

type ConflictError added in v0.3.1

type ConflictError struct {
	// Package is the package that was refused ("name:arch version").
	Package string
	// With is the package it clashes with.
	With string
	// WithInstalled is true when With is installed, false when it was selected
	// earlier in the same resolution.
	WithInstalled bool
	// Kind is "Conflicts" or "Breaks".
	Kind string
	// Relation is the relation as written in the declaring package.
	Relation string
	// Reverse is true when With declares the relation and Package is the
	// target; false when Package declares it.
	Reverse bool
}

ConflictError reports a package that cannot be installed because it conflicts with, or breaks, a package that is installed or already selected, or the other way round. It matches ErrConflict.

func (*ConflictError) Error added in v0.3.1

func (e *ConflictError) Error() string

Error names both packages and the relation.

func (*ConflictError) Is added in v0.3.1

func (e *ConflictError) Is(target error) bool

Is matches ErrConflict.

type DownloadOptions

type DownloadOptions struct {
	// Client performs the transfers. Nil builds one without an overall timeout,
	// which would abort a large package on a slow link.
	Client *httpclient.Client
	// Concurrency caps the parallel transfers. Zero selects 6.
	Concurrency int
	// Progress, when set, is called after each chunk of a package with its
	// file name, the bytes on disk and the expected size. It must be safe for
	// concurrent use.
	Progress func(name string, done, total int64)
}

DownloadOptions configures Download and DownloadClosure. The zero value is valid.

type LoadOptions

type LoadOptions struct {
	// ListsDir is the directory holding the downloaded Packages indexes, named
	// the way apt names them ("<host>_<path>_dists_<suite>_<comp>_binary-<arch>_Packages[.ext]").
	// Empty loads no index.
	ListsDir string
	// StatusFile is the dpkg status database to overlay, to set Installed. Empty
	// skips it.
	StatusFile string
	// Sources resolve the BaseURL of every index: an index file named after a
	// source's host and path takes that source's URL.
	Sources []Source
	// HostArch is the architecture unqualified names resolve to. Empty selects
	// the one of the running program.
	HostArch string
	// Logger receives one debug record per file loaded and one per stanza that
	// is skipped. Nil is silent.
	Logger *slog.Logger
}

LoadOptions says where a Cache is read from. Every field is optional.

type PackageInfo

type PackageInfo struct {
	// Name is the package name ("gcc", "libssl-dev").
	Name string
	// Architecture is the Architecture field ("amd64", "all", "arm64").
	Architecture string
	// Essential is true for "Essential: yes".
	Essential bool
	// MultiArch is the Multi-Arch field ("same", "foreign", "allowed" or "").
	MultiArch string
	// Priority is the Priority field ("required", "optional", ...). It orders
	// the candidates of a virtual package.
	Priority string
	// Installed is true when the dpkg status database reports this version as
	// installed (see [deb.Status.Installed]).
	Installed bool
	// HasCandidate is true when this version is in an apt index, that is, it
	// can be downloaded. An installed version that no index carries any more
	// has none.
	HasCandidate bool
	// Filename is the path of the .deb relative to the repository base URL
	// ("pool/main/g/gcc/gcc_12.2.0-14_amd64.deb").
	Filename string
	// SHA256 is the expected SHA-256 of the .deb, hex encoded.
	SHA256 string
	// Size is the expected size of the .deb in bytes.
	Size int64
	// BaseURL is the repository URL Filename is relative to, such as
	// "https://ports.ubuntu.com/ubuntu-ports/". Empty for packages that only
	// come from the dpkg status database, which cannot be downloaded.
	BaseURL string
	// Depends is the Depends field, one [deb.Alternatives] per entry.
	Depends []deb.Alternatives
	// PreDepends is the same for Pre-Depends. Resolution treats both alike.
	PreDepends []deb.Alternatives
	// Conflicts is the Conflicts field.
	Conflicts []deb.Relation
	// Breaks is the Breaks field.
	Breaks []deb.Relation
	// Provides is the Provides field: the virtual packages, with the version
	// of a versioned one ("foo (= 1.2)").
	Provides []deb.Relation
	// Version is the Version field.
	Version string
}

PackageInfo is the subset of a package's control fields that dependency resolution and downloading need. One value describes one version of one package on one architecture.

func (PackageInfo) ArchitectureAll

func (p PackageInfo) ArchitectureAll() bool

ArchitectureAll reports whether the package is architecture-independent.

func (PackageInfo) MultiArchForeign

func (p PackageInfo) MultiArchForeign() bool

MultiArchForeign reports whether one copy of the package on the host is meant to serve every architecture (Multi-Arch: foreign or allowed): tools and daemons that run on the build host, which must not be qualified with a target architecture during cross-compilation. Multi-Arch: same, the -dev libraries, is deliberately excluded. The resolver itself follows apt more closely: only "foreign" satisfies a dependency from another architecture, and only "allowed" satisfies one written "name:any".

func (PackageInfo) MultiArchSame

func (p PackageInfo) MultiArchSame() bool

MultiArchSame reports whether the package must be installed once per architecture (Multi-Arch: same).

type Source

type Source struct {
	// URL is the repository base URL with a trailing slash
	// ("https://archive.ubuntu.com/ubuntu/").
	URL string
	// Suite is the distribution ("jammy", "bookworm-updates").
	Suite string
	// Components lists the archive areas ("main", "universe").
	Components []string
	// Architectures restricts the source to these architectures. Empty means
	// the default architecture.
	Architectures []string
	// SignedBy is the Signed-By option: a path to a keyring file or directory,
	// or "".
	SignedBy string
}

Source is one apt repository: a base URL, a suite and its components.

func LoadSources

func LoadSources(listFile, listDir string) ([]Source, error)

LoadSources reads the configured sources. listFile is a sources.list style file and listDir a directory of *.list (one-line) and *.sources (deb822) files, read in name order. Either may be empty, and either may be missing: apt tolerates that, and so does LoadSources. A file that exists but cannot be read, or is larger than MaxSourcesFileBytes, is skipped and reported in the returned error, next to the sources that did load.

func ParseSources822

func ParseSources822(content string) []Source

ParseSources822 parses the deb822 format of *.sources files. A paragraph yields one Source per URI and suite. Paragraphs that do not declare the binary "deb" type, that are disabled (Enabled: no), or that lack URIs, Suites or Components are skipped, as are non-http(s) URIs.

func ParseSourcesList

func ParseSourcesList(content string) []Source

ParseSourcesList parses the one-line format of /etc/apt/sources.list and *.list files:

deb [arch=amd64 signed-by=/path] https://archive.ubuntu.com/ubuntu/ jammy main universe

Comments, deb-src lines, non-http(s) URLs, and lines without a suite and a component are skipped.

Example
package main

import (
	"fmt"

	"github.com/M0Rf30/pkgformat/deb/apt"
)

func main() {
	sources := apt.ParseSourcesList(`
# main archive
deb [arch=amd64] https://deb.debian.org/debian bookworm main contrib
deb-src https://deb.debian.org/debian bookworm main
`)

	for _, s := range sources {
		fmt.Println(s.URL, s.Suite, s.Components, s.Architectures)
	}
}
Output:
https://deb.debian.org/debian/ bookworm [main contrib] [amd64]

type UnsatisfiedError added in v0.3.1

type UnsatisfiedError struct {
	// Package is the package whose dependency it is ("name:arch version"), or
	// "" for a name given to ResolveDeps.
	Package string
	// Dependency is the dependency as written ("foo (>= 2) | bar").
	Dependency string
	// Reason says why nothing satisfied it when no candidate was tried.
	Reason string
	// Causes are the errors of the candidates that were tried, in order.
	Causes []error
}

UnsatisfiedError reports a dependency that no available package satisfies: no version of the name meets the constraint, or every candidate was refused (see Causes). It matches ErrUnsatisfiable.

func (*UnsatisfiedError) Error added in v0.3.1

func (e *UnsatisfiedError) Error() string

Error describes the dependency and, when there are any, the reasons.

func (*UnsatisfiedError) Is added in v0.3.1

func (e *UnsatisfiedError) Is(target error) bool

Is matches ErrUnsatisfiable.

func (*UnsatisfiedError) Unwrap added in v0.3.1

func (e *UnsatisfiedError) Unwrap() []error

Unwrap exposes the candidate failures to errors.Is and errors.As.

type UpdateError

type UpdateError struct {
	Errors []error
}

UpdateError is the error Update returns when sources fail: one error for each (source, architecture) or component that did not update. The indexes that did update are in place regardless.

func (*UpdateError) Error

func (e *UpdateError) Error() string

Error lists the failures, one per line.

func (*UpdateError) Unwrap

func (e *UpdateError) Unwrap() []error

Unwrap exposes the failures to errors.Is and errors.As.

type UpdateOptions

type UpdateOptions struct {
	// ListsDir is the directory the Packages indexes are written to, under the
	// names apt gives them. Update creates it. A Cache reads it back through
	// LoadOptions.ListsDir.
	ListsDir string
	// DefaultArch is the architecture of sources that name none. Empty selects
	// the one of the running program.
	DefaultArch string
	// DefaultKeyrings are the keyring files and directories that trust sources
	// without a Signed-By option (/etc/apt/trusted.gpg.d, /usr/share/keyrings,
	// /etc/apt/keyrings, /etc/apt/trusted.gpg on a Debian host). See LoadKeyring.
	DefaultKeyrings []string
	// AllowUnverified accepts a repository for which no trust anchor exists, a
	// Release signed by an unknown key, or one without a signature. A signature
	// that is present and does not verify is rejected regardless.
	AllowUnverified bool
	// Client performs the transfers. Nil builds one with the default policy.
	Client *httpclient.Client
	// Concurrency caps the (source, architecture) pairs updated at once. Zero
	// selects min(2*GOMAXPROCS, 8).
	Concurrency int
	// Now is the clock the Valid-Until check of a Release uses. Nil is
	// time.Now.
	Now func() time.Time
	// Logger receives progress and warnings. Nil is silent.
	Logger *slog.Logger
}

UpdateOptions configures Update. Only ListsDir is required.

Jump to

Keyboard shortcuts

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