makechrootpkg: only expose failed build logs instead of products

After further followups always moving all products isn't actually
desired as they can theoretically be broken in various ways if
arch-nspawn exists non successful.

However, as we would like to always preserve the produced log files we
instead split out the logfiles into an own function and call that for
unsuccessful buils.

Fixes 4f305aa3
This commit is contained in:
Levente Polyak 2021-01-31 16:08:36 +01:00
parent a49bcf2097
commit 8c26438df8
No known key found for this signature in database
GPG Key ID: FC1B547C8D8172C8
1 changed files with 12 additions and 7 deletions

View File

@ -242,6 +242,15 @@ download_sources() {
die "Could not download sources." die "Could not download sources."
} }
move_logfiles() {
local l
for l in "$copydir"/logdest/*; do
[[ $l == */logpipe.* ]] && continue
chown "$src_owner" "$l"
mv "$l" "$LOGDEST"
done
}
move_products() { move_products() {
local pkgfile local pkgfile
for pkgfile in "$copydir"/pkgdest/*; do for pkgfile in "$copydir"/pkgdest/*; do
@ -254,12 +263,7 @@ move_products() {
fi fi
done done
local l move_logfiles
for l in "$copydir"/logdest/*; do
[[ $l == */logpipe.* ]] && continue
chown "$src_owner" "$l"
mv "$l" "$LOGDEST"
done
for s in "$copydir"/srcpkgdest/*; do for s in "$copydir"/srcpkgdest/*; do
chown "$src_owner" "$s" chown "$src_owner" "$s"
@ -367,10 +371,11 @@ if arch-nspawn "$copydir" \
/chrootbuild "${makepkg_args[@]}" /chrootbuild "${makepkg_args[@]}"
then then
mapfile -t pkgnames < <(sudo -u "$makepkg_user" bash -c 'source PKGBUILD; printf "%s\n" "${pkgname[@]}"') mapfile -t pkgnames < <(sudo -u "$makepkg_user" bash -c 'source PKGBUILD; printf "%s\n" "${pkgname[@]}"')
move_products
else else
(( ret += 1 )) (( ret += 1 ))
move_logfiles
fi fi
move_products
(( temp_chroot )) && delete_chroot "$copydir" "$copy" (( temp_chroot )) && delete_chroot "$copydir" "$copy"