versions

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: MIT Imports: 16 Imported by: 0 modules, 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 versions finds installed versions and the latest upstream releases.

Index

Constants

This section is empty.

Variables

View Source
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 Compare

func Compare(a, b string) int

Compare returns -1, 0 or 1 comparing dotted numeric versions a and b.

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

func Latest(ctx context.Context, pkg catalog.Package) (string, error)

Latest returns the newest upstream release version for pkg: from GitHub, or from its SourceForge listing.

func PackageVersion

func PackageVersion(pkg catalog.Package) string

PackageVersion asks the system's package database for the version of the first of pkg's distribution packages that is installed.

func Record

func Record(name, version string) error

Record notes that name was built from source at version.

func RecordAt added in v0.2.0

func RecordAt(home, name, version string) error

RecordAt respects an installer's target home (including an isolated test environment).

func RecordedVersion

func RecordedVersion(name string) string

RecordedVersion is the version Record noted, or "".

func UpstreamVersion

func UpstreamVersion(pkgVersion string) string

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.

func Which

func Which(bin string) (string, error)

Which finds a program, preferring the copy hamstack installs in ~/.local/bin over one earlier on PATH. A newer program built from source must win over the distribution's older one even when ~/.local/bin is not first on PATH, so every part of hamstack resolves programs through this.

func WhichSbin

func WhichSbin(bin string) (string, error)

WhichSbin is Which, also looking in the system administration directories. gpsd, for one, installs to /usr/sbin on Debian, which is not on an ordinary user's PATH.

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.

func ReleaseAssets

func ReleaseAssets(ctx context.Context, repo string) (string, []Asset, error)

ReleaseAssets returns the latest release tag of repo and its assets.

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

func FindInstalled(pkg catalog.Package) *Installed

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.

Jump to

Keyboard shortcuts

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