Improve package install errors handling

pull/86/head
Michele Locati 2019-12-23 12:40:28 +01:00
parent d21ab4af58
commit f3c663103a
No known key found for this signature in database
GPG Key ID: 98B7CE2E7234E28B
1 changed files with 11 additions and 11 deletions

View File

@ -564,15 +564,13 @@ buildRequiredPackageLists() {
esac esac
if test -n "$buildRequiredPackageLists_persistent"; then if test -n "$buildRequiredPackageLists_persistent"; then
PACKAGES_PERSISTENT="$(expandPackagesToBeInstalled $buildRequiredPackageLists_persistent)" PACKAGES_PERSISTENT="$(expandPackagesToBeInstalled $buildRequiredPackageLists_persistent)"
if test -s "$IPE_ERRFILE"; then if test -s "$IPE_ERRFLAG_FILE"; then
cat "$IPE_ERRFILE" >&2
exit 1 exit 1
fi fi
fi fi
if test -n "$buildRequiredPackageLists_volatile"; then if test -n "$buildRequiredPackageLists_volatile"; then
buildRequiredPackageLists_packages="$(expandPackagesToBeInstalled $buildRequiredPackageLists_volatile)" buildRequiredPackageLists_packages="$(expandPackagesToBeInstalled $buildRequiredPackageLists_volatile)"
if test -s "$IPE_ERRFILE"; then if test -s "$IPE_ERRFLAG_FILE"; then
cat "$IPE_ERRFILE" >&2
exit 1 exit 1
fi fi
resetIFS resetIFS
@ -598,9 +596,10 @@ expandPackagesToBeInstalled() {
alpine) alpine)
expandPackagesToBeInstalled_log="$(apk add --simulate $@ 2>&1 || printf '\nERROR: apk failed\n')" expandPackagesToBeInstalled_log="$(apk add --simulate $@ 2>&1 || printf '\nERROR: apk failed\n')"
if test -n "$(printf '%s' "$expandPackagesToBeInstalled_log" | grep -E '^ERROR:')"; then if test -n "$(printf '%s' "$expandPackagesToBeInstalled_log" | grep -E '^ERROR:')"; then
printf 'FAILED TO LIST THE WHOLE PACKAGE LIST FOR\n' >"$IPE_ERRFILE" printf 'FAILED TO LIST THE WHOLE PACKAGE LIST FOR\n' >&2
printf '%s ' "$@" >>"$IPE_ERRFILE" printf '%s ' "$@" >&2
printf '\n\nCOMMAND OUTPUT:\n%s\n' "$expandPackagesToBeInstalled_log" >>"$IPE_ERRFILE" printf '\n\nCOMMAND OUTPUT:\n%s\n' "$expandPackagesToBeInstalled_log" >&2
echo 'y' >"$IPE_ERRFLAG_FILE"
exit 1 exit 1
fi fi
IFS=' IFS='
@ -615,9 +614,10 @@ expandPackagesToBeInstalled() {
debian) debian)
expandPackagesToBeInstalled_log="$(DEBIAN_FRONTEND=noninteractive apt-get install -sy $@ 2>&1 || printf '\nE: apt-get failed\n')" expandPackagesToBeInstalled_log="$(DEBIAN_FRONTEND=noninteractive apt-get install -sy $@ 2>&1 || printf '\nE: apt-get failed\n')"
if test -n "$(printf '%s' "$expandPackagesToBeInstalled_log" | grep -E '^E:')"; then if test -n "$(printf '%s' "$expandPackagesToBeInstalled_log" | grep -E '^E:')"; then
printf 'FAILED TO LIST THE WHOLE PACKAGE LIST FOR\n' >"$IPE_ERRFILE" printf 'FAILED TO LIST THE WHOLE PACKAGE LIST FOR\n' >&2
printf '%s ' "$@" >"$IPE_ERRFILE" printf '%s ' "$@" >&2
printf '\n\nCOMMAND OUTPUT:\n%s\n' "$expandPackagesToBeInstalled_log" >"$IPE_ERRFILE" printf '\n\nCOMMAND OUTPUT:\n%s\n' "$expandPackagesToBeInstalled_log" >&2
echo 'y' >"$IPE_ERRFLAG_FILE"
exit 1 exit 1
fi fi
expandPackagesToBeInstalled_inNewPackages=0 expandPackagesToBeInstalled_inNewPackages=0
@ -1138,7 +1138,7 @@ cleanup() {
resetIFS resetIFS
mkdir -p /tmp/src mkdir -p /tmp/src
IPE_ERRFILE="$(mktemp -p /tmp/src)" IPE_ERRFLAG_FILE="$(mktemp -p /tmp/src)"
PHP_MAJMIN_VERSION=$(getPHPMajorMinor) PHP_MAJMIN_VERSION=$(getPHPMajorMinor)
case "$PHP_MAJMIN_VERSION" in case "$PHP_MAJMIN_VERSION" in
506 | 700 | 701 | 702 | 703 | 704) ;; 506 | 700 | 701 | 702 | 703 | 704) ;;