def execute(self, name): assert name is not None script_command = ['sh'] script_file = os.path.join( self.install_scripts_dir, self.node['script'], ) script_file = os.path.abspath(script_file) if not os.path.isfile(script_file): pass script_command.append(script_file) self.append_optional('script_args', script_command) script_command.append('-p') script_command.append(self.usr_dir) if self.reinstall: script_command.append('-r') logging.debug('Running script with: %s', ' '.join(script_command)) if execute_sanitized('Script', script_command, self.root) is None: return None return 0
def execute(self, name): assert name is not None cp_node = self.node['cp'] for copy in cp_node: cp_command = ['cp', '-a', '-v'] if isinstance(copy['source'], str): source = sanitize_input_variable(copy['source']) cp_command += [source] else: source = map(sanitize_input_variable, copy['source']) cp_command += source dest = sanitize_input_variable(copy['dest']) if not os.path.exists(dest): os.makedirs(dest) cp_command += [dest] logging.debug('Running copy command: %s', cp_command) if execute_sanitized('cp', cp_command, self.root) is None: return None return 0
def _download_curl(self, name, package, root): # pylint: disable=R0201 logging.info('Trying to fetch with curl.') if 'curl' not in package.keys() or not isinstance( package['curl'], dict): debug_red('Invalid curl node for packag %s.', name) return None if 'url' not in package['curl'].keys(): debug_red('The git node of %s does not have urlf field.', name) return None curl_node = package['curl'] url = curl_node['url'] path = root file_name = file_name = url.split('/')[-1] with suppress(OSError): os.makedirs(path) cmd = [] cmd.append(self.CURL_COMMAND) if 'args' in curl_node.keys() and isinstance(curl_node['args'], str): cmd.append(curl_node['args']) cmd.append(url) if 'output' in curl_node.keys() and isinstance(curl_node['output'], str): cmd.append('-o') cmd.append(curl_node['output']) file_name = curl_node['output'] else: cmd.append('-O') logging.debug('Fetching with curl and command: %s', cmd) if execute_sanitized('curl', cmd, path) is None: return None file_path = os.path.join(path, file_name) for ext in self.archive_extensions: if file_path.endswith(ext): self.extract_queue.append((file_path, name)) break return 0
def execute(self, name): assert name is not None ln_node = self.node['ln'] for copy in ln_node: ln_command = ['sudo', 'ln', '-s', '-f'] if isinstance(copy['source'], str): source = sanitize_input_variable(copy['source']) ln_command += [os.path.join(self.root, source)] dest = sanitize_input_variable(copy['dest']) ln_command += [dest] logging.debug('Running copy command: [%s]', ' '.join(ln_command)) if execute_sanitized('ln', ln_command, self.root) is None: return None return 0
def _do_execute(self, name): assert name is not None autoreconf_command = ['sh', 'autoreconf'] build_dir = self.root self.append_optional('autoreconf_args', autoreconf_command) logging.debug( 'Running autoreconf with: %s', ' '.join(autoreconf_command), ) logging.debug('Build directory: %s', build_dir) if execute_sanitized('Autoreconf', autoreconf_command, self.root) is None: return None return 0
def _do_execute(self, name): assert name is not None pip_command = ['pip', 'install'] build_dir = self.root self.append_optional('pip_args', pip_command) if os.path.isfile(os.path.join(build_dir, 'requirements.txt')): pip_command.append('-r') pip_command.append('requirements.txt') self.append_optional('pip_packages', pip_command) logging.debug('Running autoreconf with: %s', ' '.join(pip_command)) logging.debug('Build directory: %s', build_dir) if execute_sanitized('pip', pip_command, self.root) is None: return None return 0
def execute(self, name): assert name is not None commands = [] command_field = self.node['command'] if isinstance(command_field, str): commands.append([command_field]) elif isinstance(command_field, list): if isinstance(command_field[0], str): commands.append(command_field) else: for com in command_field: commands.append(com) for command in commands: logging.debug('Running command with: %s', command) if execute_sanitized('Command', command, self.root) is None: return None return 0