#992 Add BASE_MODULE_KOJI_ARCHES to override default Koji arches.
Merged 8 months ago by jkaluza. Opened 8 months ago by jkaluza.
jkaluza/fm-orchestrator platform-koji-arches  into  master

@@ -171,6 +171,16 @@ 

  

          self.koji_session = self.get_session(config, owner)

          self.arches = config.koji_arches

+ 

+         # Handle BASE_MODULE_KOJI_ARCHES. Find out the base modules in buildrequires

+         # section of XMD and set the Koji tag arches according to it.

+         if "mbs" in self.mmd.get_xmd().keys():

+             for req_name, req_data in self.mmd.get_xmd()["mbs"]["buildrequires"].items():

+                 ns = ":".join([req_name, req_data["stream"]])

+                 if ns in config.base_module_koji_arches:

+                     self.arches = config.base_module_koji_arches[ns]

+                     break

+ 

          if not self.arches:

              raise ValueError("No koji_arches specified in the config.")

  

@@ -393,6 +393,10 @@ 

              'default': set(['platform', 'bootstrap']),

              'desc': ("Set of module names which defines the product version "

                       "(by their stream) of modules depending on them.")},

+         'base_module_koji_arches': {

+             'type': dict,

+             'default': {},

+             'desc': 'Per base-module name:stream Koji arches list.'},

          'koji_cg_build_tag_template': {

              'type': str,

              'default': "{}-modular-updates-candidate",

@@ -604,6 +608,16 @@ 

                               .format(strategy, ', '.join(SUPPORTED_STRATEGIES)))

          self._rebuild_strategy = strategy

  

+     def _setifok_base_module_koji_arches(self, data):

+         if not isinstance(data, dict):

+             raise ValueError("BASE_MODULE_KOJI_ARCHES must be a dict")

+         for ns, arches in data.items():

+             if len(ns.split(":")) != 2:

+                 raise ValueError("BASE_MODULE_KOJI_ARCHES keys must be in 'name:stream' format")

+             if not isinstance(arches, list):

+                 raise ValueError("BASE_MODULE_KOJI_ARCHES values must be lists")

+         self._base_module_koji_arches = data

+ 

      def _setifok_rebuild_strategies_allowed(self, strategies):

          if not isinstance(strategies, list):

              raise ValueError('REBUILD_STRATEGIES_ALLOWED must be a list')

@@ -412,10 +412,14 @@ 

          weights = KojiModuleBuilder.get_build_weights(["httpd", "apr"])

          assert weights == {"httpd": 1.5, "apr": 1.5}

  

+     @patch.object(conf, 'base_module_koji_arches',

+                   new={"platform:xx": ["x86_64", "i686"]})

      @pytest.mark.parametrize('blocklist', [False, True])

      @pytest.mark.parametrize('custom_whitelist', [False, True])

      @pytest.mark.parametrize('repo_include_all', [False, True])

-     def test_buildroot_connect(self, custom_whitelist, blocklist, repo_include_all):

+     @pytest.mark.parametrize('override_arches', [False, True])

+     def test_buildroot_connect(self, custom_whitelist, blocklist, repo_include_all,

+                                override_arches):

          if blocklist:

              mmd = self.module.mmd()

              xmd = glib.from_variant_dict(mmd.get_xmd())

@@ -439,6 +443,15 @@ 

              mmd.set_xmd(glib.dict_values(xmd))

              self.module.modulemd = mmd.dumps()

  

+         if override_arches:

+             mmd = self.module.mmd()

+             xmd = glib.from_variant_dict(mmd.get_xmd())

+             mbs_options = xmd["mbs"] if "mbs" in xmd.keys() else {}

+             mbs_options["buildrequires"] = {"platform": {"stream": "xx"}}

+             xmd["mbs"] = mbs_options

+             mmd.set_xmd(glib.dict_values(xmd))

+             self.module.modulemd = mmd.dumps()

+ 

          builder = FakeKojiModuleBuilder(

              owner=self.module.owner, module=self.module, config=conf, tag_name='module-foo',

              components=["nginx"])

@@ -476,10 +489,15 @@ 

          expected_calls = []

          assert session.packageListBlock.mock_calls == expected_calls

  

-         expected_calls = [mock.call('module-foo', arches='i686 armv7hl x86_64',

+         if override_arches:

+             expected_arches = "x86_64 i686"

+         else:

+             expected_arches = "i686 armv7hl x86_64"

+ 

+         expected_calls = [mock.call('module-foo', arches=expected_arches,

                                      extra={'mock.package_manager': 'dnf',

                                             'repo_include_all': repo_include_all}),

-                           mock.call('module-foo-build', arches='i686 armv7hl x86_64',

+                           mock.call('module-foo-build', arches=expected_arches,

                                      extra={'mock.package_manager': 'dnf',

                                             'repo_include_all': repo_include_all})]

          assert session.editTag2.mock_calls == expected_calls

We need a way to disable building for "ppc64" for builds against platform:f29 and later while keeping it there for platfrom:f28.

Nice!

We ... have a ticket for this from way back when.

Nevermind, false memory. I couldn't find it.

:+1: to the patch. (I'm surprised we need this for f29 so soon! I missed that arch change.)

Pull-Request has been merged by jkaluza

8 months ago