def build(module, options, log, origEnviron, exitOnFailure=True): """ Build the software """ spec = module["spec"] print_msg("processing EasyBuild easyconfig %s" % spec, log) ## Restore original environment log.info("Resetting environment") filetools.errorsFoundInLog = 0 if not filetools.modifyEnv(os.environ, origEnviron): error("Failed changing the environment back to original") cwd = os.getcwd() ## Load easyblock easyblock = options.easyblock if not easyblock: ## Try to look in .eb file reg = re.compile(r"^\s*easyblock\s*=(.*)$") for line in open(spec).readlines(): match = reg.search(line) if match: easyblock = eval(match.group(1)) break name = module["module"][0] try: app_class = get_class(easyblock, log, name=name) app = app_class(spec, debug=options.debug) log.info("Obtained application instance of for %s (easyblock: %s)" % (name, easyblock)) except EasyBuildError, err: error("Failed to get application instance for %s (easyblock: %s): %s" % (name, easyblock, err.msg))
try: instance = parbuild.get_instance(pkg, log) apps.append(instance) except EasyBuildError, err: test_results.append((pkg['spec'], 'initialization', err)) base_dir = os.getcwd() base_env = copy.deepcopy(os.environ) succes = [] for app in apps: start_time = time.time() # start with a clean slate os.chdir(base_dir) modifyEnv(os.environ, base_env) # create a handler per app so we can capture debug output per application handler = logging.FileHandler(os.path.join(output_dir, "%s-%s.log" % (app.name(), app.installversion()))) handler.setFormatter(build_log.formatter) app.log.addHandler(handler) # take manual control over the building perform_step("preparation", app, lambda x: x.prepare_build()) perform_step("pre-build verification", app, lambda x: x.ready2build()) perform_step("generate installdir name", app, lambda x: x.gen_installdir()) perform_step("make builddir", app, lambda x: x.make_builddir()) perform_step("unpacking", app, lambda x: x.unpack_src()) perform_step("patching", app, lambda x: x.apply_patch()) perform_step("prepare toolkit", app, lambda x: x.toolkit().prepare(x.getcfg('onlytkmod')))