From 4203fbee14fbbea330ae348dbdaa25b3744819f5 Mon Sep 17 00:00:00 2001 From: Pat Riehecky Date: May 16 2022 14:15:03 +0000 Subject: kojid: permit forcing the target arch within mock per tag --- diff --git a/builder/kojid b/builder/kojid index 951ddef..248f1fb 100755 --- a/builder/kojid +++ b/builder/kojid @@ -280,6 +280,9 @@ class BuildRoot(object): opts['maven_envs'] = self.maven_envs opts['bind_opts'] = self.bind_opts opts['target_arch'] = self.target_arch + if 'mock.forcearch' in self.config['extra']: + if bool(self.config['extra']['mock.forcearch']): + opts['forcearch'] = self.target_arch if 'mock.package_manager' in self.config['extra']: opts['package_manager'] = self.config['extra']['mock.package_manager'] if 'mock.yum.module_hotfixes' in self.config['extra']: diff --git a/cli/koji_cli/commands.py b/cli/koji_cli/commands.py index 9318f0b..00e515b 100644 --- a/cli/koji_cli/commands.py +++ b/cli/koji_cli/commands.py @@ -1136,6 +1136,9 @@ def anon_handle_mock_config(goptions, session, args): warn("Tag %s has an empty arch list" % opts['tag_name']) elif arch not in buildcfg['arches']: warn('%s is not in the list of tag arches' % arch) + if 'mock.forcearch' in buildcfg['extra']: + if bool(buildcfg['extra']['mock.forcearch']): + opts['forcearch'] = options.arch if 'mock.package_manager' in buildcfg['extra']: opts['package_manager'] = buildcfg['extra']['mock.package_manager'] if 'mock.yum.module_hotfixes' in buildcfg['extra']: diff --git a/docs/source/using_the_koji_build_system.rst b/docs/source/using_the_koji_build_system.rst index 73a3448..b6b43d1 100644 --- a/docs/source/using_the_koji_build_system.rst +++ b/docs/source/using_the_koji_build_system.rst @@ -433,6 +433,8 @@ environment follows: * ``mock.module_setup_commands`` - commands for configuring the modules active in a buildroot. Available in `mock 2.4 `__. +* ``mock.forcearch`` - 0/1 value. If true mock will set the ``forcearch`` + config option to match the target arch of each buildroot. * ``mock.yum.best`` - 0/1 value. If set yum/dnf will use highest available rpm version (see man yum.conf) * ``mock.yum.module_hotfixes`` - 0/1 value. If set, yum/dnf will use packages diff --git a/koji/__init__.py b/koji/__init__.py index f656564..d12ecb5 100644 --- a/koji/__init__.py +++ b/koji/__init__.py @@ -1629,6 +1629,8 @@ def genMockConfig(name, arch, managed=False, repoid=None, tag_name=None, **opts) # turn off warning for yum being used in place of dnf 'dnf_warning': False, } + if 'forcearch' in opts: + config_opts['forcearch'] = opts['forcearch'] if opts.get('package_manager'): config_opts['package_manager'] = opts['package_manager'] if opts.get('bootstrap_image'):