def run_check(cls, results_dir): """ Compares old and new RPMs using pkgdiff """ cls.results_dir = results_dir cls.pkgdiff_results_full_path = os.path.join(cls.results_dir, cls.pkgdiff_results_filename) versions = ['old', 'new'] cmd = [cls.CMD] for version in versions: old = OutputLogger.get_build(version) if old: file_name = cls._create_xml(version, input_structure=old) cmd.append(file_name) cmd.append('-extra-info') cmd.append(cls.results_dir) cmd.append('-report-path') cmd.append(cls.pkgdiff_results_full_path) ret_code = ProcessHelper.run_subprocess(cmd, output=ProcessHelper.DEV_NULL) """ From pkgdiff source code: ret_code 0 means unchanged ret_code 1 means Changed other return codes means error """ if int(ret_code) != 0 and int(ret_code) != 1: raise RebaseHelperError('Execution of %s failed.\nCommand line is: %s', cls.CMD, cmd) OutputLogger.set_info_text('Result HTML page from pkgdiff is store in: ', cls.pkgdiff_results_full_path) results_dict = cls.process_xml_results(cls.results_dir) text = [] for key, val in six.iteritems(results_dict): text.append('Following files were %s:\n%s' % (key, '\n'.join(val))) return text
def print_summary(cls, path): """ Function is used for printing summary informations :return: """ # First of all we would like to print all # summary information OutputLogger.set_info_text("Summary output is also available in log:", path) logger.info('\n') for key, value in six.iteritems(OutputLogger.get_summary_info()): logger.info("%s %s\n", key, value) try: LoggerHelper.add_file_handler(logger_output, path) except (OSError, IOError): raise RebaseHelperError("Can not create results file '%s'", path) type_pkgs = ['old', 'new'] cls.print_patches(OutputLogger.get_patches(), '\nSummary information about patches:') for pkg in type_pkgs: type_pkg = OutputLogger.get_build(pkg) if type_pkg: cls.print_rpms(type_pkg, pkg.capitalize()) cls.print_build_logs(type_pkg, pkg.capitalize()) cls.print_pkgdiff_tool()
def _prepare_spec_objects(self): """ Prepare spec files and initialize objects :return: """ self.rebase_spec_file_path = get_rebase_name(self.spec_file_path) self.spec_file = SpecFile(self.spec_file_path, self.execution_dir, download=not self.conf.not_download_sources) # Check whether test suite is enabled at build time if not self.spec_file.is_test_suite_enabled(): OutputLogger.set_info_text('WARNING', 'Test suite is not enabled at build time.') # create an object representing the rebased SPEC file self.rebase_spec_file = self.spec_file.copy(self.rebase_spec_file_path) # check if argument passed as new source is a file or just a version if [True for ext in Archive.get_supported_archives() if self.conf.sources.endswith(ext)]: logger.debug("argument passed as a new source is a file") self.rebase_spec_file.set_version_using_archive(self.conf.sources) else: logger.debug("argument passed as a new source is a version") version, extra_version = SpecFile.split_version_string(self.conf.sources) self.rebase_spec_file.set_version(version) if extra_version: self.rebase_spec_file.set_extra_version(extra_version)
def setup(self): OutputLogger.set_info_text('Information text', 'some information text') OutputLogger.set_info_text('Next Information', 'some another information text') OutputLogger.set_patch_output('Patches:', self.patches_data) OutputLogger.set_build_data('old', self.old_rpm_data) OutputLogger.set_build_data('new', self.new_rpm_data)