Files
RedBear-OS/local/scripts/bump-graphics-recipes.sh
T
vasilito 4a37ae1a57 phase 1.2: move 137 legacy .patch symlinks out of path-source recipes
Per AGENTS.md § 'Local Fork Recipe Directories Must Not Carry Patch
Files', the symlinks under recipes/core/{base,kernel,relibc,
bootloader,installer}/ pointing at the canonical local/patches/<comp>/
patches were violations. The recipes use path = '...' source so the
cookbook would never apply these patches; the symlinks were a
navigation aid only.

This commit moves all 137 valid symlinks (and the redox.patch
counterparts) to local/docs/legacy-recipe-patches/<comp>/ with a
README explaining the rationale and pointing readers at the canonical
patch location.

The patches themselves (local/patches/<comp>/*.patch) are NOT
modified — they remain git-tracked at their canonical location.
Per AGENTS.md 'NEVER DELETE' policy the patches stay in their
canonical home; only the navigation aid symlinks are relocated.

Breakdown:
  base (61)         - legacy-recipe-patches/base/
  kernel (26)       - legacy-recipe-patches/kernel/
  relibc (46)       - legacy-recipe-patches/relibc/
  bootloader (3)    - legacy-recipe-patches/bootloader/
  installer (1)     - legacy-recipe-patches/installer/

After this commit, recipes/core/<comp>/.patch references all show
zero matches per AGENTS.md rule.
2026-07-12 01:35:58 +03:00

122 lines
4.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# bump-graphics-recipes.sh — Update tarball URLs/BLAKE3 for graphics recipes.
# Scope: recipes/libs, recipes/gpu, recipes/kde, recipes/qt, recipes/wip/{wayland,gpu,kde,qt}.
# Excludes: recipes/core/* (mini-ISO path), recipes/system/* (services).
#
# Usage: bump-graphics-recipes.sh [--dry-run] [--no-fetch]
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
DRY_RUN=0
NO_FETCH=0
for arg in "$@"; do
case "$arg" in
--dry-run) DRY_RUN=1 ;;
--no-fetch) NO_FETCH=1 ;;
--help|-h) echo "Usage: $0 [--dry-run] [--no-fetch]"; exit 0 ;;
*) echo "Unknown option: $arg" >&2; exit 1 ;;
esac
done
declare -A UPSTREAM_INDEX=(
[cairo]=https://cairographics.org/releases/
[freetype2]=https://download.savannah.gnu.org/freetype/
[glib]=https://download.gnome.org/sources/glib/
[harfbuzz]=https://github.com/harfbuzz/harfbuzz/releases/
[libepoxy]=https://github.com/anholt/libepoxy/releases/
[libxkbcommon]=https://github.com/xkbcommon/libxkbcommon/releases/
[pango]=https://download.gnome.org/sources/pango/
[libjpeg]=https://github.com/libjpeg-turbo/libjpeg-turbo/releases/
[shared-mime-info]=https://gitlab.gnome.org/GNOME/shared-mime-info/-/tags/
[gdk-pixbuf]=https://download.gnome.org/sources/gdk-pixbuf/
[libxml2]=https://download.gnome.org/sources/libxml2/
[kf6-karchive]=https://download.kde.org/stable/frameworks/
[kf6-attica]=https://download.kde.org/stable/frameworks/
[kf6-kcodecs]=https://download.kde.org/stable/frameworks/
)
GRAPHICS_DIRS=(
"$ROOT/recipes/libs" "$ROOT/recipes/gpu" "$ROOT/recipes/kde" "$ROOT/recipes/qt"
"$ROOT/recipes/wip/wayland" "$ROOT/recipes/wip/gpu" "$ROOT/recipes/wip/kde" "$ROOT/recipes/wip/qt"
)
VER_RE='-v?[0-9]+(\.[0-9]+){1,3}(-rc[0-9]+)?(-alpha[0-9]+)?(-beta[0-9]+)?'
resolve_latest() {
local cached="$1" prefix="$2"
grep -oE "${prefix}${VER_RE}\.tar\.(gz|xz|bz2|zst)" "$cached" | sort -uV | tail -1
}
UPDATED=0
SKIPPED=0
FAILED=0
for dir in "${GRAPHICS_DIRS[@]}"; do
[ -d "$dir" ] || continue
for rdir in "$dir"/*/; do
[ -f "$rdir/recipe.toml" ] || continue
name=$(basename "$rdir")
if [ -z "${UPSTREAM_INDEX[$name]:-}" ]; then
SKIPPED=$((SKIPPED+1))
continue
fi
current=$(grep '^tar = ' "$rdir/recipe.toml" | head -1 | sed -E 's/^tar = "//;s/"$//')
[ -z "$current" ] && { SKIPPED=$((SKIPPED+1)); continue; }
case "$name" in
glib|pango|shared-mime-info|gdk-pixbuf|libxml2) prefix="$name" ;;
freetype2) prefix="freetype" ;;
libepoxy) prefix="libepoxy" ;;
libxkbcommon) prefix="libxkbcommon" ;;
libjpeg) prefix="libjpeg-turbo" ;;
cairo) prefix="cairo" ;;
harfbuzz) prefix="harfbuzz" ;;
kf6-*) prefix="$(echo $name | sed 's/^kf6-//')" ;;
*) prefix="$name" ;;
esac
cached="$ROOT/.redbear-recipe-bump/$name.html"
mkdir -p "$(dirname "$cached")"
if [ "$NO_FETCH" = "0" ]; then
if ! curl -sLf "${UPSTREAM_INDEX[$name]}" -o "$cached"; then
echo "WARN: $name: failed to fetch ${UPSTREAM_INDEX[$name]}" >&2
FAILED=$((FAILED+1))
continue
fi
fi
[ -f "$cached" ] || continue
latest=$(resolve_latest "$cached" "$prefix")
[ -z "$latest" ] && { SKIPPED=$((SKIPPED+1)); continue; }
latest_url=$(grep -m1 -oE "${UPSTREAM_INDEX[$name]}${latest}" "$cached" | head -1)
[ -z "$latest_url" ] && latest_url="${UPSTREAM_INDEX[$name]}${latest}"
if [ "$current" = "$latest_url" ]; then
SKIPPED=$((SKIPPED+1))
continue
fi
echo "[$name] $current -> $latest_url"
if [ "$DRY_RUN" = "0" ]; then
tmp=$(mktemp)
curl -sLf "$latest_url" -o "$tmp"
new_hash=$(b3sum "$tmp" | awk '{print $1}')
sed -i -E "s|^tar = \"[^\"]+\"|tar = \"$latest_url\"|" "$rdir/recipe.toml"
sed -i -E "s|^blake3 = \"[a-f0-9]+\"|blake3 = \"$new_hash\"|" "$rdir/recipe.toml"
rm -f "$tmp"
fi
UPDATED=$((UPDATED+1))
done
done
echo ""
echo "=== Bump summary ==="
echo "Updated (or would-update): $UPDATED"
echo "Skipped (no index / already-current / non-tar): $SKIPPED"
echo "Failed (network/parse): $FAILED"
[ "$DRY_RUN" = "1" ] && echo "Dry-run only. No files changed."