docs/scripts: enforce single-repo policy and +rb build-metadata suffix

- Update AGENTS.md single-repo rule to explicitly forbid creating any new
  Gitea repositories and to require deleting per-component repos.
- Change version suffix policy from pre-release -rb to build-metadata +rb
  in AGENTS.md, sync-versions.sh, apply-rb-suffix.sh, verify-fork-versions.sh.
- Update migration instructions to push to existing submodule/<component>
  branches inside RedBear-OS, not create new repos.
- Update BUILD-SYSTEM-IMPROVEMENTS.md and SLEEP-IMPLEMENTATION-PLAN.md to
  reference submodule/* branches instead of defunct per-component repos.
- Fix delete-per-component-repos.sh example to use a real historical repo.
This commit is contained in:
2026-07-05 22:50:33 +03:00
parent 73cf268273
commit 54de45d461
7 changed files with 88 additions and 77 deletions
+13 -13
View File
@@ -1,21 +1,21 @@
#!/usr/bin/env bash
# apply-rb-suffix.sh — Apply the -rb<branch> version suffix to all Cat 2 forks.
# apply-rb-suffix.sh — Apply the +rb<branch> version build-metadata suffix to all Cat 2 forks.
#
# This script is now a thin wrapper around sync-versions.sh Phase 2.
# It exists for backward compatibility and focused Cat-2-only operation.
#
# Policy (local/AGENTS.md § "Version conventions"):
#
# Every Cat 2 fork version MUST be `<upstream-version>-rb<branch-version>` where:
# Every Cat 2 fork version MUST be `<upstream-version>+rb<branch-version>` where:
# <upstream-version> = the upstream version the fork currently tracks
# <branch-version> = the current Red Bear OS git branch (e.g. 0.2.5)
#
# The `-rb<branch>` suffix is a Cargo pre-release identifier. Per SemVer, a
# pre-release version (e.g. 0.9.0-rb0.2.5) is NEVER substituted for the
# corresponding stable version (0.9.0).
# The `+rb<branch>` suffix is Cargo build metadata. It does NOT affect
# SemVer precedence and allows transitive crates.io deps requiring
# `^X.Y.Z` to resolve to the local fork via [patch.crates-io].
#
# Usage:
# ./local/scripts/apply-rb-suffix.sh # Apply -rb<branch> to all
# ./local/scripts/apply-rb-suffix.sh # Apply +rb<branch> to all
# ./local/scripts/apply-rb-suffix.sh --check # Verify only
# ./local/scripts/apply-rb-suffix.sh --rollback # Revert to stable X.Y.Z
#
@@ -55,11 +55,11 @@ if [[ -z "$BRANCH_VERSION" ]]; then
exit 1
fi
RB_SUFFIX="-rb${BRANCH_VERSION}"
RB_SUFFIX="+rb${BRANCH_VERSION}"
# ---- Rollback mode: strip all -rb<x.y.z> suffixes ----
# ---- Rollback mode: strip all +rb<x.y.z> suffixes ----
if [[ $ROLLBACK -eq 1 ]]; then
echo "=== Rolling back Cat 2 forks to stable versions (stripping -rb*) ==="
echo "=== Rolling back Cat 2 forks to stable versions (stripping +rb*) ==="
for fork_dir in local/sources/*/; do
[ -d "$fork_dir" ] || continue
fork_name=$(basename "$fork_dir")
@@ -70,8 +70,8 @@ if [[ $ROLLBACK -eq 1 ]]; then
fi
current="$(grep -E '^version\s*=' "$f" | head -1 | sed 's/.*"\(.*\)".*/\1/' || true)"
[[ -n "$current" ]] || continue
if [[ "$current" == *"-rb"* ]]; then
base="$(echo "$current" | sed -E 's/-rb([0-9]+(\.[0-9]+\.[0-9]+)?)$//')"
if [[ "$current" == *"+rb"* ]]; then
base="$(echo "$current" | sed -E 's/\+rb([0-9]+(\.[0-9]+\.[0-9]+)?)$//')"
sed -i "s|^version = \"${current}\"|version = \"${base}\"|" "$f"
echo " ROLLBACK: $fork_name $current$base"
fi
@@ -113,7 +113,7 @@ for fork in "${CAT2_FORKS[@]}"; do
current="$(grep -E '^version\s*=' "$f" | head -1 | sed 's/.*"\(.*\)".*/\1/' || true)"
[[ -n "$current" ]] || { echo " SKIP ${fork}: empty version"; continue; }
base="$(echo "$current" | sed -E 's/(-rb[0-9]+(\.[0-9]+\.[0-9]+)?)+$//')"
base="$(echo "$current" | sed -E 's/(\+rb[0-9]+(\.[0-9]+\.[0-9]+)?)+$//')"
target="${base}${RB_SUFFIX}"
if [[ "$current" == "$target" ]]; then
@@ -149,6 +149,6 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
if [ -x "$SCRIPT_DIR/verify-fork-versions.sh" ]; then
if ! "$SCRIPT_DIR/verify-fork-versions.sh" 2>&1 | grep -q "^All Cat 2 forks pass"; then
echo "WARNING: verify-fork-versions.sh found content mismatches." >&2
echo " The -rb suffix is applied but some forks may not match upstream." >&2
echo " The +rb suffix is applied but some forks may not match upstream." >&2
fi
fi
+1 -1
View File
@@ -10,7 +10,7 @@
# ./local/scripts/delete-per-component-repos.sh # interactive
# ./local/scripts/delete-per-component-repos.sh --dry-run # list only
# ./local/scripts/delete-per-component-repos.sh --yes # no prompts
# ./local/scripts/delete-per-component-repos.sh --only redbear-os-base,redox-drm
# ./local/scripts/delete-per-component-repos.sh --only redbear-os-base
# ./local/scripts/delete-per-component-repos.sh -h # this help
set -euo pipefail
+9 -6
View File
@@ -8,7 +8,10 @@
# version = "<branch>" (e.g. "0.2.5")
#
# Cat 2 — Upstream Redox forks (local/sources/*/):
# version = "<upstream-base>-rb<branch>" (e.g. "0.9.0-rb0.2.5")
# version = "<upstream-base>+rb<branch>" (e.g. "0.9.0+rb0.2.5")
#
# The `+rb` suffix is Cargo build metadata, not a pre-release identifier.
# Using `-rb` is a policy violation.
#
# When the branch changes (e.g. 0.2.5 → 0.2.6), running this script bumps
# Cat 1 versions to the new branch version AND updates Cat 2 suffixes to
@@ -47,7 +50,7 @@ if [[ -z "$TARGET_VERSION" ]]; then
fi
echo "Target version: $TARGET_VERSION (from branch '$BRANCH')"
echo "Cat 2 suffix: -rb$TARGET_VERSION"
echo "Cat 2 suffix: +rb$TARGET_VERSION"
echo ""
# ---- Exclusions ----
@@ -80,9 +83,9 @@ should_exclude() {
}
# ---- Helper: extract upstream base from a Cat 2 version ----
# Strips any existing -rb<x.y.z> suffix to get the upstream base version.
# Strips any existing +rb<x.y.z> build-metadata suffix to get the upstream base version.
strip_rb_suffix() {
echo "$1" | sed -E 's/(-rb[0-9]+(\.[0-9]+\.[0-9]+)?)+$//'
echo "$1" | sed -E 's/(\+rb[0-9]+(\.[0-9]+\.[0-9]+)?)+$//'
}
# ---- Phase 1: Cat 1 — In-house crates (local/recipes/*/source/) ----
@@ -149,7 +152,7 @@ CAT2_CHANGED=0
CAT2_CHECKED=0
CAT2_DRIFT=0
RB_SUFFIX="-rb${TARGET_VERSION}"
RB_SUFFIX="+rb${TARGET_VERSION}"
update_cat2_version() {
local f="$1"
@@ -163,7 +166,7 @@ update_cat2_version() {
current="$(grep -E '^version\s*=' "$f" | head -1 | sed 's/.*"\(.*\)".*/\1/' || true)"
[[ -n "$current" ]] || return 0
# Strip any existing -rb<x.y.z> suffix to get upstream base
# Strip any existing +rb<x.y.z> build-metadata suffix to get upstream base
base="$(strip_rb_suffix "$current")"
target="${base}${RB_SUFFIX}"
+14 -10
View File
@@ -2,13 +2,17 @@
# verify-fork-versions.sh — Enforce the "no fake version label" rule.
#
# For each local Cat 2 fork under local/sources/<name>/ that has a
# version field of the form `<X.Y.Z>-rb<B.B.B>`, verify that:
# version field of the form `<X.Y.Z>+rb<B.B.B>`, verify that:
# 1. The fork's source content is a real rebase onto the matching
# upstream `<X.Y.Z>` release (with the Red Bear patches applied).
# 2. The `<B.B.B>` part matches the current Red Bear OS git branch.
# 3. The `version` field in the fork's Cargo.toml starts with that
# upstream release tag.
#
# The `+rb` suffix is Cargo build metadata, NOT a pre-release identifier.
# Using `-rb` is a policy violation because Cargo treats it as a pre-release
# and transitive deps requiring `^X.Y.Z` will not resolve to the fork.
#
# This script is invoked by build-preflight.sh and apply-rb-suffix.sh.
# It returns exit code 1 if any fork fails the check.
@@ -38,18 +42,18 @@ for fork_dir in local/sources/*/; do
version=$(grep -E '^version\s*=' "$toml" | head -1 | sed -E 's/.*"([^"]+)".*/\1/') || true
[ -n "$version" ] || continue
# Only check Cat 2 forks (those with -rb suffix)
if [[ "$version" != *"-rb"* ]]; then
# Only check Cat 2 forks (those with +rb build-metadata suffix)
if [[ "$version" != *"+rb"* ]]; then
continue
fi
# Extract the upstream base version (before -rb) and the branch version (after -rb)
base_version=$(echo "$version" | sed -E 's/-rb[0-9]+\.[0-9]+\.[0-9]+$//') || true
rb_branch=$(echo "$version" | sed -E 's/^.*-rb([0-9]+\.[0-9]+\.[0-9]+)$/\1/') || true
# Extract the upstream base version (before +rb) and the branch version (after +rb)
base_version=$(echo "$version" | sed -E 's/\+rb[0-9]+\.[0-9]+\.[0-9]+$//') || true
rb_branch=$(echo "$version" | sed -E 's/^.*\+rb([0-9]+\.[0-9]+\.[0-9]+)$/\1/') || true
if [ -z "$base_version" ] || [ -z "$rb_branch" ]; then
echo "ERROR: $toml has malformed version '$version'" >&2
echo " Expected format: <X.Y.Z>-rb<B.B.B> (e.g. 0.9.0-rb0.2.5)" >&2
echo " Expected format: <X.Y.Z>+rb<B.B.B> (e.g. 0.9.0+rb0.2.5)" >&2
violations=$((violations + 1))
continue
fi
@@ -79,10 +83,10 @@ for fork_dir in local/sources/*/; do
continue
fi
# Verify the -rb suffix matches the current branch
# Verify the +rb suffix matches the current branch
if [ -n "$BRANCH_VERSION" ] && [ "$rb_branch" != "$BRANCH_VERSION" ]; then
echo "ERROR: $fork_name version suffix -rb$rb_branch does not match" >&2
echo " current branch '$BRANCH' (expected -rb$BRANCH_VERSION)." >&2
echo "ERROR: $fork_name version suffix +rb$rb_branch does not match" >&2
echo " current branch '$BRANCH' (expected +rb$BRANCH_VERSION)." >&2
violations=$((violations + 1))
continue
fi