Fix dnf repoquery regression

Fixed issue identified at https://review.opendev.org/#/c/664872/1 which
prevented full execution of yum_update.sh on dnf platforms because
`dnf repoquery` returned exit code 1 when repo did not exist.

Change-Id: I86918f292b6863d6cb0e4fd16e62409a7f9fa80a
This commit is contained in:
Sorin Sbarnea 2019-06-20 15:18:29 +01:00 committed by yatin
parent 8b366d2a27
commit 6dab9dda02
1 changed files with 2 additions and 1 deletions

View File

@ -14,7 +14,8 @@ fi
packages_for_update=
if [ -n "$1" ] && [[ -n $REPOQUERY_CMD ]]; then
installed_versions=$(rpm -qa --qf "%{NAME} = %{VERSION}-%{RELEASE}\n" | sort)
available_versions=$($REPOQUERY_CMD --quiet --provides --disablerepo='*' --enablerepo=$1 -a | sort)
# dnf repoquery return 1 when repo does not exists, but standalone does not
available_versions=$($REPOQUERY_CMD --quiet --provides --disablerepo='*' --enablerepo=$1 -a | sort || true)
uptodate_versions=$(comm -12 <(printf "%s\n" "$installed_versions") <(printf "%s\n" "$available_versions"))