~/bend-docscommunity

ledger/manifest.bend checks

raw source on the hub · import 0x046551eff0d59a82cf10d858b17b0c84/ledger/manifest.bend as Manifest

ezx: ez's ledger library for Bend 2: it parses an ez.toml into its package, dependencies and pinned tools.

ledger/manifest: the dependency ledger. Bend's import lines carry a bare 0x<hash>, which says nothing about what the package is or where it came from, and nothing in a repo lists them. ez.toml is that list: every package the repo imports, by name, with its hash and its origin.

2 imports
import Base
import ../toml/toml.bend as T

Types

type Source source · line 20 · raw

Data

where a package's bytes come from. A hub package needs nothing else, though one added by its <name>@<version> keeps it, which is what its import lines say and what the hub named the hash by; a git one pins a commit, and remembers the tag that was asked for so an upgrade knows what to re-resolve. It also carries the two facts nothing can work out again without the checkout: the directory inside it the package's paths are written from, and the NAR hash nix rebuilds it by. They live here, in the file that is committed, because a clone gets the ledger and not the vendoring cache. vend is the committed tree: the package is allowlisted under .ez/lib and an upgrade that moves it lays the new hash there. Absent, it is not.

type Dep source · line 25 · raw

Data

one tracked dependency

type Tool source · line 32 · raw

Data

one pinned CLI. The git fields are a dependency's. It is not a package: it has no 0x name, it is not imported, and it is not put on BEND_LIB. entry and bin name the file to build when the tool's own ledger should not be the one.

type Manifest source · line 40 · raw

Data

