def process_delete_requests(self, force=False): delete_items = [] for delete_item in self.__delete_items(): try: Command.run(['chroot', self.root_dir, 'rpm', '-q', delete_item]) delete_items.append(delete_item) except Exception: # ignore packages which are not installed pass if not delete_items: raise KiwiRequestError( 'None of the requested packages to delete are installed' ) if force: force_options = ['--nodeps', '--allmatches', '--noscripts'] return Command.call( [ 'chroot', self.root_dir, 'rpm', '-e' ] + force_options + delete_items, self.command_env ) else: chroot_zypper_args = self.root_bind.move_to_root( self.zypper_args ) return Command.call( ['chroot', self.root_dir, 'zypper'] + chroot_zypper_args + [ 'remove', '-u', '--force-resolution' ] + delete_items, self.command_env )
def process_install_requests_bootstrap(self): command = ['zypper'] + self.zypper_args + [ '--root', self.root_dir, 'install', '--auto-agree-with-licenses' ] + self.custom_args + self.__install_items() return Command.call( command, self.command_env )
def process_install_requests(self): chroot_zypper_args = self.root_bind.move_to_root( self.zypper_args ) return Command.call( ['chroot', self.root_dir, 'zypper'] + chroot_zypper_args + [ 'install', '--auto-agree-with-licenses' ] + self.custom_args + self.__install_items(), self.command_env )
def update(self): chroot_zypper_args = self.root_bind.move_to_root( self.zypper_args ) return Command.call( ['chroot', self.root_dir, 'zypper'] + chroot_zypper_args + [ 'update', '--auto-agree-with-licenses' ] + self.custom_args, self.command_env )
def update(self): chroot_yum_args = self.root_bind.move_to_root( self.yum_args ) return Command.call( [ 'chroot', self.root_dir, 'yum' ] + chroot_yum_args + self.custom_args + [ 'upgrade' ], self.command_env )
def process_install_requests_bootstrap(self): Command.run(['yum'] + self.yum_args + ['makecache']) bash_command = ['yum'] + self.yum_args + [ '--installroot', self.root_dir ] + self.custom_args + ['install'] + self.package_requests if self.collection_requests: bash_command += ['&&', 'yum'] + self.yum_args + [ '--installroot', self.root_dir ] + self.custom_args + ['groupinstall'] + self.collection_requests self.cleanup_requests() return Command.call(['bash', '-c', ' '.join(bash_command)], self.command_env)
def __call_script(self, name): if os.path.exists(self.root_dir + '/image/' + name): config_script = Command.call( ['chroot', self.root_dir, 'bash', '/image/' + name] ) process = CommandProcess( command=config_script, log_topic='Calling ' + name + ' script' ) result = process.poll_and_watch() if result.returncode != 0: raise KiwiScriptFailed( '%s failed: %s' % (name, format(result.stderr)) )
def process_install_requests(self): Command.run(['chroot', self.root_dir, 'rpm', '--rebuilddb']) chroot_yum_args = self.root_bind.move_to_root(self.yum_args) bash_command = ['chroot', self.root_dir, 'yum'] + chroot_yum_args + self.custom_args + [ 'install' ] + self.package_requests if self.collection_requests: bash_command += ['&&', 'chroot', self.root_dir, 'yum' ] + chroot_yum_args + self.custom_args + [ 'groupinstall' ] + self.collection_requests self.cleanup_requests() return Command.call(['bash', '-c', ' '.join(bash_command)], self.command_env)
def process_delete_requests(self, force=False): delete_items = [] for delete_item in self.package_requests: try: Command.run( ['chroot', self.root_dir, 'rpm', '-q', delete_item]) delete_items.append(delete_item) except Exception: # ignore packages which are not installed pass if not delete_items: raise KiwiRequestError( 'None of the requested packages to delete are installed') delete_options = ['--nodeps', '--allmatches', '--noscripts'] self.cleanup_requests() return Command.call(['chroot', self.root_dir, 'rpm', '-e'] + delete_options + delete_items, self.command_env)
def __call_script_no_chroot(self, name, option_list): if os.path.exists(self.root_dir + '/image/' + name): bash_command = [ 'cd', self.root_dir, '&&', 'bash', '--norc', 'image/' + name, ' '.join(option_list) ] config_script = Command.call( ['bash', '-c', ' '.join(bash_command)] ) process = CommandProcess( command=config_script, log_topic='Calling ' + name + ' script' ) result = process.poll_and_watch() if result.returncode != 0: raise KiwiScriptFailed( '%s failed: %s' % (name, format(result.stderr)) )
def process_install_requests_bootstrap(self): Command.run( ['yum'] + self.yum_args + ['makecache'] ) bash_command = [ 'yum' ] + self.yum_args + [ '--installroot', self.root_dir ] + self.custom_args + ['install'] + self.package_requests if self.collection_requests: bash_command += [ '&&', 'yum' ] + self.yum_args + [ '--installroot', self.root_dir ] + self.custom_args + ['groupinstall'] + self.collection_requests self.cleanup_requests() return Command.call( ['bash', '-c', ' '.join(bash_command)], self.command_env )
def process_delete_requests(self, force=False): delete_items = [] for delete_item in self.package_requests: try: Command.run(['chroot', self.root_dir, 'rpm', '-q', delete_item]) delete_items.append(delete_item) except Exception: # ignore packages which are not installed pass if not delete_items: raise KiwiRequestError( 'None of the requested packages to delete are installed' ) delete_options = ['--nodeps', '--allmatches', '--noscripts'] self.cleanup_requests() return Command.call( [ 'chroot', self.root_dir, 'rpm', '-e' ] + delete_options + delete_items, self.command_env )
def process_install_requests(self): Command.run( ['chroot', self.root_dir, 'rpm', '--rebuilddb'] ) chroot_yum_args = self.root_bind.move_to_root( self.yum_args ) bash_command = [ 'chroot', self.root_dir, 'yum' ] + chroot_yum_args + self.custom_args + [ 'install' ] + self.package_requests if self.collection_requests: bash_command += [ '&&', 'chroot', self.root_dir, 'yum' ] + chroot_yum_args + self.custom_args + [ 'groupinstall' ] + self.collection_requests self.cleanup_requests() return Command.call( ['bash', '-c', ' '.join(bash_command)], self.command_env )
def update(self): chroot_yum_args = self.root_bind.move_to_root(self.yum_args) return Command.call(['chroot', self.root_dir, 'yum'] + chroot_yum_args + self.custom_args + ['upgrade'], self.command_env)