コード例 #1
0
    def save_reports_to_db(self, req, state, result):
        try:
            request = self.session.query(
                DB.Request).filter(DB.Request.id == req.reqid).one()
            for i in self.session.query(DB.ABICheck).filter(
                    DB.ABICheck.request_id == request.id).all():
                # yeah, we could be smarter here and update existing reports instead
                self.session.delete(i)
            self.session.flush()
            request.state = state
            request.result = result
        except sqlalchemy.orm.exc.NoResultFound as e:
            request = DB.Request(
                id=req.reqid,
                state=state,
                result=result,
            )
            self.session.add(request)
        self.session.commit()
        for r in self.reports:
            abicheck = DB.ABICheck(request=request,
                                   src_project=r.src_project,
                                   src_package=r.src_package,
                                   src_rev=r.src_rev,
                                   dst_project=r.dst_project,
                                   dst_package=r.dst_package,
                                   result=r.result)
            self.session.add(abicheck)
            self.session.commit()
            if r.result is None:
                continue
            elif r.result:
                self.text_summary += "Good news from ABI check, "
                self.text_summary += "%s seems to be ABI [compatible](%s/request/%s):\n\n" % (
                    r.dst_package, WEB_URL, req.reqid)
            else:
                self.text_summary += "Warning: bad news from ABI check, "
                self.text_summary += "%s may be ABI [**INCOMPATIBLE**](%s/request/%s):\n\n" % (
                    r.dst_package, WEB_URL, req.reqid)
            for lr in r.reports:
                libreport = DB.LibReport(
                    abicheck=abicheck,
                    src_repo=lr.src_repo,
                    src_lib=lr.src_lib,
                    dst_repo=lr.dst_repo,
                    dst_lib=lr.dst_lib,
                    arch=lr.arch,
                    htmlreport=lr.htmlreport,
                    result=lr.result,
                )
                self.session.add(libreport)
                self.session.commit()
                self.text_summary += "* %s (%s): [%s](%s/report/%d)\n" % (
                    lr.dst_lib, lr.arch, "compatible" if lr.result else
                    "***INCOMPATIBLE***", WEB_URL, libreport.id)

        self.reports = []
コード例 #2
0
 def save_reports_to_db(self, req, state, result):
     try:
         request = self.session.query(DB.Request).filter(DB.Request.id == req.reqid).one()
         for i in self.session.query(DB.ABICheck).filter(DB.ABICheck.request_id == request.id).all():
             # yeah, we could be smarter here and update existing reports instead
             self.session.delete(i)
         self.session.flush()
         request.state = state
         request.result = result
     except sqlalchemy.orm.exc.NoResultFound, e:
         request = DB.Request(id = req.reqid,
                 state = state,
                 result = result,
                 )
         self.session.add(request)