From patchwork Mon Aug 5 13:15:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Victor Huesca X-Patchwork-Id: 1142179 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 462JDq2gLhz9sPv for ; Mon, 5 Aug 2019 23:16:11 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id B5F4D87D17; Mon, 5 Aug 2019 13:16:03 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MFogyae44Yt9; Mon, 5 Aug 2019 13:16:01 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id B0F9B87D54; Mon, 5 Aug 2019 13:16:01 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id E3E141BF33C for ; Mon, 5 Aug 2019 13:15:58 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id D963F834A7 for ; Mon, 5 Aug 2019 13:15:58 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id X6AiQgrV3I5I for ; Mon, 5 Aug 2019 13:15:57 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 12A9F834A1 for ; Mon, 5 Aug 2019 13:15:56 +0000 (UTC) X-Originating-IP: 86.250.200.211 Received: from localhost.localdomain (lfbn-1-17395-211.w86-250.abo.wanadoo.fr [86.250.200.211]) (Authenticated sender: victor.huesca@bootlin.com) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id B66CA60011; Mon, 5 Aug 2019 13:15:54 +0000 (UTC) From: Victor Huesca To: buildroot@buildroot.org Date: Mon, 5 Aug 2019 15:15:42 +0200 Message-Id: <20190805131544.3849-3-victor.huesca@bootlin.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190805131544.3849-1-victor.huesca@bootlin.com> References: <20190805131544.3849-1-victor.huesca@bootlin.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH buildroot-test v2 2/4] utils/daily-mail: add outdated packages to the developer notification X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Victor Huesca , thomas.petazzoni@bootlin.com Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" This patch provides the logic to add outdated packages to the notification structure. This will allow future patches to add this new data to the per-developer emails. Signed-off-by: Victor Huesca --- utils/daily-mail | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/utils/daily-mail b/utils/daily-mail index c16af54..e99f526 100755 --- a/utils/daily-mail +++ b/utils/daily-mail @@ -72,6 +72,7 @@ class Notification: def __init__(self): self.arch_notifications = defaultdict(list) self.package_notifications = defaultdict(list) + self.package_version_notification = [] def get_mklist(basepath): @@ -160,6 +161,23 @@ def add_package_notification(branch, notifications, build_result): build_result['orphan'] = orphan +def add_outdated_pkg_notification(notifications, package): + ''' + Add to the notifications{} dict notifications that are related to + package "maintainers". + ''' + orphan = True + for dev in developers: + if package['name'] in dev.packages: + orphan = False + notif = notifications.setdefault(dev, Notification()) + notif.package_version_notification.append(package) + if orphan: + package['orphan'] = True + notif = notifications.setdefault(get_orphan_developer(), Notification()) + notif.package_version_notification.append(package) + + def shrink_str(string, length, align='right', fill='...'): ''' Returns the `string` shrinked to fit `length` characters and with `fill` @@ -394,7 +412,7 @@ def get_outdated_pkg(path): return sorted(s, key=lambda pkg: pkg['name']) -def calculate_notifications(results): +def calculate_notifications(results, outdated_pkg): ''' Prepare the notifications{} dict for the notifications to individual developers, based on architecture developers, package developers, @@ -408,6 +426,10 @@ def calculate_notifications(results): continue add_arch_notification(branch, notifications, result) add_package_notification(branch, notifications, result) + + for pkg in outdated_pkg: + add_outdated_pkg_notification(notifications, pkg) + return notifications @@ -449,7 +471,7 @@ def __main__(): overall_stats = {} results = {} results_by_reason = {} - notifications = calculate_notifications(results) + notifications = calculate_notifications(results, []) smtp = smtplib.SMTP(localconfig.smtphost, localconfig.smtpport) smtp.starttls() smtp.login(localconfig.smtpuser, localconfig.smtppass)