code wiki / _hdl_build / nx_split_resolve.nx

nx_split_resolve.nx

buildroot/runtime/_hdl_build/nx_split_resolve.nx

16253 B327 linesdepth 4pulls 6 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

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

nx_seat_drive_lib.nx nx_seg_store.nx nx_deploy_lib.nx nx_syscalls.nx nx_split_resolve.nx

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

main sd_w sys_write sys_exit sys_mmap sd_cat sr_mktok sr_strlen sr_strlen ↻ sr_basename sr_strlen ↻ sr_tmpp sd_cat ↻ sr_read sys_openat_rd sys_read sys_close ss_writefile sys_openat_wr sys_write ↻ sys_close ↻ sys_fsync sr_build sys_unlinkat sys_mmap ↻ dep_run_capture sys_fork sys_openat_wr ↻ sys_dup3 sys_mmap ↻ sys_execve_clean sys_close ↻ sys_execve sys_exit ↻ sys_wait4 sr_read ↻ sr_contains sr_dirname sr_strlen ↻ sr_streq

structs

none

consts

22const SR_CAP: i64 = 4194304
23const SR_MAXC: i64 = 64

functions

25func sr_strlen(s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { i = i + 1 } return i }
26func sr_read(path: *u8, buf: *u8, cap: i64) -> i64
35func 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
36func 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
38func sr_mktok(out: *u8, lib: *u8, tag: *u8) -> i64
called by 1: main calls 1: sr_strlen
58func sr_replace(src: *u8, n: i64, oldt: *u8, ol: i64, newt: *u8, nl: i64, out: *u8) -> i64
called by 1: main
79func sr_contains(buf: *u8, n: i64, tok: *u8, tl: i64) -> i64
called by 1: main
91func sr_basename(path: *u8, out: *u8) -> i64
called by 1: main calls 1: sr_strlen
105func sr_dirname(path: *u8, out: *u8) -> i64
called by 1: main calls 1: sr_strlen
116func sr_build(buildelf: *u8, tname: *u8, artpath: *u8, buf: *u8) -> i64
124func sr_tmpp(out: *u8, base: *u8, suffix: *u8) -> i64
called by 1: main calls 1: sd_cat
128func main(argc: i64, argv: *i64) -> i64