makechrootpkg: check local pkg versions before downloading for checkpkg

Avoid always trying to download and output the according message.
Add checks for packages either not being available in the repo or
all variants have up to date versions stored in the local cache.
This commit is contained in:
Levente Polyak 2019-11-30 13:09:14 +01:00
parent e0f82d3947
commit cee28a1b13
No known key found for this signature in database
GPG Key ID: FC1B547C8D8172C8
1 changed files with 12 additions and 6 deletions

View File

@ -387,13 +387,19 @@ if (( ret != 0 )); then
else else
if (( run_checkpkg )); then if (( run_checkpkg )); then
msg "Running checkpkg" msg "Running checkpkg"
remotepkgs=($(pacman -Sddp --logfile /dev/null "${pkgnames[@]}"))
if (( $? )); then
warning "Skipped checkpkg due to missing repo packages"
exit 0
fi
for remotepkg in ${remotepkgs[@]}; do
[[ $remotepkg == file://* ]] && continue
msg2 "Downloading current versions" msg2 "Downloading current versions"
if pacman --noconfirm -Swdd --logfile /dev/null "${pkgnames[@]}"; then pacman --noconfirm -Swdd --logfile /dev/null "${pkgnames[@]}"
break
done
msg2 "Checking packages" msg2 "Checking packages"
sudo -u "$makepkg_user" checkpkg --rmdir --warn sudo -u "$makepkg_user" checkpkg --rmdir --warn
else
warning "Skipped checkpkg due to missing packages"
fi
fi fi
true true
fi fi