Etapa G: tanda C tier-2 — import-batch PREFER=alpine + importador separa runtime depends
Arranca el tier-2 de la escalera (C clasico via Alpine, que trae los parches musl): - import-batch.sh: env PREFER=nix|alpine. Para tandas C, PREFER=alpine antepone Alpine — el import de nix de un C tiene exito (tarball) pero SIN parches musl => romperia al construir. Refactor a 'tiers' ordenados (misma escalera, dos sentidos). - tandas/cli-c.txt: primera tanda C (tree/which/sed/gawk/gzip/tar/jq/file). - importador Alpine: build-deps = SOLO makedepends. El depends de abuild es RUNTIME (gzip depends=less para zless) — no hace falta para compilar y rompia hammer build (buscaba recipes/less.toml). Ahora va como comentario de provenance. Mismo patron que el fix de buildInputs-de-nix en recetas Rust. VALIDADO: import C 8/8 desde Alpine/main con parches musl bajados; gzip pierde el less espurio. test extracts_source_patches_deps_phases actualizado (depends != build-dep). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+30
-18
@@ -13,9 +13,10 @@
|
||||
# Ej: scripts/import-batch.sh ripgrep fd bat hyperfine
|
||||
# scripts/import-batch.sh -f tandas/cli-rust.txt
|
||||
# OUTDIR=recipes/incoming scripts/import-batch.sh sd dust
|
||||
# Env: OUTDIR (default recipes), NIX_STORE (p.ej. $HOME/.nixstore si /nix/store no es escribible),
|
||||
# ALPINE_BRANCH (default master), HAMMER (cmd del cli). Un nombre puede mapear nix→alpine
|
||||
# distintos con `nixattr=alpinepkg` (p.ej. `ripgrep=ripgrep`, `the_silver_searcher=the-silver-searcher`).
|
||||
# Env: OUTDIR (default recipes), PREFER (nix|alpine; default nix — alpine antepone Alpine para tandas
|
||||
# C, que necesitan sus parches musl), NIX_STORE (p.ej. $HOME/.nixstore si /nix/store no es
|
||||
# escribible), ALPINE_BRANCH (default master), HAMMER (cmd del cli). Un nombre puede mapear
|
||||
# nix→alpine distintos con `nixattr=alpinepkg` (p.ej. `the_silver_searcher=the-silver-searcher`).
|
||||
set -eu
|
||||
|
||||
here=$(dirname "$0")
|
||||
@@ -31,6 +32,12 @@ else
|
||||
pkgs=$(printf '%s\n' "$@")
|
||||
fi
|
||||
|
||||
# Orden de fuentes: PREFER=nix (default, tier-1 Rust/Go) o PREFER=alpine (tier-2 C, trae parches musl).
|
||||
case "${PREFER:-nix}" in
|
||||
alpine) TIERS="alpine-main alpine-community nix" ;;
|
||||
nix|*) TIERS="nix alpine-main alpine-community" ;;
|
||||
esac
|
||||
|
||||
mkdir -p "$OUTDIR"
|
||||
nix_n=0; alpine_n=0; failed=""; got=""
|
||||
|
||||
@@ -47,22 +54,27 @@ for entry in $pkgs; do
|
||||
out="$OUTDIR/${nixattr}.toml"
|
||||
|
||||
printf '%-24s ' "$nixattr" >&2
|
||||
if "$here/nix-import.sh" "$nixattr" > "$out.tmp" 2>/dev/null && [ -s "$out.tmp" ]; then
|
||||
mv "$out.tmp" "$out"
|
||||
nix_n=$((nix_n + 1)); got="$got $nixattr"
|
||||
echo "✓ nix" >&2
|
||||
elif "$here/alpine-import.sh" "$alpinepkg" main > "$out.tmp" 2>/dev/null && [ -s "$out.tmp" ]; then
|
||||
mv "$out.tmp" "$out"
|
||||
alpine_n=$((alpine_n + 1)); got="$got $nixattr"
|
||||
echo "✓ alpine/main (parches musl)" >&2
|
||||
elif "$here/alpine-import.sh" "$alpinepkg" community > "$out.tmp" 2>/dev/null && [ -s "$out.tmp" ]; then
|
||||
mv "$out.tmp" "$out"
|
||||
alpine_n=$((alpine_n + 1)); got="$got $nixattr"
|
||||
echo "✓ alpine/community (parches musl)" >&2
|
||||
else
|
||||
rm -f "$out.tmp"
|
||||
done_pkg=""
|
||||
# Orden de fuentes según PREFER (default nix, ~100% Rust/Go). PREFER=alpine antepone Alpine para
|
||||
# tandas C: el import de nix de un C tiene éxito (tarball) pero SIN los parches musl ⇒ rompería al
|
||||
# construir; Alpine los TRAE. Cada "tier" es una etiqueta y el comando que produce la receta.
|
||||
for tier in $TIERS; do
|
||||
case $tier in
|
||||
nix) src="nix"; cmd_out=$("$here/nix-import.sh" "$nixattr" 2>/dev/null) || cmd_out="" ;;
|
||||
alpine-main) src="alpine/main"; cmd_out=$("$here/alpine-import.sh" "$alpinepkg" main 2>/dev/null) || cmd_out="" ;;
|
||||
alpine-comm*) src="alpine/community"; cmd_out=$("$here/alpine-import.sh" "$alpinepkg" community 2>/dev/null) || cmd_out="" ;;
|
||||
esac
|
||||
if [ -n "$cmd_out" ]; then
|
||||
printf '%s\n' "$cmd_out" > "$out"
|
||||
case $tier in nix) nix_n=$((nix_n + 1)) ;; *) alpine_n=$((alpine_n + 1)) ;; esac
|
||||
got="$got $nixattr"; done_pkg=1
|
||||
echo "✓ $src" >&2
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ -z "$done_pkg" ]; then
|
||||
failed="$failed $nixattr"
|
||||
echo "✗ ni nix ni Alpine" >&2
|
||||
echo "✗ ninguna fuente" >&2
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user