Beispiel #1
0
 def _execute_checkers(self, checker):
     """
     Function executes a checker based on command line arguments
     :param checker: checker name based from command line
     :return: Nothing
     """
     pkgchecker = Checker(checker)
     logger.info('Comparing packages using %s...', checker)
     text = pkgchecker.run_check(self.results_dir)
     return text
Beispiel #2
0
 def pkgdiff_packages(self):
     """
     Function calls pkgdiff class for comparing packages
     :return:
     """
     try:
         pkgchecker = Checker(self.conf.pkgcomparetool)
     except NotImplementedError:
         raise RebaseHelperError('You have to specify one of these check tools %s', Checker.get_supported_tools())
     else:
         logger.info('Comparing packages using %s...', self.conf.pkgcomparetool)
         results_dict = pkgchecker.run_check(self.results_dir)
         for key, val in six.iteritems(results_dict):
             if val:
                 OutputLogger.set_checker_output('Following files were ' + key, '\n'.join(val))
Beispiel #3
0
 def pkgdiff_packages(self, dir_name):
     """
     Function calls pkgdiff class for comparing packages
     :param dir_name: specify a result dir
     :return: 
     """
     pkgdiff_results = {}
     checker = Checker(os.path.dirname(__file__))
     if not self.conf.pkgcomparetool:
         for check in checker.get_supported_tools():
             try:
                 results = checker.run_check(dir_name, checker_name=check)
                 pkgdiff_results[check] = results
             except CheckerNotFoundError:
                 logger.info("Rebase-helper did not find checker '%s'." % check)
     else:
         pkgdiff_results[self.conf.pkgcomparetool] = checker.run_check(dir_name, checker_name=self.conf.pkgcomparetool)
     if pkgdiff_results:
         for diff_name, result in six.iteritems(pkgdiff_results):
             OutputLogger.set_checker_output(diff_name, result)
Beispiel #4
0
    def pkgdiff_packages(self):
        """
        Function calls pkgdiff class for comparing packages
        :return:
        """
        pkgdiff_results = {}
        if not self.conf.pkgcomparetool:
            for checker in Checker.get_supported_tools():
                text = self._execute_checkers(checker)
                pkgdiff_results[checker] = text

        else:
            text = self._execute_checkers(self.conf.pkgcomparetool)
            pkgdiff_results[self.conf.pkgcomparetool] = text
        OutputLogger.set_checker_output('\nResults from checker(s):', pkgdiff_results)
Beispiel #5
0
    def pkgdiff_packages(self):
        """
        Function calls pkgdiff class for comparing packages
        :return:
        """
        pkgdiff_results = {}
        if not self.conf.pkgcomparetool:
            for checker in Checker.get_supported_tools():
                results = self._execute_checkers(checker)
                pkgdiff_results[checker] = results

        else:
            text = self._execute_checkers(self.conf.pkgcomparetool)
            pkgdiff_results[self.conf.pkgcomparetool] = text
        for diff_name, result in six.iteritems(pkgdiff_results):
            OutputLogger.set_checker_output(diff_name, result)
Beispiel #6
0
    def _initialize_data(self):
        """
        Function fill dictionary with default data
        """
        # Get all tarballs before self.kwargs initialization
        self.old_sources = self.spec_file.get_archive()
        new_sources = self.rebase_spec_file.get_archive()

        self.old_sources = os.path.abspath(self.old_sources)
        if new_sources:
            self.conf.sources = new_sources

        if not self.conf.sources:
            raise RebaseHelperError('You have to define new sources.')
        else:
            self.new_sources = os.path.abspath(self.conf.sources)
        # Contains all source except the Source0
        self.rest_sources = self.spec_file.get_sources()[1:]
        self.rest_sources = [os.path.abspath(x) for x in self.rest_sources]

        # We want to inform user immediatelly if compare tool doesn't exists
        if self.conf.pkgcomparetool and self.conf.pkgcomparetool not in Checker.get_supported_tools():
            raise RebaseHelperError('You have to specify one of these check tools %s', Checker.get_supported_tools())