diff --git a/.gitignore b/.gitignore index 2a541ce181..d4f7cd8179 100644 --- a/.gitignore +++ b/.gitignore @@ -62,3 +62,4 @@ Packages/*.pkgar local/cache/pkgar/ local/patches/base/redox.patch local/reference/ +local/sources/ diff --git a/AGENTS.md b/AGENTS.md index eb279daa14..f837cb2fa1 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,41 +1,39 @@ # RED BEAR OS BUILD SYSTEM — PROJECT KNOWLEDGE BASE -**Generated:** 2026-04-12 (P1/P2 complete) · Updated: 2026-05-29 (mega-patch discipline) +**Generated:** 2026-04-12 (P1/P2 complete) · Updated: 2026-06 (source ownership migration) **Toolchain:** Rust nightly-2025-10-03 (edition 2024) **Architecture:** Microkernel OS in Rust, ~38k files, ~294k LoC Rust **Target Hardware**: AMD64 bare metal, with AMD and Intel machines treated as equal-priority Red Bear OS targets ## OVERVIEW -Red Bear OS build system orchestrator — fetches, builds, and packages ~100+ Git repositories +Red Bear OS build system orchestrator — builds and packages ~100+ Git repositories into a bootable Redox image. Uses a Makefile + Rust "cookbook" tool + TOML configs. Languages: Rust (core), C (ported packages), TOML (config), Make (build orchestration). -RedBearOS is a **full fork** of Redox OS — based on frozen, archived source snapshots. -Sources are immutable and never auto-immutable archived from upstream. All changes are explicit, -human-initiated operations. Durable Red Bear state belongs in `local/patches/`, +RedBearOS is a **full fork** of Redox OS with direct source ownership. +Red Bear maintains its own git forks of every patched component under `local/sources/`. +Sources are directly editable — no patches, no indirection. Changes are committed +to the appropriate fork repo. Durable Red Bear state belongs in `local/sources/`, `local/recipes/`, `local/docs/`, and tracked Red Bear configs. The current baseline is **Red Bear OS 0.1.0** (Redox snapshot at build-system commit `f55acba68`). -All recipe sources are pinned and archived in `sources/redbear-0.1.0/`. ## BUILD SYSTEM DURABILITY — THE CARDINAL RULE -**THE `recipes/*/source/` DIRECTORY WILL ALWAYS BE REWRITTEN. DO NOT EVER USE IT FOR ANY -WORK THAT YOU INTEND TO KEEP. THOSE TREES ARE EPHEMERAL — THEY ARE DESTROYED AND REGENERATED -ON EVERY `repo fetch`, `repo cook`, `make clean`, AND `make distclean`. ANY EDIT MADE THERE -WILL BE SILENTLY LOST ON THE NEXT BUILD. COMMITTING TO A SUBMODULE INSIDE `source/` DOES NOT -PROTECT YOUR WORK — THE ENTIRE DIRECTORY IS DELETED AND RE-CLONED/RE-EXTRACTED FROM SCRATCH.** +**SOURCE LIVES IN `local/sources//`. EDIT THERE. `recipes/*/source/` IS A SYMLINK +TO `local/sources/` — DO NOT EDIT THROUGH THE SYMLINK (git operations won't work). DO NOT +EDIT FILES IN `recipes/*/source/` DIRECTLY — GO TO `local/sources//` INSTEAD.** This is the #1 mistake AI agents and new contributors make. It has caused repeated work loss in this project. The rule is: | What you want to do | Where to do it | |---|---| -| Change a kernel source file | Create or update a patch in `local/patches/kernel/` | -| Change an init or daemon source file | Create or update a patch in `local/patches/base/` | -| Change relibc | Create or update a patch in `local/patches/relibc/` | -| Change a driver | Create or update a patch in `local/patches/base/` or `local/patches//` | +| Change a kernel source file | Edit `local/sources/kernel/` and commit | +| Change an init or daemon source file | Edit `local/sources/base/` and commit | +| Change relibc | Edit `local/sources/relibc/` and commit | +| Change a driver | Edit `local/sources//` and commit | | Add a new package | Create a recipe in `local/recipes///` | | Change build config | Edit `config/redbear-*.toml` | | Add documentation | Write to `local/docs/` | @@ -45,50 +43,46 @@ in this project. The rule is: ``` repo cook ├── repo fetch - │ ├── Clone/fetch upstream source → recipes//source/ - │ ├── Apply patches from recipe.toml → patches are read from local/patches// - │ └── Source tree is now fully patched and ready for build + │ ├── For local sources: symlink local/sources// → recipes//source/ + │ ├── For git sources: clone/fetch from git URL → recipes//source/ + │ └── Source tree is ready for build (no patch step) ├── Cargo/cmake/configure build └── Stage artifacts into sysroot ``` -The `source/` directory is a disposable working copy. It is produced at the start of every -build by cloning the upstream source + applying patches sequentially. The recipe's -`patches = [...]` list in `recipe.toml` controls which patches are applied. +The `source/` directory is a symlink to `local/sources/` for Red Bear-owned +components, or a git clone for upstream packages. There are no patches — +the source IS the source. ### Two-layer architecture ``` Layer 1: Ephemeral (destroyed on clean/fetch/rebuild) - recipes//source/ ← working tree, cloned + patched + recipes//source/ ← symlink to local/sources/ or git clone build/ ← build outputs target/ ← cargo target dir Layer 2: Durable (survives clean/fetch/rebuild/release provisioning) - local/patches// ← .patch files — the actual source code changes + local/sources// ← Red Bear source forks (git repos, directly editable) local/recipes// ← custom recipe directories config/redbear-*.toml ← Red Bear OS build configs local/docs/ ← planning and integration docs - recipes//recipe.toml ← the patches list (git-tracked) ``` ### The correct workflow for any source change -1. **Make the change** in `recipes//source/` to validate it compiles -2. **Generate a patch**: `cd recipes//source && git diff > ../../../local/patches//my-fix.patch` -3. **Wire the patch**: add `"my-fix.patch"` to the recipe's `recipe.toml` `patches = [...]` list -4. **Validate**: `./target/release/repo validate-patches ` -5. **Rebuild**: `./target/release/repo cook ` -6. **Commit**: `git add local/patches/ recipes//recipe.toml && git commit` +1. **Edit the source** in `local/sources//` +2. **Build**: `./target/release/repo cook ` +3. **Test**: `make qemu CONFIG_NAME=redbear-mini` +4. **Commit**: `git -C local/sources// commit -m "..."` ### Common anti-patterns | Anti-pattern | Why it fails | |---|---| -| Editing `source/` files then running `make all` | `make all` calls `repo fetch` which regenerates `source/` — edits are lost | -| Creating a patch but not wiring it into `recipe.toml` | Patch file exists but is never applied — build uses unpatched source | -| **Hand-writing patches manually** | **FORBIDDEN. Unified diffs hand-written by humans routinely have incorrect line counts, wrong context, malformed hunks, or timestamp headers — all of which cause `patch(1)` to reject them. The ONLY acceptable way to generate patches is `git diff -U0 -w` from a committed source tree baseline.** | -| Editing `recipe.toml` patches list without creating the actual `.patch` file | Build fails with "missing patch" error | +| Editing files in `recipes//source/` | Those are symlinks to `local/sources/`. Git operations must happen in the actual repo. | +| Creating new patch files in `local/patches/` | `local/patches/` is historical only. Changes go as git commits in `local/sources//`. | +| Hand-writing patches | No patches exist. Use standard git workflow. | | Editing `recipe.toml` patches list without creating the actual `.patch` file | Build fails with "missing patch" error | | Expecting `source/` changes to survive `make clean` | `make clean` deletes `source/` directories | | Running `repo cook` without `--allow-protected` for core packages | Protected recipes (kernel, relibc, base) are offline-only by default | @@ -191,8 +185,13 @@ redox-master/ ├── docs/ # Architecture docs (6 detailed integration guides) — See docs/AGENTS.md ├── local/ # OUR CUSTOM WORK — survives mainline updates — See local/AGENTS.md │ ├── config/ # Custom configs (my-amd-desktop.toml) +│ ├── sources/ # Red Bear source forks (git repos, directly editable) +│ │ ├── kernel/ # Red Bear's kernel fork +│ │ ├── relibc/ # Red Bear's C library fork +│ │ ├── base/ # Red Bear's userspace drivers fork +│ │ └── ... # Additional component forks │ ├── recipes/ # Custom recipes (AMD drivers, GPU stack, Wayland) -│ ├── patches/ # Patches against mainline sources (kernel, relibc, base) +│ ├── patches/ # HISTORICAL — old patch files (not used by build system) │ ├── Assets/ # Branding assets (icon, loading background) │ ├── firmware/ # AMD GPU firmware blobs (fetched, not committed) │ ├── scripts/ # Build/deploy scripts (fetch-firmware.sh, build-redbear.sh) @@ -612,9 +611,9 @@ or any path that is already git-tracked and not inside a fetched source tree. Every successful `repo cook` produces two durable artifacts: 1. **Package in the repo**: `repo/x86_64-unknown-redox/.pkgar` + `.toml` -2. **Patched source form**: All source modifications are in `local/patches//` and wired into `recipe.toml` +2. **Committed source**: All source modifications are committed in the appropriate `local/sources//` git repo -A build is **not complete** until both artifacts exist: +A build is **not complete** until the repo artifacts exist: ```bash # After cooking, verify the package is in the repo @@ -666,375 +665,6 @@ The script: - Standalone applications with no dependents (editors, games, utilities) - Terminal/leaf packages that nothing depends on -### Atomic Patch Application - -The cookbook tool (`src/cook/fetch.rs`) applies patches **atomically**: -patches are applied to a staging directory (created via `cp -al` hard links), -and only promoted into the live source tree if **all** patches succeed. If any -patch fails, the staging directory is discarded and the source tree remains -untouched. - -**The source tree is NEVER left in a partially-patched state.** - -When a patch fails, the error message includes the `[ATOMIC]` tag and the -failed patch name. Recovery: fix the patch file, then re-run `repo fetch`. - -### Patch Format - -Patches may use either format: -- Unified diff (`---`/`+++` lines, preferred — most portable) -- `diff --git` format (auto-normalized by `normalize_patch()`) -- `diff -ruN` format (also auto-normalized — `diff -ruN` headers stripped like `diff --git`) - -Git-specific headers (`diff --git`, `diff -ruN`, `index`, `new file mode`, `rename from/to`, -`similarity index`, `dissimilarity index`) are automatically stripped before -`patch` is invoked. The build system uses `--fuzz=3` for resilient context matching. - -**Timestamps in `---`/`+++` lines** (common in `diff -ruN` output) should be removed. -Use `--- a/path` and `+++ b/path` without timestamps. The `normalize_patch` function -does NOT strip timestamps — they should be removed from the patch file directly. - -### Robust Patch Generation (REQUIRED) - -**MANDATORY: All patches MUST be generated using `git diff -U0 -w` from a committed source tree. -Hand-writing unified diffs is FORBIDDEN — it routinely produces incorrect line counts, malformed -hunks, or timestamp headers that cause `patch(1)` to reject them. The build system uses -`--fuzz=3` for resilient context matching, which requires properly generated diffs.** - -Context-line mismatches (renamed variables, shifted line numbers, upstream refactors) -are the single largest source of patch application failures. Use the zero-context, -whitespace-ignored technique to make patches resilient to drift: - -**Workflow (mandatory):** -```bash -# 1. Start with a clean P0..P(N-1) source tree (repo fetch already applied earlier patches) -cd recipes//source - -# 2. Commit the P0..P(N-1) state as a git baseline -git add -A && git commit -m "P0..P(N-1) baseline" - -# 3. Make P(N) edits in the source tree -# (edit files, test compile, etc.) - -# 4. Generate the P(N) patch using ONLY git diff -U0 -w: -git diff -U0 -w > ../../../local/patches//P-.patch - -# 5. Wire the patch into recipe.toml patches list - -# 6. Validate: repo validate-patches -# 7. Rebuild: repo cook -# 8. Commit: git add local/patches/ recipes//recipe.toml && git commit -``` - -**Apply (for manual testing):** -```bash -patch -p1 --fuzz=3 < local/patches//P-.patch> -``` - -**Why this works:** -- `-U0` produces zero lines of surrounding context, so the patch has no fragile context - lines that can drift when surrounding code changes -- `-w` ignores all whitespace changes, so indentation-only refactors don't break the patch -- `--fuzz=3` allows `patch(1)` to find the target location even when nearby lines have shifted -- Together these three flags eliminate the entire class of "context mismatch" failures - -**Why hand-writing is forbidden:** -- Human-written diffs routinely have wrong `@@` line counts, missing or extra context lines, - incorrect `--- a/` / `+++ b/` paths, or embedded timestamps — all of which cause `patch(1)` - to reject the patch or silently apply it to the wrong location -- The `git diff -U0 -w` command produces mechanically correct diffs every time - -**Before this technique**, patches routinely broke when: -- A variable was renamed (e.g., `deamon` → `daemon` in context) -- Lines were added or removed above the changed code -- Indentation was reformatted -- An earlier patch in the chain shifted line numbers - -**With this technique**, patches survive all of the above. A hunk consists only of the -changed lines themselves — no context that can go stale. - -**Conventions:** -- Always use `--- a/path` and `+++ b/path` headers (no timestamps) -- Always name patches `P-.patch` with sequential numbering -- Always wire patches into `recipe.toml` `patches = [...]` in application order -- Always validate with `repo validate-patches ` after creating or editing a patch -- When updating an existing patch, regenerate it entirely rather than editing line numbers manually - -### Protected Recipes - -Core recipes (`base`, `kernel`, `relibc`, `bootloader`, etc.) and any recipe carrying -Red Bear patches are **protected** and cannot be re-fetched online. Protected recipes -always use offline/archived sources from `sources/redbear-/tarballs/`. - -Use the `--allow-protected` flag (or set `REDBEAR_ALLOW_PROTECTED_FETCH=1`) to override -protection (e.g., for debugging or when archives are missing). - -```bash -repo --allow-protected fetch base -repo --allow-protected cook base -``` - -The full protected recipe list (in `src/cook/fetch.rs:redbear_protected_recipe()`) -includes: all core system recipes, all Red Bear custom recipes, all patched Qt/Wayland/ -KDE recipes, and all recipes carrying Red Bear patches (Qt, DRM, Mesa, Wayland, D-Bus, -glib, etc.). Any recipe with a `redox.patch` or local patches is a candidate for -protection — add it when adding patches. - -### Offline-First By Default - -Red Bear OS is a **fork with frozen sources**. The cookbook tool defaults to -`COOKBOOK_OFFLINE=true` (changed from upstream Redox's `false`). Builds use archived -sources from `sources/redbear-0.1.0/` — no network access during compilation. - -To allow online fetching for non-protected development recipes: -```bash -COOKBOOK_OFFLINE=false make all CONFIG_NAME=redbear-full -``` - -In release mode (`REDBEAR_RELEASE=0.1.0`), online fetching is **completely disabled** -even with `COOKBOOK_OFFLINE=false`. Sources are immutable in release mode. - -### Workspace Pollution Prevention - -Before every fetch and build, the cookbook tool removes orphaned `Cargo.toml` -and `Cargo.lock` files from `recipes/` root. These files can appear as side -effects of relibc workspace builds and cause "current package believes it's in -a workspace" errors. - -### Patch Chain Ordering - -Patches in `recipe.toml` are applied in listed order. Dependencies between -patches must be respected: -- Patches that **define** types (e.g., `InputProducer`) must come BEFORE - patches that **use** those types -- Patches that **create** files must come BEFORE patches that **modify** them -- Cumulative patches (P0 → P2 → P3) must maintain correct line number context - -When reordering patches: remove the source tree, re-fetch, and rebuild to verify. - -### MEGA-PATCH + INDIVIDUAL PATCH DISCIPLINE (CRITICAL) - -**This is the single most common source of build failures in Red Bear OS.** -Violating these rules causes patches to silently drift, overlap, or conflict — -wasting hours of debugging time. - -#### The Two-Layer Architecture - -Each patched component (base, kernel, relibc) uses two patch layers: - -1. **The mega-patch** (`redox.patch`) — a single consolidated `git diff` of the - entire source tree against upstream. Applied first. This is the **frozen baseline** - of all Red Bear work up to a known date. - -2. **Individual P-patches** (`P10-*.patch`, `P11-*.patch`, etc.) — granular, - single-purpose patches for new work done AFTER the mega-patch was generated. - Applied after the mega-patch, in listed order. - -The `recipe.toml` patches list looks like: -```toml -patches = [ - "redox.patch", # Layer 1: frozen baseline - "P10-rootfs-uuid-search-no-block.patch", # Layer 2: new work on top - "P11-init-noise-reduction.patch", # Layer 2: new work on top -] -``` - -#### The Discipline (MANDATORY) - -| Rule | Why | What happens if violated | -|------|-----|--------------------------| -| **NEVER regenerate `redox.patch` from a source tree that includes P-patches** | The mega-patch absorbs P-patch changes, making P-patches redundant. They then fail to apply ("Reversed or previously applied") on the next clean build. | P-patches conflict with their own changes inside the mega-patch. Build fails. | -| **New work always goes as P-patches AFTER the mega-patch** | Keeps the mega-patch frozen. Each P-patch is a small, reviewable delta. | Mixing changes into the mega-patch makes it a monolith with no logical structure. | -| **To regenerate `redox.patch`, first fold all P-patches into it, then remove them from `recipe.toml`** | Consolidation pass must be atomic — absorb and remove in one step. | Orphan P-patches in `recipe.toml` reference changes already in the mega-patch. | -| **P-patches MUST apply cleanly on top of the mega-patch-only state** | The build system applies patches sequentially: upstream → mega-patch → P-patches. | Build fails on clean fetch. | -| **Validate with `repo validate-patches` after ANY patch change** | Catches drift before it reaches the build. | Drift silently accumulates until the next clean build explodes. | - -#### How to Make a New Change (Correct Workflow) - -```bash -# 1. Source tree already has mega-patch + existing P-patches applied (working tree) -cd recipes/core/base/source - -# 2. Make your edit -vim init/src/main.rs - -# 3. Generate the patch against the current git HEAD (upstream rev) -git diff -U0 -w -- init/src/main.rs > ../../../local/patches/base/P-.patch - -# 4. Create symlink and wire into recipe.toml -cd ../../../recipes/core/base -ln -s ../../../local/patches/base/P-.patch P-.patch -# Add "P-.patch" to patches list in recipe.toml - -# 5. Validate and rebuild -cd ../../.. -./target/release/repo validate-patches base -CI=1 ./target/release/repo cook base-initfs -``` - -#### How to Consolidate (Periodic Maintenance) - -When P-patches accumulate and the mega-patch should absorb them: - -```bash -# 1. Source tree has mega-patch + all P-patches applied -cd recipes/core/base/source - -# 2. Generate NEW mega-patch from full diff -git diff -U0 -w > ../../../local/patches/base/redox.patch - -# 3. Remove ALL P-patches from recipe.toml patches list -# Keep P-patch FILES in local/patches/base/ for history — just remove from recipe.toml - -# 4. Validate -./target/release/repo validate-patches base - -# 5. Rebuild -CI=1 ./target/release/repo cook base-initfs -``` - -#### How NOT to Break Things - -| Action | Correct | WRONG | -|--------|---------|-------| -| Add new feature | Create P-patch, add after mega-patch in recipe.toml | Regenerate mega-patch from tree that includes P-patches | -| Fix a bug | Create P-patch | Edit mega-patch directly | -| Consolidate | Regenerate mega-patch, remove ALL P-patches from recipe.toml | Regenerate mega-patch but leave P-patches in recipe.toml | -| Update upstream | Provision new release, rebase mega-patch | Cherry-pick upstream commits into source tree | - -#### Root Cause of Past Failures - -The pattern that has recurred multiple times: - -1. Mega-patch generated at time T -2. P-patches added at time T+1, T+2, etc. -3. Someone regenerates mega-patch from source tree at T+3 (which includes P-patch changes) -4. Mega-patch now contains P-patch changes -5. P-patches still in `recipe.toml` try to re-apply their changes → conflicts -6. Build fails with "Reversed or previously applied" and hunk failures -7. Hours spent debugging why "patches that used to work" now fail - -**The fix is always the same**: either (a) remove the absorbed P-patches from `recipe.toml`, -or (b) regenerate the mega-patch from a tree WITHOUT P-patch changes. Option (a) is faster. - -### Large Patch Files (redox.patch) - -`local/patches/base/redox.patch` (consolidated mega-patch) is currently ~544K. -If it grows beyond a manageable size, it can be chunked under -`local/patches/base/redox-patch-chunks/` and reassembled by: -```bash -local/patches/base/reassemble-redox-patch.sh -``` - -### Patch Governance - -See `local/docs/PATCH-GOVERNANCE.md` for the full patch governance rules. -Critical rules: -- **Never remove patches** to fix build failures — rebase them -- **Never remove BINS entries** — fix the source or use `EXISTING_BINS` -- **Recipe.toml is git-tracked** — changes to it are durable -- **Source trees are disposable** — `repo clean`/`distclean` destroy them -- **All source changes must be patches** in `local/patches/` -- **Commit patch files and recipe.toml changes** before session end -- **NEVER regenerate mega-patch from a tree that includes P-patches** — see MEGA-PATCH DISCIPLINE above - -### Build Validation - -After ANY change to patches or `recipe.toml`: -1. Validate patches: `./target/release/repo validate-patches ` -2. Remove source: `rm -rf recipes/core//source` -3. Fetch: `repo --allow-protected fetch ` -4. Build: `repo cook ` -5. Verify no `FAILED`, `[ATOMIC] patch application rolled back`, or `.rej` files -6. Full image: `make all CONFIG_NAME=` - -The `repo validate-patches` command (added 2026-05) performs a dry-run patch -application against clean upstream source in a temporary staging directory. -It reports per-patch `[PASS]`/`[FAIL]` status without modifying the live source -tree. Always run it before attempting a full build when patches have changed. - -## PATCH MANAGEMENT - -All Red Bear OS modifications to upstream files are kept separately in `local/patches/`. - -This is not just a convenience rule; it is a long-term maintenance rule. For fast-moving upstream -areas like relibc, prefer the upstream solution whenever upstream already solves the same problem. -Keep Red Bear patch carriers only for gaps or compatibility work that upstream still does not solve -adequately. - -When upstream Redox already provides a package, crate, or subsystem for functionality that also -exists in Red Bear local code, prefer the upstream Redox version by default unless the Red Bear -implementation is materially better. Do not grow lower-quality in-house duplicates as a steady -state. - -For quirks and driver support specifically: - -- prefer improving and using the canonical `redox-driver-sys` path, -- avoid maintaining separate lower-quality quirk engines when the same functionality belongs in - `redox-driver-sys`, -- if duplication is temporarily unavoidable, treat it as convergence work to remove, not as a - permanent design. - -### Structure - -``` -local/patches/ -├── kernel/redox.patch # Applied to kernel source during build (symlinked from recipe) -├── kernel/P0-*.patch # Individual logical patches (for reference/merge) -├── base/redox.patch # Applied to base source during build (symlinked from recipe) -├── base/P0-*.patch # Individual logical patches -├── relibc/P3-*.patch # POSIX gap patches (eventfd, signalfd, timerfd, etc.) -├── installer/redox.patch # Installer ext4 + GRUB bootloader support -└── build-system/ - ├── 001-rebrand-and-build.patch # Makefile, mk/*, scripts, build.sh rebranding - ├── 002-cookbook-fixes.patch # src/ Rust fixes (fetch.rs, staged_pkg.rs, repo.rs, html.rs) - ├── 003-config.patch # config/*.toml changes (os-release, hostname, redbear-full) - └── 004-docs-and-cleanup.patch # README, CONTRIBUTING, LICENSE, deleted upstream files -``` - -### Protection Mechanism - -1. **Recipe patches** (`kernel/redox.patch`, `base/redox.patch`): Canonical copy lives in - `local/patches/`. The recipe directory contains a **symlink** to it: - ``` - recipes/core/kernel/redox.patch → ../../../local/patches/kernel/redox.patch - recipes/core/base/redox.patch → ../../../local/patches/base/redox.patch - ``` - The build system follows symlinks transparently. Patches are never touched by `make clean` - or `make distclean`. Only `local/` modifications affect them. - -2. **Build-system patches**: Generated via `git diff` against the upstream base commit. - These serve as a backup — the working tree already has patches applied (via git commits). - If upstream update via rebase fails, these can be applied from scratch. - -3. **Custom recipes**: Live entirely in `local/recipes/` with symlinks into `recipes/`: - ``` - recipes/drivers/linux-kpi → ../../local/recipes/drivers/linux-kpi - recipes/gpu/amdgpu → ../../local/recipes/gpu/amdgpu - recipes/system/firmware-loader → ../../local/recipes/system/firmware-loader - ... etc - ``` - -### Scripts - -| Script | Purpose | -|--------|---------| -| `local/scripts/apply-patches.sh` | Apply all build-system patches + create recipe symlinks | -| `local/scripts/provision-release.sh` | Provision new release from Redox ref + archive sources | -| `local/scripts/check-upstream-releases.sh` | Check for new Redox snapshots (read-only) | - -### Release Model (Fork) - -Red Bear OS is a full fork based on frozen Redox snapshots. Sources are immutable -and never auto-immutable archived. The current baseline is 0.1.0. - -```bash -# Check for newer Redox snapshots (read-only, zero side effects): -./local/scripts/check-upstream-releases.sh - -# Provision a new release (explicit, human-initiated only): -./local/scripts/provision-release.sh --ref= --release=0.2.0 --dry-run -``` ## AMD-FIRST INTEGRATION PATH diff --git a/Makefile b/Makefile index 8b481f2095..afc3da0ba2 100644 --- a/Makefile +++ b/Makefile @@ -230,6 +230,15 @@ wireshark: FORCE packages-sync: ; @bash local/scripts/sync-packages.sh packages-list: ; @ls -la Packages/*.pkgar 2>/dev/null | wc -l && echo "pkgar files in Packages/" validate-patches: - @bash local/scripts/validate-patches.sh + @echo "validate-patches has been removed. Source is now directly owned in local/sources/." + @echo "Run 'make validate-sources' to verify fork repos." +validate-sources: + @for d in local/sources/kernel local/sources/relibc local/sources/base local/sources/bootloader local/sources/installer; do \ + if [ -d "$$d/.git" ]; then \ + echo "$$d: $(shell git -C $$d rev-list --count HEAD 2>/dev/null || echo 0) commits, $(shell git -C $$d ls-files 2>/dev/null | wc -l) files"; \ + else \ + echo "$$d: MISSING — run local/scripts/create-forks.sh"; \ + fi; \ + done cascade.%: FORCE @bash local/scripts/rebuild-cascade.sh $(basename $(subst cascade,, $*)) diff --git a/local/docs/PATCH-GOVERNANCE.md b/local/docs/PATCH-GOVERNANCE.md deleted file mode 100644 index 9d35636782..0000000000 --- a/local/docs/PATCH-GOVERNANCE.md +++ /dev/null @@ -1,143 +0,0 @@ -# Red Bear OS Patch Governance - -## Purpose - -This document prevents loss of implemented work. It establishes rules that AI agents -and human contributors must follow when modifying patches, recipes, or build configs. - -## Incident: 2026-04-26 Driver Code Loss - -A previous agent session removed 8 patches and 9 BINS entries from -`recipes/core/base/recipe.toml` to make the build succeed, instead of fixing -patch conflicts. This deleted GPIO/I2C/UCSI driver source code that took a full -day to implement (commits `dc3f1f996`, `3054adc5d`). - -The code was recovered from git history, but this must never happen again. - -## Rules - -### 0. MEGA-PATCH + P-PATCH DISCIPLINE (HIGHEST PRIORITY) - -Each patched component (base, kernel, relibc) uses a two-layer patch model: - -- **`redox.patch`** (the mega-patch) — frozen baseline of all Red Bear work. Applied first. -- **`P-.patch`** (individual patches) — new work done AFTER the mega-patch. Applied after. - -**The single rule that prevents the most build failures:** - -> **NEVER regenerate `redox.patch` from a source tree that includes P-patch changes.** - -If the source tree has P-patches applied (visible in `git status --short` or in the recipe.toml -patches list after `redox.patch`), then `git diff` from that tree will absorb the P-patches into -the mega-patch. The P-patches will then fail to apply on the next clean build because their -changes are already in the mega-patch. - -**Correct operations:** - -| Operation | How | -|-----------|-----| -| Add new change | Create a new P-patch, add it after `redox.patch` in `recipe.toml` | -| Consolidate P-patches into mega-patch | Generate new `redox.patch` from full source tree, then **remove all P-patches from `recipe.toml`** in the same commit | -| Fix a bug in a P-patch | Create a new P-patch that fixes it (or regenerate just that P-patch) | - -**Wrong operations (causes build failures):** - -| Wrong operation | What breaks | -|-----------------|-------------| -| Regenerate mega-patch from tree with P-patches, leave P-patches in recipe.toml | P-patches try to re-apply changes already in mega-patch → "Reversed or previously applied" | -| Edit mega-patch by hand | Line counts go wrong, hunks fail, impossible to debug | -| Remove P-patches from recipe.toml without folding into mega-patch | Changes are lost entirely | - -**Incident log:** - -| Date | What happened | Root cause | Fix | -|------|---------------|-----------|-----| -| 2026-05-29 | `validate-patches base` showed mega-patch with 100+ hunk failures, P10/P11/P12 also failing | Mega-patch was regenerated from a source tree that included P-patch changes. Individual P-patches touched same files (`init/src/main.rs`) as mega-patch, causing overlap. | P10/P11/P12 are genuinely new work on top of the mega-patch (not absorbed). The validation failure was from the mega-patch itself being stale for some hunks. Fix: regenerate mega-patch from a clean mega-patch-only tree, then re-apply P-patches. | - -### 1. Never remove patches to fix build failures - -When a patch fails to apply: - -- **Rebase the patch** against the current cumulative state -- **Fix the context lines** so the hunk applies cleanly -- **Split the patch** if only some hunks fail (keep the working hunks) -- **Document** the failure reason in the patch file header - -Do NOT remove the patch from the recipe.toml patches list without explicit -user approval. If a patch must be temporarily disabled, comment it with a TODO -explaining why and what needs to be fixed. - -### 2. Never remove BINS entries to fix build failures - -When a driver binary fails to compile: - -- **Fix the compilation error** in the driver source -- **Add the driver to EXISTING_BINS** filter if source is incomplete -- **Document** the failure - -Do NOT remove the driver from the BINS array without explicit user approval. - -### 3. Patch ordering matters - -Patches in `recipes/core/base/recipe.toml` must be applied in the listed order. -Some patches have interdependencies: - -- `P2-acpi-i2c-resources.patch` must apply before `P2-daemon-hardening.patch` - (workspace entries reference source files created by the former) -- `P2-boot-runtime-fixes.patch` modifies hwd/acpi.rs (must apply cleanly to upstream) -- `P2-init-acpid-wiring.patch` adds 41_acpid.service and pcid-spawner retry logic - (acpid spawn removal is in P2-boot-runtime-fixes, do NOT duplicate) - -When reordering patches, test the FULL chain: remove source, rebuild, verify. - -### 4. Recipe.toml is tracked, source trees are not - -`recipes/core/base/recipe.toml` is git-tracked. Changes to it are durable. -`recipes/core/base/source/` is a fetched working copy — destroyed by `make clean`, -`make distclean`, source immutable archived, and provision-release. - -Any change to source/ MUST be preserved as a patch in `local/patches/base/`. - -### 5. Before removing anything, check git history - -```bash -git log --oneline --all -- -``` - -If a previous commit added substantial work (driver implementations, features), -the removal MUST be approved by the user. Agent sessions MUST NOT delete -implemented work to bypass build failures. - -### 6. Build validation after patch changes - -After ANY change to the patches list or patch files: - -1. Remove the source tree: `rm -rf recipes/core/base/source` -2. Full rebuild: `REDBEAR_ALLOW_PROTECTED_FETCH=1 CI=1 make r.base` -3. Verify NO "FAILED" or "rejects" in output -4. Verify all expected binaries in stage: `ls stage/usr/bin/ stage/usr/lib/drivers/` -5. Full image build: `CI=1 make all CONFIG_NAME=redbear-full` - -## Known Issues - -| Patch | Status | Notes | -|-------|--------|-------| -| P2-acpid-core-refactor.patch | Needs rebasing | 13/15 hunks fail on acpid/scheme.rs; removed from recipe.toml with TODO | -| P2-acpi-i2c-resources.patch | Recovered & rebased → P2-i2c-gpio-ucsi-drivers.patch | Original couldn't apply to current source revision; extracted driver sources, fixed PCI API calls (try_mem→map_bar, try_map_bar→map_bar), regenerated as P2-i2c-gpio-ucsi-drivers.patch (5938 lines, 32 files) | -| P2-boot-runtime-fixes.patch | Needs rebasing | Context lines from monolith split are stale; hwd/acpi.rs hunk fails on clean upstream | -| P2-init-acpid-wiring.patch | Deduplicated | Removed acpi.rs hunk that duplicated P2-boot-runtime-fixes | - -## Recipe.toml Fix Log - -| Date | Change | Why | -|------|--------|-----| -| 2026-04-30 | Recovered I2C/GPIO/UCSI drivers | P2-acpi-i2c-resources.patch couldn't apply; regenerated as P2-i2c-gpio-ucsi-drivers.patch (5938 lines, 12 drivers: gpiod, i2cd, amd-mp2-i2cd, dw-acpi-i2cd, intel-lpss-i2cd, i2c-interface, intel-gpiod, i2c-gpio-expanderd, i2c-hidd, intel-thc-hidd, ucsid, acpi-resource) | -| 2026-04-30 | Fixed amd-mp2-i2cd PCI API | .try_mem() removed from PciBar; replaced with PciFunctionHandle::map_bar(0) | -| 2026-04-30 | Fixed intel-thc-hidd PCI API | .try_map_bar() removed from PciFunctionHandle; replaced with .map_bar(0) | -| 2026-04-30 | Added P0-bootstrap-workspace-fix.patch | [workspace] in bootstrap Cargo.toml prevents parent workspace auto-detection; fixes base-initfs from-scratch build | -| 2026-04-30 | Added symlinks to integrate-redbear.sh | P0-bootstrap-workspace-fix.patch and P2-i2c-gpio-ucsi-drivers.patch symlinks now auto-created | -| 2026-04-26 | Restored 8 removed patches | Agent deleted them to bypass conflicts; restored all from git HEAD | -| 2026-04-26 | Restored 9 BINS entries | Agent deleted i2cd, gpiod, ucsid, etc. to bypass missing sources | -| 2026-04-26 | Added EXISTING_BINS grep loop | Gracefully handles missing driver source instead of build failure | -| 2026-05-29 | Added P12-init-fix-init-debug-import.patch | P11 introduced `init_debug` calls but forgot to import `init_debug` — `use crate::color::{init_error, init_warn, ...}` missing `init_debug`. Build error: `cannot find function init_debug in this scope`. | -| 2026-05-29 | Documented mega-patch discipline (Rule 0) | Recurring patch corruption caused by regenerating mega-patch from trees that include P-patches. Created Rule 0 in PATCH-GOVERNANCE.md and updated AGENTS.md. | diff --git a/local/docs/SOURCE-OWNERSHIP-MODEL.md b/local/docs/SOURCE-OWNERSHIP-MODEL.md new file mode 100644 index 0000000000..db931529e3 --- /dev/null +++ b/local/docs/SOURCE-OWNERSHIP-MODEL.md @@ -0,0 +1,89 @@ +# Red Bear OS Source Ownership Model + +**Effective:** 2026-06 (migrated from patch-based build system) +**Replaces:** PATCH-GOVERNANCE.md, AGENTS.md patch sections + +## What Changed + +Red Bear OS migrated from a patch-based build system to direct source ownership. +Previously, we maintained upstream Redox source + 341 patch files applied at build +time. Now, we maintain our own git forks of every component under `local/sources/`. + +The source IS the source. No patches. No indirection. Edit, build, commit. + +## Where Source Lives + +| Component | Fork Location | +|---|---| +| Kernel | `local/sources/kernel/` | +| C library (relibc) | `local/sources/relibc/` | +| Userspace drivers (base) | `local/sources/base/` | +| Bootloader | `local/sources/bootloader/` | +| Installer | `local/sources/installer/` | +| RedoxFS | `local/sources/redoxfs/` | +| User utilities | `local/sources/userutils/` | + +Additional components have individual forks as needed. Each fork is a git +repository initialized from the frozen Redox 0.1.0 baseline with all Red Bear +modifications applied as the initial commit. + +## Daily Workflow + +### Make a change +```bash +vim local/sources/relibc/src/header/sys_signalfd/mod.rs +./target/release/repo cook relibc +make qemu CONFIG_NAME=redbear-mini +git -C local/sources/relibc commit -m "relibc: fix signalfd edge case" +``` + +### Integrate upstream improvements +Upstream Redox is a reference. When they improve something you want: + +```bash +cd local/sources/relibc +git remote add upstream https://gitlab.redox-os.org/redox-os/relibc.git +git fetch upstream +git log upstream/main --not main --oneline +# Read each interesting commit. Understand it. Port manually. +git commit -m "relibc: port upstream fix (ref: redox )" +``` + +### Release +Tag each component repo with the release version: +```bash +git -C local/sources/kernel tag v0.2.3 +git -C local/sources/relibc tag v0.2.3 +git -C local/sources/base tag v0.2.3 +# Build from tags +``` + +## Why This Is Better + +| Before (Patches) | After (Source Ownership) | +|---|---| +| 341 .patch files to manage | 0 patches. History in git. | +| 5-step edit cycle (edit → diff → save → wire → validate → build) | 2-step (edit → build) | +| New developers must learn patch system | Standard git workflow | +| make clean could destroy unpatched work | Work lives in git repos | +| Mega-patch corruption and hunk failures | Git merge conflicts (standard, tool-supported) | +| ~5,000 words of patch documentation | ~300 words of source model documentation | + +## Historical Note + +The old patch files in `local/patches/` are preserved as historical reference. +Each patch was converted into the initial commit of its corresponding fork repo. +To trace a change: `git log local/sources/base/` — commit messages reference the +original patch filenames. + +## Recipe Configuration + +Recipes that use Red Bear forks configure their source as a local path: + +```toml +[source] +path = "../../../local/sources/base" +``` + +Recipes for non-forked packages (upstream libraries, tools) use standard git +or tar sources without patches — the source is fetched directly. diff --git a/local/scripts/integrate-redbear.sh b/local/scripts/integrate-redbear.sh index a3d7023583..7b37b5108b 100755 --- a/local/scripts/integrate-redbear.sh +++ b/local/scripts/integrate-redbear.sh @@ -169,52 +169,26 @@ symlink "../../../../local/recipes/wayland/qt6-wayland-smoke" "recipes/wip/wayla status "Custom recipe symlinks ready (${linked_count} linked, ${skipped_count} skipped)" echo "" -section "Ensuring recipe patch symlinks..." +section "Validating local source forks..." -# Auto-discover patches from local/patches// and create/refresh -# symlinks in the corresponding recipe directories. This replaces the -# previous hardcoded-per-patch approach which went stale whenever patches -# were reorganized (e.g. moved to absorbed/ subdirectories). - -declare -A PATCH_COMPONENT_TO_RECIPE=( - [kernel]="recipes/core/kernel" - [base]="recipes/core/base" - [relibc]="recipes/core/relibc" - [bootloader]="recipes/core/bootloader" - [installer]="recipes/core/installer" - [userutils]="recipes/core/userutils" +declare -A SOURCE_COMPONENTS=( + [kernel]="local/sources/kernel" + [relibc]="local/sources/relibc" + [base]="local/sources/base" + [bootloader]="local/sources/bootloader" + [installer]="local/sources/installer" ) -linked=0 -skipped=0 - -for component in "${!PATCH_COMPONENT_TO_RECIPE[@]}"; do - recipe_dir="${PATCH_COMPONENT_TO_RECIPE[$component]}" - [ -d "$recipe_dir" ] || continue - - patch_dir="local/patches/${component}" - - # Collect all .patch files from the component dir (skip absorbed/ subdirs). - find "$patch_dir" -maxdepth 1 -name "*.patch" -type f 2>/dev/null | while read patch_file; do - patch_name="$(basename "$patch_file")" - - # Resolve the relative path from recipe dir to patch file. - # recipe_dir is e.g. recipes/core/base (2 levels deep) - # patch_file is e.g. local/patches/base/absorbed/P0-foo.patch - # We need to go up from recipe_dir to repo root, then into local/patches/... - # For recipes/core/base → ../../.. → repo root → local/patches/base/absorbed/... - # Number of directory components = slashes + 1 - depth=$(($(echo "$recipe_dir" | tr -cd '/' | wc -c) + 1)) - up="" - for ((i=0; i/ - "../../../local/patches/kernel/P23-sys-msr-scheme.patch", - # P25: Comprehensive cpuidle framework with deep C-states (C1-C7) - "../../../local/patches/kernel/P25-cpuidle-deep-cstates.patch", - # P26: DebugDisplay proper scrolling — ptr::copy rows up instead of wrapping to top - "../../../local/patches/kernel/P26-debug-display-scroll.patch", - # P27: Capability bitmask — replace uid==0 checks with has_cap() capability model - "../../../local/patches/kernel/P27-capability-bitmask.patch", -] +path = "../../../local/sources/kernel" [build] template = "custom" diff --git a/recipes/core/kernel/redbear-consolidated.patch b/recipes/core/kernel/redbear-consolidated.patch deleted file mode 120000 index edb5b32a65..0000000000 --- a/recipes/core/kernel/redbear-consolidated.patch +++ /dev/null @@ -1 +0,0 @@ -../../../local/patches/kernel/redbear-consolidated.patch \ No newline at end of file diff --git a/recipes/core/kernel/redox.patch b/recipes/core/kernel/redox.patch deleted file mode 120000 index d14c739efe..0000000000 --- a/recipes/core/kernel/redox.patch +++ /dev/null @@ -1 +0,0 @@ -../../../local/patches/kernel/redox.patch \ No newline at end of file diff --git a/recipes/core/redoxfs/recipe.toml b/recipes/core/redoxfs/recipe.toml index 5d7ddb1159..8e97ec7842 100644 --- a/recipes/core/redoxfs/recipe.toml +++ b/recipes/core/redoxfs/recipe.toml @@ -1,6 +1,5 @@ [source] -git = "https://gitlab.redox-os.org/redox-os/redoxfs.git" -patches = ["P2-readonly-live-media-open.patch", "P3-uuid-retry.patch"] +path = "../../../local/sources/redoxfs" [build] template = "custom" diff --git a/recipes/core/relibc/P10-stack-size-8mb.patch b/recipes/core/relibc/P10-stack-size-8mb.patch deleted file mode 120000 index 8287de0237..0000000000 --- a/recipes/core/relibc/P10-stack-size-8mb.patch +++ /dev/null @@ -1 +0,0 @@ -../../../local/patches/relibc/P10-stack-size-8mb.patch \ No newline at end of file diff --git a/recipes/core/relibc/P11-getrlimit-getrusage.patch b/recipes/core/relibc/P11-getrlimit-getrusage.patch deleted file mode 120000 index 8b0522455f..0000000000 --- a/recipes/core/relibc/P11-getrlimit-getrusage.patch +++ /dev/null @@ -1 +0,0 @@ -../../../local/patches/relibc/P11-getrlimit-getrusage.patch \ No newline at end of file diff --git a/recipes/core/relibc/P3-bits-eventfd-mod.patch b/recipes/core/relibc/P3-bits-eventfd-mod.patch deleted file mode 120000 index 083d65e3a3..0000000000 --- a/recipes/core/relibc/P3-bits-eventfd-mod.patch +++ /dev/null @@ -1 +0,0 @@ -../../../local/patches/relibc/P3-bits-eventfd-mod.patch \ No newline at end of file diff --git a/recipes/core/relibc/P3-bits-eventfd.patch b/recipes/core/relibc/P3-bits-eventfd.patch deleted file mode 120000 index ab518c9b1c..0000000000 --- a/recipes/core/relibc/P3-bits-eventfd.patch +++ /dev/null @@ -1 +0,0 @@ -../../../local/patches/relibc/P3-bits-eventfd.patch \ No newline at end of file diff --git a/recipes/core/relibc/P3-eventfd-cbindgen.patch b/recipes/core/relibc/P3-eventfd-cbindgen.patch deleted file mode 120000 index e626c9ee8a..0000000000 --- a/recipes/core/relibc/P3-eventfd-cbindgen.patch +++ /dev/null @@ -1 +0,0 @@ -../../../local/patches/relibc/P3-eventfd-cbindgen.patch \ No newline at end of file diff --git a/recipes/core/relibc/P3-eventfd-impl.patch b/recipes/core/relibc/P3-eventfd-impl.patch deleted file mode 120000 index 3396b6f877..0000000000 --- a/recipes/core/relibc/P3-eventfd-impl.patch +++ /dev/null @@ -1 +0,0 @@ -../../../local/patches/relibc/P3-eventfd-impl.patch \ No newline at end of file diff --git a/recipes/core/relibc/P3-sys-types-stdint-include.patch b/recipes/core/relibc/P3-sys-types-stdint-include.patch deleted file mode 120000 index 211e564a23..0000000000 --- a/recipes/core/relibc/P3-sys-types-stdint-include.patch +++ /dev/null @@ -1 +0,0 @@ -../../../local/patches/relibc/P3-sys-types-stdint-include.patch \ No newline at end of file diff --git a/recipes/core/relibc/recipe.toml b/recipes/core/relibc/recipe.toml index 38d0f22449..aca0b76cda 100644 --- a/recipes/core/relibc/recipe.toml +++ b/recipes/core/relibc/recipe.toml @@ -1,105 +1,5 @@ [source] -git = "https://gitlab.redox-os.org/redox-os/relibc.git" -rev = "861bbb0" -patches = [ - "P3-eventfd-mod.patch", - # Add pub mod bits_eventfd to header/mod.rs - "P3-bits-eventfd-mod.patch", - # bits_eventfd module (eventfd_t type) - "P3-bits-eventfd.patch", - # sys_eventfd module — FULL eventfd() implementation (opens /scheme/event/eventfd) - "P3-eventfd-impl.patch", - # cbindgen.toml for sys/eventfd.h C header generation - "P3-eventfd-cbindgen.patch", - # eventfd_read() and eventfd_write() helpers - "P3-eventfd-readwrite.patch", - # sys_signalfd module (cbindgen.toml + mod.rs with cbindgen exports) - "P3-signalfd-header.patch", - # signalfd implementation (signal/signalfd.rs + signal/mod.rs wiring) - "P3-signalfd.patch", - # sys_timerfd module (creates mod.rs with timerfd_create/settime/gettime) - "P3-timerfd-impl.patch", - # timerfd: creates cbindgen.toml, reformats, adds relative time handling - "P3-timerfd-relative.patch", - # timerfd: fix cbindgen.toml to generate C (not C++) headers - "P3-timerfd-cbindgen-fix.patch", - - # REMOVED: P3-sys-types-stdint-include.patch — upstream already has - # sys_includes = ["stddef.h"] (no stdint.h). Adding stdint.h here creates - # a circular include chain with gnulib: - # gnulib stdint.h → inttypes.h → wchar.h → stdio.h → sys/types.h → - # sys/types/internal.h → stdint.h → cycle - # Headers needing stdint.h include it directly (signal.h, signalfd.h, eventfd.h). - - # open_memstream: single-patch implementation in stdio/mod.rs - "P3-open-memstream.patch", - # F_DUPFD_CLOEXEC fallback (try CLOEXEC, fall back to DUPFD + SETFD) - "P3-fcntl-dupfd-cloexec.patch", - # Non-conflicting individual patches - "P3-elf64-types.patch", - "P3-clock-nanosleep.patch", - "P3-exec-root-bypass.patch", - "P3-secure-getenv.patch", - "P3-getentropy.patch", - "P3-dup3.patch", - "P3-waitid-header.patch", - "P3-waitid.patch", - "P3-in6-pktinfo.patch", - "P3-inet6-pton-ntop.patch", - "P3-tcp-nodelay.patch", - "P3-tcp-sockopt-forward.patch", - # Named POSIX semaphores (sem_open/close/unlink) — comprehensive + refcount + va_list - "P3-semaphore-comprehensive.patch", - # semaphore.h: expose SEM_FAILED and real variadic sem_open() prototype/ABI - "P3-semaphore-varargs-header.patch", - # Reverse From<&syscall::TimeSpec> for timespec (needed by getrusage) - "P3-timespec-reverse-from.patch", - "P10-stack-size-8mb.patch", - "P11-getrlimit-getrusage.patch", - # Move #include after size_t/ptrdiff_t typedefs in stddef.h - # to prevent recursive include chain (stdint.h → sys/types.h → pthread.h) - # from seeing undefined size_t when gnulib wrappers are present - "P3-stddef-reorder.patch", - # ld.so: parse DT_RPATH in addition to DT_RUNPATH (RUNPATH takes precedence per gABI) - "P3-ldso-rpath-support.patch", - - # signal.h cbindgen: expose stdint types to downstream consumers - "P3-signal-stdint-include.patch", - # spawn.h implementation (new header module) - "P3-spawn.patch", - # spawn: wire pub mod spawn into header/mod.rs - "P3-spawn-module-wire.patch", - # spawn: posix_spawnattr_setflags, posix_spawnattr_setsigmask + getters - "P3-spawn-setflags-setsigmask.patch", - # C11 threads.h compatibility header - "P3-threads.patch", - # stdio_ext: __freadahead, __fpending, __fseterr helpers - "P3-stdio-fseterr.patch", - # locale: getlocalename_l function - "P3-locale-getlocalename-l.patch", - # SysV IPC foundation (key_t, ipc_perm, IPC_* constants, sys/ipc.h header) - "P3-sysv-ipc.patch", - # SysV semaphore implementation (semget/semop/semctl) - "P3-sysv-sem-impl.patch", - # SysV shared memory implementation (shmget/shmat/shmdt/shmctl) - "P3-sysv-shm-impl.patch", - # IPC tests (semaphore/shm) - "P3-ipc-tests.patch", - # ST_RDONLY/ST_NOSUID constants for statvfs (POSIX) - "P3-statvfs-constants.patch", - "P3-ld-so-usr-lib-search-path.patch", - # Remove relibc's DRM ioctl handler — libdrm's redox_drm_simple_ioctl() - # handles all DRM ioctls with its own scheme:drm wire format. - "P5-remove-drm-ioctl-intercept.patch", - - # Break gnulib circular include chain: inttypes.h → wchar.h conditional guard - "P3-inttypes-wchar-guard.patch", - # Break gnulib circular include chain: wchar.h forward-declare FILE/tm instead - # of including stdio.h/time.h - "P3-wchar-forward-decls.patch", - # stdlib: getloadavg() — returns -1 (load average not available on Redox) - "P3-getloadavg.patch", -] +path = "../../../local/sources/relibc" [build] template = "custom" diff --git a/recipes/core/relibc/redox.patch b/recipes/core/relibc/redox.patch deleted file mode 120000 index 3a8274b58e..0000000000 --- a/recipes/core/relibc/redox.patch +++ /dev/null @@ -1 +0,0 @@ -../../../local/patches/relibc/absorbed/redox.patch \ No newline at end of file diff --git a/recipes/core/userutils/P4-login-rate-limit.patch b/recipes/core/userutils/P4-login-rate-limit.patch deleted file mode 120000 index 40dc0ca596..0000000000 --- a/recipes/core/userutils/P4-login-rate-limit.patch +++ /dev/null @@ -1 +0,0 @@ -../../../local/patches/base/P4-login-rate-limit.patch \ No newline at end of file diff --git a/recipes/core/userutils/recipe.toml b/recipes/core/userutils/recipe.toml index 9a4ffa0b5f..65f468be70 100644 --- a/recipes/core/userutils/recipe.toml +++ b/recipes/core/userutils/recipe.toml @@ -1,6 +1,5 @@ [source] -git = "https://gitlab.redox-os.org/redox-os/userutils.git" -patches = ["P5-redbear-branding.patch", "P6-login-privilege-drop.patch", "P7-login-diagnostics.patch", "P8-login-proc-fd.patch"] +path = "../../../local/sources/userutils" [build] template = "custom" diff --git a/recipes/core/uutils/recipe.toml b/recipes/core/uutils/recipe.toml index d218bdf06e..96ab756055 100644 --- a/recipes/core/uutils/recipe.toml +++ b/recipes/core/uutils/recipe.toml @@ -4,9 +4,6 @@ [source] git = "https://github.com/uutils/coreutils" rev = "1f7c81f5d2d3e56c518349c0392158871a1ea9ec" -patches = [ - "redox.patch" -] [build] template = "custom" diff --git a/recipes/dev/fontconfig/recipe.toml b/recipes/dev/fontconfig/recipe.toml index 1726f3bc5f..08715e4b14 100644 --- a/recipes/dev/fontconfig/recipe.toml +++ b/recipes/dev/fontconfig/recipe.toml @@ -1,9 +1,6 @@ [source] tar = "https://www.freedesktop.org/software/fontconfig/release/fontconfig-2.16.0.tar.xz" blake3 = "5c95d48f5b9150f4a06d8acac12c25edaac956007df95a3bf527df02a5908f0e" -patches = [ - "redox.patch" -] [build] template = "meson" dependencies = [ diff --git a/recipes/dev/git/recipe.toml b/recipes/dev/git/recipe.toml index 043f88f4aa..1eb2ba9e50 100644 --- a/recipes/dev/git/recipe.toml +++ b/recipes/dev/git/recipe.toml @@ -1,7 +1,6 @@ [source] tar = "https://www.kernel.org/pub/software/scm/git/git-2.13.1.tar.xz" blake3 = "bc78271bffd60c5b8b938d8c08fd74dc2de8d21fbaf8f8e0e3155436d9263f17" -patches = ["git.patch"] [build] dependencies=[ diff --git a/recipes/dev/luajit/recipe.toml b/recipes/dev/luajit/recipe.toml index b6d86974e3..77aef4e4ff 100644 --- a/recipes/dev/luajit/recipe.toml +++ b/recipes/dev/luajit/recipe.toml @@ -1,7 +1,6 @@ [source] git = "https://luajit.org/git/luajit.git" rev = "a4f56a459a588ae768801074b46ba0adcfb49eb1" -patches = ["redox.patch"] [build] template = "custom" script = """ diff --git a/recipes/dev/patch/recipe.toml b/recipes/dev/patch/recipe.toml index 3e4cadbc2f..cf83db2565 100644 --- a/recipes/dev/patch/recipe.toml +++ b/recipes/dev/patch/recipe.toml @@ -1,11 +1,6 @@ [source] tar = "https://ftp.gnu.org/gnu/patch/patch-2.7.6.tar.xz" blake3 = "d46d14c12aa4ea51e356bf92091c368fd871e1d770b94bc29027886737aecd5f" -patches = [ - "01_no_rlimit.patch", - "02_no_chown.patch", - "03_renameat2.patch", -] script = """ wget -O build-aux/config.sub "https://gitlab.redox-os.org/redox-os/gnu-config/-/raw/master/config.sub?inline=false" autoreconf diff --git a/recipes/dev/php84/recipe.toml b/recipes/dev/php84/recipe.toml index 21ca76e411..472c5f34b0 100644 --- a/recipes/dev/php84/recipe.toml +++ b/recipes/dev/php84/recipe.toml @@ -1,9 +1,6 @@ [source] tar = "https://www.php.net/distributions/php-8.4.17.tar.xz" blake3 = "a8478dddd948d4b26e51c5727ac0895440da76e8ad9be947098a4284ca0b7f2a" -patches = [ - "redox.patch" -] [build] template = "custom" diff --git a/recipes/dev/python312/recipe.toml b/recipes/dev/python312/recipe.toml index 5e5916c574..28667c57f0 100644 --- a/recipes/dev/python312/recipe.toml +++ b/recipes/dev/python312/recipe.toml @@ -1,9 +1,6 @@ [source] tar = "https://www.python.org/ftp/python/3.12.12/Python-3.12.12.tar.xz" blake3 = "29636fdae3e0ee8d0fe585e528c9376fe43876f5f3f0f7892140567946fd907b" -patches = [ - "redox.patch" -] [build] template = "custom" diff --git a/recipes/dev/rustpython/recipe.toml b/recipes/dev/rustpython/recipe.toml index bbed445a6f..92886f39db 100644 --- a/recipes/dev/rustpython/recipe.toml +++ b/recipes/dev/rustpython/recipe.toml @@ -3,9 +3,6 @@ git = "https://github.com/RustPython/RustPython" # newer rev requires 'bits/libc-header-start.h' for bindgen rev = "2025-10-13-main-51" shallow_clone = true -patches = [ - "redox.patch" -] [build] dependencies = [ diff --git a/recipes/emulators/dosbox/recipe.toml b/recipes/emulators/dosbox/recipe.toml index 02801a6fd5..1c439fd194 100644 --- a/recipes/emulators/dosbox/recipe.toml +++ b/recipes/emulators/dosbox/recipe.toml @@ -1,7 +1,6 @@ [source] tar = "https://sourceforge.net/projects/dosbox/files/dosbox/0.74-3/dosbox-0.74-3.tar.gz/download" blake3 = "8bc50ffdba20579fb3080a0dca32cb939c8a3c19259aed026482c6ac069b0007" -patches = ["01_redox.patch"] script = """ ./autogen.sh GNU_CONFIG_GET config.sub diff --git a/recipes/emulators/mednafen/recipe.toml b/recipes/emulators/mednafen/recipe.toml index bd51a37db4..d10cbf0d1e 100644 --- a/recipes/emulators/mednafen/recipe.toml +++ b/recipes/emulators/mednafen/recipe.toml @@ -1,9 +1,6 @@ [source] tar = "https://mednafen.github.io/releases/files/mednafen-1.29.0.tar.xz" blake3 = "c75c1044cdc9328b2349915a67972d6135c77eb53eb0d995788f22b7daacf79b" -patches = [ - "redox.patch", -] [build] template = "custom" diff --git a/recipes/emulators/mgba/recipe.toml b/recipes/emulators/mgba/recipe.toml index b61b7bd052..630e18289a 100644 --- a/recipes/emulators/mgba/recipe.toml +++ b/recipes/emulators/mgba/recipe.toml @@ -1,7 +1,6 @@ [source] tar = "https://github.com/mgba-emu/mgba/archive/0.10.5.tar.gz" blake3 = "a1b9e797a5058f5264d276805aef5643b7ea460916e491a0098ba32d87f1519e" -patches = ["redox.patch"] [build] dependencies = ["libiconv", "liborbital", "libpng", "pixman", "sdl1", "zlib"] diff --git a/recipes/emulators/scummvm/recipe.toml b/recipes/emulators/scummvm/recipe.toml index fe8b377b88..c93141e550 100644 --- a/recipes/emulators/scummvm/recipe.toml +++ b/recipes/emulators/scummvm/recipe.toml @@ -1,7 +1,6 @@ [source] tar = "https://downloads.scummvm.org/frs/scummvm/2.0.0/scummvm-2.0.0.tar.xz" blake3 = "02e6791fd43ad3cb4238c07d23350ca1459a0f692689e585dba1d46648f64327" -patches = ["redox.patch"] script = """ GNU_CONFIG_GET config.sub """ diff --git a/recipes/games/eduke32/recipe.toml b/recipes/games/eduke32/recipe.toml index 93f962bf28..75f6ed203a 100644 --- a/recipes/games/eduke32/recipe.toml +++ b/recipes/games/eduke32/recipe.toml @@ -1,7 +1,6 @@ [source] tar = "https://dukeworld.com/eduke32/synthesis/20181010-7067/eduke32_src_20181010-7067.tar.xz" blake3 = "b0b759fe9ca51849f42669e4832ae1ae1f9ad7938529769108f7cf6a6a176558" -patches = ["redox.patch"] [build] dependencies = [ diff --git a/recipes/games/neverball/recipe.toml b/recipes/games/neverball/recipe.toml index 1d7e333385..3dfc46ee50 100644 --- a/recipes/games/neverball/recipe.toml +++ b/recipes/games/neverball/recipe.toml @@ -1,7 +1,6 @@ [source] tar = "https://neverball.org/neverball-1.6.0.tar.gz" blake3 = "74f3b68595f475e89fd2ca8b5fc349837ff36fbbe141f321dfc232dbf8fccf51" -patches = ["redox.patch"] [build] dependencies = [ diff --git a/recipes/games/openttd/recipe.toml b/recipes/games/openttd/recipe.toml index a3b352457b..638046297b 100644 --- a/recipes/games/openttd/recipe.toml +++ b/recipes/games/openttd/recipe.toml @@ -3,7 +3,6 @@ git = "https://github.com/OpenTTD/OpenTTD.git" #TODO: fix issues with this: branch = "release/1.8" rev = "231402fb4bea0a0d6a16cef90764d9e7aa699c53" shallow_clone = true -patches = ["redox.patch"] [build] template = "custom" diff --git a/recipes/games/opentyrian/recipe.toml b/recipes/games/opentyrian/recipe.toml index 3f9fbfb5ea..98e0a19f66 100644 --- a/recipes/games/opentyrian/recipe.toml +++ b/recipes/games/opentyrian/recipe.toml @@ -9,7 +9,6 @@ [source] git = "https://github.com/opentyrian/opentyrian" -patches = [ "redox.patch" ] [build] template = "custom" diff --git a/recipes/gui/orbutils/redox.patch b/recipes/gui/orbutils/redox.patch deleted file mode 120000 index e5d6e3073c..0000000000 --- a/recipes/gui/orbutils/redox.patch +++ /dev/null @@ -1 +0,0 @@ -../../../local/patches/orbutils/redox.patch \ No newline at end of file diff --git a/recipes/libs/cairo/recipe.toml b/recipes/libs/cairo/recipe.toml index 47b1d5ebdb..f0a07236ff 100644 --- a/recipes/libs/cairo/recipe.toml +++ b/recipes/libs/cairo/recipe.toml @@ -1,7 +1,6 @@ [source] tar = "https://www.cairographics.org/releases/cairo-1.18.4.tar.xz" blake3 = "b9fa14e02f85ec4e72396c62236c98502d04dbbdf8daf01ab9557a1c7aa7106e" -patches = ["redox.patch"] [build] dependencies = [ diff --git a/recipes/libs/ffmpeg6/recipe.toml b/recipes/libs/ffmpeg6/recipe.toml index 09f8283435..d090c9b906 100644 --- a/recipes/libs/ffmpeg6/recipe.toml +++ b/recipes/libs/ffmpeg6/recipe.toml @@ -1,10 +1,6 @@ [source] tar = "https://ffmpeg.org/releases/ffmpeg-6.0.tar.xz" blake3 = "4879074c357102f85932673044c57c144b0c188ae58edec2a115965536ee340f" -patches = [ - "ffmpeg.patch", - "binutils-2.41.patch", -] [build] template = "custom" diff --git a/recipes/libs/glib/recipe.toml b/recipes/libs/glib/recipe.toml index b43eae2638..b869dc16ca 100644 --- a/recipes/libs/glib/recipe.toml +++ b/recipes/libs/glib/recipe.toml @@ -1,9 +1,6 @@ [source] tar = "https://download.gnome.org/sources/glib/2.87/glib-2.87.0.tar.xz" blake3 = "26b77ae24bc02f85d1c6742fe601167b056085f117cda70da7b805cefa6195e9" -patches = [ - "redox.patch", -] [build] template = "custom" diff --git a/recipes/libs/gstreamer/recipe.toml b/recipes/libs/gstreamer/recipe.toml index 4944a00b27..faa0648b79 100644 --- a/recipes/libs/gstreamer/recipe.toml +++ b/recipes/libs/gstreamer/recipe.toml @@ -1,7 +1,6 @@ [source] tar = "https://gitlab.freedesktop.org/gstreamer/gstreamer/-/archive/1.24.12/gstreamer-1.24.12.tar.gz" blake3 = "181daf73050f7472ec656e7461b7f67028d6002c1133870576033a32e43a364f" -patches = ["redox.patch"] [build] template = "custom" diff --git a/recipes/libs/libarchive/recipe.toml b/recipes/libs/libarchive/recipe.toml index 033f271eee..b5686e0ba0 100644 --- a/recipes/libs/libarchive/recipe.toml +++ b/recipes/libs/libarchive/recipe.toml @@ -1,9 +1,6 @@ [source] tar = "https://libarchive.org/downloads/libarchive-3.6.2.tar.xz" blake3 = "f98695fe81235a74fa3fc2c3ba0f0d4f13ea15f9be3850b83e304cf5d78be710" -patches = [ - "redox.patch" -] [build] template = "configure" diff --git a/recipes/libs/libiconv/recipe.toml b/recipes/libs/libiconv/recipe.toml index e45018fcbe..df2d4b6c9f 100644 --- a/recipes/libs/libiconv/recipe.toml +++ b/recipes/libs/libiconv/recipe.toml @@ -1,9 +1,6 @@ [source] tar = "https://ftp.gnu.org/gnu/libiconv/libiconv-1.17.tar.gz" blake3 = "820b3b9fd3e2181bfb95475f01e9a3451e6d751e4f8c98ebcdcca1d8aa720f7f" -patches = [ - "01_redox.patch" -] script = """ DYNAMIC_INIT cp /usr/share/aclocal/libtool.m4 ./m4/ diff --git a/recipes/libs/liburcu/recipe.toml b/recipes/libs/liburcu/recipe.toml index 80a257cdb5..8e71cbcd7a 100644 --- a/recipes/libs/liburcu/recipe.toml +++ b/recipes/libs/liburcu/recipe.toml @@ -1,6 +1,5 @@ [source] tar = "https://lttng.org/files/urcu/userspace-rcu-0.14.0.tar.bz2" -patches = ["0001-Fix-compilation-on-Redox-OS.patch"] [build] template = "configure" diff --git a/recipes/libs/libuv/recipe.toml b/recipes/libs/libuv/recipe.toml index 23b563c32d..873d39aef7 100644 --- a/recipes/libs/libuv/recipe.toml +++ b/recipes/libs/libuv/recipe.toml @@ -1,7 +1,6 @@ [source] tar = "https://dist.libuv.org/dist/v1.51.0/libuv-v1.51.0.tar.gz" blake3 = "e8b5e68bc2d0776ac4ea67df59d694fca58d5cc570c103443a2284e723d01fc2" -patches = ["redox.patch"] [build] template = "custom" diff --git a/recipes/libs/mesa/recipe.toml b/recipes/libs/mesa/recipe.toml index 305e81f77a..135c18c7cb 100644 --- a/recipes/libs/mesa/recipe.toml +++ b/recipes/libs/mesa/recipe.toml @@ -3,7 +3,6 @@ git = "https://gitlab.redox-os.org/redox-os/mesa.git" upstream = "https://gitlab.freedesktop.org/mesa/mesa" branch = "redox-24.0" shallow_clone = true -patches = ["../../../local/patches/mesa/P4-virgl-redox-disk-cache.patch", "../../../local/patches/mesa/P5-gbm-dumb-prime-export.patch", "../../../local/patches/mesa/P6-platform-redox-gpu-probe.patch"] [build] template = "custom" dependencies = [ diff --git a/recipes/libs/ncurses/recipe.toml b/recipes/libs/ncurses/recipe.toml index c4135c6092..172f7dfcd2 100644 --- a/recipes/libs/ncurses/recipe.toml +++ b/recipes/libs/ncurses/recipe.toml @@ -1,9 +1,6 @@ [source] tar = "https://ftp.gnu.org/gnu/ncurses/ncurses-6.6.tar.gz" blake3 = "fbec55697a01f99b9cc3f25be55e73ae7091f4c53e5d81a1ea15734c4e5b7238" -patches = [ - "redox.patch" -] [build] template = "custom" diff --git a/recipes/libs/pango/recipe.toml b/recipes/libs/pango/recipe.toml index 8080ad3c44..8ea39f742b 100644 --- a/recipes/libs/pango/recipe.toml +++ b/recipes/libs/pango/recipe.toml @@ -1,7 +1,6 @@ [source] tar = "https://download.gnome.org/sources/pango/1.56/pango-1.56.3.tar.xz" blake3 = "78542feaaf007c1d648b94c4e9b6655ed7515d27ce434766aea99bef886c21ac" -patches = ["redox.patch"] [build] dependencies = [ diff --git a/recipes/libs/pcre/recipe.toml b/recipes/libs/pcre/recipe.toml index 05b24fec71..c84ced0d01 100644 --- a/recipes/libs/pcre/recipe.toml +++ b/recipes/libs/pcre/recipe.toml @@ -4,9 +4,6 @@ blake3 = "12d515ba12a816994def6b1e7196b5783fd2cfe495733a9167fa4d71dbe10248" script = """ autotools_recursive_regenerate """ -patches = [ - "redox.patch" -] [build] template = "custom" diff --git a/recipes/libs/pixman/recipe.toml b/recipes/libs/pixman/recipe.toml index 50bb30ea03..423922f1a5 100644 --- a/recipes/libs/pixman/recipe.toml +++ b/recipes/libs/pixman/recipe.toml @@ -1,7 +1,6 @@ [source] tar = "https://www.cairographics.org/releases/pixman-0.46.0.tar.xz" blake3 = "379369245a0bbd13784bf550c87622964a6aba87edf598ffa137dc10201746e0" -patches = ["redox.patch"] [build] template = "custom" diff --git a/recipes/libs/sdl-gfx/recipe.toml b/recipes/libs/sdl-gfx/recipe.toml index 540b8d1588..2021e03b9c 100644 --- a/recipes/libs/sdl-gfx/recipe.toml +++ b/recipes/libs/sdl-gfx/recipe.toml @@ -1,7 +1,6 @@ [source] tar = "https://sourceforge.net/projects/sdlgfx/files/SDL_gfx-2.0.25.tar.gz" blake3 = "e6f571a38e51d369b010f4b10eb35b95e3d2edae2edd796241c47ea8376581e6" -patches = ["redox.patch"] script = """ ./autogen.sh """ diff --git a/recipes/libs/sdl1-image/recipe.toml b/recipes/libs/sdl1-image/recipe.toml index ee73b9214c..2ada6615e4 100644 --- a/recipes/libs/sdl1-image/recipe.toml +++ b/recipes/libs/sdl1-image/recipe.toml @@ -1,7 +1,6 @@ [source] tar = "https://www.libsdl.org/projects/SDL_image/release/SDL_image-1.2.12.tar.gz" blake3 = "731a6f8cad9fff22c82394bd1c0c34ce4aa60fa8923f3755a3e3239f1e269389" -patches = ["redox.patch"] script = """ ./autogen.sh """ diff --git a/recipes/libs/sdl1-mixer/recipe.toml b/recipes/libs/sdl1-mixer/recipe.toml index 59755cff95..d75adfdae3 100644 --- a/recipes/libs/sdl1-mixer/recipe.toml +++ b/recipes/libs/sdl1-mixer/recipe.toml @@ -1,7 +1,6 @@ [source] tar = "https://www.libsdl.org/projects/SDL_mixer/release/SDL_mixer-1.2.12.tar.gz" blake3 = "ef23bab2d42250dfdc51ce6939ee7b393973ff11a0dd3481f32180b489d2661c" -patches = ["redox.patch"] script = """ ./autogen.sh """ diff --git a/recipes/libs/sdl1-ttf/recipe.toml b/recipes/libs/sdl1-ttf/recipe.toml index 4d0280e6e6..1c3c386b1d 100644 --- a/recipes/libs/sdl1-ttf/recipe.toml +++ b/recipes/libs/sdl1-ttf/recipe.toml @@ -1,7 +1,6 @@ [source] tar = "https://www.libsdl.org/projects/SDL_ttf/release/SDL_ttf-2.0.11.tar.gz" blake3 = "a684e57553e43b55ab28b064d1d5d44b8749299f259da31a62d671fc1d5505ee" -patches = ["redox.patch"] script = """ ./autogen.sh """ diff --git a/recipes/net/nginx/recipe.toml b/recipes/net/nginx/recipe.toml index defe601545..ff7203c8d1 100644 --- a/recipes/net/nginx/recipe.toml +++ b/recipes/net/nginx/recipe.toml @@ -1,9 +1,6 @@ #TODO FastCGI not working [source] tar = "https://nginx.org/download/nginx-1.28.0.tar.gz" -patches = [ - "redox.patch" -] [build] template = "custom" diff --git a/recipes/net/openssh/recipe.toml b/recipes/net/openssh/recipe.toml index 06706cd771..541e16b0c2 100644 --- a/recipes/net/openssh/recipe.toml +++ b/recipes/net/openssh/recipe.toml @@ -2,9 +2,6 @@ #TODO lack of utmpx.h, expect no way to track login in sshd [source] tar = "https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.8p1.tar.gz" -patches = [ - "redox.patch", -] [build] template = "custom" dependencies = [ diff --git a/recipes/net/rsync/recipe.toml b/recipes/net/rsync/recipe.toml index 4a967f2706..1290e520ca 100644 --- a/recipes/net/rsync/recipe.toml +++ b/recipes/net/rsync/recipe.toml @@ -1,6 +1,5 @@ [source] tar = "https://download.samba.org/pub/rsync/src/rsync-3.4.1.tar.gz" -patches = ["redox.patch"] [build] template = "configure" diff --git a/recipes/shells/bash/recipe.toml b/recipes/shells/bash/recipe.toml index e37076b09e..bb7e3d3a60 100644 --- a/recipes/shells/bash/recipe.toml +++ b/recipes/shells/bash/recipe.toml @@ -1,10 +1,6 @@ [source] tar = "https://ftp.gnu.org/gnu/bash/bash-5.2.15.tar.gz" blake3 = "c1548e3f2a9b6de5296e18c28b3d2007985e647273e03f039efd3e489edaa41f" -patches = [ - "redox.patch", - "../../../local/patches/bash/P1-mksyntax-host-headers.patch" -] [build] template = "custom" diff --git a/recipes/shells/nushell/recipe.toml b/recipes/shells/nushell/recipe.toml index db22b6c4ba..952a7c844d 100644 --- a/recipes/shells/nushell/recipe.toml +++ b/recipes/shells/nushell/recipe.toml @@ -2,7 +2,6 @@ [source] git = "https://github.com/nushell/nushell" rev = "172a070a4bbeff15a289813bc73d4628a3032210" -patches = ["redox.patch"] [build] dependencies = [ diff --git a/recipes/shells/zsh/recipe.toml b/recipes/shells/zsh/recipe.toml index edb533b0d6..e674403ae3 100644 --- a/recipes/shells/zsh/recipe.toml +++ b/recipes/shells/zsh/recipe.toml @@ -1,9 +1,6 @@ [source] tar = "https://github.com/zsh-users/zsh/archive/refs/tags/zsh-5.9.tar.gz" blake3 = "a15b94fae03e87aba6fc6a27df3c98e610b85b0c7c0fc90248f07fdcb8816860" -patches = [ - "redox.patch" -] script = """ DYNAMIC_INIT autotools_recursive_regenerate diff --git a/recipes/tests/sysbench/recipe.toml b/recipes/tests/sysbench/recipe.toml index 3586df7957..4b6c470e84 100644 --- a/recipes/tests/sysbench/recipe.toml +++ b/recipes/tests/sysbench/recipe.toml @@ -1,6 +1,5 @@ [source] git = "https://github.com/akopytov/sysbench.git" -patches = ["redox.patch"] script = """ DYNAMIC_INIT autoreconf -fvi -I${COOKBOOK_HOST_SYSROOT}/share/aclocal diff --git a/recipes/tests/vttest/recipe.toml b/recipes/tests/vttest/recipe.toml index 020c419255..75152209d5 100644 --- a/recipes/tests/vttest/recipe.toml +++ b/recipes/tests/vttest/recipe.toml @@ -1,7 +1,6 @@ [source] tar = "https://invisible-island.net/archives/vttest/vttest-20140305.tgz" blake3 = "b515b9a5e1f1498ed99e1a1c172fbcfdf2b7a214e185bd2005cc994407ded89e" -patches = ["redox.patch"] script = """ GNU_CONFIG_GET config.sub """ diff --git a/recipes/tools/gettext/recipe.toml b/recipes/tools/gettext/recipe.toml index 269ecdf34b..fbf001104f 100644 --- a/recipes/tools/gettext/recipe.toml +++ b/recipes/tools/gettext/recipe.toml @@ -3,9 +3,6 @@ [source] tar = "https://ftp.gnu.org/gnu/gettext/gettext-0.22.5.tar.gz" blake3 = "cb3f3a34da7ce1a92746df81f5b78c5d53841973a24eb80ab76537263d380ec0" -patches = [ - "redox.patch" -] script = """ DYNAMIC_INIT GNU_CONFIG_GET build-aux/config.sub diff --git a/recipes/tools/gnu-binutils/recipe.toml b/recipes/tools/gnu-binutils/recipe.toml index b0a4f96d61..55437532a0 100644 --- a/recipes/tools/gnu-binutils/recipe.toml +++ b/recipes/tools/gnu-binutils/recipe.toml @@ -1,7 +1,6 @@ [source] tar = "https://ftp.gnu.org/gnu/binutils/binutils-2.43.1.tar.xz" blake3 = "f074c81313b70eabc58ce9a9411cd771c5fa2433792d0ad8abcc45f603f58ed6" -patches = ["01_build_fix.patch"] script = """ DYNAMIC_INIT diff --git a/recipes/tools/gnu-grep/recipe.toml b/recipes/tools/gnu-grep/recipe.toml index b3ad6e4038..cf0dc60e70 100644 --- a/recipes/tools/gnu-grep/recipe.toml +++ b/recipes/tools/gnu-grep/recipe.toml @@ -1,7 +1,6 @@ [source] tar = "https://ftp.gnu.org/gnu/grep/grep-3.1.tar.xz" blake3 = "46b6e24dfa1b0f309f4eae3c450d612396c8faa6510b53a55f629e4f4c70b4a3" -patches = ["grep.patch"] [build] template = "custom" diff --git a/recipes/tools/libc-bench/recipe.toml b/recipes/tools/libc-bench/recipe.toml index 89c8ebfad4..0214097275 100644 --- a/recipes/tools/libc-bench/recipe.toml +++ b/recipes/tools/libc-bench/recipe.toml @@ -1,7 +1,6 @@ [source] tar = "https://www.etalabs.net/releases/libc-bench-20110206.tar.gz" blake3 = "64093102f29faa76da455f55a7b4be25b6d74d5c3d6fe88dbbc38aaae185182f" -patches = ["redox.patch"] [build] template = "custom" diff --git a/recipes/tools/schismtracker/recipe.toml b/recipes/tools/schismtracker/recipe.toml index 7d08b5ad52..b9b4955469 100644 --- a/recipes/tools/schismtracker/recipe.toml +++ b/recipes/tools/schismtracker/recipe.toml @@ -1,7 +1,6 @@ [source] tar = "https://github.com/schismtracker/schismtracker/archive/20181223.tar.gz" blake3 = "057e973f4f84cf898e2240d67c0e92f25086d8b9ffdc7e0c7ef81dd8dc81bc70" -patches = ["redox.patch"] script = """ autoreconf -i """ diff --git a/recipes/tools/sed/recipe.toml b/recipes/tools/sed/recipe.toml index 486b6de58a..05ffa8e082 100644 --- a/recipes/tools/sed/recipe.toml +++ b/recipes/tools/sed/recipe.toml @@ -1,9 +1,6 @@ [source] tar = "https://ftp.gnu.org/gnu/sed/sed-4.4.tar.xz" blake3 = "a88c12b2b4304e53e3c7ae2eb0499d02e28873c1b9e1a6871e5347c6886a1ecd" -patches = [ - "sed.patch" -] [build] template = "configure" diff --git a/recipes/tools/vim/recipe.toml b/recipes/tools/vim/recipe.toml index 5b8c1c3fc4..88b926239f 100644 --- a/recipes/tools/vim/recipe.toml +++ b/recipes/tools/vim/recipe.toml @@ -1,7 +1,6 @@ [source] tar = "https://github.com/vim/vim/archive/refs/tags/v9.1.0821.tar.gz" blake3 = "d1f5802ceb047b09143f1764bf4016f084cf7e6c026c7047919264c9f262a5dd" -patches = ["vim.patch"] [build] dependencies = ["ncursesw"] diff --git a/recipes/tui/goaccess/recipe.toml b/recipes/tui/goaccess/recipe.toml index 7fcff9e397..5b6d1f342b 100644 --- a/recipes/tui/goaccess/recipe.toml +++ b/recipes/tui/goaccess/recipe.toml @@ -6,10 +6,6 @@ blake3 = "a7a7641c98956e8941191956129141e071321851d004269c7d21bce536d9224a" #git = "https://github.com/allinurl/goaccess.git" #branch = "master" -patches = [ - "redox1.patch", - "redox2.patch", -] # This is only needed when compiling from git. The tar.gz already has the make files. script = """ diff --git a/recipes/web/netsurf/recipe.toml b/recipes/web/netsurf/recipe.toml index 595f6132c7..c59eef613a 100644 --- a/recipes/web/netsurf/recipe.toml +++ b/recipes/web/netsurf/recipe.toml @@ -1,9 +1,6 @@ [source] tar = "https://download.netsurf-browser.org/netsurf/releases/source-full/netsurf-all-3.11.tar.gz" blake3 = "cd406668a9ed5712efac1a8685125b83626690b73bbc6cb5de82ef00e3f65087" -patches = [ - "./01_redox.patch" -] [build] template = "custom" diff --git a/recipes/wip/db/mariadb/recipe.toml b/recipes/wip/db/mariadb/recipe.toml index 5c69d15391..53ab9cbbfb 100644 --- a/recipes/wip/db/mariadb/recipe.toml +++ b/recipes/wip/db/mariadb/recipe.toml @@ -2,9 +2,6 @@ [source] tar = "https://dlm.mariadb.com/4509471/MariaDB/mariadb-12.1.2/source/mariadb-12.1.2.tar.gz" blake3 = "749a293e1c4fd13be936fbda33de38b1ccc8c737c30a55c187c028d3ce74f70c" -patches = [ - "redox.patch" -] [build] template = "custom" dependencies = [ diff --git a/recipes/wip/db/postgresql18/recipe.toml b/recipes/wip/db/postgresql18/recipe.toml index 7b636775b1..3768816ac6 100644 --- a/recipes/wip/db/postgresql18/recipe.toml +++ b/recipes/wip/db/postgresql18/recipe.toml @@ -2,9 +2,6 @@ [source] tar = "https://ftp.postgresql.org/pub/source/v18.3/postgresql-18.3.tar.bz2" blake3 = "52696c9d474ce3e2073f97d4ba891af59ffc67a9dfb8f9f5adac409d1fe0dc28" -patches = [ - "redox.patch" -] [build] template = "meson" mesonflags = [ diff --git a/recipes/wip/dev/lang/nodejs-21/recipe.toml b/recipes/wip/dev/lang/nodejs-21/recipe.toml index 0ba9d4c0a7..119707294b 100644 --- a/recipes/wip/dev/lang/nodejs-21/recipe.toml +++ b/recipes/wip/dev/lang/nodejs-21/recipe.toml @@ -2,7 +2,6 @@ [source] tar = "https://nodejs.org/dist/v21.7.3/node-v21.7.3.tar.xz" blake3 = "95a56db4f9729b2f8384ab58ccb2ec0c41da05991f7400ef97bd76748d77870b" -patches = ["redox.patch"] [build] template = "custom" diff --git a/recipes/wip/dev/lang/nodejs-24/recipe.toml b/recipes/wip/dev/lang/nodejs-24/recipe.toml index cea227197d..5556fb68f5 100644 --- a/recipes/wip/dev/lang/nodejs-24/recipe.toml +++ b/recipes/wip/dev/lang/nodejs-24/recipe.toml @@ -2,7 +2,6 @@ [source] tar = "https://nodejs.org/dist/v24.9.0/node-v24.9.0.tar.xz" blake3 = "c710713c9144dc2dfadaef1d180b295d85edd9945513017fc700af68eb08a251" -patches = ["01_redox.patch"] [build] template = "custom" diff --git a/recipes/wip/dev/lang/php80/recipe.toml b/recipes/wip/dev/lang/php80/recipe.toml index 0a45f69951..b240dd0e10 100644 --- a/recipes/wip/dev/lang/php80/recipe.toml +++ b/recipes/wip/dev/lang/php80/recipe.toml @@ -1,9 +1,6 @@ #TODO promote [source] tar = "https://www.php.net/distributions/php-8.0.30.tar.xz" -patches = [ - "redox.patch" -] [build] template = "custom" diff --git a/recipes/wip/dev/lang/python37/recipe.toml b/recipes/wip/dev/lang/python37/recipe.toml index beb86e4c68..7bbe6ef187 100644 --- a/recipes/wip/dev/lang/python37/recipe.toml +++ b/recipes/wip/dev/lang/python37/recipe.toml @@ -3,9 +3,6 @@ #TODO maybe the script is wrong [source] tar = "https://www.python.org/ftp/python/3.7.17/Python-3.7.17.tar.xz" -patches = [ - "redox.patch", -] [build] template = "custom" dependencies = [ diff --git a/recipes/wip/dev/lang/python39/recipe.toml b/recipes/wip/dev/lang/python39/recipe.toml index f7bc5ddb22..4e62d4c0aa 100644 --- a/recipes/wip/dev/lang/python39/recipe.toml +++ b/recipes/wip/dev/lang/python39/recipe.toml @@ -1,9 +1,6 @@ #TODO Fix dynamic loading of C modules [source] tar = "https://www.python.org/ftp/python/3.9.9/Python-3.9.9.tar.xz" -patches = [ - 'redox.patch' -] [build] template = "custom" diff --git a/recipes/wip/dev/other/apr-util/recipe.toml b/recipes/wip/dev/other/apr-util/recipe.toml index e2ce43a073..09312e2150 100644 --- a/recipes/wip/dev/other/apr-util/recipe.toml +++ b/recipes/wip/dev/other/apr-util/recipe.toml @@ -1,8 +1,5 @@ [source] tar = "https://archive.apache.org/dist/apr/apr-util-1.6.0.tar.bz2" -patches = [ - "redox.patch", -] [build] template = "custom" dependencies = [ diff --git a/recipes/wip/dev/other/apr/recipe.toml b/recipes/wip/dev/other/apr/recipe.toml index 9991bfa6e0..ec9c5f5256 100644 --- a/recipes/wip/dev/other/apr/recipe.toml +++ b/recipes/wip/dev/other/apr/recipe.toml @@ -1,6 +1,5 @@ [source] tar = "https://dlcdn.apache.org//apr/apr-1.7.4.tar.bz2" -patches = ["redox.patch"] [build] template = "custom" script = """ diff --git a/recipes/wip/dev/python/ruff/recipe.toml b/recipes/wip/dev/python/ruff/recipe.toml index 51bfd023b7..7d46a8aa3d 100644 --- a/recipes/wip/dev/python/ruff/recipe.toml +++ b/recipes/wip/dev/python/ruff/recipe.toml @@ -3,9 +3,6 @@ git = "https://github.com/astral-sh/ruff" rev = "93a16bd05fba249439848beb6fbcbf3e8a436f03" shallow_clone = true -patches = [ - "redox.patch" -] [build] template = "cargo" diff --git a/recipes/wip/games/engines/love/recipe.toml b/recipes/wip/games/engines/love/recipe.toml index 4ee0050e51..32b5778c57 100644 --- a/recipes/wip/games/engines/love/recipe.toml +++ b/recipes/wip/games/engines/love/recipe.toml @@ -1,9 +1,6 @@ [source] tar = "https://github.com/love2d/love/archive/refs/tags/11.5.tar.gz" blake3 = "1fe441b04af1c0aa12b5d12f274fd892e6f307bcc882888c3a1ec048294a25c7" -patches = [ - "redox.patch" -] [build] template = "custom" diff --git a/recipes/wip/games/engines/luanti/recipe.toml b/recipes/wip/games/engines/luanti/recipe.toml index 301836c74b..4cce6e716b 100644 --- a/recipes/wip/games/engines/luanti/recipe.toml +++ b/recipes/wip/games/engines/luanti/recipe.toml @@ -4,7 +4,6 @@ [source] git = "https://github.com/minetest/minetest" branch = "stable-5" -patches = ["redox.patch"] [build] template = "custom" diff --git a/recipes/wip/games/fps/zerospades-free/recipe.toml b/recipes/wip/games/fps/zerospades-free/recipe.toml index b8f2b486c6..25ae5028df 100644 --- a/recipes/wip/games/fps/zerospades-free/recipe.toml +++ b/recipes/wip/games/fps/zerospades-free/recipe.toml @@ -3,9 +3,6 @@ [source] git = "https://github.com/siecvi/zerospades" shallow_clone = true -patches = [ - "redox.patch" -] [build] template = "custom" diff --git a/recipes/wip/games/racing/supertuxkart/recipe.toml b/recipes/wip/games/racing/supertuxkart/recipe.toml index d136a5e5e8..f8f58069c1 100644 --- a/recipes/wip/games/racing/supertuxkart/recipe.toml +++ b/recipes/wip/games/racing/supertuxkart/recipe.toml @@ -2,7 +2,6 @@ # build instructions: https://github.com/supertuxkart/stk-code/blob/master/INSTALL.md#compiling [source] tar = "https://github.com/supertuxkart/stk-code/releases/download/1.5/SuperTuxKart-1.5-src.tar.gz" -patches = ["redox.patch"] [build] template = "cmake" cmakeflags = [ diff --git a/recipes/wip/games/syobonaction/recipe.toml b/recipes/wip/games/syobonaction/recipe.toml index 576a90103f..fe20314c8b 100644 --- a/recipes/wip/games/syobonaction/recipe.toml +++ b/recipes/wip/games/syobonaction/recipe.toml @@ -1,8 +1,5 @@ [source] git = "https://github.com/angelXwind/OpenSyobonAction" -patches = [ - "01_redox.patch" -] [build] template = "custom" diff --git a/recipes/wip/icons/adwaita-icon-theme/recipe.toml b/recipes/wip/icons/adwaita-icon-theme/recipe.toml index ce90ad699e..af6fdf23a7 100644 --- a/recipes/wip/icons/adwaita-icon-theme/recipe.toml +++ b/recipes/wip/icons/adwaita-icon-theme/recipe.toml @@ -1,7 +1,6 @@ [source] tar = "https://download.gnome.org/sources/adwaita-icon-theme/49/adwaita-icon-theme-49.0.tar.xz" blake3 = "757eedf680c4ae564d887dd9eccfeab2d4101e0bdfdb10288a072ba4530fb0e5" -patches = ["redox.patch"] [build] template = "meson" diff --git a/recipes/wip/libs/audio/openal/recipe.toml b/recipes/wip/libs/audio/openal/recipe.toml index 566e58fa78..4fb7b9c0fd 100644 --- a/recipes/wip/libs/audio/openal/recipe.toml +++ b/recipes/wip/libs/audio/openal/recipe.toml @@ -1,9 +1,6 @@ [source] tar = "https://github.com/kcat/openal-soft/archive/refs/tags/1.24.1.tar.gz" blake3 = "da65f839d4cee560371d08fc977f90757f964f49b14655b1d8d43f779c90a815" -patches = [ - "redox.patch" -] [build] template = "custom" diff --git a/recipes/wip/libs/gnome/dconf/recipe.toml b/recipes/wip/libs/gnome/dconf/recipe.toml index 44a9fb7733..104a7becf3 100644 --- a/recipes/wip/libs/gnome/dconf/recipe.toml +++ b/recipes/wip/libs/gnome/dconf/recipe.toml @@ -1,7 +1,6 @@ [source] tar = "https://download.gnome.org/sources/dconf/0.49/dconf-0.49.0.tar.xz" blake3 = "41ee23bdab3208f7a08efa134a481c852874dc5846433a665c5a5149511a7659" -patches = ["redox.patch"] [build] dependencies = [ diff --git a/recipes/wip/libs/gnome/glib-networking/recipe.toml b/recipes/wip/libs/gnome/glib-networking/recipe.toml index f5cb23d883..e89add3b1c 100644 --- a/recipes/wip/libs/gnome/glib-networking/recipe.toml +++ b/recipes/wip/libs/gnome/glib-networking/recipe.toml @@ -1,7 +1,6 @@ [source] tar = "https://download.gnome.org/sources/glib-networking/2.80/glib-networking-2.80.1.tar.xz" blake3 = "114a3ea41ea33d8cd01a61381b49fbf60278212ddd88c65f70c26137217be3fd" -patches = ["redox.patch"] [build] template = "custom" diff --git a/recipes/wip/libs/gnome/gtk3/recipe.toml b/recipes/wip/libs/gnome/gtk3/recipe.toml index 44958e1a0a..3b8d70b64b 100644 --- a/recipes/wip/libs/gnome/gtk3/recipe.toml +++ b/recipes/wip/libs/gnome/gtk3/recipe.toml @@ -2,7 +2,6 @@ [source] tar = "https://download.gnome.org/sources/gtk+/3.24/gtk%2B-3.24.43.tar.xz" blake3 = "5feab2bad81e6b5906895f70ddce6227cf96a6a14b16af0ef72c79991a48ddf4" -patches = ["redox.patch"] [build] dependencies = [ diff --git a/recipes/wip/libs/gnome/libayatana-appindicator-glib/recipe.toml b/recipes/wip/libs/gnome/libayatana-appindicator-glib/recipe.toml index e373152187..ee2f061008 100644 --- a/recipes/wip/libs/gnome/libayatana-appindicator-glib/recipe.toml +++ b/recipes/wip/libs/gnome/libayatana-appindicator-glib/recipe.toml @@ -1,7 +1,6 @@ [source] tar = "https://github.com/AyatanaIndicators/libayatana-appindicator-glib/archive/refs/tags/2.0.1.tar.gz" blake3 = "5c7e39f29b23cd5c14a6eacbe0c0bf16dfd28b9b013ec011421d5d6e5742ba2d" -patches = ["redox.patch"] [build] dependencies = [ diff --git a/recipes/wip/libs/gnome/libepoxy/recipe.toml b/recipes/wip/libs/gnome/libepoxy/recipe.toml index 334655d13e..1f4153fcfa 100644 --- a/recipes/wip/libs/gnome/libepoxy/recipe.toml +++ b/recipes/wip/libs/gnome/libepoxy/recipe.toml @@ -1,7 +1,6 @@ [source] tar = "https://download.gnome.org/sources/libepoxy/1.5/libepoxy-1.5.10.tar.xz" blake3 = "0ccee9635115fe417cfc4bc33ffd160bf1e2852bd6c03816b4af771d59462f53" -patches = ["redox.patch"] [build] template = "custom" diff --git a/recipes/wip/libs/gnome/vte/recipe.toml b/recipes/wip/libs/gnome/vte/recipe.toml index d4081c479f..b41fb6db05 100644 --- a/recipes/wip/libs/gnome/vte/recipe.toml +++ b/recipes/wip/libs/gnome/vte/recipe.toml @@ -2,7 +2,6 @@ [source] tar = "https://download.gnome.org/sources/vte/0.82/vte-0.82.1.tar.xz" blake3 = "2d16b6808c0eaa801d59ccabcae13e76ccd6229869dad1efe0524a4c83b53a87" -patches = ["redox.patch"] [build] dependencies = [ diff --git a/recipes/wip/libs/other/boost/recipe.toml b/recipes/wip/libs/other/boost/recipe.toml index 2c53b2b9b2..2ac5bdffed 100644 --- a/recipes/wip/libs/other/boost/recipe.toml +++ b/recipes/wip/libs/other/boost/recipe.toml @@ -2,9 +2,6 @@ [source] tar = "https://archives.boost.io/release/1.90.0/source/boost_1_90_0.tar.gz" blake3 = "1c1b0fe7596e3f72dba529b2d0bc6d330cc00610f8d3b3e3b6f20bad43fc388d" -patches = [ - "redox.patch" -] [build] template = "custom" diff --git a/recipes/wip/libs/other/gdbm/recipe.toml b/recipes/wip/libs/other/gdbm/recipe.toml index 3589e5cdb6..8accc2eecc 100644 --- a/recipes/wip/libs/other/gdbm/recipe.toml +++ b/recipes/wip/libs/other/gdbm/recipe.toml @@ -1,7 +1,4 @@ [source] tar= "https://ftp.gnu.org/gnu/gdbm/gdbm-1.23.tar.gz" -patches = [ - "redox.patch", -] [build] template = "configure" diff --git a/recipes/wip/libs/other/imlib2/recipe.toml b/recipes/wip/libs/other/imlib2/recipe.toml index 70a9559a42..1e1cd547f2 100644 --- a/recipes/wip/libs/other/imlib2/recipe.toml +++ b/recipes/wip/libs/other/imlib2/recipe.toml @@ -2,7 +2,6 @@ [source] tar = "https://downloads.sourceforge.net/project/enlightenment/imlib2-src/1.12.5/imlib2-1.12.5.tar.xz" blake3 = "535b6a986538295af5194e81281a11a1d7e79ae518959ca434f1e53bfa67e86d" -patches = ["redox.patch"] script = """ autotools_recursive_regenerate """ diff --git a/recipes/wip/libs/other/libedit/recipe.toml b/recipes/wip/libs/other/libedit/recipe.toml index 62d169b81c..ac08b7de57 100644 --- a/recipes/wip/libs/other/libedit/recipe.toml +++ b/recipes/wip/libs/other/libedit/recipe.toml @@ -1,9 +1,6 @@ #TODO promote [source] tar = "https://www.thrysoee.dk/editline/libedit-20250104-3.1.tar.gz" -patches = [ - "redox.patch" -] [build] template = "configure" dependencies = [ diff --git a/recipes/wip/libs/other/libgcrypt/recipe.toml b/recipes/wip/libs/other/libgcrypt/recipe.toml index 1ee3ec04e8..82c06724b0 100644 --- a/recipes/wip/libs/other/libgcrypt/recipe.toml +++ b/recipes/wip/libs/other/libgcrypt/recipe.toml @@ -2,7 +2,6 @@ [source] tar = "https://gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-1.11.1.tar.bz2" blake3 = "68844e12b92960d66c4ce85a4c3db1df8377b232980f1218b4c5d904e9c02511" -patches = ["redox.patch"] script = """ autotools_recursive_regenerate """ diff --git a/recipes/wip/libs/other/libicu/recipe.toml b/recipes/wip/libs/other/libicu/recipe.toml index ce3c1ad339..4d8d00642e 100644 --- a/recipes/wip/libs/other/libicu/recipe.toml +++ b/recipes/wip/libs/other/libicu/recipe.toml @@ -2,7 +2,6 @@ [source] tar = "https://github.com/unicode-org/icu/releases/download/release-77-1/icu4c-77_1-src.tgz" blake3 = "8f51c4e4c6577b61d02921e800ddb0a2d4778addf7717eef4c5bb0e8a5582c3a" -patches = ["redox.patch"] [build] template = "custom" diff --git a/recipes/wip/libs/other/libuuid/recipe.toml b/recipes/wip/libs/other/libuuid/recipe.toml index cac1cbf48b..21b59b6213 100644 --- a/recipes/wip/libs/other/libuuid/recipe.toml +++ b/recipes/wip/libs/other/libuuid/recipe.toml @@ -2,9 +2,6 @@ [source] tar = "https://sourceforge.net/projects/libuuid/files/libuuid-1.0.3.tar.gz/download" blake3 = "ac6582304401d2be6e5db4570c0d9d6d1500f12c918591a05066679bb2e41e55" -patches = [ - "redox.patch" -] [build] template = "configure" diff --git a/recipes/wip/libs/other/tree-sitter/recipe.toml b/recipes/wip/libs/other/tree-sitter/recipe.toml index 95209bdab2..148508ecf7 100644 --- a/recipes/wip/libs/other/tree-sitter/recipe.toml +++ b/recipes/wip/libs/other/tree-sitter/recipe.toml @@ -1,9 +1,6 @@ [source] tar = "https://github.com/tree-sitter/tree-sitter/archive/refs/tags/v0.25.8.tar.gz" blake3 = "a9bce1e3c610441dc9d7dcc3d7d38e6a74e0b06d6b7d40e22982d927006dbfc4" -patches = [ - "redox.patch" -] [build] template = "custom" diff --git a/recipes/wip/libs/tls/openssl3/recipe.toml b/recipes/wip/libs/tls/openssl3/recipe.toml index 6f5a6c9008..ffa76b7a03 100644 --- a/recipes/wip/libs/tls/openssl3/recipe.toml +++ b/recipes/wip/libs/tls/openssl3/recipe.toml @@ -2,7 +2,6 @@ [source] tar = "https://github.com/openssl/openssl/releases/download/openssl-3.5.3/openssl-3.5.3.tar.gz" blake3 = "e1622a4587c71c278355bf38ff5a619918bd51e3cd37214d53dd5345b187fc10" -patches = [ "redox.patch" ] [build] template = "custom" diff --git a/recipes/wip/libs/video/libgif/recipe.toml b/recipes/wip/libs/video/libgif/recipe.toml index aebee7b7f3..6325886d77 100644 --- a/recipes/wip/libs/video/libgif/recipe.toml +++ b/recipes/wip/libs/video/libgif/recipe.toml @@ -1,7 +1,6 @@ [source] tar = "https://sourceforge.net/projects/giflib/files/giflib-5.2.2.tar.gz/download" blake3 = "025cd79ba2d524c24b33a3d2750c146c6823adf96e1dbcc380ca6210bc7058a8" -patches = ["redox.patch"] [build] template = "custom" diff --git a/recipes/wip/net/http/apache-httpd/recipe.toml b/recipes/wip/net/http/apache-httpd/recipe.toml index 49ede8b7f9..5fd48f44aa 100644 --- a/recipes/wip/net/http/apache-httpd/recipe.toml +++ b/recipes/wip/net/http/apache-httpd/recipe.toml @@ -1,9 +1,6 @@ #TODO compiles but requires setgroups syscall at startup [source] tar= "https://archive.apache.org/dist/httpd/httpd-2.4.61.tar.bz2" -patches = [ - "redox.patch", -] [build] dependencies = [ "apr", diff --git a/recipes/wip/net/http/lighttpd/recipe.toml b/recipes/wip/net/http/lighttpd/recipe.toml index 2749ee7d8d..e6f840780d 100644 --- a/recipes/wip/net/http/lighttpd/recipe.toml +++ b/recipes/wip/net/http/lighttpd/recipe.toml @@ -2,9 +2,6 @@ [source] tar = "https://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.82.tar.xz" b3sum = "1890d4d63dab35ed8c6e994f11f408aaf9e6dd7cda959d2533a3c80d20c93029" -patches = [ - "redox.patch" -] [build] template = "cmake" diff --git a/recipes/wip/shells/fish-shell/recipe.toml b/recipes/wip/shells/fish-shell/recipe.toml index 1327a0519e..c085b8f864 100644 --- a/recipes/wip/shells/fish-shell/recipe.toml +++ b/recipes/wip/shells/fish-shell/recipe.toml @@ -2,7 +2,6 @@ [source] git = "https://github.com/fish-shell/fish-shell" rev = "54e8ad7e90a8213c01ba58de0640223bee6846d6" -patches = ["redox.patch"] [build] template = "custom" diff --git a/recipes/wip/terminal/tmux/recipe.toml b/recipes/wip/terminal/tmux/recipe.toml index 04af36e33e..c5f8b81cc1 100644 --- a/recipes/wip/terminal/tmux/recipe.toml +++ b/recipes/wip/terminal/tmux/recipe.toml @@ -2,9 +2,6 @@ [source] tar = "https://github.com/tmux/tmux/releases/download/3.6a/tmux-3.6a.tar.gz" blake3 = "43a9a5fd4ebe403efccd666c7b620fcf65489b123092df70113466a2b5aedb5a" -patches = [ - "redox.patch" -] [build] template = "configure" dependencies = [ diff --git a/recipes/wip/text/neovim/recipe.toml b/recipes/wip/text/neovim/recipe.toml index b0379ef32d..09422ef4ac 100644 --- a/recipes/wip/text/neovim/recipe.toml +++ b/recipes/wip/text/neovim/recipe.toml @@ -4,9 +4,6 @@ git = "https://github.com/neovim/neovim" rev = "v0.11.5" shallow_clone = true -patches = [ - "redox.patch" -] [build] template = "custom" diff --git a/recipes/wip/wayland/wlroots/recipe.toml b/recipes/wip/wayland/wlroots/recipe.toml index 3a58b98f06..f57a72ca15 100644 --- a/recipes/wip/wayland/wlroots/recipe.toml +++ b/recipes/wip/wayland/wlroots/recipe.toml @@ -3,7 +3,6 @@ [source] tar = "https://gitlab.freedesktop.org/wlroots/wlroots/-/releases/0.17.0/downloads/wlroots-0.17.0.tar.gz" blake3 = "f119e53d1f1dd5c8d4c348b0ebc2a780cf4174d158995356a087b26c3bc7d222" -patches = ["redox.patch"] [build] template = "meson" diff --git a/recipes/wip/wayland/xwayland/recipe.toml b/recipes/wip/wayland/xwayland/recipe.toml index 3ac342a598..327178c285 100644 --- a/recipes/wip/wayland/xwayland/recipe.toml +++ b/recipes/wip/wayland/xwayland/recipe.toml @@ -1,9 +1,6 @@ #TODO wayland-client, fix linux/input, wayland-scanner shim [source] tar = "https://www.x.org/releases/individual/xserver/xwayland-24.1.8.tar.xz" -patches = [ - "redox.patch" -] [build] template = "meson" dependencies = [ diff --git a/recipes/wip/web/webkitgtk3/recipe.toml b/recipes/wip/web/webkitgtk3/recipe.toml index 79115e3db3..f38aed177c 100644 --- a/recipes/wip/web/webkitgtk3/recipe.toml +++ b/recipes/wip/web/webkitgtk3/recipe.toml @@ -2,7 +2,6 @@ [source] tar = "https://webkitgtk.org/releases/webkitgtk-2.49.1.tar.xz" blake3 = "7f04acb2f909ad334fc623afb297ebca1d5a5005bda1682946fb37e044e45ecb" -patches = ["redox.patch"] [build] template = "custom" diff --git a/recipes/wip/web/zola/recipe.toml b/recipes/wip/web/zola/recipe.toml index cf1e83b698..dbff643f13 100644 --- a/recipes/wip/web/zola/recipe.toml +++ b/recipes/wip/web/zola/recipe.toml @@ -3,9 +3,6 @@ git = "https://github.com/getzola/zola" shallow_clone = true rev = "33f03bb11158464e3ff877cdc5f1c55bbe7337ac" -patches = [ - "redox.patch" -] [build] template = "cargo" diff --git a/recipes/wip/x11/drm-info/recipe.toml b/recipes/wip/x11/drm-info/recipe.toml index d1885e8c54..e36b06e45e 100644 --- a/recipes/wip/x11/drm-info/recipe.toml +++ b/recipes/wip/x11/drm-info/recipe.toml @@ -1,7 +1,6 @@ [source] tar = "https://gitlab.freedesktop.org/emersion/drm_info/-/archive/v2.9.0/drm_info-v2.9.0.tar.gz" blake3 = "48ff592b206a85c1d946abfe2f8a4e7ef40f9f1ee7d3d5ee454a33390f86d8cb" -patches = ["redox.patch"] [build] dependencies = [ diff --git a/recipes/wip/x11/libxfont2/recipe.toml b/recipes/wip/x11/libxfont2/recipe.toml index f95d0af925..4101cc6e63 100644 --- a/recipes/wip/x11/libxfont2/recipe.toml +++ b/recipes/wip/x11/libxfont2/recipe.toml @@ -1,7 +1,6 @@ [source] tar = "https://www.x.org/releases/individual/lib/libXfont2-2.0.7.tar.xz" blake3 = "9b4951683df21108e45fda23dbd25dcb47b67a3a0e224a36374fbc2d0f489cac" -patches = ["redox.patch"] script = """ autotools_recursive_regenerate """ diff --git a/recipes/wip/x11/libxkbcommon-x11/recipe.toml b/recipes/wip/x11/libxkbcommon-x11/recipe.toml index ea53a2ca0c..8242917c91 100644 --- a/recipes/wip/x11/libxkbcommon-x11/recipe.toml +++ b/recipes/wip/x11/libxkbcommon-x11/recipe.toml @@ -3,7 +3,6 @@ [source] tar = "https://xkbcommon.org/download/libxkbcommon-1.7.0.tar.xz" blake3 = "5001ca0b8562feeef2010bf16c05657e3875fda3ed5fdedbf48b9135e5cdfcbc" -patches = [ "redox.patch" ] [build] template = "custom" diff --git a/recipes/wip/x11/mate/marco/recipe.toml b/recipes/wip/x11/mate/marco/recipe.toml index d4c935c419..1a4294352e 100644 --- a/recipes/wip/x11/mate/marco/recipe.toml +++ b/recipes/wip/x11/mate/marco/recipe.toml @@ -1,7 +1,6 @@ [source] tar = "https://github.com/mate-desktop/marco/releases/download/v1.29.1/marco-1.29.1.tar.xz" blake3 = "609db8d6da0ceffb67fd79a2d017be301f5cdbe441301ca5469530cdca4a7cf5" -patches = ["redox.patch"] [build] dependencies = [ diff --git a/recipes/wip/x11/mate/mate-control-center/recipe.toml b/recipes/wip/x11/mate/mate-control-center/recipe.toml index 2f0cee64a2..0b35f3f266 100644 --- a/recipes/wip/x11/mate/mate-control-center/recipe.toml +++ b/recipes/wip/x11/mate/mate-control-center/recipe.toml @@ -1,7 +1,6 @@ [source] tar = "https://github.com/mate-desktop/mate-control-center/archive/refs/tags/v1.28.1.tar.gz" blake3 = "78ef68e12d0f5d68f62953999e55061a0ef911eceecd2dc66b9242f6b84c143b" -patches = ["redox.patch"] [build] dependencies = [ diff --git a/recipes/wip/x11/mesa-demos-x11/recipe.toml b/recipes/wip/x11/mesa-demos-x11/recipe.toml index f7b049aeb3..d02b474acc 100644 --- a/recipes/wip/x11/mesa-demos-x11/recipe.toml +++ b/recipes/wip/x11/mesa-demos-x11/recipe.toml @@ -1,7 +1,6 @@ [source] tar = "https://archive.mesa3d.org/demos/mesa-demos-9.0.0.tar.xz" blake3 = "eef628aebdaa65d3bb1078bb6d6bdd7685c41fb67674e7f7b0e1e15f10433240" -patches = ["redox.patch"] [build] dependencies = [ diff --git a/recipes/wip/x11/x11proto/recipe.toml b/recipes/wip/x11/x11proto/recipe.toml index fc5be2a28d..4f167e6f8e 100644 --- a/recipes/wip/x11/x11proto/recipe.toml +++ b/recipes/wip/x11/x11proto/recipe.toml @@ -1,7 +1,6 @@ [source] tar = "https://www.x.org/releases/individual/proto/xorgproto-2024.1.tar.xz" blake3 = "fad667bb04e16dca5e816969f2641bb075929cd73564114cc1aabd87d1975dd3" -patches = ["redox.patch"] [build] template = "configure" diff --git a/recipes/wip/x11/xfce4/libxfce4windowing/recipe.toml b/recipes/wip/x11/xfce4/libxfce4windowing/recipe.toml index a57d839227..b61b45f94d 100644 --- a/recipes/wip/x11/xfce4/libxfce4windowing/recipe.toml +++ b/recipes/wip/x11/xfce4/libxfce4windowing/recipe.toml @@ -1,7 +1,6 @@ [source] tar = "https://archive.xfce.org/src/xfce/libxfce4windowing/4.20/libxfce4windowing-4.20.4.tar.bz2" blake3 = "396cbd13d547e6e109e348dd207747714dc4827b744fe729b1697c9dd1a55c3f" -patches = ["redox.patch"] [build] dependencies = [ diff --git a/recipes/wip/x11/xserver-xorg-video-orbital/recipe.toml b/recipes/wip/x11/xserver-xorg-video-orbital/recipe.toml index 1f52a9e72b..3a256f8555 100644 --- a/recipes/wip/x11/xserver-xorg-video-orbital/recipe.toml +++ b/recipes/wip/x11/xserver-xorg-video-orbital/recipe.toml @@ -2,7 +2,6 @@ [source] tar = "https://www.x.org/releases/individual/driver/xf86-video-dummy-0.4.1.tar.xz" blake3 = "9b49296f62bf4d22345d87fc01f2a5571f941457c19d21c8800f8f6d2e64ae67" -patches = ["redox.patch"] script = """ autotools_recursive_regenerate """ diff --git a/recipes/wip/x11/xserver-xorg/recipe.toml b/recipes/wip/x11/xserver-xorg/recipe.toml index 86849c2438..c29d75d753 100644 --- a/recipes/wip/x11/xserver-xorg/recipe.toml +++ b/recipes/wip/x11/xserver-xorg/recipe.toml @@ -1,7 +1,6 @@ [source] tar = "https://www.x.org/releases/individual/xserver/xorg-server-21.1.16.tar.xz" blake3 = "b47c68a0a8bc5b69143d95440fbf75c17245ba8bc2c28a8d9619d8c6890dca58" -patches = ["redox.patch"] [build] dependencies = [ diff --git a/recipes/wip/x11/xterm/recipe.toml b/recipes/wip/x11/xterm/recipe.toml index f0bc4c612f..c074b9036b 100644 --- a/recipes/wip/x11/xterm/recipe.toml +++ b/recipes/wip/x11/xterm/recipe.toml @@ -1,7 +1,6 @@ [source] tar = "https://invisible-island.net/archives/xterm/xterm-398.tgz" blake3 = "c42112586b2c231681db9327df9d797953469e3b7cb2abe93b8f3f821597d528" -patches = ["redox.patch"] [build] dependencies = [ diff --git a/src/bin/repo.rs b/src/bin/repo.rs index 97bf74a66c..8f26043ce2 100644 --- a/src/bin/repo.rs +++ b/src/bin/repo.rs @@ -2,7 +2,7 @@ use ansi_to_tui::IntoText; use anyhow::{Context, anyhow, bail}; use cookbook::config::{CookConfig, get_config, init_config}; use cookbook::cook::cook_build::{build, get_stage_dirs, remove_stage_dir}; -use cookbook::cook::fetch::{FetchResult, fetch, fetch_offline, validate_patches}; +use cookbook::cook::fetch::{FetchResult, fetch, fetch_offline}; use cookbook::cook::fs::{create_target_dir, run_command}; use cookbook::cook::ident; use cookbook::cook::package::{package, package_handle_push}; @@ -122,7 +122,6 @@ enum CliCommand { Push, PushTree, Find, - ValidatePatches, } impl CliCommand { @@ -156,7 +155,6 @@ impl FromStr for CliCommand { "push-tree" => Ok(CliCommand::PushTree), "cook-tree" => Ok(CliCommand::CookTree), "find" => Ok(CliCommand::Find), - "validate-patches" => Ok(CliCommand::ValidatePatches), _ => Err(anyhow!("Unknown command '{}'\n{}\n", s, REPO_HELP_STR)), } } @@ -174,7 +172,6 @@ impl ToString for CliCommand { CliCommand::PushTree => "push-tree".to_string(), CliCommand::CookTree => "cook-tree".to_string(), CliCommand::Find => "find".to_string(), - CliCommand::ValidatePatches => "validate-patches".to_string(), } } } @@ -419,26 +416,6 @@ fn repo_inner( println!("{}", recipe.dir.display()); false } - CliCommand::ValidatePatches => { - let validate_fn = move |logger: &PtyOut| -> Result { - handle_validate_patches(recipe, logger)?; - Ok(false) - }; - let Some(_log_path) = &config.logs_dir else { - return validate_fn(&None); - }; - let (status_tx, status_rx) = mpsc::channel::(); - let (mut stdout_writer, mut stderr_writer) = setup_logger(&status_tx, &recipe.name); - let mut logger = Some((&mut stdout_writer, &mut stderr_writer)); - let result = validate_fn(&logger); - if let Err(ref e) = result { - write_to_pty(&logger, &format!("\n{:?}", e)); - } - flush_pty(&mut logger); - drop(status_tx); - let _ = status_rx.recv_timeout(std::time::Duration::from_millis(100)); - result? - } }) } @@ -812,10 +789,6 @@ fn handle_cook( Ok(build_result.cached) } -fn handle_validate_patches(recipe: &CookRecipe, logger: &PtyOut) -> anyhow::Result<()> { - validate_patches(recipe, logger).map_err(|e| anyhow!("{}", e)) -} - /// delete stage artifacts upon nonstop failure to let repo_builder know fn handle_nonstop_fail(recipe: &CookRecipe) -> cookbook::Result<()> { let target_dir = recipe.target_dir(); diff --git a/src/cook/fetch.rs b/src/cook/fetch.rs index ffb74c153c..e1a7f9b3d7 100644 --- a/src/cook/fetch.rs +++ b/src/cook/fetch.rs @@ -91,29 +91,8 @@ fn redbear_allow_protected_fetch() -> bool { ) } -/// Check if a recipe has patches that would be at risk from upstream source changes. -/// Recipes with patches should be protected from online re-fetching because: -/// 1. Upstream source changes can break patch context lines -/// 2. The atomic patch system expects patches to apply cleanly against the frozen source -/// 3. Re-fetching from upstream could pull incompatible changes that invalidate all patches -fn recipe_has_patches(recipe: &CookRecipe) -> bool { - match &recipe.recipe.source { - Some(SourceRecipe::Git { patches, .. }) => !patches.is_empty(), - Some(SourceRecipe::Tar { patches, .. }) => !patches.is_empty(), - _ => false, - } -} - -/// Check if a recipe should be protected from online re-fetching. -/// A recipe is protected if: -/// 1. It's on the explicit protected list (redbear_protected_recipe), OR -/// 2. It has patches that would be at risk from upstream source changes -/// -/// This ensures that ANY recipe carrying patches — whether explicitly listed or not — -/// is automatically shielded from accidental upstream overwrites. The explicit list -/// covers recipes that need protection even without patches (e.g., custom source recipes). fn redbear_should_protect(recipe: &CookRecipe) -> bool { - redbear_protected_recipe(recipe.name.name()) || recipe_has_patches(recipe) + redbear_protected_recipe(recipe.name.name()) } fn redbear_release() -> Option { @@ -287,12 +266,26 @@ pub fn fetch_offline(recipe: &CookRecipe, logger: &PtyOut) -> Result { + let source_path = recipe_dir.join(path); + if !source_path.exists() { + bail_other_err!("local source not found: {}", source_path.display()); + } + if source_dir.is_symlink() || !source_dir.exists() { + let _ = fs::remove_file(&source_dir); + symlink(&source_path, &source_dir) + .map_err(|e| format!("failed to symlink local source: {e}"))?; + } + let ident = get_git_head_rev(&source_path) + .map(|(r, _)| r) + .unwrap_or_else(|_| "local".to_string()); + FetchResult::cached(source_dir, ident) + } Some(SourceRecipe::Git { git: _, upstream: _, branch: _, rev, - patches, script, shallow_clone: _, }) => { @@ -322,43 +315,12 @@ pub fn fetch_offline(recipe: &CookRecipe, logger: &PtyOut) -> Result { let ident = blake3.clone().unwrap_or("no_tar_blake3_hash_info".into()); @@ -375,9 +337,7 @@ pub fn fetch_offline(recipe: &CookRecipe, logger: &PtyOut) -> Result Result Result { if redbear_should_protect(recipe) && !redbear_allow_protected_fetch() { - let reason = if redbear_protected_recipe(recipe.name.name()) { - "explicitly protected" - } else { - "has patches (auto-protected)" - }; log_to_pty!( logger, - "[INFO]: {} recipe {} uses local source (fetch disabled; use --allow-protected flag or set REDBEAR_ALLOW_PROTECTED_FETCH=1 to override)", - reason, + "[INFO]: protected recipe {} (fetch disabled; use --allow-protected flag or set REDBEAR_ALLOW_PROTECTED_FETCH=1 to override)", recipe.name.name() ); return fetch_offline(recipe, logger); } - // Warn when --allow-protected bypasses protection on a patched recipe. - // Upstream source changes may break patch context lines. - if redbear_allow_protected_fetch() && recipe_has_patches(recipe) { - log_to_pty!( - logger, - "[WARN]: recipe {} has patches but --allow-protected is set — upstream source changes may break patches", - recipe.name.name() - ); - } - let recipe_dir = &recipe.dir; let source_dir = recipe_dir.join("source"); match recipe.recipe.build.kind { @@ -461,12 +405,26 @@ pub fn fetch(recipe: &CookRecipe, check_source: bool, logger: &PtyOut) -> Result } FetchResult::new(source_dir, "local_source".to_string(), cached) } + Some(SourceRecipe::Local { path }) => { + let source_path = recipe_dir.join(path); + if !source_path.exists() { + bail_other_err!("local source not found: {}", source_path.display()); + } + if source_dir.is_symlink() || !source_dir.exists() { + let _ = fs::remove_file(&source_dir); + symlink(&source_path, &source_dir) + .map_err(|e| format!("failed to symlink local source: {e}"))?; + } + let ident = get_git_head_rev(&source_path) + .map(|(r, _)| r) + .unwrap_or_else(|_| "local".to_string()); + FetchResult::cached(source_dir, ident) + } Some(SourceRecipe::Git { git, upstream, branch, rev, - patches, script, shallow_clone, }) => { @@ -575,32 +533,6 @@ pub fn fetch(recipe: &CookRecipe, check_source: bool, logger: &PtyOut) -> Result if !cached { if let Some(_upstream) = upstream { - //TODO: set upstream URL (is this needed?) - // git remote set-url upstream "$GIT_UPSTREAM" &> /dev/null || - // git remote add upstream "$GIT_UPSTREAM" - // git fetch upstream - } - - if !patches.is_empty() || script.is_some() { - if is_local_overlay(recipe_dir) && !redbear_allow_protected_fetch() { - log_to_pty!( - logger, - "[WARN] skipping git reset --hard for local overlay recipe at {} \ - (set REDBEAR_ALLOW_PROTECTED_FETCH=1 to override)", - recipe_dir.display() - ); - } else { - let mut clean_cmd = Command::new("git"); - clean_cmd.arg("-C").arg(&source_dir); - clean_cmd.arg("clean").arg("-fd"); - let _ = run_command(clean_cmd, logger); - - // Hard reset - let mut command = Command::new("git"); - command.arg("-C").arg(&source_dir); - command.arg("reset").arg("--hard"); - run_command(command, logger)?; - } } if let Some(rev) = rev { @@ -654,9 +586,6 @@ pub fn fetch(recipe: &CookRecipe, check_source: bool, logger: &PtyOut) -> Result } manual_git_recursive_submodule(logger, &source_dir, cmds)?; } - - fetch_validate_patch_symlinks(recipe_dir, patches)?; - fetch_apply_patches(recipe_dir, patches, script, &source_dir, logger)?; } let (head_rev, _) = get_git_head_rev(&source_dir)?; @@ -665,7 +594,6 @@ pub fn fetch(recipe: &CookRecipe, check_source: bool, logger: &PtyOut) -> Result Some(SourceRecipe::Tar { tar, blake3, - patches, script, }) => { let source_tar = recipe_dir.join("source.tar"); @@ -708,21 +636,8 @@ pub fn fetch(recipe: &CookRecipe, check_source: bool, logger: &PtyOut) -> Result } let mut cached = true; if source_dir.is_dir() { - if tar_updated || fetch_is_patches_newer(recipe_dir, patches, &source_dir)? { - if is_local_overlay(recipe_dir) && !redbear_allow_protected_fetch() { - log_to_pty!( - logger, - "[WARN] refusing to wipe source for local overlay recipe at {} \ - (set REDBEAR_ALLOW_PROTECTED_FETCH=1 to override)", - recipe_dir.display() - ); - } else { - log_to_pty!( - logger, - "DEBUG: source tar or patches is newer than the source directory" - ); - remove_all(&source_dir)? - } + if tar_updated { + remove_all(&source_dir)? } } if !source_dir.is_dir() { @@ -730,7 +645,6 @@ pub fn fetch(recipe: &CookRecipe, check_source: bool, logger: &PtyOut) -> Result let source_dir_tmp = recipe_dir.join("source.tmp"); create_dir_clean(&source_dir_tmp)?; fetch_extract_tar(source_tar, &source_dir_tmp, logger)?; - fetch_apply_patches(recipe_dir, patches, script, &source_dir_tmp, logger)?; // Move source.tmp to source atomically rename(&source_dir_tmp, &source_dir)?; @@ -1074,559 +988,6 @@ fn read_source_toml(source_toml: &Path) -> Result { Ok(pkg_toml) } -pub(crate) fn fetch_is_patches_newer( - recipe_dir: &Path, - patches: &Vec, - source_dir: &PathBuf, -) -> Result { - // don't check source files inside as it can be mixed with user patches - let source_time = modified(&source_dir)?; - for patch_name in patches { - let patch_file = recipe_dir.join(patch_name); - if !patch_file.is_file() { - bail_other_err!("Failed to find patch file {:?}", patch_file.display()); - } - - let patch_time = modified(&patch_file)?; - if patch_time > source_time { - return Ok(true); - } - } - return Ok(false); -} - -pub(crate) fn fetch_apply_patches( - recipe_dir: &Path, - patches: &Vec, - script: &Option, - source_dir_tmp: &PathBuf, - logger: &PtyOut, -) -> Result<()> { - if patches.is_empty() && script.is_none() { - return Ok(()); - } - - // Read and normalize all patch files. - let mut patch_contents: Vec<(String, Vec)> = Vec::new(); - for patch_name in patches { - let patch_file = recipe_dir.join(patch_name); - if !patch_file.is_file() { - bail_other_err!("Failed to find patch file {:?}", patch_file.display()); - } - let raw = fs::read(&patch_file).map_err(|err| { - format!( - "failed to read patch file '{}': {err}", - patch_file.display() - ) - })?; - let normalized = normalize_patch(&raw); - patch_contents.push((patch_name.clone(), normalized)); - } - - // Apply all patches atomically to a staging directory. - // If any patch fails, the staging directory is discarded and the - // original source tree is left untouched. - // Uses cp -al (hard links) for zero-copy staging. - let staging_dir = source_dir_tmp.with_extension("staging"); - let _ = fs::remove_dir_all(&staging_dir); - Command::new("cp") - .arg("-al") - .arg(source_dir_tmp) - .arg(&staging_dir) - .status() - .map_err(|e| format!("failed to create staging copy via cp -al: {e}"))?; - - // Snapshot pre-existing .orig files in the source tree (some upstreams - // ship .orig files in their tarballs — e.g. glib test data). Only .orig - // files created by the patch command should be flagged as failures. - let preexisting_origs: std::collections::HashSet = { - let out = Command::new("find") - .arg(&staging_dir) - .arg("-name") - .arg("*.orig") - .output(); - match out { - Ok(o) => String::from_utf8_lossy(&o.stdout) - .lines() - .map(|l| l.trim().to_string()) - .filter(|l| !l.is_empty()) - .collect(), - Err(_) => std::collections::HashSet::new(), - } - }; - - let result = (|| -> Result> { - let mut applied = Vec::new(); - for (patch_name, patch_data) in &patch_contents { - let mut command = Command::new("patch"); - command.arg("--directory").arg(&staging_dir); - command.arg("--strip=1"); - command.arg("--batch"); - command.arg("--fuzz=3"); - command.arg("--no-backup-if-mismatch"); - run_command_stdin(command, patch_data.as_slice(), logger) - .map_err(|e| format!("patch {patch_name} FAILED: {e}"))?; - - // .rej files always indicate failure — check unconditionally. - let rej_check = Command::new("find") - .arg(&staging_dir) - .arg("-name") - .arg("*.rej") - .arg("-print") - .arg("-quit") - .output(); - if let Ok(out) = rej_check { - if !out.stdout.is_empty() { - let path = String::from_utf8_lossy(&out.stdout).trim().to_string(); - bail_other_err!( - "patch {patch_name} left .rej file (hunks failed to apply): {path}" - ); - } - } - - // .orig files: only flag newly-created ones (not pre-existing). - let orig_check = Command::new("find") - .arg(&staging_dir) - .arg("-name") - .arg("*.orig") - .output(); - if let Ok(out) = orig_check { - for line in String::from_utf8_lossy(&out.stdout).lines() { - let trimmed = line.trim().to_string(); - if !trimmed.is_empty() && !preexisting_origs.contains(&trimmed) { - bail_other_err!( - "patch {patch_name} left .orig file (hunks failed to apply): {trimmed}" - ); - } - } - } - - applied.push(patch_name.clone()); - } - Ok(applied) - })(); - - match result { - Ok(applied) => { - let backup_dir = source_dir_tmp.with_extension("backup"); - let _ = fs::remove_dir_all(&backup_dir); - fs::rename(source_dir_tmp, &backup_dir) - .map_err(|e| format!("failed to rename source to backup: {e}"))?; - fs::rename(&staging_dir, source_dir_tmp) - .map_err(|e| format!("failed to promote staging to source: {e}"))?; - let _ = fs::remove_dir_all(&backup_dir); - - fetch_write_patches_state(recipe_dir, &applied, source_dir_tmp, script, logger)?; - - if let Some(script) = script { - let mut command = Command::new("bash"); - command.arg("-ex"); - command.current_dir(source_dir_tmp); - run_command_stdin( - command, - format!("{SHARED_PRESCRIPT}\n{script}").as_bytes(), - logger, - )?; - } - log_to_pty!( - logger, - "[ATOMIC] {n}/{n} patches applied", - n = applied.len() - ); - Ok(()) - } - Err(e) => { - let _ = fs::remove_dir_all(&staging_dir); - log_to_pty!( - logger, - "[ATOMIC] patch application rolled back — source tree unchanged" - ); - Err(e) - } - } -} - -pub fn validate_patches(recipe: &CookRecipe, logger: &PtyOut) -> Result<()> { - let recipe_dir = &recipe.dir; - let source_dir = recipe_dir.join("source"); - - if !source_dir.is_dir() { - bail_other_err!( - "Source directory does not exist: {}. Fetch first.", - source_dir.display() - ); - } - - let (patches, script) = match &recipe.recipe.source { - Some(SourceRecipe::Git { - patches, script, .. - }) - | Some(SourceRecipe::Tar { - patches, script, .. - }) => (patches.clone(), script.clone()), - _ => { - log_to_pty!(logger, "[INFO] Recipe has no patches to validate"); - return Ok(()); - } - }; - - if patches.is_empty() && script.is_none() { - log_to_pty!(logger, "[INFO] No patches to validate"); - return Ok(()); - } - - // Validate patch symlinks - fetch_validate_patch_symlinks(recipe_dir, &patches)?; - - // Read and normalize all patch files - let mut patch_contents: Vec<(String, Vec)> = Vec::new(); - for patch_name in &patches { - let patch_file = recipe_dir.join(patch_name); - if !patch_file.is_file() { - bail_other_err!("Failed to find patch file {:?}", patch_file.display()); - } - let raw = fs::read(&patch_file).map_err(|err| { - format!( - "failed to read patch file '{}': {err}", - patch_file.display() - ) - })?; - let normalized = normalize_patch(&raw); - patch_contents.push((patch_name.clone(), normalized)); - } - - // Create temp staging directory on same filesystem as source (for hard link support) - let staging_dir = source_dir.with_extension("validate-staging"); - let _ = fs::remove_dir_all(&staging_dir); - - // cp -al (hard link copy, zero cost) from source to staging - Command::new("cp") - .arg("-al") - .arg(&source_dir) - .arg(&staging_dir) - .status() - .map_err(|e| format!("failed to create staging copy via cp -al: {e}"))?; - - // Clean the staging copy to pristine upstream state. - // Only git-sourced recipes have a .git directory — tarball sources - // are already pristine from the cp -al copy. - if staging_dir.join(".git").exists() { - let _ = Command::new("git") - .arg("-C") - .arg(&staging_dir) - .arg("clean") - .arg("-ffdx") - .status(); - Command::new("git") - .arg("-C") - .arg(&staging_dir) - .arg("reset") - .arg("--hard") - .status() - .map_err(|e| format!("failed to reset staging to clean state: {e}"))?; - } - - let mut passed = 0; - let mut failed = 0; - - for (patch_name, patch_data) in &patch_contents { - log_to_pty!(logger, " {} ...", patch_name); - let mut command = Command::new("patch"); - command.arg("--directory").arg(&staging_dir); - command.arg("--strip=1"); - command.arg("--batch"); - command.arg("--fuzz=3"); - command.arg("--no-backup-if-mismatch"); - - match run_command_stdin(command, patch_data.as_slice(), logger) { - Ok(_) => { - // Check for .rej files - let rej_check = Command::new("find") - .arg(&staging_dir) - .arg("-name") - .arg("*.rej") - .arg("-print") - .arg("-quit") - .output(); - if let Ok(out) = rej_check { - if !out.stdout.is_empty() { - let path = String::from_utf8_lossy(&out.stdout).trim().to_string(); - log_to_pty!( - logger, - " [FAIL] {} → {} has rejected hunks", - patch_name, - path - ); - failed += 1; - continue; - } - } - log_to_pty!(logger, " [PASS] {}", patch_name); - passed += 1; - } - Err(e) => { - log_to_pty!(logger, " [FAIL] {} → {}", patch_name, e); - failed += 1; - } - } - } - - // Run script if present - if let Some(script) = script { - log_to_pty!(logger, " [script] ..."); - let mut command = Command::new("bash"); - command.arg("-ex"); - command.current_dir(&staging_dir); - match run_command_stdin( - command, - format!("{}\n{}", SHARED_PRESCRIPT, script).as_bytes(), - logger, - ) { - Ok(_) => { - log_to_pty!(logger, " [PASS] script"); - passed += 1; - } - Err(e) => { - log_to_pty!(logger, " [FAIL] script → {}", e); - failed += 1; - } - } - } - - // Clean up staging directory - let _ = fs::remove_dir_all(&staging_dir); - - if failed > 0 { - bail_other_err!( - "[SUMMARY] {}/{} patches applied, {} failed", - passed, - passed + failed, - failed - ); - } - - log_to_pty!( - logger, - "[SUMMARY] All {} patches validated successfully", - passed - ); - Ok(()) -} - -/// Normalizes a patch for compatibility with the `patch` command by stripping -/// git-specific headers (`diff --git`, `index`, `new file mode`, etc.) that -/// `patch` does not recognize. -fn normalize_patch(raw: &[u8]) -> Vec { - let text = String::from_utf8_lossy(raw); - let mut out = String::with_capacity(text.len()); - let mut prev_empty = true; - for line in text.lines() { - let trimmed = line.trim(); - if trimmed.starts_with("diff --git ") - || trimmed.starts_with("diff -ruN ") - || trimmed.starts_with("index ") - || trimmed.starts_with("new file mode ") - || trimmed.starts_with("deleted file mode ") - || trimmed.starts_with("rename from ") - || trimmed.starts_with("rename to ") - || trimmed.starts_with("similarity index ") - || trimmed.starts_with("dissimilarity index ") - { - continue; - } - if !prev_empty || !line.is_empty() { - out.push_str(line); - out.push('\n'); - prev_empty = line.is_empty(); - } - } - if !out.ends_with('\n') { - out.push('\n'); - } - out.into_bytes() -} - -/// Computes a BLAKE3 hash over all patch file contents (in order). -fn fetch_compute_patches_hash(recipe_dir: &Path, patches: &[String]) -> Result { - // BLAKE3 is already a project dependency (used for source verification). - let mut hasher = blake3::Hasher::new(); - for patch_name in patches { - let patch_file = recipe_dir.join(patch_name); - let content = fs::read(&patch_file).map_err(|err| { - format!( - "failed to read patch for hashing '{}': {err}", - patch_file.display() - ) - })?; - hasher.update(&content); - } - Ok(hasher.finalize().to_hex().to_string()) -} - -/// Writes a .patches-state file into the recipe's *target* directory -/// (NOT the source checkout — git clean would delete it otherwise). -/// Contains: upstream commit, ordered patch list, composite hash, script hash, -/// and state schema version for forward-compatibility. -/// Computes a BLAKE3 hash over all tracked files in the source directory, -/// so that manual source edits (outside the patch system) are detected -/// and trigger re-patching on the next build. -fn fetch_compute_source_hash(source_dir: &Path) -> String { - let output = Command::new("git") - .arg("-C") - .arg(source_dir) - .args(["ls-files", "-z"]) - .output(); - match output { - Ok(out) if !out.stdout.is_empty() => { - let mut hasher = blake3::Hasher::new(); - // Hash file paths in sorted order for stability. - let mut files: Vec<&str> = out - .stdout - .split(|&b| b == 0) - .filter_map(|s| std::str::from_utf8(s).ok()) - .collect(); - files.sort(); - for path in &files { - hasher.update(path.as_bytes()); - hasher.update(b"\0"); - // Hash file contents for integrity. - if let Ok(content) = fs::read(source_dir.join(path)) { - hasher.update(&content); - } - hasher.update(b"\0"); - } - hasher.finalize().to_hex().to_string() - } - _ => "no-git".to_string(), - } -} - -fn fetch_write_patches_state( - recipe_dir: &Path, - applied: &[String], - source_dir: &Path, - script: &Option, - logger: &PtyOut, -) -> Result<()> { - let head_rev = get_git_head_rev(&source_dir.to_path_buf()) - .map(|(r, _)| r) - .unwrap_or_else(|_| "unknown".to_string()); - let hash = fetch_compute_patches_hash(recipe_dir, applied) - .unwrap_or_else(|_| "hash-error".to_string()); - let script_hash = script - .as_ref() - .map(|s| blake3::hash(s.as_bytes()).to_hex().to_string()) - .unwrap_or_else(|| "none".to_string()); - - // State goes in target/ so git clean/reset won't delete it. - let state_dir = recipe_dir.join("target"); - let _ = fs::create_dir_all(&state_dir); - let state_file = state_dir.join(".patches-state"); - - let source_hash = fetch_compute_source_hash(source_dir); - - let mut content = String::new(); - content.push_str("schema: 1\n"); - content.push_str(&format!("upstream-rev: {head_rev}\n")); - content.push_str(&format!("patches-hash: {hash}\n")); - content.push_str(&format!("script-hash: {script_hash}\n")); - content.push_str(&format!("source-hash: {source_hash}\n")); - for (i, name) in applied.iter().enumerate() { - content.push_str(&format!("patch[{}]: {name}\n", i + 1)); - } - fs::write(&state_file, &content) - .map_err(|err| format!("failed to write .patches-state: {err}"))?; - log_to_pty!( - logger, - "[OK] wrote .patches-state ({}/{} patches)", - applied.len(), - applied.len() - ); - Ok(()) -} - -/// Validates that every patch file path resolves to a real file before we -/// touch the source tree. Fails early with a clear message if any symlink -/// is broken or file is missing. -fn fetch_validate_patch_symlinks(recipe_dir: &Path, patches: &[String]) -> Result<()> { - let mut seen = std::collections::HashSet::new(); - for patch_name in patches { - let patch_file = recipe_dir.join(patch_name); - if !patch_file.is_file() { - bail_other_err!( - "patch file not found: {:?} (broken symlink or missing file in {})", - patch_file.display(), - recipe_dir.display() - ); - } - // Canonicalize to catch symlink chains - let canonical = patch_file.canonicalize().map_err(|e| { - format!( - "cannot resolve patch path {:?}: {e} (broken symlink?)", - patch_file.display() - ) - })?; - if !seen.insert(canonical) { - bail_other_err!( - "duplicate patch after canonicalization: {:?} (listed twice in recipe?)", - patch_name - ); - } - } - Ok(()) -} - -/// Checks whether the source directory's .patches-state matches the -/// recipe's current patch list. Returns true if patches should be -/// (re-)applied. -fn fetch_patches_state_stale( - recipe_dir: &Path, - patches: &[String], - script: &Option, - source_dir: &Path, -) -> bool { - let state_file = recipe_dir.join("target/.patches-state"); - let state_content = match fs::read_to_string(&state_file) { - Ok(c) => c, - Err(_) => return true, - }; - - let expected_hash = match fetch_compute_patches_hash(recipe_dir, patches) { - Ok(h) => h, - Err(_) => return true, - }; - let expected_script_hash = script - .as_ref() - .map(|s| blake3::hash(s.as_bytes()).to_hex().to_string()) - .unwrap_or_else(|| "none".to_string()); - let current_source_hash = fetch_compute_source_hash(source_dir); - - let mut found_hash = false; - let mut found_script = false; - let mut found_source = false; - for line in state_content.lines() { - if let Some(stored) = line.strip_prefix("patches-hash: ") { - if stored.trim() != expected_hash { - return true; - } - found_hash = true; - } - if let Some(stored) = line.strip_prefix("script-hash: ") { - if stored.trim() != expected_script_hash { - return true; - } - found_script = true; - } - if let Some(stored) = line.strip_prefix("source-hash: ") { - if stored.trim() != current_source_hash { - return true; - } - found_source = true; - } - } - - !found_hash || !found_script || !found_source -} pub(crate) fn fetch_apply_source_info( recipe: &CookRecipe, diff --git a/src/recipe.rs b/src/recipe.rs index 4c85860e5a..96e6f4a3b8 100644 --- a/src/recipe.rs +++ b/src/recipe.rs @@ -42,9 +42,6 @@ pub enum SourceRecipe { rev: Option, /// The optional config to clone with treeless clone. Default is true if "rev" added shallow_clone: Option, - /// A list of patch files to apply to the source - #[serde(default)] - patches: Vec, /// Optional script to run to prepare the source script: Option, }, @@ -55,12 +52,16 @@ pub enum SourceRecipe { /// The optional blake3 sum of the tar file. Please specify this to make reproducible /// builds more reliable blake3: Option, - /// A list of patch files to apply to the source - #[serde(default)] - patches: Vec, /// Optional script to run to prepare the source, such as ./autogen.sh script: Option, }, + /// Direct local source — for Red Bear-owned forks. + /// Source lives in local/sources// and is directly editable. + /// No fetching, no patching, no cloning. + Local { + /// Path to the source directory, relative to the recipe directory + path: String, + }, } /// Specifies how to build a recipe @@ -485,7 +486,6 @@ impl CookRecipe { SourceRecipe::Tar { tar, blake3: _, - patches: _, script: _, } => { if let Some(ver) = re.extract_ver(&tar) { @@ -498,7 +498,6 @@ impl CookRecipe { branch, rev, shallow_clone: _, - patches: _, script: _, } => { if let Some(rev) = rev { @@ -679,9 +678,8 @@ mod tests { upstream: None, branch: Some("master".to_string()), rev: Some("06344744d3d55a5ac9a62a6059cb363d40699bbc".to_string()), - patches: Vec::new(), - script: None, shallow_clone: None, + script: None, }), build: BuildRecipe::new(BuildKind::Cargo { cargopath: None, @@ -720,7 +718,6 @@ mod tests { "8220c0e4082fa26c07b10bfe31f641d2e33ebe1d1bb0b20221b7016bc8b78a3a" .to_string() ), - patches: Vec::new(), script: None, }), build: BuildRecipe::new(BuildKind::Custom {