From 16bdb70f1d76dcdd25e43124898c9d87c5ea90b0 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Tue, 28 Feb 2012 23:18:17 +0100 Subject: [PATCH] Correctly parse the configuration sent by the hub. --- python/pakfire/builder.py | 15 ++++++++------- python/pakfire/client/builder.py | 18 +++++++----------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/python/pakfire/builder.py b/python/pakfire/builder.py index 517ff27e5..94da4cf9e 100644 --- a/python/pakfire/builder.py +++ b/python/pakfire/builder.py @@ -66,8 +66,8 @@ class BuildEnviron(object): # The version of the kernel this machine is running. kernel_version = os.uname()[2] - def __init__(self, filename=None, distro_name=None, configs=None, arch=None, build_id=None, logfile=None, - builder_mode="release", use_cache=None, **pakfire_args): + def __init__(self, filename=None, distro_name=None, config=None, configs=None, arch=None, + build_id=None, logfile=None, builder_mode="release", use_cache=None, **pakfire_args): # Set mode. assert builder_mode in ("development", "release",) self.mode = builder_mode @@ -121,12 +121,13 @@ class BuildEnviron(object): if pakfire_args.has_key("mode"): del pakfire_args["mode"] - config = ConfigBuilder(files=configs) - if not configs: - if distro_name is None: - distro_name = config.get("builder", "distro", None) + if config is None: + config = ConfigBuilder(files=configs) - config.load_distro_config(distro_name) + if not configs: + if distro_name is None: + distro_name = config.get("builder", "distro", None) + config.load_distro_config(distro_name) if not config.has_distro(): log.error(_("You have not set the distribution for which you want to build.")) diff --git a/python/pakfire/client/builder.py b/python/pakfire/client/builder.py index 136427444..32dff2308 100644 --- a/python/pakfire/client/builder.py +++ b/python/pakfire/client/builder.py @@ -385,15 +385,17 @@ class ClientBuilder(object): if not self.build_source_hash512 == h.hexdigest(): raise DownloadError, "Hash check did not succeed." - # Write configuration to file. - f = open(cfgfile, "w") - f.write(self.build_config) - print self.build_config - f.close() + # Build configuration. + config = pakfire.config.Config(files=["general.conf"]) + + # Parse the configuration received from the build service. + config.parse(self.build_config) # Create dict with arguments that are passed to the pakfire # builder. kwargs = { + "config" : config, + # Of course this is a release build. # i.e. don't use local packages. "builder_mode" : "release", @@ -404,12 +406,6 @@ class ClientBuilder(object): # Files and directories (should be self explaining). "logfile" : logfile, - # Configuration files to load. - "configs" : [ - os.path.join(CONFIG_DIR, "general.conf"), - cfgfile, - ], - # Perform the build for this architecture. "arch" : self.build_arch, } -- 2.39.5