[FIX] clean the source tree between attempts; strip gcc _pick lines

Four packages -- grep, gnupg, pacman and curl -- were failing on my own
driver, not on the port. makepkg -f rebuilds but does not wipe $srcdir,
so a re-run re-entered the previous attempt's tree:

  patch: ... already exists!  Skipping patch.
  1 out of 1 hunk ignored
  mkdir: build-curl-compat: File exists

makepkg -C now cleans first. Worth stating plainly: those four looked
like port problems for two full rounds, and were not.

gcc: dropping sub-packages from pkgname was not enough. package_gcc()
_picks files out for every front end regardless of what was requested,
and _pick is a mv, so it fails on what was never built:

  mv: cannot stat 'usr/bin/gnat': No such file or directory

The _pick lines for the disabled front ends are removed too.

shadow needed libaudit-dev on the host -- one more makedepend that
--nodeps hides until a build stops on it.

--- FR ---

Quatre paquets -- grep, gnupg, pacman et curl -- echouaient a cause de
mon propre pilote, pas du portage. makepkg -f reconstruit mais ne vide
pas $srcdir, si bien qu une reprise revenait dans l arbre de la
tentative precedente :

  patch: ... already exists!  Skipping patch.
  1 out of 1 hunk ignored
  mkdir: build-curl-compat: File exists

makepkg -C nettoie desormais d abord. A dire clairement : ces quatre-la
ont eu l air de problemes de portage pendant deux tours entiers, et ne
l etaient pas.

gcc : retirer les sous-paquets de pkgname ne suffisait pas.
package_gcc() extrait des fichiers pour chaque frontal quoi qu on ait
demande, et _pick est un mv, donc il echoue sur ce qui n a jamais ete
bati :

  mv: cannot stat 'usr/bin/gnat': No such file or directory

Les lignes _pick des frontaux desactives sont retirees aussi.

shadow reclamait libaudit-dev sur l hote -- un makedepend de plus que
--nodeps masque jusqu a ce qu une compilation s y arrete.

Assisted-by: Claude Opus 5
This commit is contained in:
Mathieu Benoit 2026-08-16 02:23:01 -04:00
parent 6eb83c91c3
commit d72673a3db
2 changed files with 24 additions and 2 deletions

View file

@ -91,6 +91,21 @@ sed -i '/usr\/lib32/d; /_libdir\/32/d' PKGBUILD
# front end is off.
sed -i 's/^\(\s*for _so in \).*; do$/\1libatomic.so libstdc++.so; do/' PKGBUILD
# package_gcc() also _picks files out for every sub-package, including the
# front ends we disabled. _pick is a mv, so it fails on what was never built:
#
# mv: cannot stat 'usr/bin/gnat': No such file or directory
#
# Dropping the entries from pkgname was not enough -- the _pick lines live in
# package_gcc() and run regardless of which sub-packages are requested.
for _lang in gcc-ada gcc-d gcc-go gcc-m2 gcc-rust gcc-gcobol \
libgm2 libgo libgphobos libgcobol libhwasan; do
sed -i "/_pick ${_lang} /d" PKGBUILD
done
if grep -qE '_pick (gcc-ada|gcc-d|gcc-go|gcc-m2|gcc-rust|gcc-gcobol) ' PKGBUILD; then
echo "gcc: _pick lines remain for a disabled front end" >&2; exit 1
fi
if grep -q 'usr/lib32' PKGBUILD; then
echo "gcc: usr/lib32 still manipulated" >&2; exit 1
fi

View file

@ -123,8 +123,15 @@ build_package() {
# success became the function's exit status -- and a run reported
# "51 built, 0 failed" while glibc, gcc, coreutils and pacman had all
# failed. Measured: the repository held 23 files, not a hundred.
makepkg --nodeps --ignorearch --skippgpcheck --skipchecksums --nocheck -f \
|| return 1
# -C wipes $srcdir first. Without it a re-run inherits the previous
# attempt's tree, and prepare() fails on work it already did:
# patch: ... already exists! Skipping patch.
# 1 out of 1 hunk ignored
# mkdir: build-curl-compat: File exists
# grep, gnupg, pacman and curl all failed this way -- not on the
# port, but on my own driver re-entering a dirty directory.
makepkg --nodeps --ignorearch --skippgpcheck --skipchecksums --nocheck \
-C -f || return 1
# An exit code is not proof. Only the artefact is.
local produced=()
shopt -s nullglob