Show info for packages that aren't installed
Rolling Release / build (push) Successful in 1m49s
Rolling Release / publish (push) Successful in 8s

- `orbit info` finds a package that isn't installed, or a `channel::` / `@constraint` build, in the cached channel listings used by search
- Channel indexes record each version's manifest digest, so a repeated info needs no network
- Versions without a digest, or indexes built before digests were added, are resolved in the registry
- Show the docs link, channel, digest, bins and dependencies for available builds
This commit is contained in:
nandi committed 2026-12-01 14:39:13 -08:00
1 parent 022898ed65
commit a00c87bf04
7 files changed
+176 -29

No files matched your search

+86 -17
View File
@@ -764,25 +764,94 @@ async fn locate_spec(
}
///|
fn cmd_info(ctx : Ctx, spec : String) -> Unit raise OrbitError {
let (pin, name) = split_channel(spec)
let p = match ctx.state.get(name) {
Some(p) => p
None => raise OrbitError("\{spec} is not installed")
/// Find a build for info in the channel listings that search caches: the
/// pinned channel, else the one it is installed from, else by priority. None
/// if no listing has a matching version with a known digest, so the registry
/// has to be asked.
async fn listed_build(
ctx : Ctx,
name : String,
pin : String?,
constraint : String,
) -> (Channel, String, String)? raise OrbitError {
let wanted = match pin {
Some(c) => Some(c)
None => ctx.state.get(name).map(i => i.channel)
}
if pin is Some(channel) && channel != p.channel {
raise OrbitError("\{spec} is not installed (installed from '\{p.channel}')")
let channels = match wanted {
Some(c) => [find_channel(ctx, c)]
None => ctx.channels
}
println("\{name} \{p.version} (installed)")
print_details(installed_details(ctx, p), " ")
print_details(
[
("constraint", [p.constraint]),
("needed by", [join(reverse_deps(ctx, name), " ")]),
("rollback", [join(p.history.map(g => g.version), " ")]),
],
" ",
)
for ch in channels {
let entries = match channel_listing(ctx.root, ch, name, false) {
Some(es) => es
None => continue
}
match find_entry(entries, name) {
Some(e) =>
if e.digest != "" && satisfies_all(e.version, [constraint]) {
return Some((ch, e.version, e.digest))
} else {
// Another version, or no digest: the registry knows its digest.
return None
}
None => ()
}
}
None
}
///|
/// Details of an installed package, or of the newest matching build in a
/// channel when it isn't installed (or `channel::` / `@constraint` asks for
/// another build).
async fn cmd_info(ctx : Ctx, spec : String) -> Unit raise OrbitError {
let (pin, name, constraint, explicit) = parse_spec_full(spec)
match ctx.state.get(name) {
Some(p) =>
if (pin is None || pin == Some(p.channel)) &&
(!explicit || satisfies_all(p.version, [constraint])) {
println("\{name} \{p.version} (installed)")
print_details(installed_details(ctx, p), " ")
print_details(
[
("constraint", [p.constraint]),
("needed by", [join(reverse_deps(ctx, name), " ")]),
("rollback", [join(p.history.map(g => g.version), " ")]),
],
" ",
)
return
}
None => ()
}
let (ch, version, digest) = match listed_build(ctx, name, pin, constraint) {
Some(found) => found
None => {
let wanted = match pin {
Some(c) => Some(c)
None => ctx.state.get(name).map(i => i.channel)
}
let (ch, tags) = locate(ctx, name, wanted)
let versions = sorted_versions(tags)
let version = match
versions.search_by(v => satisfies_all(v, [constraint])) {
Some(i) => versions[i]
None =>
raise OrbitError(
"no version of \{ch.name}::\{name} matches '\{constraint}'",
)
}
(ch, version, resolve_digest(ch, name, version))
}
}
let m = fetch_manifest_cached(ctx.root, ch, name, digest)
let status = match ctx.state.get(name) {
Some(p) => "not installed; \{p.version} from \{p.channel} is"
None => "not installed"
}
println("\{name} \{version} (\{status})")
print_details(available_details(m, channel=ch.name, digest~), " ")
}
///|