Files
RedBear-OS/local/scripts/verify-patches.sh
T
vasilito 5851974b20 feat: build system transition to release fork + archive hardening
Release fork infrastructure:
- REDBEAR_RELEASE=0.1.1 with offline enforcement (fetch/distclean/unfetch blocked)
- 195 BLAKE3-verified source archives in standard format
- Atomic provisioning via provision-release.sh (staging + .complete sentry)
- 5-phase improvement plan: restore format auto-detection, source tree
  validation (validate-source-trees.py), archive-map.json, REPO_BINARY fallback

Archive normalization:
- Removed 87 duplicate/unversioned archives from shared pool
- Regenerated all archives in consistent format with source/ + recipe.toml
- BLAKE3SUMS and manifest.json generated from stable tarball set

Patch management:
- verify-patches.sh: pre-sync dry-run report (OK/REVERSED/CONFLICT)
- 121 upstream-absorbed patches moved to absorbed/ directories
- 43 active patches verified clean against rebased sources
- Stress test: base updated to upstream HEAD, relibc reset and patched

Compilation fixes:
- relibc: Vec imports in redox-rt (proc.rs, lib.rs, sys.rs)
- relibc: unsafe from_raw_parts in mod.rs (2024 edition)
- fetch.rs: rev comparison handles short/full hash prefixes
- kibi recipe: corrected rev mismatch

New scripts: restore-sources.sh, provision-release.sh, verify-sources-archived.sh,
check-upstream-releases.sh, validate-source-trees.py, verify-patches.sh,
repair-archive-format.sh, generate-manifest.py

Documentation: AGENTS.md, README.md, local/AGENTS.md updated for release fork model
2026-05-02 01:41:17 +01:00

87 lines
2.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# verify-patches.sh — Check which Red Bear patches need rebasing against current source trees.
#
# Usage:
# ./local/scripts/verify-patches.sh [--component=base|kernel|relibc] [--all]
#
# Dry-runs all patches against their target source trees and reports:
# OK — patch applies cleanly
# REV — reversed/already applied (upstream absorbed)
# CONFLICT — genuine conflict, needs rebasing
#
# Exit code: number of CONFLICT patches
set -eo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
COMPONENT="${1:-all}"
MODE="${2:-}"
cd "$PROJECT_ROOT"
GREEN='\033[1;32m'
RED='\033[1;31m'
YELLOW='\033[1;33m'
NC='\033[0m'
ok=0
rev=0
conflict=0
check_patches() {
local patch_dir="$1"
local target_dir="$2"
local label="$3"
[ -d "$patch_dir" ] || return
[ -d "$target_dir" ] || { echo " ${RED}SKIP${NC} $label: target not found"; return; }
echo "=== $label ==="
for patch in "$patch_dir"/*.patch; do
[ -f "$patch" ] || continue
local name=$(basename "$patch")
local result=$(patch -p1 --dry-run -d "$target_dir" < "$patch" 2>&1) || true
if echo "$result" | grep -q 'Reversed\|previously applied'; then
echo " ${YELLOW}REV${NC} $name (upstream absorbed)"
rev=$((rev + 1))
elif echo "$result" | grep -q 'FAILED\|hunks\? FAILED'; then
echo " ${RED}CONFLICT${NC} $name"
conflict=$((conflict + 1))
else
echo " ${GREEN}OK${NC} $name"
ok=$((ok + 1))
fi
done
}
case "$COMPONENT" in
base|all)
check_patches "local/patches/base" "recipes/core/base/source" "base"
;;
esac
case "$COMPONENT" in
kernel|all)
check_patches "local/patches/kernel" "recipes/core/kernel/source" "kernel"
# Fallback: kernel source may be nested from archive extraction
if [ ! -d "recipes/core/kernel/source" ] && [ -d "recipes/core/kernel/kernel/source" ]; then
check_patches "local/patches/kernel" "recipes/core/kernel/kernel/source" "kernel"
fi
;;
esac
case "$COMPONENT" in
relibc|all)
check_patches "local/patches/relibc" "recipes/core/relibc/source" "relibc"
;;
esac
echo ""
echo "========================================="
echo " OK: $ok"
echo " Reversed: $rev (upstream absorbed)"
echo " Conflict: $conflict (needs rebase)"
echo "========================================="
exit $conflict