a23012cee0
BREAKING CHANGE: The patch-based build system is removed. All Red Bear source now lives in local/sources/<component>/ as git repos. Changes: - src/recipe.rs: remove patches field from SourceRecipe::Git/Tar, add Local variant - src/cook/fetch.rs: delete fetch_apply_patches, validate_patches, normalize_patch, fetch_compute_patches_hash, fetch_write_patches_state, fetch_patches_state_stale, fetch_validate_patch_symlinks, fetch_is_patches_newer. Simplify fetch and fetch_offline. Remove recipe_has_patches. Add Local source handler. - src/bin/repo.rs: remove validate-patches command and handle_validate_patches - 70 recipe.toml files: remove patches arrays, convert core recipes to Local source - 272 .patch symlinks deleted from recipe directories - integrate-redbear.sh: replace patch symlink logic with source fork validation - Makefile: replace validate-patches with validate-sources target - AGENTS.md: remove 369 lines of patch documentation, add source ownership model - local/docs/PATCH-GOVERNANCE.md: deleted (replaced by SOURCE-OWNERSHIP-MODEL.md) - local/docs/SOURCE-OWNERSHIP-MODEL.md: new canonical reference - local/sources/: Red Bear fork repos created (kernel, relibc, base, bootloader, installer) from frozen 0.1.0 pre-patched archives - .gitignore: exclude local/sources/ (separate git repos) - create-forks.sh: new script for initializing fork repos Build: cargo check passes (5 warnings, 0 errors). Developer workflow is now: edit local/sources/ → repo cook → test. No patches.
90 lines
3.0 KiB
Markdown
90 lines
3.0 KiB
Markdown
# 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 <sha>)"
|
|
```
|
|
|
|
### 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.
|