#307 Fix bug in which mock.py fails to parse the config file
Merged 5 years ago by ngompa. Opened 5 years ago by eclipseo.
Unknown source fix_mock.py_bug  into  devel

file modified
+3 -1
@@ -167,7 +167,9 @@

              content = re.sub(r'include\((.*)\)',

                               r'exec(open(\g<1>).read(), {}, locals())',

                               content)

-             config = compile(content, path, 'exec')

+             content = [line for line in content.splitlines() if

+                       line.find("config_opts['root']") >= 0]

+             config = compile(content[0], path, 'exec')

          exec(config)

          self.mock_root = config_opts['root']

          if Settings.uniqueext:

Commit https://pagure.io/FedoraReview/c/23e1e504032f83772cb84111a285053fbee1dd35?branch=devel introducing a bug in which exec(config) fails to parse the config file when the config contains config_opts sub-dictionnaries, for example:

config_opts['plugin_conf']['root_cache_enable'] = True

config_opts['macros']['%_host'] = 'x86_64-koji-linux-gnu'

fails because plugin_conf and macros have not been declared beforehand.

Since we only need config_opts['root'], this PR extracts that line from the config and pass only that line to exec.

rebased onto 844ad866a0a4e7184012b575495f9110cb38b09e

5 years ago

@eclipseo Is this still relevant? If so, could you please rebase this PR?

I have to check this, eclipseo might have a point here , IIRC here in Fedorareview only config_opts['root'] is relevant , but if fails to parse might break it ...

rebased onto 28ea85d399c1536b61722700e6a495a7e0c1aaa4

5 years ago

rebased onto 43b367e

5 years ago

I'd still like that to be merged :pray:

Pull-Request has been merged by ngompa

5 years ago

Sorry for the delay, I confirm this patch fix a bug of the other previous commit .
Thanks all

Sorry for the delay, I confirm this patch fix a bug of the other previous commit .
Thanks all

but breaks rpmfusion repos, I have to sleep now , but I already have in mind one fix

Metadata