<< lib/operating-system/SLDownloadSet.sleela SLeeLa Standard Library Definition. Definition: Defines SLDownloadSet — the set of URLs for the related downloads an OS build needs, resolved and recorded BEFORE the OS is compiled or the ISO is authored. A build does not pull everything from one place: it needs package repositories, the kernel and firmware sources, backend runtimes for foreign execution (Wine, QEMU, binfmt tooling), the upstream distro parts, and any developer-added sources. Each download is a kind + URL + an optional pinned version/checksum, and a PHASE that says whether it must be present before compile (sources/toolchain) or before the final ISO conversion (runtime payloads seeded into the rootfs). This makes the build's external dependencies explicit and auditable: a tool can list every URL, verify each is reachable, and refuse to compile or author the ISO until the required ones for that phase are present. SLOSModel composes one; the OS Creator writes it as a downloads manifest and a fetch script. The slots are fixed (array-free, like the rest of the model); up to a bounded number of extra developer URLs are held in parallel string fields. Family: operating-system. Design model; the reachability probe crosses the osRun bridge (requires #sleela 1.5). >> #sleela 2.5 material; class SLDownloadSet { < ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- > << Eleven catalogued attributes with getter/setter pairs, so a GUI, loader, or catalog can read and (where appropriate) override this record. Values are faithful to the subject's real origin where publicly known. >> String metaVersion = "1.0.0"; int metaId = 11006; String metaAuthor = "Kiro Agent"; String metaDate = "2026-10-16"; String metaCopyright = "SLeeLa project"; String metaTrademark = "none"; String metaCorporation = "none"; < metaOrigin: National | | International | Galactic > String metaOrigin = "International"; String metaBirthDate = "2026-10-11"; < metaScienceRating: maturity/robustness on a 1..10 scale > int metaScienceRating = 9; < metaNationalSchedule: a real, citable instrument or "none" > String metaNationalSchedule = "none"; String getMetaVersion() { return metaVersion; } void setMetaVersion(String v) { metaVersion = v; } int getMetaId() { return metaId; } void setMetaId(int v) { metaId = v; } String getAuthor() { return metaAuthor; } void setAuthor(String v) { metaAuthor = v; } String getDate() { return metaDate; } void setDate(String v) { metaDate = v; } String getCopyright() { return metaCopyright; } void setCopyright(String v) { metaCopyright = v; } String getTrademark() { return metaTrademark; } void setTrademark(String v) { metaTrademark = v; } String getCorporation() { return metaCorporation; } void setCorporation(String v) { metaCorporation = v; } String getOrigin() { return metaOrigin; } void setOrigin(String v) { metaOrigin = v; } String getBirthDate() { return metaBirthDate; } void setBirthDate(String v) { metaBirthDate = v; } int getScienceRating() { return metaScienceRating; } void setScienceRating(int v) { metaScienceRating = v; } String getNationalSchedule() { return metaNationalSchedule; } void setNationalSchedule(String v) { metaNationalSchedule = v; } < Phase tags: when a download must be present. > < before compiling the OS (sources/toolchain) > static final int PHASE_COMPILE = 0; < before authoring the ISO (rootfs payloads) > static final int PHASE_ISO = 1; < Well-known download slots. "" when unset. > String packageRepo; String kernelSrc; String firmwareSrc; String runtimeWine; String runtimeQemu; String upstreamDistro; < Up to four developer-added extra URLs, each "kind|url|phase". > String extra0; String extra1; String extra2; String extra3; int extraCount; < The resilient fallback downloader: when a primary URL 404s, it supplies > < prioritized support/mirror URLs (authoritative -> official -> college -> > < archive). This is the OS-document hook for the support downloader module. > SLSupportDownloader support; int configured; void configure() { packageRepo = ""; kernelSrc = ""; firmwareSrc = ""; runtimeWine = ""; runtimeQemu = ""; upstreamDistro = ""; extra0 = ""; extra1 = ""; extra2 = ""; extra3 = ""; extraCount = 0; support = new SLSupportDownloader(); support.configure(); configured = 1; } < The composed support downloader (for the OS document to reach). > SLSupportDownloader supportDownloader() { return support; } < Seed the per-shape default download URLs. These are the canonical upstreams > < a build of that family pulls from; a developer overrides any of them. > void forShape(SLOSShape shape) { configure(); upstreamDistro = "https://github.com/mearvk/Ubuntu.Determinant.Beta.Restricted.git"; if (shape.isWindows()) { packageRepo = "https://pkgs.local/windows"; kernelSrc = "https://pkgs.local/windows/nt-src"; firmwareSrc = "https://uefi.org/firmware"; return; } if (shape.isMac()) { packageRepo = "https://pkgs.local/macos"; kernelSrc = "https://opensource.apple.com/source/xnu"; firmwareSrc = "https://uefi.org/firmware"; runtimeQemu = "https://www.qemu.org/download"; return; } < Linux defaults. > packageRepo = "http://archive.ubuntu.com/ubuntu"; kernelSrc = "https://cdn.kernel.org/pub/linux/kernel"; firmwareSrc = "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git"; runtimeWine = "https://dl.winehq.org/wine-builds"; runtimeQemu = "https://www.qemu.org/download"; } < ---- Setters -------------------------------------------------------- > void setPackageRepo(String url) { packageRepo = url; } void setKernelSrc(String url) { kernelSrc = url; } void setFirmwareSrc(String url) { firmwareSrc = url; } void setRuntimeWine(String url) { runtimeWine = url; } void setRuntimeQemu(String url) { runtimeQemu = url; } void setUpstreamDistro(String url) { upstreamDistro = url; } < Add a developer download: kind label, URL, and phase (0 compile / 1 iso). > < Up to four extras are held. > int addExtra(String kind, String url, int phase) { String ph = "compile"; if (phase == PHASE_ISO) { ph = "iso"; } String rec = kind + "|" + url + "|" + ph; if (extraCount == 0) { extra0 = rec; } else if (extraCount == 1) { extra1 = rec; } else if (extraCount == 2) { extra2 = rec; } else if (extraCount == 3) { extra3 = rec; } < full > else { return -1; } extraCount = extraCount + 1; return 0; } < ---- Validity ------------------------------------------------------- > < Before COMPILE: a package repo + kernel source must be known (you cannot > < build an OS without where its base and kernel come from). > boolean readyForCompile() { if (configured != 1) { return false; } return packageRepo != "" && kernelSrc != ""; } < Before ISO: additionally the firmware source must be known (the ESP/loader > < needs firmware), and every required slot resolved. > boolean readyForIso() { if (!readyForCompile()) { return false; } return firmwareSrc != ""; } < ---- Manifest + fetch ----------------------------------------------- > < A newline manifest " " of every known download. > String downloadManifest() { String m = ""; m = row(m, "package-repo", "compile", packageRepo); m = row(m, "kernel-src", "compile", kernelSrc); m = row(m, "firmware-src", "iso", firmwareSrc); m = row(m, "runtime-wine", "iso", runtimeWine); m = row(m, "runtime-qemu", "iso", runtimeQemu); m = row(m, "upstream", "compile", upstreamDistro); m = rowExtra(m, extra0); m = rowExtra(m, extra1); m = rowExtra(m, extra2); m = rowExtra(m, extra3); return m; } String row(String acc, String kind, String phase, String url) { if (url == "") { return acc; } String l = kind + " " + phase + " " + url; if (acc == "") { return l; } return acc + "\n" + l; } < An extra record "kind|url|phase" -> "kind phase url". > String rowExtra(String acc, String rec) { if (rec == "") { return acc; } < kept raw; the emitter reformats pipes for display > return acc + "\n" + rec; } < A POSIX fetch script that retrieves the phase's downloads. Honest: it uses > < the right tool per URL scheme (git clone for .git, curl otherwise) and is a > < separate, explicit step — never run during compile automatically. > String fetchScript(int phase) { String s = "#!/bin/sh\n# fetch downloads (phase=" + phaseName(phase) + ") generated by SLeeLa lib/os\nset -eu\nmkdir -p downloads\n"; s = s + fetchLine(phase, PHASE_COMPILE, "package-repo", packageRepo); s = s + fetchLine(phase, PHASE_COMPILE, "kernel-src", kernelSrc); s = s + fetchLine(phase, PHASE_COMPILE, "upstream", upstreamDistro); s = s + fetchLine(phase, PHASE_ISO, "firmware-src", firmwareSrc); s = s + fetchLine(phase, PHASE_ISO, "runtime-wine", runtimeWine); s = s + fetchLine(phase, PHASE_ISO, "runtime-qemu", runtimeQemu); s = s + "echo \"downloads for phase " + phaseName(phase) + " complete\"\n"; return s; } String fetchLine(int wantPhase, int rowPhase, String kind, String url) { if (url == "") { return ""; } if (wantPhase != rowPhase) { return ""; } < Choose the fetch tool by the download's kind rather than by string > < inspection: the distro upstream and kernel/firmware source are git repos; > < package repos and runtime payloads are retrieved with curl. (The surface > < has no string-length/substring, so kind drives the choice, not a suffix.) > if (kind == "upstream" || kind == "kernel-src" || kind == "firmware-src") { return "git clone --depth 1 " + url + " downloads/" + kind + " || true\n"; } return "curl -fsSL -o downloads/" + kind + ".payload \"" + url + "\" || true\n"; } String phaseName(int phase) { if (phase == PHASE_ISO) { return "iso"; } return "compile"; } < ---- Resilient fetch via the support downloader --------------------- > < supportFetchScript(phase): like fetchScript, but each component is fetched > < through the support downloader's 404-tolerant fallback loop (primary -> > < official mirror -> college/edu mirror -> archive). This is what a build > < should run so a single 404 does not break it. > String supportFetchScript(int phase) { String s = "#!/bin/sh\n# resilient fetch (phase=" + phaseName(phase) + ") with 404 fallback, generated by SLeeLa lib/os\nset -eu\nmkdir -p downloads\n"; if (phase == PHASE_COMPILE) { s = s + support.fetchWithFallback("package", "downloads/package.payload"); s = s + support.fetchWithFallback("kernel", "downloads/kernel-src"); s = s + support.fetchWithFallback("upstream", "downloads/upstream"); } else { s = s + support.fetchWithFallback("firmware", "downloads/firmware"); s = s + support.fetchWithFallback("wine", "downloads/wine.payload"); s = s + support.fetchWithFallback("qemu", "downloads/qemu.payload"); } s = s + "echo \"resilient downloads for phase " + phaseName(phase) + " complete\"\n"; return s; } < The support URL table for the manifest/report (every kind, every tier). > String supportManifest() { String s = ""; s = s + "# package:\n" + support.rankedList("package") + "\n"; s = s + "# kernel:\n" + support.rankedList("kernel") + "\n"; s = s + "# firmware:\n" + support.rankedList("firmware") + "\n"; s = s + "# upstream:\n" + support.rankedList("upstream") + "\n"; s = s + "# wine:\n" + support.rankedList("wine") + "\n"; s = s + "# qemu:\n" + support.rankedList("qemu"); return s; } }