Files
RedBear-OS/local/scripts/refresh-fork-upstream-map.sh
T
vasilito f7c3d504dd policy: enforce no-fake-version-label rule for Cat 2 forks
Per local/AGENTS.md \xC2\xA7 'No-fake-version-label rule':

  Every Cat 2 fork version MUST match the source content from the
  corresponding upstream release + documented Red Bear patches.
  A `-rbN` label on stale content is a fake label and a policy
  violation.

Changes:

  * local/AGENTS.md: documented the no-fake-version-label rule,
    including what counts as a fake label, the enforcement contract,
    and what a real Red Bear fork looks like.

  * local/fork-upstream-map.toml: authoritative mapping of each
    Cat 2 fork (syscall, libredox, redoxfs, redox-scheme, relibc,
    kernel, bootloader, installer, userutils) to its upstream Git
    URL and release tag.

  * local/scripts/refresh-fork-upstream-map.sh: auto-update the
    fork-upstream-map by querying each upstream repo for the
    current latest stable release tag.

  * local/scripts/verify-fork-versions.sh: preflight enforcement
    script. For each Cat 2 fork with a `-rbN` version field:
      1. Compare fork's file list and content against the upstream
         release tag from the map. Reject the build if files are
         missing (would be a fake label).
      2. Reject the build if files exist in local that don't exist
         in upstream (must be moved to local/patches/<fork>/ as
         documented Red Bear patches).
      3. Reject the build if shared files diverge in content.

  * local/scripts/apply-rb-suffix.sh: invokes
    verify-fork-versions.sh after applying the `-rbN` label so the
    build fails fast if the labelled content is fake.

  * local/scripts/build-preflight.sh: invokes
    verify-fork-versions.sh at the start of every build. Bypassed
    only with REDBEAR_SKIP_FORK_VERIFY=1 (emergency only).

  * local/patches/bottom/0001-ratui-0.30-braille-compat.patch: the
    ratatui 0.30+ compatibility shim for bottom 0.11.2.

This is the structural enforcement that prevents fake labels from
ever reaching the build again. The current 6 forks with `-rbN`
labels are flagged by the verifier — they must be rebased onto
their actual upstream release before the build can succeed.
2026-07-05 02:37:54 +03:00

56 lines
2.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# refresh-fork-upstream-map.sh — Update local/fork-upstream-map.toml
# with the current upstream URLs and latest release tags for each
# Cat 2 fork. This is the canonical source of truth for
# verify-fork-versions.sh.
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
cd "$ROOT"
MAP="$ROOT/local/fork-upstream-map.toml"
# fork_name upstream_url latest_tag
declare -A FORKS=(
[syscall]="https://gitlab.redox-os.org/redox-os/syscall.git"
[libredox]="https://gitlab.redox-os.org/redox-os/libredox.git"
[redoxfs]="https://gitlab.redox-os.org/redox-os/redoxfs.git"
[redox-scheme]="https://gitlab.redox-os.org/redox-os/redox-scheme.git"
[relibc]="https://gitlab.redox-os.org/redox-os/relibc.git"
[kernel]="https://gitlab.redox-os.org/redox-os/kernel.git"
[bootloader]="https://gitlab.redox-os.org/redox-os/bootloader.git"
[installer]="https://gitlab.redox-os.org/redox-os/installer.git"
[userutils]="https://gitlab.redox-os.org/redox-os/userutils.git"
)
{
echo "# fork-upstream-map.toml — Auto-generated by"
echo "# local/scripts/refresh-fork-upstream-map.sh. Do not edit by hand."
echo "# Format: <fork-name> <upstream-git-url> <upstream-release-tag>"
echo ""
for fork in syscall libredox redoxfs redox-scheme relibc kernel bootloader installer userutils; do
url="${FORKS[$fork]:-}"
if [ -z "$url" ]; then
echo "WARN: no upstream URL for $fork, skipping" >&2
continue
fi
# Get latest tag matching the project's version scheme
# (e.g. 0.9.0, 0.1.18, 0.5.12, 1.0.0). Exclude pre-release and
# non-stable tags.
latest=$(cd /tmp && git ls-remote --tags --sort=-v:refname "$url" 2>/dev/null \
| awk '{print $2}' \
| sed 's|refs/tags/||' \
| grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' \
| head -1)
if [ -z "$latest" ]; then
echo "WARN: couldn't determine latest tag for $fork from $url" >&2
continue
fi
printf "%-13s %-55s %s\n" "$fork" "$url" "$latest"
done
} > "$MAP"
echo "Updated $MAP"
cat "$MAP"