def run(param): source_dir = param['pkg_info']['dir']['source'] build_dir = param['pkg_info']['dir']['build'] install_dir = param['pkg_info']['dir']['install'] safe_mkdir(build_dir) safe_mkdir(install_dir) cmake_args = param['action_param'].get('args', []) cmake_args = ensure_list(cmake_args) cmake_args = [p.format(**param['pkg_dir_list']) for p in cmake_args] if not param['action_param'].get('ignore_install_prefix', False): cmake_args.insert(0, '-DCMAKE_INSTALL_PREFIX='+install_dir) envcmake = param['action_param'].get('envcmake', {}) for k, v in envcmake.items(): full_value = v.format(**param['pkg_dir_list']) full_arg = '-D{0}={1}'.format(k, full_value) cmake_args.append(full_arg) install_args = param['action_param'].get('install', ['install']) install_args = ensure_list(install_args) env = param.get('env') make_opt = param['config'].get('make_opt', []) make_opt = ensure_list(make_opt) make_opt = auto_make_jobs(make_opt) with open(param['log_file'], 'w') as f: cmd = ['cmake', source_dir] + cmake_args ret = call_and_log(cmd, log=f, cwd=build_dir, env=env) if ret != 0: return False cmd = ['make'] + make_opt ret = call_and_log(cmd, log=f, cwd=build_dir, env=env) if ret != 0: return False if param['action_param'].get('do_make_install', True): cmd = ['make'] + install_args ret = call_and_log(cmd, log=f, cwd=build_dir, env=env) if ret != 0: return False return True
def run(param): source_dir = param['pkg_info']['dir']['source'] build_dir = param['pkg_info']['dir']['build'] install_dir = param['pkg_info']['dir']['install'] safe_mkdir(build_dir) safe_mkdir(install_dir) configure_args = param['action_param'].get('configure', []) configure_args = ensure_list(configure_args) configure_args = [ p.format(**param['pkg_dir_list']) for p in configure_args ] if not param['action_param'].get('ignore_install_prefix', False): configure_args.insert(0, '--prefix=' + install_dir) install_args = param['action_param'].get('install', ['install']) install_args = ensure_list(install_args) env = param.get('env') env_configure = env.copy() for k, v in param['action_param'].get('env_configure', {}).items(): env_configure[k] = v.format(**param['pkg_dir_list']) env_make = env.copy() for k, v in param['action_param'].get('env_make', {}).items(): env_make[k] = v.format(**param['pkg_dir_list']) env_install = env.copy() for k, v in param['action_param'].get('env_install', {}).items(): env_install[k] = v.format(**param['pkg_dir_list']) make_opt = param['config'].get('make_opt', []) make_opt = ensure_list(make_opt) make_opt = auto_make_jobs(make_opt) configure_path = os.path.join(source_dir, 'configure') with open(param['log_file'], 'w') as f: cmd = [configure_path] + configure_args ret = call_and_log(cmd, log=f, cwd=build_dir, env=env_configure) if ret != 0: return False cmd = ['make'] + make_opt ret = call_and_log(cmd, log=f, cwd=build_dir, env=env_make) if ret != 0: return False cmd = ['make'] + install_args ret = call_and_log(cmd, log=f, cwd=build_dir, env=env_install) return ret == 0
def __build_dag(self): self.__dag = Dag() for pkg, pkg_info in self.__pkg_mgr.package_all().items(): if not pkg_info.get('category', {}).get('install'): continue self.__dag.add_vertex((pkg, 'download')) self.__dag.add_vertex((pkg, 'extract')) self.__dag.add_vertex((pkg, 'pre_compile')) self.__dag.add_vertex((pkg, 'compile')) self.__dag.add_vertex((pkg, 'post_compile')) self.__dag.add_vertex((pkg, 'clean')) self.__dag.add_edge((pkg, 'download'), (pkg, 'extract')) self.__dag.add_edge((pkg, 'extract'), (pkg, 'pre_compile')) self.__dag.add_edge((pkg, 'pre_compile'), (pkg, 'compile')) self.__dag.add_edge((pkg, 'compile'), (pkg, 'post_compile')) self.__dag.add_edge((pkg, 'post_compile'), (pkg, 'clean')) for pkg, pkg_info in self.__pkg_mgr.package_all().items(): if not pkg_info.get('category', {}).get('install'): continue pkgs_dep = ensure_list(pkg_info.get('attribute', {}).get('dep', [])) for pkg_dep in pkgs_dep: if not self.__pkg_mgr.package_info(pkg_dep).get('category', {}).get('install'): continue self.__dag.add_edge((pkg_dep, 'post_compile'), (pkg, 'pre_compile'))
def run(param): source_dir = param['pkg_info']['dir']['source'] build_dir = param['pkg_info']['dir']['build'] install_dir = param['pkg_info']['dir']['install'] safe_mkdir(build_dir) safe_mkdir(install_dir) configure_args = param['action_param'].get('configure', []) configure_args = ensure_list(configure_args) configure_args = [ p.format(**param['pkg_dir_list']) for p in configure_args ] install_args = param['action_param'].get('install', ['install']) install_args = ensure_list(install_args) env = param.get('env') make_opt = param['config'].get('make_opt', []) make_opt = ensure_list(make_opt) make_opt = auto_make_jobs(make_opt) configure_path = os.path.join(source_dir, 'configure') with open(param['log_file'], 'w') as f: ret = call_and_log([configure_path, '-prefix', install_dir] + configure_args, log=f, cwd=build_dir, env=env, input=b'yes\n') if ret != 0: return False ret = call_and_log(['make'] + make_opt, log=f, cwd=build_dir, env=env) if ret != 0: return False ret = call_and_log(['make'] + install_args, log=f, cwd=build_dir, env=env) return ret == 0
def __init__(self, config, version_name=None, version_config_cmd={}, extra_config=[]): self.__config = config self.__version_name = version_name self.__config_version_cmd = version_config_cmd self.__items = list(_VERSION_ITEMS) + ensure_list(extra_config) self.__load_config()
def run(param): source_dir = param['pkg_info']['dir']['source'] make_root = param['action_param'].get('make_root', '') if not make_root: make_root = source_dir else: make_root = os.path.join(source_dir, make_root) env = param.get('env') make_opt = param['config'].get('make_opt', []) make_opt = ensure_list(make_opt) make_opt = auto_make_jobs(make_opt) with open(param['log_file'], 'w') as f: ret = call_and_log(['make'] + make_opt, log=f, cwd=make_root, env=env) return ret == 0
def __build_dag(self): self.__dag = Dag() for pkg, pkg_info in self.__pkg_mgr.package_all().items(): if not pkg_info.get('category', {}).get('auto_env'): continue self.__dag.add_vertex(pkg) for pkg, pkg_info in self.__pkg_mgr.package_all().items(): if not pkg_info.get('category', {}).get('auto_env'): continue pkgs_dep = ensure_list( pkg_info.get('attribute', {}).get('dep', [])) for pkg_dep in pkgs_dep: if not self.__pkg_mgr.package_info(pkg_dep).get( 'category', {}).get('auto_env'): continue self.__dag.add_edge(pkg_dep, pkg)
def __build_dag(self): self.__dag = Dag() package_config = self.__config_release.get('package', {}) attribute_config = self.__config_release.get('attribute', {}) for pkg, cfg in package_config.items(): self.__dag.add_vertex((pkg, 'download')) self.__dag.add_vertex((pkg, 'extract')) self.__dag.add_vertex((pkg, 'pre_check')) self.__dag.add_vertex((pkg, 'compile')) self.__dag.add_vertex((pkg, 'post_check')) self.__dag.add_edge((pkg, 'download'), (pkg, 'extract')) self.__dag.add_edge((pkg, 'extract'), (pkg, 'pre_check')) self.__dag.add_edge((pkg, 'pre_check'), (pkg, 'compile')) self.__dag.add_edge((pkg, 'compile'), (pkg, 'post_check')) basic_pkgs = [] for pkg, cfg in attribute_config.items(): if pkg in package_config: if 'basic' in cfg and cfg['basic']: basic_pkgs.append(pkg) for pkg, cfg in package_config.items(): # category = cfg['category'] # should_install = False # if category in self.__config_release.config['main']['category']['categories']: # should_install = self.__config_release.config['main']['category']['categories'][category].get('install', False) if pkg not in basic_pkgs: # if not should_install: # continue for bp in basic_pkgs: self.__dag.add_edge((bp, 'post_check'), (pkg, 'download')) if pkg in attribute_config and 'dep' in attribute_config[pkg]: # if not should_install: # continue pkgs_dep = ensure_list(attribute_config[pkg]['dep']) for pkg_dep in pkgs_dep: self.__dag.add_edge((pkg_dep, 'post_check'), (pkg, 'pre_check'))
def __build_dag(self): self.__dag = Dag() package_config = self.__config_release.get('package', {}) attribute_config = self.__config_release.get('attribute', {}) for pkg, cfg in package_config.items(): self.__dag.add_vertex(pkg) basic_pkgs = [] for pkg, cfg in attribute_config.items(): if pkg in package_config: if 'basic' in cfg and cfg['basic']: basic_pkgs.append(pkg) for pkg in package_config: if pkg not in basic_pkgs: for bp in basic_pkgs: self.__dag.add_edge(bp, pkg) if pkg in attribute_config and 'dep' in attribute_config[pkg]: pkgs_dep = ensure_list(attribute_config[pkg]['dep']) for pkg_dep in pkgs_dep: self.__dag.add_edge(pkg_dep, pkg)