#2255 cli: output extra['rpm.macro.*'] to mock-config
Merged 3 years ago by tkopecek. Opened 3 years ago by tkopecek.
tkopecek/koji issue1859  into  master

@@ -1029,6 +1029,11 @@ 

          opts['bootstrap_image'] = buildcfg['extra']['mock.bootstrap_image']

      if 'mock.use_bootstrap' in buildcfg['extra']:

          opts['use_bootstrap'] = buildcfg['extra']['mock.use_bootstrap']

+     opts['tag_macros'] = {}

+     for key in buildcfg['extra']:

+         if key.startswith('rpm.macro.'):

+             macro = '%' + key[10:]

+             opts['tag_macros'][macro] = buildcfg['extra'][key]

      output = koji.genMockConfig(name, arch, **opts)

      if options.ofile:

          with open(options.ofile, 'w') as fo:

@@ -97,7 +97,8 @@ 

          opts = self.common_opts.copy()

          opts.update({

              'repoid': buildroot_info['repo_id'],

-             'tag_name': buildroot_info['tag_name']

+             'tag_name': buildroot_info['tag_name'],

+             'tag_macros': {},

          })

          anon_handle_mock_config(options, session, arguments)

          self.assert_console_message(
@@ -162,7 +163,8 @@ 

          opts = self.common_opts.copy()

          opts.update({

              'repoid': 'latest',

-             'tag_name': multi_broots[0]['tag_name']

+             'tag_name': multi_broots[0]['tag_name'],

+             'tag_macros': {},

          })

          arguments = self.common_args + ['--task', str(task_id),

                                          '--name', self.progname,
@@ -219,7 +221,15 @@ 

          self.assert_console_message(stderr, expected)

  

          # return build config

-         session.getBuildConfig.return_value = {'id': 301, 'extra': {}}

+         session.getBuildConfig.return_value = {

+             'id': 301,

+             'extra': {

+                 'rpm.macro.random_macro1': 'random_macro_content1',

+                 'rpm.macro.random_macro2': 'random_macro_content2',

+                 'mock.package_manager': 'yum',

+                 'mock.yum.module_hotfixes': 1,

+             }

+         }

          expected = "Could not get a repo for tag: %(name)s\n" % tag

          with self.assertRaises(SystemExit) as ex:

              anon_handle_mock_config(options, session, arguments)
@@ -241,6 +251,12 @@ 

          opts.update({

              'repoid': 'latest',

              'tag_name': tag['name'],

+             'tag_macros': {

+                 '%random_macro1': 'random_macro_content1',

+                 '%random_macro2': 'random_macro_content2',

+             },

+             'package_manager': 'yum',

+             'module_hotfixes': 1,

          })

          anon_handle_mock_config(options, session, arguments)

          self.assert_console_message(
@@ -303,7 +319,8 @@ 

          opts = self.common_opts.copy()

          opts.update({

              'repoid': 101,

-             'tag_name': target['build_tag_name']

+             'tag_name': target['build_tag_name'],

+             'tag_macros': {},

          })

          session.getRepo.return_value = {'id': 101}

          gen_config_mock.return_value = self.mock_output

Metadata Update from @tkopecek:
- Pull-request tagged with: testing-ready

3 years ago

rebased onto 6f40e01a48a4fb7e3daf9f753c84f13dde18d62f

3 years ago

Metadata Update from @jcupova:
- Pull-request tagged with: testing-done

3 years ago

rebased onto 2bb460b

3 years ago

Commit 1fe319d fixes this pull-request

Pull-Request has been merged by tkopecek

3 years ago