#1196 Set the $releasever variable in Mock config.
Merged 5 months ago by mprahl. Opened 5 months ago by jkaluza.
jkaluza/fm-orchestrator releaserver  into  master

file modified
+1 -1

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

  config_opts['chroot_setup_cmd'] = 'install $group'

  config_opts['dist'] = ''

  config_opts['extra_chroot_dirs'] = [ '/run/lock', ]

- config_opts['releasever'] = ''

+ config_opts['releasever'] = '$releasever'

  config_opts['package_manager'] = 'dnf'

  config_opts['nosync'] = True

  config_opts['use_bootstrap_container'] = False

@@ -91,6 +91,7 @@ 

          self.config = config

          self.groups = []

          self.enabled_modules = []

+         self.releasever = module_build_service.utils.get_local_releasever()

          self.yum_conf = MockModuleBuilder.yum_config_template

          self.koji_session = None

  

@@ -257,6 +258,7 @@ 

                  self.groups = config_opts["chroot_setup_cmd"].split(" ")[1:]

                  self.yum_conf = config_opts['yum.conf']

                  self.enabled_modules = config_opts['module_enable']

+                 self.releasever = config_opts['releasever']

  

      def _write_mock_config(self):

          """

@@ -271,6 +273,7 @@ 

              config = config.replace("$group", " ".join(self.groups))

              config = config.replace("$yum_conf", self.yum_conf)

              config = config.replace("$enabled_modules", str(self.enabled_modules))

+             config = config.replace("$releasever", str(self.releasever))

  

              # We write the most recent config to "mock.cfg", so thread-related

              # configs can be later (re-)generated from it using _load_mock_config.

@@ -452,6 +452,16 @@ 

          import_mmd(session, mmd)

  

  

+ def get_local_releasever():

+     """

+     Returns the $releasever variable used in the system when expanding .repo files.

+     """

+     # Import DNF here to not force it as a hard MBS dependency.

+     import dnf

+     dnf_base = dnf.Base()

+     return dnf_base.conf.releasever

+ 

+ 

  def import_builds_from_local_dnf_repos():

      """

      Imports the module builds from all available local repositories to MBS DB.

Found that while testing the local builds in clear environment. I originally hardcoded the releasever in my local mock.cfg.

This commit auto-detects the right value and sets it.

rebased onto 4bc6e7e

5 months ago

Pull-Request has been merged by mprahl

5 months ago