Fix 'build-pkgs --container' when building in docker

build-pkgs --container fails when run within docker
due to DNS lookup failure.

Need to add pkg bind-utils to mock when building in
the 'container' context, and to add an /etc/resolv.conf
via 'config_opts['use_host_resolv'] = True'

Story: 2003907
Task: 28370

Change-Id: I5f9ec16d29545ba74457a060323e07967e085556
Signed-off-by: Scott Little <scott.little@windriver.com>
This commit is contained in:
Scott Little 2018-12-11 13:29:02 -05:00
parent cf0135e886
commit f1bfa53e87
1 changed files with 11 additions and 2 deletions

View File

@ -92,8 +92,13 @@ if [ -f /usr/lib64/nosync/nosync.so ]; then
echo "config_opts['nosync'] = True" >> $FILE
fi
grep -q "config_opts\['chroot_setup_cmd'\] = 'install @buildsys-build pigz lbzip2 yum'" $FILE || \
echo "config_opts['chroot_setup_cmd'] = 'install @buildsys-build pigz lbzip2 yum'" >> $FILE
NETWORK_PKGS=""
if [ "containers" == "$BUILD_TYPE" ]; then
NETWORK_PKGS="bind-utils"
fi
grep -q "config_opts\['chroot_setup_cmd'\] = 'install @buildsys-build pigz lbzip2 yum $NETWORK_PKGS'" $FILE || \
echo "config_opts['chroot_setup_cmd'] = 'install @buildsys-build pigz lbzip2 yum $NETWORK_PKGS'" >> $FILE
# Special case for containers.
# rpmbuild_networking is required for invoking helm commands within mock
@ -101,6 +106,10 @@ grep -q "config_opts\['chroot_setup_cmd'\] = 'install @buildsys-build pigz lbzip
if [ "containers" == "$BUILD_TYPE" ]; then
grep -q "config_opts\['rpmbuild_networking'\] = True" $FILE || \
echo "config_opts['rpmbuild_networking'] = True" >> $FILE
grep -q "config_opts\['use_host_resolv'\] = True" $FILE || \
echo "config_opts['use_host_resolv'] = True" >> $FILE
sed -i "/^\[local-std\]/,/^\[/ s/enabled=0/enabled=1/" $FILE
fi