コード例 #1
0
ファイル: review_helper.py プロジェクト: timlau/FedoraReview
    def _do_report(self, outfile=None):
        ''' Create a review report'''
        clock = time.time()
        self.log.info('Getting .spec and .srpm Urls from : '
                      + self.bug.get_location())

        Settings.dump()
        if not self.bug.find_urls():
            raise self.HelperError('Cannot find .spec or .srpm URL(s)')
        self.log.debug("find_urls completed: %.3f"
                       % (time.time() - clock))
        clock = time.time()

        if not ReviewDirs.is_inited:
            wd = self.bug.get_dirname()
            ReviewDirs.workdir_setup(wd)
        if Mock.is_available():
            Mock.init()

        if not self.bug.download_files():
            raise self.HelperError('Cannot download .spec and .srpm')
        self.log.debug("Url download completed: %.3f" % (time.time() - clock))

        Settings.name = self.bug.get_name()
        self._run_checks(self.bug.spec_file, self.bug.srpm_file, outfile)
コード例 #2
0
    def _get_spec_from_srpm(self):
        path = urlparse(self.srpm_url).path
        name = os.path.basename(path).rsplit('-', 2)[0]
        ReviewDirs.workdir_setup(name)
        self.do_download_srpm()

        SRPMFile(self.srpm_file).unpack()
        file = glob(os.path.join(ReviewDirs.srpm_unpacked, name + '*.spec'))[0]
        self.spec_file = file
        self.spec_url = 'file://' + file
コード例 #3
0
 def _get_spec_from_srpm(self):
     path = urlparse(self.srpm_url).path
     name = os.path.basename(path).rsplit('-',2)[0]
     ReviewDirs.workdir_setup(name)
     self.do_download_srpm()
     
     SRPMFile(self.srpm_file).unpack()
     file = glob(os.path.join(ReviewDirs.srpm_unpacked, 
                              name + '*.spec'))[0]
     self.spec_file = file
     self.spec_url = 'file://' + file
コード例 #4
0
    def _get_spec_from_srpm(self):
        ''' Extract spec from srpm and update self.spec_url. '''
        path = urlparse(self.srpm_url).path
        name = os.path.basename(path).rsplit('-', 2)[0]
        ReviewDirs.workdir_setup(self.get_dirname())
        self.do_download_srpm()

        SRPMFile(self.srpm_file).unpack()
        path = glob(os.path.join(ReviewDirs.srpm_unpacked,
                                 name + '*.spec'))[0]
        self.spec_file = path
        self.spec_url = 'file://' + path
コード例 #5
0
ファイル: abstract_bug.py プロジェクト: timlau/FedoraReview
    def _get_spec_from_srpm(self):
        ''' Extract spec from srpm and update self.spec_url. '''
        path = urlparse(self.srpm_url).path
        name = os.path.basename(path).rsplit('-', 2)[0]
        ReviewDirs.workdir_setup(name, Settings.cache)
        self.do_download_srpm()

        SRPMFile(self.srpm_file).unpack()
        try:
            path = glob(os.path.join(ReviewDirs.srpm_unpacked,
                                     name + '*.spec'))[0]
        except IndexError:
            raise ReviewError("Cannot find spec file in srpm")
        self.spec_file = path
        self.spec_url = 'file://' + path
コード例 #6
0
ファイル: abstract_bug.py プロジェクト: jbadiapa/FedoraReview
    def _get_spec_from_srpm(self):
        ''' Extract spec from srpm and update self.spec_url. '''
        path = urlparse(self.srpm_url).path
        name = os.path.basename(path).rsplit('-', 2)[0]
        ReviewDirs.workdir_setup(name, Settings.cache)
        self.do_download_srpm()

        SRPMFile(self.srpm_file).unpack()
        try:
            path = glob(os.path.join(ReviewDirs.srpm_unpacked,
                                     name + '*.spec'))[0]
        except IndexError:
            raise ReviewError("Cannot find spec file in srpm")
        self.spec_file = path
        self.spec_url = 'file://' + path
コード例 #7
0
    def _do_report(self, outfile=None):
        ''' Create a review report'''
        clock = time.time()
        self.log.info('Getting .spec and .srpm Urls from : ' +
                      self.bug.get_location())

        Settings.dump()
        if not self.bug.find_urls():
            raise self.HelperError('Cannot find .spec or .srpm URL(s)')
        self.log.debug("find_urls completed: %.3f" % (time.time() - clock))
        clock = time.time()

        if not ReviewDirs.is_inited:
            wd = self.bug.get_dirname()
            ReviewDirs.workdir_setup(wd)
        if Mock.is_available():
            Mock.init()

        if not self.bug.download_files():
            raise self.HelperError('Cannot download .spec and .srpm')
        self.log.debug("Url download completed: %.3f" % (time.time() - clock))

        Settings.name = self.bug.get_name()
        self._run_checks(self.bug.spec_file, self.bug.srpm_file, outfile)
コード例 #8
0
    def _run_checks(self, spec, srpm, outfile=None):
        ''' Register and run all checks. '''
        def apply_color(s, formatter):
            ''' Return s formatted by formatter or plain s. '''
            return formatter(s) if Settings.use_colors else s

        self.checks = Checks(spec, srpm)
        if outfile:
            self.outfile = outfile
        elif Settings.no_report:
            self.outfile = '/dev/null'
        else:
            self.outfile = ReviewDirs.report_path()
        with open(self.outfile, "w") as output:
            self.log.info('Running checks and generating report')
            self.checks.run_checks(output=output,
                                   writedown=not Settings.no_report)
        if not Settings.no_report:
            print apply_color("Review template in: " + self.outfile,
                              ansi.green)
            print apply_color(_EXIT_MESSAGE, ansi.red)
コード例 #9
0
ファイル: review_helper.py プロジェクト: timlau/FedoraReview
    def _run_checks(self, spec, srpm, outfile=None):
        ''' Register and run all checks. '''

        def apply_color(s, formatter):
            ''' Return s formatted by formatter or plain s. '''
            return formatter(s) if Settings.use_colors else s

        self.checks = Checks(spec, srpm)
        if outfile:
            self.outfile = outfile
        elif Settings.no_report:
            self.outfile = '/dev/null'
        else:
            self.outfile = ReviewDirs.report_path()
        with open(self.outfile, "w") as output:
            self.log.info('Running checks and generating report')
            self.checks.run_checks(output=output,
                                   writedown=not Settings.no_report)
        if not Settings.no_report:
            print apply_color("Review template in: " + self.outfile,
                              ansi.green)
            print apply_color(_EXIT_MESSAGE, ansi.red)