Don't yum update files which are not installed
This change builds the packages_for_update list by intersecting installed packages with the packages available, which avoids passing uninstalled packages to the yum update call. For some reason doing a yum update with packages which are not installed causes a delay for each uninstalled package. For my test case this gave a speed improvement of 35s vs 45s for the whole image build. This would accumulate to decent time savings for all images in CI. Change-Id: I338d9881d5a05dd7b1fbc5efea1145349f0997a6
This commit is contained in:
parent
678b93fe30
commit
b58b916dbc
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
set -eux
|
||||
|
||||
|
@ -11,7 +11,9 @@ fi
|
|||
|
||||
packages_for_update=
|
||||
if [ -n "$1" ] && command -v repoquery >/dev/null 2>&1; then
|
||||
packages_for_update=("$(repoquery --disablerepo='*' --enablerepo=$1 --qf %{NAME} -a)")
|
||||
installed=$(rpm -qa --qf "%{NAME}\n" | sort)
|
||||
available=$(repoquery --disablerepo='*' --enablerepo=$1 --qf %{NAME} -a | sort)
|
||||
packages_for_update=$(comm -12 <(printf "%s\n" $installed) <(printf "%s\n" $available))
|
||||
fi
|
||||
|
||||
if [ -z "$packages_for_update" ]; then
|
||||
|
|
Loading…
Reference in New Issue