code wiki / _hdl_build / nx_split_resolve.nx
nx_split_resolve.nx
buildroot/runtime/_hdl_build/nx_split_resolve.nx
about
nx_split_resolve.nx -- SPLIT-BRAIN resolver: byte-provable RENAME+REPOINT for a DIVERGENT lib that
exists (with DIFFERENT content) in two dirs, where different consumers silently resolve different
copies. Retirement (nx_consol_apply_mc) REFUSES these (the copy is live for someone). The sound
resolution is to give each copy a DISTINCT name IN PLACE (so its own relative imports still resolve)
and repoint every consumer to the copy that reproduces ITS build BYTE-FOR-BYTE. Commit ONLY if every
buildable consumer's artifact is byte-identical to its pre-change build, else restore every source +
undo both renames (never-brick). Keeps BOTH versions (Rule 25: make the dependency explicit).
TRANSITIVE case: a direct importer that is itself a LIB (no main, does not build standalone) cannot be
byte-verified directly. It is repointed by DIRECTORY RULE (the copy in its own dir) and verified
TRANSITIVELY -- a buildable consumer that imports it will change if it was repointed wrong. A coverage
guard REFUSES if a lib-importer is imported by no buildable consumer in the list (unverifiable).
argv: <lib> <dir1> <tag1> <dir2> <tag2> <buildonly-elf> <consumer-srcpath>...
e.g. nx_split_resolve nx_bom runtime rt runtime/_hdl_build hb _offc/nx_buildonly.elf <5 consumer paths>
exit: 0 RESOLVED | 1 REFUSED (all restored) | 2 usage/precondition | 3 filesystem move error
license_tier: ORIGINAL No hw writes (Rule 26): edits .nx source + rebuilds only.
dependencies 4 imports · 0 importers
imports: nx_seat_drive_lib.nxnx_seg_store.nxnx_deploy_lib.nxnx_syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 22 | const SR_CAP: i64 = 4194304 |
| 23 | const SR_MAXC: i64 = 64 |
functions
| 25 | func sr_strlen(s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { i = i + 1 } return i } |
| 26 | func sr_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 35 | func sr_eq(a: *u8, an: i64, b: *u8, bn: i64) -> i64 { if an != bn { return 0 } var i: i64 = 0; while i < an { if a[i] != b[i] { return 0 } i = i + 1 } return 1 } called by 1: main |
| 36 | func sr_streq(a: *u8, b: *u8) -> i64 { var i: i64 = 0; while a[i] == b[i] { if a[i] == (0 as u8) { return 1 } i = i + 1 } return 0 } called by 1: main |
| 38 | func sr_mktok(out: *u8, lib: *u8, tag: *u8) -> i64 |
| 58 | func sr_replace(src: *u8, n: i64, oldt: *u8, ol: i64, newt: *u8, nl: i64, out: *u8) -> i64 called by 1: main |
| 79 | func sr_contains(buf: *u8, n: i64, tok: *u8, tl: i64) -> i64 called by 1: main |
| 91 | func sr_basename(path: *u8, out: *u8) -> i64 |
| 105 | func sr_dirname(path: *u8, out: *u8) -> i64 |
| 116 | func sr_build(buildelf: *u8, tname: *u8, artpath: *u8, buf: *u8) -> i64 |
| 124 | func sr_tmpp(out: *u8, base: *u8, suffix: *u8) -> i64 |
| 128 | func main(argc: i64, argv: *i64) -> i64 |