From patchwork Thu Feb 16 22:07:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zack Weinberg X-Patchwork-Id: 728930 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vPVf033y2z9ryQ for ; Fri, 17 Feb 2017 09:08:08 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="iBtv4Q1F"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; q=dns; s=default; b=ZPp Tets6LZmCDOV9cG9zcpfGIlFqT2Y6c/OWYUUWvHJ8e6bIDex/LLx52eD7XmvJb1a 4xNBYmlf6B0iLBFe1EQWDutdWq69DhynduugCTjiODygQCPxEk8t0dahWWfkybNk Y1gDYffjm1vTDqkJjwtV5fr4csxrER69+Kq5S+e4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; s=default; bh=t33jYhTMa /sOcbGBGyEWh6dWyPE=; b=iBtv4Q1F64miXumqQrtx2H/yvRClS6xbuPOf6PmVF Z2ADpIiWaslbBJdABPvyvMKqGOUWkSbsvgajL8qCLCLgX+1ERO3Hf4aJ4AWKkPBV 1oANqSlmtTkYSfvpvV9OOad/P7/usbqroXz23qRbG4wLK9oVqUqjlB/2mkbwF4q1 kc= Received: (qmail 16037 invoked by alias); 16 Feb 2017 22:08:00 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 16023 invoked by uid 89); 16 Feb 2017 22:07:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=UD:replace, sk:build_t X-HELO: mailbackend.panix.com From: Zack Weinberg To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com Subject: [PATCH] build-many-glibcs: don't crash if email is not configured Date: Thu, 16 Feb 2017 17:07:47 -0500 Message-Id: <20170216220747.16020-1-zackw@panix.com> MIME-Version: 1.0 The 'bot-cycle' action for build-many-glibcs is a convenient way to not have to remember all the steps in keeping a many-glibcs tree up to date ... or it would be, if the script could send mail _optionally_. Make it so by skipping the mail step if mail isn't configured. OK? * scripts/build-many-glibcs.py (bot_build_mail): If the bot_config does not contain all of the necessary email- related settings, just print a warning and continue. --- scripts/build-many-glibcs.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py index d2947e676b..4f724ced6f 100755 --- a/scripts/build-many-glibcs.py +++ b/scripts/build-many-glibcs.py @@ -122,6 +122,7 @@ class Context(object): self.load_versions_json() self.load_build_state_json() self.status_log_list = [] + self.email_warning = False def get_script_text(self): """Return the text of this script.""" @@ -1003,6 +1004,15 @@ class Context(object): def bot_build_mail(self, action, build_time): """Send email with the results of a build.""" + if not ('email-from' in self.bot_config and + 'email-server' in self.bot_config and + 'email-subject' in self.bot_config and + 'email-to' in self.bot_config): + if not self.email_warning: + print("Email not configured, not sending.") + self.email_warning = True + return + build_time = build_time.replace(microsecond=0) subject = (self.bot_config['email-subject'] % {'action': action,