def print_pkgdiff_tool(cls): """ Function prints a summary information about pkgcomparetool """ if OutputLogger.get_checkers(): for check, data in six.iteritems(OutputLogger.get_checkers()): if data: logger_output.info("%s:\n%s", check, data)
def print_pkgdiff_tool(cls): """ Function prints a summary information about pkgcomparetool """ if OutputLogger.get_checkers(): for check, data in six.iteritems(OutputLogger.get_checkers()): if data: logger_output.info("%s", check) for checker, output in six.iteritems(data): logger_output.info("===Checker %s===\n%s\n", checker, '\n'.join(output))
def print_build_logs(cls, rpms, version): """ Function is used for printing rpm build logs :param kwargs: :return: """ if rpms.get('logs', None) is None: return logger_output.info('Available %s logs:', version) for logs in rpms.get('logs', None): logger_output.info('- %s', logs)
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_rpms(cls, rpms, version): pkgs = ['srpm', 'rpm'] if not rpms.get('srpm', None): return message = '\n{0} (S)RPM packages:'.format(version) cls.print_message_and_separator(message=message, separator='-') for type_rpm in pkgs: srpm = rpms.get(type_rpm, None) if not srpm: continue message = "%s package(s): are in directory %s :" if isinstance(srpm, str): logger_output.info(message, type_rpm.upper(), os.path.dirname(rpms.get(srpm, ""))) logger_output.info("- %s", os.path.basename(srpm)) else: logger_output.info(message, type_rpm.upper(), os.path.dirname(srpm[0])) for pkg in srpm: logger_output.info("- %s", os.path.basename(pkg))
def print_patches(cls, patches, summary): if not patches: logger_output.info("Patches were neither modified nor deleted.") return logger_output.info("\nPatches:") max_number = max(x for x in [len(str(y)) for y in patches.keys()]) + 2 max_name = max(x for x in [len(os.path.basename(y[0])) for y in patches.values()]) + 2 for key, value in patches.items(): patch_name = os.path.basename(value[0]) for status, patches in summary.items(): found = [x for x in patches if patch_name in x] if not found: continue logger_output.info("Patch%s %s [%s]", str(key).ljust(max_number), patch_name.ljust(max_name), status) break
def print_patches(cls, patches, summary): if not patches: logger_output.info("Patches were neither modified nor deleted.") return logger_output.info(summary) max_name = 0 for value in six.itervalues(patches): if value: new_max = max([len(os.path.basename(x)) for x in value]) if new_max > max_name: max_name = new_max max_key = max([len(x) for x in six.iterkeys(patches)]) for key, value in six.iteritems(patches): if value: for patch in value: logger_output.info('Patch %s [%s]', os.path.basename(patch).ljust(max_name), key.ljust(max_key))
def print_message_and_separator(cls, message="", separator='='): logger_output.info(message) logger_output.info(separator * len(message))
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_report_file_path(cls): """Print path to the report file""" logger_output.heading('%s report:', cls.name) logger_output.info('%s', cls.prepend_results_dir_name('report.' + cls.EXTENSION))
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 print_report_file_path(cls): """Print path to the report file""" logger_output.heading('%s report:' % cls.NAME) logger_output.info( '%s', cls.prepend_results_dir_name('report.' + cls.get_extension()))
def print_report_file_path(cls): """Print path to the report file""" logger_output.heading('%s report:' % cls.name) logger_output.info('%s', cls.prepend_results_dir_name('report.' + cls.EXTENSION))