def send_notification(pkg): package_status = BBSreportutils.get_pkg_field_from_meat_index( pkg, 'PackageStatus') if package_status == 'Deprecated': return maintainer_email = BBSreportutils.get_pkg_field_from_meat_index( pkg, 'MaintainerEmail') #print "%s %s %s %s" % (pkg, version, maintainer, maintainer_email) #key = 'Last Changed Date' #last_changed_date = BBSreportutils.get_vcs_meta(pkg, key) #key = 'Last Changed Rev' #last_changed_rev = BBSreportutils.get_vcs_meta(pkg, key) problem_descs = [] for node in BBSreportutils.supported_nodes(pkg): stage = 'install' status = BBSreportutils.get_status_from_db(pkg, node.id, stage) if status in ["TIMEOUT", "ERROR"]: leafreport_rURL = BBSreportutils.get_leafreport_rel_url( pkg, node.id, stage) problem_desc = " o %s for 'R CMD INSTALL' on %s. See the details here:\n" % (status, node.id) \ + " %s%s\n" % (BBSreportutils.data_source, leafreport_rURL) problem_descs.append(problem_desc) stage = 'buildsrc' status = BBSreportutils.get_status_from_db(pkg, node.id, stage) if status in ["TIMEOUT", "ERROR"]: leafreport_rURL = BBSreportutils.get_leafreport_rel_url( pkg, node.id, stage) problem_desc = " o %s for 'R CMD build' on %s. See the details here:\n" % (status, node.id) \ + " %s%s\n" % (BBSreportutils.data_source, leafreport_rURL) problem_descs.append(problem_desc) stage = 'checksrc' status = BBSreportutils.get_status_from_db(pkg, node.id, stage) if status in ["TIMEOUT", "ERROR"]: leafreport_rURL = BBSreportutils.get_leafreport_rel_url( pkg, node.id, stage) problem_desc = " o %s for 'R CMD check' on %s. See the details here:\n" % (status, node.id) \ + " %s%s\n" % (BBSreportutils.data_source, leafreport_rURL) problem_descs.append(problem_desc) if len(problem_descs) == 0: return if maintainer_email == "*****@*****.**": to_addrs = ["*****@*****.**"] else: to_addrs = [maintainer_email] subject = "%s problems reported in the %s" % \ (pkg, BBSreportutils.REPORT_TITLE) msg = "%s\nHi %s maintainer,\n\n" % (msg_head, pkg) \ + "According to the %s,\n" % BBSreportutils.REPORT_TITLE \ + "the %s package has the following problem(s):\n\n" % pkg \ + "%s\n%s\n%s" % ('\n'.join(problem_descs), msg_tail, msg_footnote) if arg1 == "": print "###########################################################" print "maintainer_email: %s\n" % maintainer_email print "subject: %s\n" % subject print msg print "" print "BBS> Notifying maintainer(s) of %s:" % pkg sys.stdout.flush() bbs.email.sendtextmail(from_addr, to_addrs, subject, msg) return
def send_notification(pkg): package_status = BBSreportutils.get_pkg_field_from_meat_index(pkg, 'PackageStatus') if package_status == 'Deprecated': return maintainer_email = BBSreportutils.get_pkg_field_from_meat_index(pkg, 'MaintainerEmail') #print "%s %s %s %s" % (pkg, version, maintainer, maintainer_email) #key = 'Last Changed Date' #last_changed_date = BBSreportutils.get_vcs_meta(pkg, key) #key = 'Last Changed Rev' #last_changed_rev = BBSreportutils.get_vcs_meta(pkg, key) problem_descs = [] for node in BBSreportutils.supported_nodes(pkg): stage = 'install' status = BBSreportutils.get_status_from_db(pkg, node.id, stage) if status in ["TIMEOUT", "ERROR"]: leafreport_rURL = BBSreportutils.get_leafreport_rel_url(pkg, node.id, stage) problem_desc = " o %s for 'R CMD INSTALL' on %s. See the details here:\n" % (status, node.id) \ + " %s%s\n" % (BBSreportutils.data_source, leafreport_rURL) problem_descs.append(problem_desc) stage = 'buildsrc' status = BBSreportutils.get_status_from_db(pkg, node.id, stage) if status in ["TIMEOUT", "ERROR"]: leafreport_rURL = BBSreportutils.get_leafreport_rel_url(pkg, node.id, stage) problem_desc = " o %s for 'R CMD build' on %s. See the details here:\n" % (status, node.id) \ + " %s%s\n" % (BBSreportutils.data_source, leafreport_rURL) problem_descs.append(problem_desc) stage = 'checksrc' status = BBSreportutils.get_status_from_db(pkg, node.id, stage) if status in ["TIMEOUT", "ERROR"]: leafreport_rURL = BBSreportutils.get_leafreport_rel_url(pkg, node.id, stage) problem_desc = " o %s for 'R CMD check' on %s. See the details here:\n" % (status, node.id) \ + " %s%s\n" % (BBSreportutils.data_source, leafreport_rURL) problem_descs.append(problem_desc) if len(problem_descs) == 0: return if maintainer_email == "*****@*****.**": to_addrs = ["*****@*****.**"] else: to_addrs = [maintainer_email] subject = "%s problems reported in the %s" % \ (pkg, BBSreportutils.REPORT_TITLE) msg = "%s\nHi %s maintainer,\n\n" % (msg_head, pkg) \ + "According to the %s,\n" % BBSreportutils.REPORT_TITLE \ + "the %s package has the following problem(s):\n\n" % pkg \ + "%s\n%s\n%s" % ('\n'.join(problem_descs), msg_tail, msg_footnote) if arg1 == "": print "###########################################################" print "maintainer_email: %s\n" % maintainer_email print "subject: %s\n" % subject print msg print "" print "BBS> Notifying maintainer(s) of %s:" % pkg sys.stdout.flush() bbs.email.sendtextmail(from_addr, to_addrs, subject, msg) return
def collect_problems(pkg, node): stage2command = { 'install': 'R CMD INSTALL', 'buildsrc': 'R CMD build', 'checksrc': 'R CMD check' } stages_on_report = BBSreportutils.stages_to_display(BBSvars.buildtype) stages_to_collect = list(stage2command.keys() & stages_on_report) problem_descs = [] for stage in stages_to_collect: status = BBSreportutils.get_pkg_status(pkg, node.node_id, stage) if status in ["TIMEOUT", "ERROR"]: problem_desc = "%s for '%s' on %s" % \ (status, stage2command[stage], node.node_id) rurl = BBSreportutils.get_leafreport_rel_url( pkg, node.node_id, stage) problem_desc = " o %s. See the details here:\n %s%s\n" % \ (problem_desc, published_report_url, rurl) problem_descs.append(problem_desc) return problem_descs