From patchwork Mon Oct 26 01:04:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1387398 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CKGzr6yfBz9sT6 for ; Mon, 26 Oct 2020 12:13:12 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=NbYI1dkv; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4CKGzr3SZhzDqKD for ; Mon, 26 Oct 2020 12:13:12 +1100 (AEDT) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=chromium.org (client-ip=2607:f8b0:4864:20::d35; helo=mail-io1-xd35.google.com; envelope-from=sjg@chromium.org; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=NbYI1dkv; dkim-atps=neutral Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4CKGph41CZzDqDD for ; Mon, 26 Oct 2020 12:05:16 +1100 (AEDT) Received: by mail-io1-xd35.google.com with SMTP id k21so8338866ioa.9 for ; Sun, 25 Oct 2020 18:05:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5rVaxr8XsU404FQ936J8HLE4iaca4Yd0cmtG68HXJug=; b=NbYI1dkvwGj20fXxTw49DU2PTJDX5OzExweLEnpXORvwt9ynn7qjgHhA4iANqgWdBz g6cCXVCSAFAUupYehusNP/ZynItQRwtAPcjwWMlWV2wqyp1gdLpD47vhJ8MBTGmTAOHX 3tnHPyRa6b5iuqVWO/fhtVKmLvREguzTAKwOE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5rVaxr8XsU404FQ936J8HLE4iaca4Yd0cmtG68HXJug=; b=iUz4TeNDQt390lpH+ZQgvDmctkJqRtAGyE2BIk0/Uq2NbYS9p56PzmROznAEz9qKzM IVn4c372TXxwBQztmdXp1GAlTmrd1LRxjXn2feqVB0yg2CmSF+fRHhVwqS16yUJeil/0 B2AozSqVkdQQQcxP+WXzUVoPK0NjXNHvYrt6gIvhNVEZxGtjwkoUtambJepHOWl+6Rg4 G97beIg8Nz6C2Ixee3Q54ZeZfvN7P/VOPDAk8cHeM7oBTZCi3MHxWSEsXHLiR99t5IOd DR+EzjzjLp4avCacgb8yVmMtYe7QLQ2P6TnzGGpMGG5y63Wr+RlX+mUFBXH1fSoOgQRz WUDQ== X-Gm-Message-State: AOAM5325TyA7CMZkdrjk0V1GlJ6au7g2pT35lE0UR4hTYQX994AnhuHg /DbBQ/6Ip+VhlHkbbFY6DdjMGg== X-Google-Smtp-Source: ABdhPJzW3KsTAcib3qVvhvWbxRfp8vlsf/+EDnVMx+4irP3rrWjdkmdYxdklZzxufZR2nvcwhYSQmQ== X-Received: by 2002:a05:6638:92a:: with SMTP id 10mr9636746jak.125.1603674314677; Sun, 25 Oct 2020 18:05:14 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id a6sm5231162ili.11.2020.10.25.18.05.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Oct 2020 18:05:14 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Subject: [PATCH v2 15/30] patman: Attach warnings to individual patches Date: Sun, 25 Oct 2020 19:04:27 -0600 Message-Id: <20201026010442.1606893-16-sjg@chromium.org> X-Mailer: git-send-email 2.29.0.rc2.309.g374f81d7ae-goog In-Reply-To: <20201026010442.1606893-1-sjg@chromium.org> References: <20201026010442.1606893-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tom Rini , Simon Glass , patchwork@lists.ozlabs.org Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" At present warnings are produced across the whole set of patches when parsing them. It is more useful to associate each warning with the patch (or commit) that generated it. Attach warnings to the Commit object and move them out of PatchStream. Also avoid generating duplicate warnings for the same commit. Signed-off-by: Simon Glass --- (no changes since v1) tools/patman/commit.py | 2 ++ tools/patman/patchstream.py | 15 +++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/tools/patman/commit.py b/tools/patman/commit.py index 8d583c4ed39..e49bf87dfc8 100644 --- a/tools/patman/commit.py +++ b/tools/patman/commit.py @@ -27,6 +27,7 @@ class Commit: rtags: Response tags (e.g. Reviewed-by) collected by the commit, dict: key: rtag type (e.g. 'Reviewed-by') value: Set of people who gave that rtag, each a name/email string + warn: List of warnings for this commit, each a str """ def __init__(self, hash): self.hash = hash @@ -38,6 +39,7 @@ class Commit: self.notes = [] self.change_id = None self.rtags = collections.defaultdict(set) + self.warn = [] def AddChange(self, version, info): """Add a new change line to the change list for a version. diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py index 9f283470bc2..880d7ddc7f2 100644 --- a/tools/patman/patchstream.py +++ b/tools/patman/patchstream.py @@ -68,7 +68,6 @@ class PatchStream: self.skip_blank = False # True to skip a single blank line self.found_test = False # Found a TEST= line self.lines_after_test = 0 # Number of lines found after TEST= - self.warn = [] # List of warnings we have collected self.linenum = 1 # Output line number we are up to self.in_section = None # Name of start...END section we are in self.notes = [] # Series notes @@ -84,12 +83,20 @@ class PatchStream: self.commit = None # Current commit def _add_warn(self, warn): - """Add a new warning to report to the user + """Add a new warning to report to the user about the current commit + + The new warning is added to the current commit if not already present. Args: warn (str): Warning to report + + Raises: + ValueError: Warning is generated with no commit associated """ - self.warn.append(warn) + if not self.commit: + raise ValueError('Warning outside commit: %s' % warn) + if warn not in self.commit.warn: + self.commit.warn.append(warn) def _add_to_series(self, line, name, value): """Add a new Series-xxx tag. @@ -614,7 +621,7 @@ def fix_patch(backup_dir, fname, series, cmt): if backup_dir: shutil.copy(fname, os.path.join(backup_dir, os.path.basename(fname))) shutil.move(tmpname, fname) - return pst.warn + return cmt.warn def fix_patches(series, fnames): """Fix up a list of patches identified by filenames