Compare commits

..

1 Commits

Author SHA1 Message Date
Christian Heusel
8125a81a98 fix: Reduce verbosity if version file is missing
As we don't check for the existance of the version file this would
otherwise emit a useless error to the commandline:

    > ==> Building protobuf for [extra-staging] (x86_64)
    > cat: /var/lib/archbuild/extra-staging-x86_64/root/.arch-chroot: No such file or directory
    > ==> Creating chroot for [extra-staging] (x86_64)...

Fix this by just silencing the error, as the check later also covers the
case for empty `CURRENT_CHROOT_VERSION`.

Fixes #272

Component: archbuild
Signed-off-by: Christian Heusel <christian@heusel.eu>
2025-07-28 18:30:49 +02:00
2 changed files with 13 additions and 12 deletions

View File

@@ -80,7 +80,7 @@ check_root SOURCE_DATE_EPOCH,SRCDEST,SRCPKGDEST,PKGDEST,LOGDEST,MAKEFLAGS,PACKAG
makechrootpkg_args+=("${@:$OPTIND}")
# Automatically recreate the root chroot if a version mismatch is detected
CURRENT_CHROOT_VERSION=$(cat "${chroots}/${repo}-${arch}/root/.arch-chroot")
CURRENT_CHROOT_VERSION=$(cat "${chroots}/${repo}-${arch}/root/.arch-chroot" 2>/dev/null)
if [[ -f "${chroots}/${repo}-${arch}/root/.arch-chroot" ]] && [[ "$CURRENT_CHROOT_VERSION" != "$CHROOT_VERSION" ]]; then
warning "Recreating chroot '%s' (%s) as it is not at version %s" "${chroots}/${repo}-${arch}/root" "$CURRENT_CHROOT_VERSION" "$CHROOT_VERSION"
clean_first=true

View File

@@ -19,7 +19,7 @@ shopt -s nullglob
default_makepkg_args=(--syncdeps --noconfirm --log --holdver --skipinteg)
makepkg_args=("${default_makepkg_args[@]}")
verifysource_args=(--syncdeps --noconfirm --log)
verifysource_args=()
chrootdir=
passeddir=
makepkg_user=
@@ -175,7 +175,7 @@ prepare_chroot() {
printf >>"$copydir/etc/passwd" 'builduser:x:%d:%d:builduser:/build:/bin/bash\n' "$builduser_uid" "$builduser_gid"
printf >>"$copydir/etc/shadow" 'builduser:!!:%d::::::\n' "$(( $(date -u +%s) / 86400 ))"
$install -d "$copydir"/{build,startdir,{pkg,srcpkg,src,log}dest,verify/{gnupg,ssh}}
$install -d "$copydir"/{build,startdir,{pkg,srcpkg,src,log}dest}
sed -e '/^MAKEFLAGS=/d' -e '/^PACKAGER=/d' -i "$copydir/etc/makepkg.conf"
for x in BUILDDIR=/build PKGDEST=/pkgdest SRCPKGDEST=/srcpkgdest SRCDEST=/srcdest LOGDEST=/logdest \
@@ -247,10 +247,15 @@ _chrootnamcap() {
done
}
_download_sources() {
download_sources() {
setup_workdir
chown "$makepkg_user:" "$WORKDIR"
# Ensure sources are downloaded
sudo -u builduser env SRCDEST="/srcdest" GNUPGHOME="/verify/gnupg" SSH_AUTH_SOCK="/verify/ssh" \
bash -c "cd /startdir; makepkg --config=/etc/makepkg.conf --verifysource -o ${verifysource_args[*]}"
sudo -u "$makepkg_user" --preserve-env=GNUPGHOME,SSH_AUTH_SOCK \
env SRCDEST="$SRCDEST" BUILDDIR="$WORKDIR" \
makepkg --config="$copydir/etc/makepkg.conf" --verifysource -o "${verifysource_args[@]}" ||
die "Could not download sources."
}
move_logfiles() {
@@ -347,7 +352,6 @@ umask 0022
ORIG_HOME=$HOME
IFS=: read -r _ _ _ _ _ HOME _ < <(getent passwd "${SUDO_USER:-$USER}")
load_makepkg_config
DEVTOOLS_GNUPGHOME="${GNUPGHOME:-$HOME/.gnupg}"
HOME=$ORIG_HOME
# Use PKGBUILD directory if these don't exist
@@ -379,6 +383,8 @@ if [[ "$(id -u "$makepkg_user")" == 0 ]]; then
exit 1
fi
download_sources
prepare_chroot
nspawn_build_args=(
@@ -390,11 +396,6 @@ nspawn_build_args=(
"${bindmounts_tmpfs[@]}"
)
arch-nspawn "$copydir" \
"${nspawn_build_args[@]}" --bind-ro="${DEVTOOLS_GNUPGHOME//:/\\:}:/verify/gnupg" --bind-ro="${SSH_AUTH_SOCK//:/\\:}:/verify/ssh" \
bash -c "$(declare -f _download_sources); verifysource_args=(${verifysource_args[*]}); _download_sources" ||
die "Could not download sources."
if arch-nspawn "$copydir" \
"${nspawn_build_args[@]}" \
/chrootbuild "${makepkg_args[@]}"