Documentation
¶
Overview ¶
Package ebuild parses ebuild paths into category, package and version, and compares Gentoo versions (suffixes such as _rc and _p, and -r revisions) the way Portage orders them.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrInvalidEbuildPath = errors.New("invalid ebuild path format")
)
Functions ¶
func CompareVersions ¶
CompareVersions compares two Gentoo-style version strings by the ordering of PMS section 3.3 and returns -1 if v1 < v2, 0 if v1 == v2, 1 if v1 > v2.
Every number is compared as an unbounded integer, so no component, suffix number or revision can overflow. PMS equality is not text identity: 1.0 and 1.0-r0 compare equal, and so do 1.010 and 1.01.
The comparison is total on any two strings. A valid version is compared in its trimmed form, the form IsValidVersion accepts. A string IsValidVersion rejects orders below every valid version, and two invalid strings order byte-wise on their untrimmed text, so two distinct invalid strings never compare equal.
func IsValidVersion ¶
IsValidVersion reports whether v, once surrounding whitespace is trimmed, is a well-formed Gentoo-style version string that CompareVersions orders by PMS.
A string it rejects — "INKSCAPE_1_4_4", "latest", a still-prefixed "v6.6.91" — is not an error to CompareVersions: it orders below every valid version. That is a deterministic answer, not a meaningful one, so callers that compare an upstream value against the current ebuild version should reject non-comparable inputs up front rather than treat them as "no update available".
Types ¶
type Ebuild ¶
type Ebuild struct {
Category string // e.g., "app-misc"
Package string // e.g., "hello"
Name string // e.g., "hello" (same as Package for simple cases)
Version string // e.g., "1.0", "1.0_rc1", "1.0-r1"
}
Ebuild represents a parsed ebuild file path
func ParsePath ¶
ParsePath parses an ebuild path and extracts category, package, name, and version Expected format: category/package/package-version.ebuild