Fix use_host_resolv with new mock version (2017 Nov 22+)

The change done in mock on 2017 Nov 22:

    782e150ffda41c55351c56eff6601a2cc1b8e4fe / [RHBZ#1514028]

now requires rpmbuild_networking to be used together with use_host_resolv
otherwise it does not have an affect. While setting up Fedora RISC-V koji
instance we noticed that /etc/resolv.conf was never copied into chroot,
while /ets/hosts was always present.

The following was tested on Fedora RISC-V instance and resolved the original
problem (buildSRPMFromSCM was failing on fedpkg sources as it couldn't
resolve src.fedoraproject.org)

Signed-off-by: David Abdurachmanov <david.abdurachmanov@gmail.com>
This commit is contained in:
David Abdurachmanov 2018-04-22 07:44:11 +02:00 committed by Mike McLean
parent f37e203889
commit 5b2014f8c0
2 changed files with 3 additions and 0 deletions

View file

@ -242,6 +242,8 @@ class BuildRoot(object):
if hasattr(self.options, k):
opts[k] = getattr(self.options, k)
opts['buildroot_id'] = self.id
if self.setup_dns:
opts['rpmbuild_networking'] = True
opts['use_host_resolv'] = self.setup_dns
opts['install_group'] = self.install_group
opts['maven_opts'] = self.maven_opts

View file

@ -1443,6 +1443,7 @@ def genMockConfig(name, arch, managed=False, repoid=None, tag_name=None, **opts)
# Use the group data rather than a generated rpm
'chroot_setup_cmd': 'groupinstall %s' % opts.get('install_group', 'build'),
# don't encourage network access from the chroot
'rpmbuild_networking': opts.get('use_host_resolv', False),
'use_host_resolv': opts.get('use_host_resolv', False),
# Don't let a build last more than 24 hours
'rpmbuild_timeout': opts.get('rpmbuild_timeout', 86400)