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

+21 -2
View File
@@ -20,6 +20,7 @@ struct IndexEntry {
version : String
description : String
versions : Array[String] // newest first
digest : String // of the `version` manifest; "" in older indexes
}
///|
@@ -33,6 +34,9 @@ fn index_object(entries : Array[IndexEntry]) -> Map[String, Json] {
o["version"] = Json::string(e.version)
o["description"] = Json::string(e.description)
o["versions"] = strs_json(e.versions)
if e.digest != "" {
o["digest"] = Json::string(e.digest)
}
pkgs.push(Json::object(o))
}
let top : Map[String, Json] = Map([])
@@ -64,6 +68,7 @@ fn parse_index(text : String) -> Array[IndexEntry] raise OrbitError {
version: jstr(o, "version", ""),
description: jstr(o, "description", ""),
versions: jstrs(o, "versions"),
digest: jstr(o, "digest", ""),
})
}
}
@@ -186,13 +191,15 @@ async fn read_index_entry(
return None
}
let tag = if tags.contains("latest") { "latest" } else { tags[0] }
match orbit_info(fetch_raw_manifest(ch, name, tag)) {
let raw = fetch_raw_manifest_bytes(ch, name, tag)
match orbit_info(utf8_decode(raw)) {
Some(info) =>
Some(IndexEntry::{
name,
version: info.version,
description: info.description,
versions: sorted_versions(tags),
digest: sha256_digest(raw),
})
None => None
}
@@ -334,7 +341,13 @@ async fn index_published(ch : Channel, name : String) -> Unit noraise {
///|
test "index round-trips, sorted, without unusable names" {
let entry = fn(name : String) {
IndexEntry::{ name, version: "1.0.0", description: "d", versions: ["1.0.0"] }
IndexEntry::{
name,
version: "1.0.0",
description: "d",
versions: ["1.0.0"],
digest: "sha256:ab",
}
}
let parsed = parse_index(
index_json([
@@ -346,6 +359,12 @@ test "index round-trips, sorted, without unusable names" {
)
assert_eq(parsed.map(fn(e) { e.name }), ["a", "zed"])
assert_eq(parsed[0].versions, ["1.0.0"])
assert_eq(parsed[0].digest, "sha256:ab")
// Indexes written before digests were recorded still parse.
let old = parse_index(
"{\"packages\":[{\"name\":\"a\",\"version\":\"1.0.0\",\"description\":\"d\",\"versions\":[\"1.0.0\"]}]}",
)
assert_eq(old[0].digest, "")
// Only an index artifact is used, and it is not an Orbit package.
assert_true(index_layer_digest("{\"artifactType\":\"x\"}") is None)
assert_true(