def print_cli_summary(cls, app): """ Print report of the rebase :param app: Application instance """ cls.app = app cls.print_patches_cli() result = results_store.get_result_message() cls.print_important_checkers_output() logger_output.heading('\nAvailable logs:') logger_output.info( '%s:\n%s', 'Debug log', cls.prepend_results_dir_name( os.path.relpath(app.debug_log_file, app.results_dir))) if results_store.get_old_build() is not None: logger_output.info('%s:\n%s', 'Old build logs and (S)RPMs', cls.prepend_results_dir_name('old-build')) if results_store.get_new_build() is not None: logger_output.info('%s:\n%s', 'New build logs and (S)RPMs', cls.prepend_results_dir_name('new-build')) logger_output.info('') logger_output.heading('%s:', 'Rebased sources') logger_output.info( "%s", cls.prepend_results_dir_name( os.path.relpath(app.rebased_sources_dir, app.results_dir))) patch = results_store.get_changes_patch() if 'changes_patch' in patch: logger_output.heading('%s:', 'Generated patch') logger_output.info( "%s\n", cls.prepend_results_dir_name( os.path.basename(patch['changes_patch']))) cls.print_report_file_path() if not app.conf.patch_only: if 'success' in result: logger_output.success('\n%s' % result['success']) # Error is printed out through exception caught in CliHelper.run() else: if results_store.get_patches()['success']: logger_output.success("\nPatching successful") elif results_store.get_patches()['success']: logger_output.error("\nPatching failed")
def get_rebased_patches(self): """ Function returns a list of patches either '': [list_of_deleted_patches] :return: """ patches = False output_patch_string = [] if results_store.get_patches(): for key, val in six.iteritems(results_store.get_patches()): if key: output_patch_string.append('Following patches have been %s:\n%s' % (key, val)) patches = True if not patches: output_patch_string.append('Patches were not touched. All were applied properly') return output_patch_string
def get_rebased_patches(self): """ Function returns a list of patches either '': [list_of_deleted_patches] :return: """ patches = False output_patch_string = [] if results_store.get_patches(): for key, val in results_store.get_patches().items(): if key: output_patch_string.append('Following patches have been {}:\n{}'.format(key, val)) patches = True if not patches: output_patch_string.append('Patches were not touched. All were applied properly') return output_patch_string
def print_cli_summary(cls, app): """ Print report of the rebase :param app: Application instance """ cls.app = app cls.print_patches_cli() result = results_store.get_result_message() cls.print_important_checkers_output() logger_output.heading('\nAvailable logs:') logger_output.info('%s:\n%s', 'Debug log', cls.prepend_results_dir_name(app.debug_log_file)) if results_store.get_old_build() is not None: logger_output.info('%s:\n%s', 'Old build logs and (S)RPMs', cls.prepend_results_dir_name('old-build')) if results_store.get_new_build() is not None: logger_output.info('%s:\n%s', 'New build logs and (S)RPMs', cls.prepend_results_dir_name('new-build')) logger_output.info('') logger_output.heading('%s:', 'Rebased sources') logger_output.info("%s", cls.prepend_results_dir_name(os.path.relpath(app.rebased_sources_dir, app.results_dir))) patch = results_store.get_changes_patch() if 'changes_patch' in patch: logger_output.heading('%s:', 'Generated patch') logger_output.info("%s\n", cls.prepend_results_dir_name(os.path.basename(patch['changes_patch']))) cls.print_report_file_path() if not app.conf.patch_only: if 'success' in result: logger_output.success('\n%s', result['success']) # Error is printed out through exception caught in CliHelper.run() else: if results_store.get_patches()['success']: logger_output.success("\nPatching successful") elif results_store.get_patches()['success']: logger_output.error("\nPatching failed")
def print_cli_summary(cls, app): """ Print report of the rebase :param app: Application instance """ cls.app = app cls.print_patches_cli() ConsoleHelper.cprint('\nAvailable logs:', color='yellow') print('{0}:\n{1}'.format('Debug log', app.debug_log_file)) if results_store.get_old_build() is not None: print('{0}:\n{1}'.format( 'Old build logs and (S)RPMs', os.path.join(app.results_dir, 'old-build'))) if results_store.get_new_build() is not None: print('{0}:\n{1}'.format( 'New build logs and (S)RPMs', os.path.join(app.results_dir, 'new-build'))) print('') ConsoleHelper.cprint('%s:' % 'Rebased sources', color='yellow') print("%s" % app.rebased_sources_dir) ConsoleHelper.cprint('%s:' % 'Generated patch', color='yellow') print("%s\n" % os.path.join(app.results_dir, 'changes.patch')) cls.print_report_file_path() result = results_store.get_result_message() if not app.conf.patch_only: if 'success' in result: ConsoleHelper.cprint('\n%s' % result['success'], color='green') # Error is printed out through exception caught in CliHelper.run() else: if results_store.get_patches()['success']: ConsoleHelper.cprint("\nPatching successful", color='green') elif results_store.get_patches()['success']: ConsoleHelper.cprint("\nPatching failed", color='red')
def print_patches_section_cli(cls, logger_method, patch_type): """ Print info about one of the patches key section :param logger_method: method to be used for logging :param patch_type: string containing key for the patch_dict """ patches = results_store.get_patches() if not patches: return if patch_type in patches: logger_output.info('\n%s patches:', patch_type) for patch in sorted(patches[patch_type]): logger_method(patch)
def print_patches_section_cli(cls, logger_method, patch_type): """ Print info about one of the patches key section :param logger_method: method to be used for logging :param patch_type: string containing key for the patch_dict """ patches = results_store.get_patches() if not patches: return if patch_type in patches: logger_output.info('\n%s patches:', patch_type) for patch in sorted(patches[patch_type]): logger_method(patch)
def print_patches_section_cli(cls, color, patch_type): """ Print info about one of the patches key section :param color: color used for the message printing :param patch_type: string containing key for the patch_dict """ patches = results_store.get_patches() if not patches: return if patch_type in patches: print('\n%s patches:' % patch_type) for patch in patches[patch_type]: ConsoleHelper.cprint(patch, color=color)
def print_patches_section_cli(cls, logger_method, patch_type): """Outputs information about one of the patch types. Args: logger_method: Method to use for logging patch_type: A key to use for filtering patch dictionary obtained from results_store. """ patches = results_store.get_patches() if not patches: return if patch_type in patches: logger_summary.info('\n%s patches:', patch_type) for patch in sorted(patches[patch_type]): logger_method(patch)