Documentation
¶
Overview ¶
Package updatepackages is the updates behavior: the updates that the package index has for the host.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Behavior = behavior.Register(behavior.Define( "updates", "The updates the package index has for the host", behavior.Title("Package updates"), behavior.Node, behavior.Under(packages.Behavior), behavior.API, behavior.Area(area.Software), behavior.CLI, behavior.Platform(behavior.PlatformDebian, newDebian), behavior.Read("list", List). NotAFact("the updates are what the repositories of the package index have, not a fact of the host"). Runs("apt"). Describe("List the packages the index has newer versions of"). Explain("Runs apt list --upgradable: each package with its installed "+ "version and the version the index has. Refresh the index first for "+ "what the repositories have now."). Example("Two updates", ListInput{}, []Available{ {Name: "curl", CurrentVersion: "8.5.0-2ubuntu10", NewVersion: "8.5.0-2ubuntu10.1"}, {Name: "openssl", CurrentVersion: "3.0.13-0ubuntu3", NewVersion: "3.0.13-0ubuntu3.1"}, }, behavior.Prints("apt list --upgradable", "Listing...\n"+ "curl/noble-updates 8.5.0-2ubuntu10.1 amd64 [upgradable from: 8.5.0-2ubuntu10]\n"+ "openssl/noble-updates 3.0.13-0ubuntu3.1 amd64 [upgradable from: 3.0.13-0ubuntu3]\n"), ), behavior.Write("update", Update). ReadsNothing("it refreshes the package index, whose updates are what the repositories have: no value of the example is in the read"). Sudo("apt-get"). Describe("Refresh the package index"). Explain("Runs apt-get update. It reports changed: true when the Release file "+ "of a repository under /var/lib/apt/lists changed, and changed: false when "+ "each repository was unchanged."). Example("The repositories are unchanged since the last refresh", UpdateInput{}, Result{}, behavior.After(UpdateInput{}), behavior.Prints("apt-get update", "Hit:1 http://archive.ubuntu.com/ubuntu noble-updates InRelease\n"), ), ))
Behavior is the updates the package index has for the host, under the packages: package updates. They are not facts about the host but what its repositories have, so apt reads them, not gohai. It runs on the Debian family. Its permissions are the packages': package:read and package:write.
Functions ¶
This section is empty.
Types ¶
type Available ¶
type Available struct {
Name string `json:"name" doc:"The package"`
CurrentVersion string `json:"current_version" doc:"The installed version"`
NewVersion string `json:"new_version" doc:"The version the index has"`
}
Available is one package that the index has a newer version of.
type ListInput ¶
type ListInput struct{}
ListInput takes nothing: it lists every update the index has.
type Provider ¶
type Provider interface {
// Updates is each package the index has a newer version of.
Updates(ctx context.Context) ([]Available, error)
// Refresh gets the index again, and reports whether it got new data.
Refresh(ctx context.Context) (bool, error)
}
Provider reads and refreshes the package index of the host.
type Result ¶
type Result struct {
Changed bool `json:"changed" doc:"Whether the refresh got new index data"`
}
Result is the index after a refresh.
type UpdateInput ¶
type UpdateInput struct{}
UpdateInput takes nothing: it refreshes the whole index.