the ledger: this package, the file ez build and ez run take, the file ez tool run, install and upgrade build when one is named, the hub its packages come from ("" for bend's own), the hub name and the version ez publish names the package by ("" for none, which publishes it by its hash alone), everything the package depends on, and every CLI it pins

type Read source · line 46 · raw

Data

a manifest, or why it could not be read

Definitions

def value source · line 51 · raw

@pairs:List<&2, 0x046551eff0d59a82cf10d858b17b0c84/toml/toml.Kv> -> @key:String -> String

the value written for a key in a section, or "" when it is absent

def pairs.at source · line 55 · raw

@sect:0x046551eff0d59a82cf10d858b17b0c84/toml/toml.Sect -> @rest:List<&2, 0x046551eff0d59a82cf10d858b17b0c84/toml/toml.Kv> -> @name:String -> List<&2, 0x046551eff0d59a82cf10d858b17b0c84/toml/toml.Kv>

this section's pairs when its name matches, otherwise the rest's

def pairs_of source · line 60 · raw

@ss:List<&2, 0x046551eff0d59a82cf10d858b17b0c84/toml/toml.Sect> -> @+name:String -> List<&2, 0x046551eff0d59a82cf10d858b17b0c84/toml/toml.Kv>

the pairs of the section with this name, or none

def flag source · line 68 · raw

@+word:String -> Bool

vendor = true, bare or quoted, is the only spelling that commits the tree

def source.go source · line 72 · raw

@hub:Bool -> @url:String -> @rev:String -> @tag:String -> @root:String -> @nar:String -> @vend:Bool -> Source

no git key means the package lives on the hub

def source.named source · line 82 · raw

@named:String -> @src:Source -> Source

a hub source, with the <name>@<version> a dependency's section records under hub, "" for none. A git source keeps no name, and neither does a tool: a tool is not imported, so nothing names it.

def root.or source · line 92 · raw

@+dir:String -> String

a git section that names no root was written from the top of its checkout, which is the root a lock already spells out as "." and the only one a ledger written before this key existed can have meant

def source_of source · line 96 · raw

@+pairs:List<&2, 0x046551eff0d59a82cf10d858b17b0c84/toml/toml.Kv> -> Source

where a dependency's section says its bytes come from

def dep_of source · line 104 · raw

@+full:String -> @+pairs:List<&2, 0x046551eff0d59a82cf10d858b17b0c84/toml/toml.Kv> -> Dep

a [deps.<name>] section as a dependency. A hub dependency added by its <name>@<version> records it as hub, beside the hash it named when it was added, as a git dependency records its tag beside its rev.

def dep.name source · line 109 · raw

@dependency:Dep -> String

a dependency's own name, for finding or replacing it

def dep.hash source · line 114 · raw

@dependency:Dep -> String

a dependency's hash, which is the 0x name its import line carries

def dep.entry source · line 120 · raw

@dependency:Dep -> String

the file inside the package a dependency was added by, which is the file its hash was computed from

def deps.put source · line 125 · raw

@is_dep:Bool -> @sect:0x046551eff0d59a82cf10d858b17b0c84/toml/toml.Sect -> @rest:List<&2, Dep> -> List<&2, Dep>

a section joins the dependencies only when it is a [deps.<name>]

def name_of source · line 134 · raw

@sect:0x046551eff0d59a82cf10d858b17b0c84/toml/toml.Sect -> String

a section's name, for deciding what it is

def deps source · line 139 · raw

@ss:List<&2, 0x046551eff0d59a82cf10d858b17b0c84/toml/toml.Sect> -> List<&2, Dep>

every [deps.<name>] section, as dependencies, in the order written

def tool_of source · line 147 · raw

@+full:String -> @+pairs:List<&2, 0x046551eff0d59a82cf10d858b17b0c84/toml/toml.Kv> -> Tool

a [tools.<name>] section as a pinned CLI. The prefix is tools.

def tool.name source · line 152 · raw

@pin:Tool -> String

a tool's own name

def tool.entry source · line 157 · raw

@pin:Tool -> String

the file a pin names as its entry, or "" when the tool's ledger names it

def tool.bin source · line 162 · raw

@pin:Tool -> String

the file a pin names as its binary, or "" when the tool's ledger names it

def tool.source source · line 167 · raw

@pin:Tool -> Source

where a pinned CLI's bytes come from

def tools.put source · line 172 · raw

@is_tool:Bool -> @sect:0x046551eff0d59a82cf10d858b17b0c84/toml/toml.Sect -> @rest:List<&2, Tool> -> List<&2, Tool>

a section joins the tools only when it is a [tools.<name>]

def tools source · line 181 · raw

@ss:List<&2, 0x046551eff0d59a82cf10d858b17b0c84/toml/toml.Sect> -> List<&2, Tool>

every [tools.<name>] section, as pinned CLIs, in the order written

def missing.at source · line 189 · raw

@bad:Bool -> @name:String -> @rest:String -> String

a dependency with no hash cannot be resolved, so it is reported by name

def missing.is source · line 197 · raw

@sect:0x046551eff0d59a82cf10d858b17b0c84/toml/toml.Sect -> Bool

a [deps.<name>] section is missing its hash when the key is absent

def missing source · line 202 · raw

@ss:List<&2, 0x046551eff0d59a82cf10d858b17b0c84/toml/toml.Sect> -> String

the first dependency section with no hash, or "" when every one has one

def problem source · line 211 · raw

@+bad:String -> @+miss:String -> String

the first problem with the document, or "" when there is none. A syntax error comes first, since a section that did not parse cannot be judged.

def build source · line 217 · raw

@+ss:List<&2, 0x046551eff0d59a82cf10d858b17b0c84/toml/toml.Sect> -> Read

the ledger, once the document is known to be sound

def read.go source · line 226 · raw

@ok:Bool -> @why:String -> @ss:List<&2, 0x046551eff0d59a82cf10d858b17b0c84/toml/toml.Sect> -> Read

the ledger, or the problem that stopped it

def read source · line 234 · raw

@+bad:String -> @+ss:List<&2, 0x046551eff0d59a82cf10d858b17b0c84/toml/toml.Sect> -> Read

the sections judged, then read

def parse.go source · line 239 · raw

@toml:0x046551eff0d59a82cf10d858b17b0c84/toml/toml.Toml -> Read

the parsed document, taken apart

def parse source · line 244 · raw

@text:String -> Read

the ledger written in an ez.toml

def show.source source · line 248 · raw

@src:Source -> String

how a dependency reads on one line

def show.dep source · line 256 · raw

@dependency:Dep -> String

<name>=<hash>@<hub|git>

def show.deps source · line 262 · raw

@ds:List<&2, Dep> -> List<&2, String>

every dependency shown, in the order written. Base's List.map is over a one-use list, and these are two-use, so the walk is written out.

def show.m source · line 270 · raw

@manifest:Manifest -> String

the ledger on one line, for a test or a report

def show source · line 275 · raw

@ledger:Read -> String

the ledger, or the error, on one line

def find.pick source · line 283 · raw

@hit:Bool -> @dependency:Dep -> @rest:Dep -> Dep

this dependency when its name matches, otherwise whatever the rest gave

def find.at source · line 291 · raw

@+dependency:Dep -> @rest:Dep -> @name:String -> Dep

the dependency of this name, or a blank one

def find source · line 296 · raw

@ds:List<&2, Dep> -> @+name:String -> Dep

the dependency of this name, or one with empty fields

def dep source · line 304 · raw

@ledger:Read -> @name:String -> Dep

the named dependency of a ledger that was read

def source.rev source · line 313 · raw

@src:Source -> String

the commit a dependency is pinned to, or "" when it is a hub package

def source.tag source · line 321 · raw

@src:Source -> String

the tag a dependency was asked for, or "" when it was pinned by commit

def source.url source · line 329 · raw

@src:Source -> String

the repo a dependency was vendored from, or "" when it is a hub package

def source.root source · line 337 · raw

@src:Source -> String

the directory inside the checkout a dependency's paths are written from

def source.nar source · line 345 · raw

@src:Source -> String

the NAR hash nix rebuilds a dependency's checkout by

def source.nv source · line 354 · raw

@src:Source -> String

the <name>@<version> a hub dependency was added by, or "" for one added by its hash, and for a git one

def source.is_git source · line 362 · raw

@src:Source -> Bool

whether a dependency names a repo rather than the hub

def source.vendor source · line 370 · raw

@src:Source -> Bool

whether an upgrade that moves this dependency also commits the new tree

def source.dep source · line 378 · raw

@dependency:Dep -> Source

the source of a dependency that was found

def rev_of source · line 383 · raw

@ledger:Read -> @name:String -> String

the commit the named dependency is pinned to

def tag_of source · line 387 · raw

@ledger:Read -> @name:String -> String

the tag the named dependency was asked for

def hub.or source · line 394 · raw

@+url:String -> String

the hub a ledger's packages come from: the hub its [package] table names, or bend's own when it names none. It is read from the committed ledger and not from the environment, so two checkouts of one commit lock against the same hub whatever their shells say.

def hub_of source · line 399 · raw

@ledger:Read -> String

the hub of a ledger that was read. One that would not parse names none, and so names bend's.

def tools_of source · line 408 · raw

@ledger:Read -> List<&2, Tool>

the pinned CLIs of a ledger that was read; one that would not parse has none

def tool.find.pick source · line 417 · raw

@hit:Bool -> @pin:Tool -> @rest:Tool -> Tool

this tool when its name matches, otherwise whatever the rest gave

def tool.find.at source · line 425 · raw

@+pin:Tool -> @rest:Tool -> @+name:String -> Tool

the tool of this name, or a blank one

def tool.find source · line 429 · raw

@ts:List<&2, Tool> -> @+name:String -> Tool

the tool of this name, or one with empty fields

def tool.step source · line 437 · raw

@hit:Bool -> @rest:(@_:Unit -> Bool) -> Bool

the rest of the scan only when this one was not it

def tool.has source · line 445 · raw

@ts:List<&2, Tool> -> @+name:String -> Bool

whether the ledger pins a CLI of this name

def tool.known.go source · line 453 · raw

@all:Bool -> @ts:List<&2, Tool> -> @+name:String -> Bool

an empty --package is every tool; a name is that one

def tool.known source · line 461 · raw

@+only:String -> @ts:List<&2, Tool> -> Bool

whether --package names a pinned CLI, or names nothing and so names all