def build(targets, sdk_cmd, sources_dir, build_dir): # Save build information info = [] # Build targets for target in targets: # Skip disabled targets if target.get("disabled", False): continue # Create kickstart files config_filename = os.path.join(sources_dir, target["config"]) cmd = [sdk_cmd, "cd", "/parentroot" + sources_dir, ";", "maui-kickstarter", "-e", ".", "-c", target["config"]] run_sync(cmd) # Create packages empty cache cache_dir = os.path.join(build_dir, "cache", target["cache"]) if not os.path.isdir(cache_dir): ensure_parent_dir(cache_dir) # Run build cmd = [sdk_cmd, "cd", "/parentroot" + sources_dir, ";", "sudo", "mic", "create", "auto", target["name"] + ".ks", "-k", "/parentroot" + cache_dir] run_sync(cmd) # Rectify owner after using sudo chown(sources_dir) # Append build information path = os.path.join(sources_dir, target["name"]) info.append({"name": target["name"], "path": path}) return info
def main(): # Read configuration and take a dictionary data = readconf() if not data: logger.fatal("No valid configuration found") # Paths sources_dir = os.path.expanduser(data["paths"]["sources"]) build_dir = os.path.expanduser(data["paths"]["buildroot"]) publish_dir = os.path.expanduser(data["paths"]["publish"]) # Update sources and make a working copy resolve(sources_dir) new_sources_dir = copy_sources(sources_dir, build_dir) # Build targets builds = build(data["targets"], data["sdk"]["chroot"], new_sources_dir, build_dir) # Publish targets for b in builds: timestamp = datetime.datetime.now().strftime("%Y%m%d") dest_dir = os.path.join(publish_dir, timestamp, b["name"]) ensure_parent_dir(dest_dir) shutil.move(b["path"], dest_dir) # Remove sources directory (it's a copy, don't worry) shutil.rmtree(new_sources_dir)
def build(targets, sdk_cmd, sources_dir, build_dir): # Save build information info = [] # Build targets for target in targets: # Skip disabled targets if target.get("disabled", False): continue # Create kickstart files config_filename = os.path.join(sources_dir, target["config"]) cmd = [ sdk_cmd, "cd", "/parentroot" + sources_dir, ";", "maui-kickstarter", "-e", ".", "-c", target["config"] ] run_sync(cmd) # Create packages empty cache cache_dir = os.path.join(build_dir, "cache", target["cache"]) if not os.path.isdir(cache_dir): ensure_parent_dir(cache_dir) # Run build cmd = [ sdk_cmd, "cd", "/parentroot" + sources_dir, ";", "sudo", "mic", "create", "auto", target["name"] + ".ks", "-k", "/parentroot" + cache_dir ] run_sync(cmd) # Rectify owner after using sudo chown(sources_dir) # Append build information path = os.path.join(sources_dir, target["name"]) info.append({"name": target["name"], "path": path}) return info