Documentation
¶
Overview ¶
Package versions finds installed versions and the latest upstream releases.
Index ¶
- Variables
- func Compare(a, b string) int
- func FindSourceForgeFile(ctx context.Context, f *catalog.SourceFile, version string) (string, error)
- func Latest(ctx context.Context, pkg catalog.Package) (string, error)
- func PackageVersion(pkg catalog.Package) string
- func Record(name, version string) error
- func RecordAt(home, name, version string) error
- func RecordedVersion(name string) string
- func UpstreamVersion(pkgVersion string) string
- func Which(bin string) (string, error)
- func WhichSbin(bin string) (string, error)
- type Asset
- type Installed
Constants ¶
This section is empty.
Variables ¶
var ErrNoUpstream = errors.New("no upstream to check")
ErrNoUpstream means a program has no place hamstack can look up its newest release (gpsd lives on GitLab).
Functions ¶
func FindSourceForgeFile ¶
func FindSourceForgeFile(ctx context.Context, f *catalog.SourceFile, version string) (string, error)
FindSourceForgeFile returns the download URL of the source archive in a SourceForge folder, for projects whose file names carry a build date as well as the version.
func Latest ¶
Latest returns the newest upstream release version for pkg: from GitHub, or from its SourceForge listing.
func PackageVersion ¶
PackageVersion asks the system's package database for the version of the first of pkg's distribution packages that is installed.
func RecordAt ¶ added in v0.2.0
RecordAt respects an installer's target home (including an isolated test environment).
func RecordedVersion ¶
RecordedVersion is the version Record noted, or "".
func UpstreamVersion ¶
UpstreamVersion extracts the upstream release from a distribution's package version: "1:20250502-1" has none worth comparing, "2.8.0+250501+repack-1" is 2.8.0, "3.0.1-2.fc45" is 3.0.1.
Types ¶
type Asset ¶
type Asset struct {
Name string
URL string
SHA256 string // hex digest published by GitHub; empty if unavailable
}
Asset is a downloadable file attached to a release.
type Installed ¶
type Installed struct {
Path string
Version string // empty if the binary exists but its version could not be read
Origin string // "system package", "user install", "other"
}
Installed describes a locally installed binary.
func FindInstalled ¶
FindInstalled looks pkg up (see Which) and asks it for its version. It returns nil if the binary is not installed.
A program that cannot print its version without a display (a Qt application) has it read from the record hamstack keeps when it builds one into ~/.local, or from the distribution's package database.