code wiki / _hdl_build / nx_pkg.nx
nx_pkg.nx
buildroot/runtime/_hdl_build/nx_pkg.nx
about
nx_pkg.nx -- SOVEREIGN PACKAGE MANAGER (OS gap: PACKAGE-MGMT). Composes what we built: dependency RESOLUTION via
topological sort (Kahn, as nx_init) + per-package INTEGRITY via sha/checksum (as nx_blockfs/the publisher).
install(target) = transitive-dep closure -> dep-ordered install order -> verify each package's sha -> install.
T1 install 'shell' -> needed set = only its transitive deps, order deps-before-dependents.
T2 every package verifies (sha matches the manifest). T3 teeth: a sha MISMATCH is rejected (supply-chain integrity).
T4 teeth: a dependency CYCLE is detected.
HONEST BEHIND vs apt/npm/pip: no version-constraint solving / remote repos / scale (asterisk).
expect_exit: 0 Sovereign: nx_syscalls. NEVER-BRICK: installs userspace packages, writes 0 firmware.
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_itoa_lib.nxnx_g_puts_lib.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 MAXD: i64 = 4 |
functions
| 17 | func g_pn(v: i64) -> i64 { nxi_out(v); return 0 } |
| 18 | func ck(name: *u8, c: i64) -> i64 { if c==1 { g_puts(" PASS " as *u8) } else { g_puts(" FAIL " as *u8) } g_puts(name); g_puts("\n" as *u8); return c } |
| 19 | func slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 20 | func psum(s: *u8) -> i64 { var acc: i64=0; var i: i64=0; while s[i]!=(0 as u8){ acc=acc+(s[i] as i64); i=i+1 } return acc } // content checksum |
| 25 | func pkg_needed(target: i64, ndep: *i64, dep: *i64, N: i64, needed: *i64) -> i64 called by 1: main |
| 32 | func pkg_topo(ndep: *i64, dep: *i64, N: i64, order: *i64) -> i64 |
| 43 | func pkg_verify(content: *u8, expected: i64) -> i64 { if psum(content)==expected { return 1 } return 0 } |
| 45 | func main() -> i64 |