#897 Fix use_host_resolv with new mock version (2017 Nov 22+)
Merged 4 years ago by mikem. Opened 4 years ago by davidlt.
davidlt/koji fix_host_resolv  into  master

file modified
+2
@@ -241,6 +241,8 @@ 

              if hasattr(self.options, k):

                  opts[k] = getattr(self.options, k)

          opts['buildroot_id'] = self.id

+         if self.setup_dns:

+             opts['rpmbuild_networking'] = True

it's not required here, because koji.genMockConfig uses 'use_host_resolv'

I see what you mean now, but I could we keep it for consistency? This code would have exact same issue.

          opts['use_host_resolv'] = self.setup_dns

          opts['install_group'] = self.install_group

          opts['maven_opts'] = self.maven_opts

file modified
+1
@@ -1443,6 +1443,7 @@ 

          # 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)

@@ -5,6 +5,7 @@ 

  config_opts['chroothome'] = '/builddir'

  config_opts['internal_dev_setup'] = False

  config_opts['root'] = 'ROOTNAME'

+ config_opts['rpmbuild_networking'] = False

  config_opts['rpmbuild_timeout'] = 86400

  config_opts['target_arch'] = 'x86_64'

  config_opts['use_host_resolv'] = False

@@ -5,6 +5,7 @@ 

  config_opts['chroothome'] = '/builddir'

  config_opts['internal_dev_setup'] = True

  config_opts['root'] = 'ROOTNAME'

+ config_opts['rpmbuild_networking'] = False

  config_opts['rpmbuild_timeout'] = 86400

  config_opts['target_arch'] = 'x86_64'

  config_opts['use_host_resolv'] = False

@@ -4,6 +4,7 @@ 

  config_opts['chroot_setup_cmd'] = 'groupinstall build'

  config_opts['chroothome'] = '/builddir'

  config_opts['root'] = 'ROOTNAME'

+ config_opts['rpmbuild_networking'] = False

  config_opts['rpmbuild_timeout'] = 86400

  config_opts['target_arch'] = 'x86_64'

  config_opts['use_host_resolv'] = False

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

I probably need to modify the following configuration files in tests:

internaldev.out:config_opts['use_host_resolv'] = False
internaldev2.out:config_opts['use_host_resolv'] = False
simple.out:config_opts['use_host_resolv'] = False

and add config_opts['rpmbuild_networking'] = False

1 new commit added

  • Add missing config_opts['rpmbuild_networking'] to mock config output
4 years ago

2 new commits added

  • Add missing config_opts['rpmbuild_networking'] to mock test data
  • Fix use_host_resolv with new mock version (2017 Nov 22+)
4 years ago

it's not required here, because koji.genMockConfig uses 'use_host_resolv'

@julian8628 it's required, otherwise use_host_resolv does not have any affect. See the commit I mentioned in PR description.

I see what you mean now, but I could we keep it for consistency? This code would have exact same issue.

I see what you mean now, but I could we keep it for consistency? This code would have exact same issue.

yes, it makes sense

Any plans to get this merged?

Currently we set config_opts['rpmbuild_networking'] = True in /etc/mock/site-defaults.cfg and iptables restrict most of network activity.

Commit 4a2e875 fixes this pull-request

Pull-Request has been merged by mikem

4 years ago