versions

package
v0.0.0-...-e767904 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2026 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Overview

Package versions resolves a project's upstream version from a pantry recipe's `versions:` specification.

This is deliberately distinct from bottle.PickVersion (which lists pkgx's already-built bottles at dist.pkgx.dev): dist may advertise a normalised version — e.g. ncurses 6.6.0 — that does not exist at the recipe's distributable URL (upstream only ships ncurses-6.5.tar.gz). For a fresh build the version MUST come from the recipe's own `versions:` field so it matches the distributable URL, which interpolates {{version.raw}}.

The logic mirrors libpkgx's usePantry version handling: list a GitHub repo's git tags or its REST Release names, or GET an upstream listing and regex-match version strings, then strip/ignore/select via the loose pkgx-compatible semver.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Resolve

func Resolve(spec any, constraint string) (string, string, error)

Resolve returns both the version string (as it appears upstream, for {{version.raw}}) and the raw upstream git tag it was resolved from (for {{version.tag}}) selected from a recipe's `versions:` spec, honouring an optional constraint ("" or "*" = latest). spec is pantry.Recipe.Versions, an `any` unmarshalled from YAML.

The returned tag is the pre-strip candidate that produced the winning version: for the github path it is the `refs/tags/`-trimmed tag (e.g. "v1.2.3" or "openssl-3.5.0"); for the url/match path it is the matched string before any strip. Recipes interpolate it in GitHub release URLs like `.../releases/download/{{version.tag}}/{{version.tag}}.tar.gz`.

A list-form `versions:` (an explicit, hardcoded set of candidate versions) decodes as a []any of the entries' verbatim scalar text (pantry preserves that text so e.g. "3.0" is not coerced to "3"). Those entries ARE the candidates: there is no upstream github/url resolution, no strip/ignore, and the winning candidate is its own {{version.tag}}.

Types

type VersionTag

type VersionTag struct {
	Version string
	Tag     string
}

VersionTag pairs a resolved version string (post-strip, v-normalised, as {{version.raw}}) with the pre-strip upstream tag it was resolved from (as {{version.tag}}) — the same two values Resolve returns for a single version.

func List

func List(spec any) ([]VersionTag, error)

List returns EVERY candidate version from a recipe's `versions:` spec — github/gitlab tags, an url+match listing, npm registry keys, or a hardcoded list — with each candidate stripped, CalVer-normalised, ignore-filtered and parsed by the loose semver; unparseable candidates are dropped. The result is deduped by resolved version and sorted DESCENDING (newest first). The spec semantics are identical to Resolve's; List simply keeps all survivors instead of picking the max satisfying a constraint.

Jump to

Keyboard shortcuts

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