pub fn expand_kernel_range(
start: &str,
end: &str,
cli_label: &str,
include_eol: bool,
) -> Result<Vec<String>>Expand description
Expand a kernel-version range to the list of stable / longterm
releases that fall inside [start, end] inclusive.
Fetches kernel.org’s releases.json once via
crate::fetch::cached_releases, filters to rows whose moniker
is stable or longterm (matching the policy
crate::fetch::fetch_latest_stable_version uses for “is this a
production release we want to test against”), drops any version
outside the inclusive interval, and returns the surviving versions
sorted ascending by (major, minor, patch, rc) tuple. Empty result
is a hard error — an empty range either reflects a typo (start/end
don’t bracket any active series) or releases.json missing rows
the operator expected, and silently iterating over zero kernels
would mask both. The KernelId::Range doc comment promises “every
release in the range” which a quiet no-op contradicts.
Range endpoints are NOT required to appear in releases.json — the
interval is half-the-numeric, half-presence: 6.10..6.16 selects
every stable release inside that span, regardless of whether 6.10
and 6.16 themselves are still listed (e.g. one has been pruned
from active maintenance). This matches the inclusive-numeric-comparison
semantics in crate::kernel_path::KernelId::validate and lets a
range from an EOL series survive even after the endpoint version
itself becomes unavailable.
Endpoint granularity is series-inclusive on BOTH ends: a 2-component
MAJOR.MINOR endpoint names the whole series, so 6.11..6.14
includes every 6.14.N (not just 6.14.0). START is series-inclusive
because its .0 is the series floor; END is widened to the series
ceiling by range_bounds. An explicit-patch endpoint (6.14.2) is
an exact bound — 6.11..6.14.2 stops at 6.14.2.
cli_label prefixes the kernel.org-fetch status line so the
diagnostic matches the binary that triggered the lookup
("ktstr" vs "cargo ktstr").
When include_eol is set, the maintained set from releases.json
is unioned with EOL stable series enumerated from the gregkh
linux-stable mirror’s tags (crate::fetch::cached_stable_tags),
then the highest patch of each (major, minor) series is taken
across both sources (select_series_latest_in_range). Without it
a series dropped from releases.json is silently absent —
6.11..6.14 collapses to just the 6.11 series if 6.12/6.13 are
EOL. If the mirror tag list cannot be fetched, expansion proceeds
against the active-release set alone with a warning; the
empty-result error hints --include-eol only when it was not
already set.
Pre-release filter: mainline and linux-next rows are
excluded by the moniker filter; rc tags carrying a stable
moniker would also be excluded but kernel.org publishes rcs
under mainline, so the filter is double-coverage in practice.
Operators who want to test against an rc spell it out as a
single --kernel 6.16-rc3 rather than expecting the range
expansion to surface it.