From patchwork Fri Oct 30 03:46:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1390720 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: 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=Vxro0hFp; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (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 4CMpCL2NMYz9sPB for ; Fri, 30 Oct 2020 14:46:54 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4A0D9825B5; Fri, 30 Oct 2020 04:46:51 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Vxro0hFp"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2144682625; Fri, 30 Oct 2020 04:46:50 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x141.google.com (mail-il1-x141.google.com [IPv6:2607:f8b0:4864:20::141]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7E9E7825B5 for ; Fri, 30 Oct 2020 04:46:47 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x141.google.com with SMTP id a20so5310553ilk.13 for ; Thu, 29 Oct 2020 20:46:47 -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=fFJpWuYrDwx3nWLRYAsZXI/q7l2WEwyL45Lwu/Kehrk=; b=Vxro0hFptfDujvQcBlhzy6ZzQ1tE6ouD9zrfYt3eLJocm4cNffrpmfCvtZTsZu5NIM 8vs8ScKN8VSCahrKZZK9vmHPTvTE1pLzBjI0Y9dK51Dt6h4WNMT047a7ph6F/f1wCpb6 dyQb2k5SlWbGbD/CJgg+JUcklXN4ys6QNWDp8= 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=fFJpWuYrDwx3nWLRYAsZXI/q7l2WEwyL45Lwu/Kehrk=; b=DU5/BNdIEOuLYHhrOBK1ARQ/T23u9UN1IVnEe4CK+mu1r9urcYH1lel3PcwAXHABeZ 1OFyXLJwKCnLg80XouZ3gIKgstleSrAriIRktfGLBsLPZJw/0GOaEzhoJ0bml6F3eUd/ GHgSSLJG9BPkOd31XzFPWRlL22sjBfHCfJ2+nnryPprQYQImKl+/F7D76EcdBkUovVad O2kgF/DCtGc0Js6XYAqtOq0JClSo2FMhvEBCn6FzxN/fqQxHF1/5EQsmQIOb/CWks/Sr w4SaLUHMtvGrVEGKxKUveqBDdUaG98frNQs32fuNeVaqsiit7LqTcdoiwZl8XL2O0cOn 0l4Q== X-Gm-Message-State: AOAM531uI5O2TvciHB8seNnEFBHnKEAoNXLwkZr4HOjD5vNIfqwmlPLx sU4ll+uQAJMu4rzH1yxg4fF4FGA1majofJZl X-Google-Smtp-Source: ABdhPJzoRMsm+xINJYX7KANKkq0ZX9Tvh+zvkJ3ntAIgAKxH9WVFK8M6UYX9wXI/A8JeVlTquEN1Xg== X-Received: by 2002:a05:6e02:1348:: with SMTP id k8mr459990ilr.306.1604029606347; Thu, 29 Oct 2020 20:46:46 -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 n28sm4858693ila.52.2020.10.29.20.46.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 20:46:45 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: patchwork@lists.ozlabs.org, Doug Anderson , Tom Rini , Simon Glass Subject: [PATCH v3 01/29] patman: Correct operation of -n Date: Thu, 29 Oct 2020 21:46:10 -0600 Message-Id: <20201030034638.2858999-2-sjg@chromium.org> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog In-Reply-To: <20201030034638.2858999-1-sjg@chromium.org> References: <20201030034638.2858999-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean This operation was unfortunately broken by a recent change. It is now necessary to use -i in addition to -n, if there are errors or warnings in the patches. Correct this by always showing the summary information. Fixes: f3653759758 ("patman: Move main code out to a control module") Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/patman/control.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tools/patman/control.py b/tools/patman/control.py index 67e8f397efd..aea9df8c8d1 100644 --- a/tools/patman/control.py +++ b/tools/patman/control.py @@ -170,9 +170,8 @@ def send(args): ok = ok and gitutil.CheckSuppressCCConfig() its_a_go = ok or args.ignore_errors - if its_a_go: - email_patches( - col, series, cover_fname, patch_files, args.process_tags, - its_a_go, args.ignore_bad_tags, args.add_maintainers, - args.limit, args.dry_run, args.in_reply_to, args.thread, - args.smtp_server) + email_patches( + col, series, cover_fname, patch_files, args.process_tags, + its_a_go, args.ignore_bad_tags, args.add_maintainers, + args.limit, args.dry_run, args.in_reply_to, args.thread, + args.smtp_server) From patchwork Fri Oct 30 03:46:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1390723 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: 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=JOFdHkYX; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (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 4CMpCv70J0z9sSf for ; Fri, 30 Oct 2020 14:47:23 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A89F382653; Fri, 30 Oct 2020 04:47:02 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="JOFdHkYX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2ED018264E; Fri, 30 Oct 2020 04:46:54 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd42.google.com (mail-io1-xd42.google.com [IPv6:2607:f8b0:4864:20::d42]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A3232825CF for ; Fri, 30 Oct 2020 04:46:48 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd42.google.com with SMTP id u19so6158636ion.3 for ; Thu, 29 Oct 2020 20:46:48 -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=hUuzwXyWbkAfodCjkj+NPmX5LNny7pd1HgrkEw2//5Y=; b=JOFdHkYX3cEZ201oDzqPOYReciY/2fEbiBroccqTpFoYOqoD8Xr5KnwgG+2odDWjBQ c7nr5IhkVzhqIh5iPJ1+qyJxNGk919kw7S2+5azoRVA/n2t8PR4s59GptyYNn8N04ZR+ +c2NNF8c8eXJ7CQ+Hpeqspy970JPRbQnE3MD8= 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=hUuzwXyWbkAfodCjkj+NPmX5LNny7pd1HgrkEw2//5Y=; b=kPfIP24D1NE8KneU1CBxXG8ZPFr8Sdb0TLFykTmxlW2h7+gs7WNEvnwoayJBfBSY4n y/N2Y+j9tYSoQ8fcCsYLmKjC3q6vTUDYXC2uPxjgNZaSX3eowhPeYdp29fdzsO8Ymw1b MhOUtkGOkYKkSd5layL4RiTm66MrgSJFRQXSMOaNNk/TmP8MjjXmztdgD9uudMpI7kaz qR2wBuQ3POfpBCNPG+HMBY2qrJkuQkW6p7pj8XkzTUNtjS0aoR03fPavYri9053TR168 7cmn0AvfY47rx86AcDHYWYlRlpqgpwAZkLLER12qi3zUQ+3kvKXVkjFMVthQyHa3Cbah m4Ww== X-Gm-Message-State: AOAM531pUXUzSGfLlZIX/DgYjcXrm8EW/l4SCBU5epfL5mQhIubtOaK4 3dYF+9UOYSTm4SiyhWewTwml58nj81l+7Sb9 X-Google-Smtp-Source: ABdhPJxUJ1D5sHTEXy1k3Qyc+eZAbJXulNdYnE3hSHgq7tpZrvemDeyAQooHEHjgwLQXTC4PVDiwgA== X-Received: by 2002:a05:6638:d52:: with SMTP id d18mr445390jak.127.1604029607317; Thu, 29 Oct 2020 20:46:47 -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 n28sm4858693ila.52.2020.10.29.20.46.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 20:46:46 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: patchwork@lists.ozlabs.org, Doug Anderson , Tom Rini , Simon Glass , Bin Meng , Daniel Schwierzeck , Heiko Schocher , Heinrich Schuchardt , Marek Vasut , Stephen Warren Subject: [PATCH v3 02/29] azure/gitLab/travis: Add pygit2 as a dependency for tests Date: Thu, 29 Oct 2020 21:46:11 -0600 Message-Id: <20201030034638.2858999-3-sjg@chromium.org> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog In-Reply-To: <20201030034638.2858999-1-sjg@chromium.org> References: <20201030034638.2858999-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean This lets patman run all of its tests, rather than skipping quite a few. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) .azure-pipelines.yml | 2 +- .gitlab-ci.yml | 2 +- .travis.yml | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index 473ddee3835..132daa358f5 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -140,7 +140,7 @@ jobs: export USER=azure virtualenv -p /usr/bin/python3 /tmp/venv . /tmp/venv/bin/activate - pip install pyelftools pytest + pip install pyelftools pytest pygit2 export UBOOT_TRAVIS_BUILD_DIR=/tmp/sandbox_spl export PYTHONPATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt export PATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH} diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9ac2b336a11..74aabe53016 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -161,7 +161,7 @@ Run binman, buildman, dtoc, Kconfig and patman testsuites: export USER=gitlab; virtualenv -p /usr/bin/python3 /tmp/venv; . /tmp/venv/bin/activate; - pip install pyelftools pytest; + pip install pyelftools pytest pygit2; export UBOOT_TRAVIS_BUILD_DIR=/tmp/sandbox_spl; export PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt"; export PATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}"; diff --git a/.travis.yml b/.travis.yml index fb8f73157d7..bfcc74cd62a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,6 +26,7 @@ addons: - python3-sphinx - python3-virtualenv - python3-pip + - python3-pygit2 - swig - libpython-dev - iasl From patchwork Fri Oct 30 03:46:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1390722 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: 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=NPRl+xRf; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4CMpCj5srHz9sSf for ; Fri, 30 Oct 2020 14:47:13 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BF20D82646; Fri, 30 Oct 2020 04:46:59 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="NPRl+xRf"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0749B82648; Fri, 30 Oct 2020 04:46:54 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x142.google.com (mail-il1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4B2E4825DA for ; Fri, 30 Oct 2020 04:46:49 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x142.google.com with SMTP id k1so5317610ilc.10 for ; Thu, 29 Oct 2020 20:46:49 -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=so4CxxDj42SYn2VmEdgyAm0sllUf2tBfaUpllNpwZ6I=; b=NPRl+xRfaqkrU04QvVuIFOHu4YB+1M8KNRaIzBnZQ0KMdKRUAIUddcgTMQZ94eVxW8 nG39kFPoODK1XRbeIOEqvi7EimYkQ+lgUpL7Ul2abaYZ8yrJ5W19mFui5dGMqrw14oXa M2LdFoVxBo4SaB8aiPVHM3Go9TC+M+WOd0kuA= 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=so4CxxDj42SYn2VmEdgyAm0sllUf2tBfaUpllNpwZ6I=; b=Hn69XTaD3Nv1XvI5jS5zCeTzsImGl142YbBbXyrqNZEvy4I2gBBDfjAneQVNR+nhvP PWmDSTWBRswp/d7wuSohkP86dmfCgpakpOm6A6pUolB2adimvG1QeeiU2Vn+FNPL4wVu A81uNQ08CwTRFdMTmuz+Pw9eDJK7Bou8A1nEyiS3nL2DpbD0vZik2seODfw/yxVhHvN0 j5S2Jz9Dy4UmpKbBrmjAe6JkYDRwsm0DX+rPk429snVprqIB4q5jhHhrp+ZaCnNXnNW3 +rZqtowPFEoPLjpXOIr8c12qmt8oNRvi1vbWQlCmrVML9KVEu99XE6uzsNGHgQbEVOt9 SMlw== X-Gm-Message-State: AOAM532kCpHfX2OHvOkCpukCmdHFOqB8murySwwAQJzQFGO/1RzdNl7g uvuGslv9WtU9Y1EDVolFsKUm7wUR3xT/1sTq X-Google-Smtp-Source: ABdhPJzx131Qcz8jJgogmLkzBfmcuBlLUVxbafAH6Z7pam2Oo+2AYQBzjwnHzgWYSq6FO7awKPOVUg== X-Received: by 2002:a05:6e02:ee5:: with SMTP id j5mr495065ilk.152.1604029608122; Thu, 29 Oct 2020 20:46:48 -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 n28sm4858693ila.52.2020.10.29.20.46.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 20:46:47 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: patchwork@lists.ozlabs.org, Doug Anderson , Tom Rini , Simon Glass Subject: [PATCH v3 03/29] patman: Update how tests are run Date: Thu, 29 Oct 2020 21:46:12 -0600 Message-Id: <20201030034638.2858999-4-sjg@chromium.org> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog In-Reply-To: <20201030034638.2858999-1-sjg@chromium.org> References: <20201030034638.2858999-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean The current instructions are out-of-date. Fix them. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/patman/README | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tools/patman/README b/tools/patman/README index 52b2cf70bd0..7ede1068ee1 100644 --- a/tools/patman/README +++ b/tools/patman/README @@ -533,12 +533,10 @@ Most of these are indicated by a TODO in the code. It would be nice if this could handle the In-reply-to side of things. -The tests are incomplete, as is customary. Use the --test flag to run them, -and make sure you are in the tools/patman directory first: +The tests are incomplete, as is customary. Use the 'test' subcommand to run +them: - $ cd /path/to/u-boot - $ cd tools/patman - $ ./patman --test + $ tools/patman/patman test Error handling doesn't always produce friendly error messages - e.g. putting an incorrect tag in a commit may provide a confusing message. From patchwork Fri Oct 30 03:46:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1390725 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: 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=e/9CXHRd; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (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 4CMpD73dGlz9sSn for ; Fri, 30 Oct 2020 14:47:35 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EFAD082655; Fri, 30 Oct 2020 04:47:04 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="e/9CXHRd"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 83C0182637; Fri, 30 Oct 2020 04:46:54 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x141.google.com (mail-il1-x141.google.com [IPv6:2607:f8b0:4864:20::141]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1CA4282604 for ; Fri, 30 Oct 2020 04:46:50 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x141.google.com with SMTP id q1so5348479ilt.6 for ; Thu, 29 Oct 2020 20:46:50 -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=KuUvdFPpDyt8pyPaFK3eeylnrdO6e4HUu17AQYj7Xf0=; b=e/9CXHRdVOAgRGW/U+x1cWXLc6pRSPV6odNAwBoN2Vk2XTw5rQgZhUG3NnZdttyH0/ 8q3yEeoJdEgKgamUkgFyA9H09e/BYGqNIu8qInKqhEWkj1y5+G9ZsywyKuAZ7QGvryHN f078GNHP6MMmLvqVpvT4xA3eWm5kJJvdayemg= 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=KuUvdFPpDyt8pyPaFK3eeylnrdO6e4HUu17AQYj7Xf0=; b=e22jjbSe+GxmIt086kkZOY+71Hna2bUEXhaJYvytqD2CP/lz6VxV1+rOHPtXuJiyEj sPWFbV5cv4+3qxZXNZ+zTxhcZHvdVus2C6n/bTMOAL/t2rsLqWgiNzULs4Gn2fR1lfty Av6zMtxKgNT8COYvmP4mcQgl1GgBkL/uG7U9s8kYKD9G+WfuO3JS+xuit/hKoPqwo7Tg cGRywVYrGeMT+ukcKyGBwOuJeT516sdNBnc3COeevdPa6edNrohW4QSlhtgz+l9cKw+6 yF+dzoES5Gpra8fPH0rZKsgnvy3yoAoGDpf73MB8wuE+CxmZqppH9uz0VkRocWT7wwPL 7p8Q== X-Gm-Message-State: AOAM532qcfWpe7Eed2NNK0lEkfkRVoLj2yEzZ70dOxlU0GA7aTDOubRL er0Nd9OLSLzj8YRTqblG8PrV5RGKbBI3RauC X-Google-Smtp-Source: ABdhPJwJdNghN25CRNwm7dXIQQkNW1rGZzAsYD/1/F3gg5AzwsnwmxlpC6M96txWi5OVNtmPAd+YQA== X-Received: by 2002:a92:6607:: with SMTP id a7mr474749ilc.276.1604029608900; Thu, 29 Oct 2020 20:46:48 -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 n28sm4858693ila.52.2020.10.29.20.46.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 20:46:48 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: patchwork@lists.ozlabs.org, Doug Anderson , Tom Rini , Simon Glass Subject: [PATCH v3 04/29] patman: Fix whitespace errors in func_test Date: Thu, 29 Oct 2020 21:46:13 -0600 Message-Id: <20201030034638.2858999-5-sjg@chromium.org> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog In-Reply-To: <20201030034638.2858999-1-sjg@chromium.org> References: <20201030034638.2858999-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Fix up various indentation and other minor things to make pylint3 happier. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/patman/func_test.py | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py index 810af9c6042..7fffe649974 100644 --- a/tools/patman/func_test.py +++ b/tools/patman/func_test.py @@ -24,20 +24,20 @@ from patman.test_util import capture_sys_output try: import pygit2 - HAVE_PYGIT2= True + HAVE_PYGIT2 = True except ModuleNotFoundError: HAVE_PYGIT2 = False @contextlib.contextmanager def capture(): - oldout,olderr = sys.stdout, sys.stderr + oldout, olderr = sys.stdout, sys.stderr try: - out=[StringIO(), StringIO()] - sys.stdout,sys.stderr = out + out = [StringIO(), StringIO()] + sys.stdout, sys.stderr = out yield out finally: - sys.stdout,sys.stderr = oldout, olderr + sys.stdout, sys.stderr = oldout, olderr out[0] = out[0].getvalue() out[1] = out[1].getvalue() @@ -160,10 +160,10 @@ class TestFunctional(unittest.TestCase): in_reply_to = mel count = 2 settings.alias = { - 'fdt': ['simon'], - 'u-boot': ['u-boot@lists.denx.de'], - 'simon': [ed], - 'fred': [fred], + 'fdt': ['simon'], + 'u-boot': ['u-boot@lists.denx.de'], + 'simon': [ed], + 'fred': [fred], } text = self.GetText('test01.txt') @@ -177,9 +177,9 @@ class TestFunctional(unittest.TestCase): cc_file = series.MakeCcFile(process_tags, cover_fname, not ignore_bad_tags, add_maintainers, None) - cmd = gitutil.EmailPatches(series, cover_fname, args, - dry_run, not ignore_bad_tags, cc_file, - in_reply_to=in_reply_to, thread=None) + cmd = gitutil.EmailPatches( + series, cover_fname, args, dry_run, not ignore_bad_tags, + cc_file, in_reply_to=in_reply_to, thread=None) series.ShowActions(args, cmd, process_tags) cc_lines = open(cc_file, encoding='utf-8').read().splitlines() os.remove(cc_file) @@ -221,8 +221,9 @@ class TestFunctional(unittest.TestCase): self.assertEqual(('%s %s\0%s' % (args[0], rick, stefan)), tools.ToUnicode(cc_lines[0])) - self.assertEqual(('%s %s\0%s\0%s\0%s' % (args[1], fred, ed, rick, - stefan)), tools.ToUnicode(cc_lines[1])) + self.assertEqual( + '%s %s\0%s\0%s\0%s' % (args[1], fred, ed, rick, stefan), + tools.ToUnicode(cc_lines[1])) expected = ''' This is a test of how the cover @@ -256,8 +257,8 @@ Simon Glass (2): ''' lines = open(cover_fname, encoding='utf-8').read().splitlines() self.assertEqual( - 'Subject: [RFC PATCH v3 0/2] test: A test patch series', - lines[3]) + 'Subject: [RFC PATCH v3 0/2] test: A test patch series', + lines[3]) self.assertEqual(expected.splitlines(), lines[7:]) for i, fname in enumerate(args): @@ -310,7 +311,7 @@ Changes in v2: tools.WriteFile(path, text, binary=False) index = self.repo.index index.add(fname) - author = pygit2.Signature('Test user', 'test@email.com') + author = pygit2.Signature('Test user', 'test@email.com') committer = author tree = index.write_tree() message = subject + '\n' + body @@ -335,7 +336,7 @@ Changes in v2: author = pygit2.Signature('Test user', 'test@email.com') committer = author commit = repo.create_commit('HEAD', author, committer, - 'Created master', new_tree, []) + 'Created master', new_tree, []) self.make_commit_with_file('Initial commit', ''' Add a README From patchwork Fri Oct 30 03:46:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1390726 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: 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=VataMsSU; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4CMpDM5V8Fz9sPB for ; Fri, 30 Oct 2020 14:47:47 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 999AF8265F; Fri, 30 Oct 2020 04:47:06 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="VataMsSU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7248282638; Fri, 30 Oct 2020 04:46:55 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E23BC82585 for ; Fri, 30 Oct 2020 04:46:50 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd43.google.com with SMTP id k21so6119747ioa.9 for ; Thu, 29 Oct 2020 20:46:50 -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=NnIrCIDZEcDcnKGvck+xw+6K0VewgtNefS0t/B/OAFY=; b=VataMsSUXS4Hb/xhtwen+EPbku2CsldIR0aLkYvBuSHcoTSEKP+dG0lon20eHfAQ73 nBZVEISd6Kao22bpNxDFGvqRqKFL5Kwrnw4B61JysXMNmo8mI6bOO7QWykI9YUWiowi2 XhA6F2lNqqw8s9Gy3zTgDEdoEL8SgkvuAB62U= 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=NnIrCIDZEcDcnKGvck+xw+6K0VewgtNefS0t/B/OAFY=; b=tvrvu7ofKTdIUGz6O31Uizedvcr2VNRclxOtT/wayaasBzsmjwflc22554HlsklqBA MGSrwhC2u/KBOqiJinyEMD4J7k0bN9kbWAwmxOY2rEoS0c5o/eD5gM56mk/h74eCA8U6 tW+7B2yA6j38rv6LQzRRNPeBP6nS1ThDOfbNapzMQkIZ8u1BB6Cvrq4Hst+AfkZfKVvs 1UIfb3s0fs5kMi1dDL++FwT6PWpA/JSqa3hT5zB2RVY03i1UvXEpS2PHWZynsU9N/tEN x3jUzpl95f7C4vQqCyf7s6GUYXlbs22RPwOIbkzaQ12vawxXJeqFwqlqCLUsyGmeTHtV OuyA== X-Gm-Message-State: AOAM532gJ6P0C/F5wFRQw5rJ/3KQ3SAL5tAsa6j3qBoz7jvIvznPKCLf g3J4FzqPiG/2Bf66GE2rn3OqxwYA3aWmO4Md X-Google-Smtp-Source: ABdhPJyiVLLmfPyUQLri0z8pWN7XajylKkX6keqYoR0Wrqb75/Rswzb/H+1KqllKoX57fO+poy8Tfg== X-Received: by 2002:a5d:96c1:: with SMTP id r1mr398610iol.147.1604029609728; Thu, 29 Oct 2020 20:46:49 -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 n28sm4858693ila.52.2020.10.29.20.46.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 20:46:49 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: patchwork@lists.ozlabs.org, Doug Anderson , Tom Rini , Simon Glass Subject: [PATCH v3 05/29] patman: Use capture_sys_output() consistently Date: Thu, 29 Oct 2020 21:46:14 -0600 Message-Id: <20201030034638.2858999-6-sjg@chromium.org> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog In-Reply-To: <20201030034638.2858999-1-sjg@chromium.org> References: <20201030034638.2858999-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean One test still uses its own function for capturing output. Modify it to use the standard one in test_util Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/patman/func_test.py | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py index 7fffe649974..263cb340ef5 100644 --- a/tools/patman/func_test.py +++ b/tools/patman/func_test.py @@ -4,7 +4,6 @@ # Copyright 2017 Google, Inc # -import contextlib import os import re import shutil @@ -12,8 +11,6 @@ import sys import tempfile import unittest -from io import StringIO - from patman import control from patman import gitutil from patman import patchstream @@ -29,19 +26,6 @@ except ModuleNotFoundError: HAVE_PYGIT2 = False -@contextlib.contextmanager -def capture(): - oldout, olderr = sys.stdout, sys.stderr - try: - out = [StringIO(), StringIO()] - sys.stdout, sys.stderr = out - yield out - finally: - sys.stdout, sys.stderr = oldout, olderr - out[0] = out[0].getvalue() - out[1] = out[1].getvalue() - - class TestFunctional(unittest.TestCase): def setUp(self): self.tmpdir = tempfile.mkdtemp(prefix='patman.') @@ -169,7 +153,7 @@ class TestFunctional(unittest.TestCase): text = self.GetText('test01.txt') series = patchstream.GetMetaDataForTest(text) cover_fname, args = self.CreatePatchesForTest(series) - with capture() as out: + with capture_sys_output() as out: patchstream.FixPatches(series, args) if cover_fname and series.get('cover'): patchstream.InsertCoverLetter(cover_fname, series, count) @@ -184,7 +168,7 @@ class TestFunctional(unittest.TestCase): cc_lines = open(cc_file, encoding='utf-8').read().splitlines() os.remove(cc_file) - lines = out[0].splitlines() + lines = out[0].getvalue().splitlines() self.assertEqual('Cleaned %s patches' % len(series.commits), lines[0]) self.assertEqual('Change log missing for v2', lines[1]) self.assertEqual('Change log missing for v3', lines[2]) From patchwork Fri Oct 30 03:46:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1390728 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: 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=HyK+MaRL; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4CMpDb3GTNz9sSn for ; Fri, 30 Oct 2020 14:47:59 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5A6C282659; Fri, 30 Oct 2020 04:47:08 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="HyK+MaRL"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CE0408263C; Fri, 30 Oct 2020 04:46:56 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C270282628 for ; Fri, 30 Oct 2020 04:46:51 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd44.google.com with SMTP id r9so6123945ioo.7 for ; Thu, 29 Oct 2020 20:46:51 -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=c55EztBuhBaQo8ym2EJFPu9XtjT6aXTMT8T1ohulxsc=; b=HyK+MaRLkQ0/rBJtnK6WW2tsUflhMhs159s5AozKe9UI0xr0HNZcCFp0mEL9jJu1Ev xJrJlBqvkfeU3cF/euEFna+gujLrbd7e6RbhWW9SPxwKM8OEI5wu78wD2m9ecPJ8tpJw ztm+DBQGlgeWiO+ucsK13vxRL8jD9EPk+6IDk= 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=c55EztBuhBaQo8ym2EJFPu9XtjT6aXTMT8T1ohulxsc=; b=MAsZUviLQLH3ANnTBiqrm/4Fy8T544g031cME7P1XKtunU8UavFL4/gTaI8ftd+QoU zfo+GoN7Jj7yM+gzUujZebSGw+zvaSG/s2eL2met+neQYNuPynzOah70CvzVTt9sk9RM IiQWNUk69dATGqGVf7tzJkm/mNK6TklWoRilcxojsSJ4hyu8SFSfF3XBg/jnmt5ggQo/ 5PycAtllzXvUvoITwCt+0NUL2B2fF5FchrCpqqd973P+2OP92h7LJk+690+S+TZUNClA +bMi1ih5Nnhx5fbInS5lQJ61Z8k3ucdVXJG+4XLmxb5a1s5KUgJARNxQyxcPy51LfIOR 6OjA== X-Gm-Message-State: AOAM532bjV8khyclcYrcpZtwzAY6R5195DAWongNUlP31DgtaSGRODl3 /Tf1DNOLD9Rm8g2esirD+caAj1Pd4MFuOCmx X-Google-Smtp-Source: ABdhPJzN2nCVqCB2aVyxTq/rD2UggJqmzvbDvxsXmToy0xspymThSDeUkO4rAQ7nogkceZi0L2FPqQ== X-Received: by 2002:a6b:bfc7:: with SMTP id p190mr407634iof.121.1604029610514; Thu, 29 Oct 2020 20:46:50 -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 n28sm4858693ila.52.2020.10.29.20.46.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 20:46:50 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: patchwork@lists.ozlabs.org, Doug Anderson , Tom Rini , Simon Glass Subject: [PATCH v3 06/29] patman: Fix remaining pylint3 warnings in func_test Date: Thu, 29 Oct 2020 21:46:15 -0600 Message-Id: <20201030034638.2858999-7-sjg@chromium.org> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog In-Reply-To: <20201030034638.2858999-1-sjg@chromium.org> References: <20201030034638.2858999-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean This fixes all but the ones about too many variables/statements. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/patman/func_test.py | 76 +++++++++++++++++++++++++++++---------- 1 file changed, 58 insertions(+), 18 deletions(-) diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py index 263cb340ef5..b3c3e5796ad 100644 --- a/tools/patman/func_test.py +++ b/tools/patman/func_test.py @@ -4,6 +4,8 @@ # Copyright 2017 Google, Inc # +"""Functional tests for checking that patman behaves correctly""" + import os import re import shutil @@ -27,6 +29,7 @@ except ModuleNotFoundError: class TestFunctional(unittest.TestCase): + """Functional tests for checking that patman behaves correctly""" def setUp(self): self.tmpdir = tempfile.mkdtemp(prefix='patman.') self.gitdir = os.path.join(self.tmpdir, 'git') @@ -36,33 +39,69 @@ class TestFunctional(unittest.TestCase): shutil.rmtree(self.tmpdir) @staticmethod - def GetPath(fname): + def _get_path(fname): + """Get the path to a test file + + Args: + fname (str): Filename to obtain + + Returns: + str: Full path to file in the test directory + """ return os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), 'test', fname) @classmethod - def GetText(self, fname): - return open(self.GetPath(fname), encoding='utf-8').read() + def _get_text(cls, fname): + """Read a file as text + + Args: + fname (str): Filename to read + + Returns: + str: Contents of file + """ + return open(cls._get_path(fname), encoding='utf-8').read() @classmethod - def GetPatchName(self, subject): + def _get_patch_name(cls, subject): + """Get the filename of a patch given its subject + + Args: + subject (str): Patch subject + + Returns: + str: Filename for that patch + """ fname = re.sub('[ :]', '-', subject) return fname.replace('--', '-') - def CreatePatchesForTest(self, series): + def _create_patches_for_test(self, series): + """Create patch files for use by tests + + This copies patch files from the test directory as needed by the series + + Args: + series (Series): Series containing commits to convert + + Returns: + tuple: + str: Cover-letter filename, or None if none + fname_list: list of str, each a patch filename + """ cover_fname = None fname_list = [] for i, commit in enumerate(series.commits): - clean_subject = self.GetPatchName(commit.subject) + clean_subject = self._get_patch_name(commit.subject) src_fname = '%04d-%s.patch' % (i + 1, clean_subject[:52]) fname = os.path.join(self.tmpdir, src_fname) - shutil.copy(self.GetPath(src_fname), fname) + shutil.copy(self._get_path(src_fname), fname) fname_list.append(fname) if series.get('cover'): src_fname = '0000-cover-letter.patch' cover_fname = os.path.join(self.tmpdir, src_fname) fname = os.path.join(self.tmpdir, src_fname) - shutil.copy(self.GetPath(src_fname), fname) + shutil.copy(self._get_path(src_fname), fname) return cover_fname, fname_list @@ -137,7 +176,8 @@ class TestFunctional(unittest.TestCase): stefan = b'Stefan Br\xc3\xbcns '.decode('utf-8') rick = 'Richard III ' mel = b'Lord M\xc3\xablchett '.decode('utf-8') - ed = b'Lond Edmund Blackadd\xc3\xabr X-Patchwork-Id: 1390729 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: 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=LAsy1pAS; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4CMpDv0mzTz9sPB for ; Fri, 30 Oct 2020 14:48:14 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 839F782669; Fri, 30 Oct 2020 04:47:10 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="LAsy1pAS"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 653C082646; Fri, 30 Oct 2020 04:46:57 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x143.google.com (mail-il1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C9A5282625 for ; Fri, 30 Oct 2020 04:46:52 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x143.google.com with SMTP id f16so5382915ilr.0 for ; Thu, 29 Oct 2020 20:46:52 -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=ciSgZw7G4HdKBSC4EZnoIjWFUkaISkXC/sV7CUTzO30=; b=LAsy1pASW5hoLZF44IGdzdA0f/AnedUYji30l0KHk2BtDVoN8VCU7/hxk/O7Fdcfbn A26PXrViUbFmDJkbz6uW4yQQyu3WZEOqtgRbl+dOR3U/89UNzVY9KV4dxqf4hBgO0Ek0 bOcXVkqBuB0JTc+1vIOC42lowRZJatduVaZB8= 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=ciSgZw7G4HdKBSC4EZnoIjWFUkaISkXC/sV7CUTzO30=; b=FNmIbJyfQCu5NFqv1oxWJzF866/zCdsdyGSfN6lbfdVeBksgpRPf1TXvUOa0xmMKU7 sEbKptrIIuODlvHP2qAyFiNuA/xFSL9CXcUyTdxgpMl67O+GPe0MWPBW+n5ZXRLJi1/+ gYu1I5yGJtXQKJwSf5gqdkxwCS+38oWPCS3/gV8WXUDYOaekqu89JxOLD2OTUA3LGYr/ z2l78zkHUoS4h1cEkdJ+lNorpwXJGqeG8SDCDOtuUe3UWSC6ERBATC+JN/d6MZtbzKkD 2rEjIJE6ZvfbvNsUdUUGN3/Wft1oh3+FIJYMbdysKvJUI053Uqp3U++gpCypJ7qaKFaI m/dQ== X-Gm-Message-State: AOAM530H7HNVHJwBVG586X0ZeFIJRQZWccBGhNZGffFO4mdB5p/ILlJi RssdPqckcVYfjZdsYrRobubtdM913v983MbN X-Google-Smtp-Source: ABdhPJyAW+n+LVPXP4vvbFLVSAnRXm8/DACAfczAgHGxwmDZ8+RQTAAPty0Xu6AXwXqCG67fJrUxgQ== X-Received: by 2002:a05:6e02:c0c:: with SMTP id d12mr463893ile.246.1604029611330; Thu, 29 Oct 2020 20:46:51 -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 n28sm4858693ila.52.2020.10.29.20.46.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 20:46:50 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: patchwork@lists.ozlabs.org, Doug Anderson , Tom Rini , Simon Glass Subject: [PATCH v3 07/29] patman: Allow linking a series with patchwork Date: Thu, 29 Oct 2020 21:46:16 -0600 Message-Id: <20201030034638.2858999-8-sjg@chromium.org> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog In-Reply-To: <20201030034638.2858999-1-sjg@chromium.org> References: <20201030034638.2858999-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Add a new Series-links tag to tell patman how to find the series in patchwork. Each item is the series ID optionally preceded by the series version that the link refers to. An empty version indicates this is the latest series. For example: Series-links: 209816 1:203302 Documentation is added in a later patch. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/patman/README | 15 +++++++++++++++ tools/patman/func_test.py | 1 + tools/patman/series.py | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/tools/patman/README b/tools/patman/README index 7ede1068ee1..6664027ed7d 100644 --- a/tools/patman/README +++ b/tools/patman/README @@ -187,6 +187,21 @@ Series-name: name patman does not yet use it, but it is convenient to put the branch name here to help you keep track of multiple upstreaming efforts. +Series-links: [id | version:id]... + Set the ID of the series in patchwork. You can set this after you send + out the series and look in patchwork for the resulting series. The + URL you want is the one for the series itself, not any particular patch. + E.g. for http://patchwork.ozlabs.org/project/uboot/list/?series=187331 + the series ID is 187331. This property can have a list of series IDs, + one for each version of the series, e.g. + + Series-links: 1:187331 2:188434 189372 + + Patman always uses the one without a version, since it assumes this is + the latest one. When this tag is provided, patman can compare your local + branch against patchwork to see what new reviews your series has + collected ('patman status'). + Cover-letter: This is the patch set title blah blah diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py index b3c3e5796ad..ea3c84632c0 100644 --- a/tools/patman/func_test.py +++ b/tools/patman/func_test.py @@ -417,6 +417,7 @@ Series for my board This series implements support for my glorious board. END +Series-links: 183237 ''', 'serial.c', '''The code for the serial driver is here''') self.make_commit_with_file('bootm: Make it boot', ''' diff --git a/tools/patman/series.py b/tools/patman/series.py index 9f885c89873..393a44241bd 100644 --- a/tools/patman/series.py +++ b/tools/patman/series.py @@ -16,7 +16,7 @@ from patman import tools # Series-xxx tags that we understand valid_series = ['to', 'cc', 'version', 'changes', 'prefix', 'notes', 'name', - 'cover_cc', 'process_log'] + 'cover_cc', 'process_log', 'links'] class Series(dict): """Holds information about a patch series, including all tags. From patchwork Fri Oct 30 03:46:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1390730 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: 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=Cw2H1+ni; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (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 4CMpF85T8Dz9sPB for ; Fri, 30 Oct 2020 14:48:28 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7B13482668; Fri, 30 Oct 2020 04:47:12 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Cw2H1+ni"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B861282628; Fri, 30 Oct 2020 04:46:58 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7622882645 for ; Fri, 30 Oct 2020 04:46:53 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd43.google.com with SMTP id z5so6179863iob.1 for ; Thu, 29 Oct 2020 20:46:53 -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=CGW1gTMwfWBN+yQoZytB2mhousGx+J9httQCDGfeIXQ=; b=Cw2H1+nirwRJEaUdfXxamc5UcPb9FuQUE86A/AHXk2Yb6814zwpqpeS0GWavD1eiW5 x4OEg86zl/uU4mAlJiLBMdpAQj3Q85TpEHdn84vBEzlPDa2jaWU4k/+y13JW7dgOKP0V APsJdkr4WjYp0DN3FFnBP7EQcPtxqgAntFPbo= 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=CGW1gTMwfWBN+yQoZytB2mhousGx+J9httQCDGfeIXQ=; b=WwEdA7SdIEWN2zEv+1E+z0yZsTOZ0HXaOveLWg39HdoogiBybj5VYQ+VQZoyrgo+vc UXHMsPzVJZ1CqcinMiJuTimBYCTTMrpTAqq+2Qzcpm2+2dmkkaUeLPqhdYa5BZOz0Eme BkLp4zDBce/4k7Yo+kdr8JnBXSSFGGwweslbFZfv4T+KQe//VH1rol8vaA3AKC5KoQHj xaO9GdD1ClahEWuZ3+BScs+W36KHT59LmC8U1nKtcspk+g8VnKVrz31ah2QUlG2XYRGK UMCFnTxlhFOKpXnNe2F+AzyV9SFYDqwsCO44xNikJfl7EUOUj41A8ctWz9kxhj7NWcuh F7+w== X-Gm-Message-State: AOAM531tZAMt8AEjncWwau0kD2SLBLsSEpfwWhXTKZRXtLY9QXGLwgDG EZUmamQ6PNXQ/o5u4BOyWeEFFdor+gvySy0c X-Google-Smtp-Source: ABdhPJyc77ShpYkcmG1jQVyoIDj4/zTSpy6TZIi/ZCgVbJYRqjxGeO1uLGtzyIALG6YRIAkiVeDPxg== X-Received: by 2002:a6b:b9d5:: with SMTP id j204mr397627iof.135.1604029612170; Thu, 29 Oct 2020 20:46:52 -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 n28sm4858693ila.52.2020.10.29.20.46.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 20:46:51 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: patchwork@lists.ozlabs.org, Doug Anderson , Tom Rini , Simon Glass Subject: [PATCH v3 08/29] patman: Fix indenting in patchstream Date: Thu, 29 Oct 2020 21:46:17 -0600 Message-Id: <20201030034638.2858999-9-sjg@chromium.org> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog In-Reply-To: <20201030034638.2858999-1-sjg@chromium.org> References: <20201030034638.2858999-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Update the indenting to keep pylint3 happy. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/patman/patchstream.py | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py index ba0a13f6325..5fff74918ab 100644 --- a/tools/patman/patchstream.py +++ b/tools/patman/patchstream.py @@ -2,6 +2,8 @@ # Copyright (c) 2011 The Chromium OS Authors. # +"""Handles parsing a stream of commits/emails from 'git log' or other source""" + import datetime import math import os @@ -15,8 +17,8 @@ from patman import gitutil from patman.series import Series # Tags that we detect and remove -re_remove = re.compile('^BUG=|^TEST=|^BRANCH=|^Review URL:' - '|Reviewed-on:|Commit-\w*:') +re_remove = re.compile(r'^BUG=|^TEST=|^BRANCH=|^Review URL:' + r'|Reviewed-on:|Commit-\w*:') # Lines which are allowed after a TEST= line re_allowed_after_test = re.compile('^Signed-off-by:') @@ -46,7 +48,7 @@ re_commit = re.compile('^commit ([0-9a-f]*)$') re_space_before_tab = re.compile('^[+].* \t') # Match indented lines for changes -re_leading_whitespace = re.compile('^\s') +re_leading_whitespace = re.compile(r'^\s') # States we can be in - can we use range() and still have comments? STATE_MSG_HEADER = 0 # Still in the message header @@ -149,7 +151,7 @@ class PatchStream: return int(value) except ValueError as str: raise ValueError("%s: Cannot decode version info '%s'" % - (self.commit.hash, line)) + (self.commit.hash, line)) def FinalizeChange(self): """Finalize a (multi-line) change and add it to the series or commit""" @@ -271,7 +273,7 @@ class PatchStream: # If we are not in a section, it is an unexpected END elif line == 'END': - raise ValueError("'END' wihout section") + raise ValueError("'END' wihout section") # Detect the commit subject elif not is_blank and self.state == STATE_PATCH_SUBJECT: @@ -336,8 +338,9 @@ class PatchStream: value = change_id_match.group(1) if self.is_log: if self.commit.change_id: - raise ValueError("%s: Two Change-Ids: '%s' vs. '%s'" % - (self.commit.hash, self.commit.change_id, value)) + raise ValueError( + "%s: Two Change-Ids: '%s' vs. '%s'" % self.commit.hash, + self.commit.change_id, value) self.commit.change_id = value self.skip_blank = True @@ -353,7 +356,7 @@ class PatchStream: self.change_version = self.ParseVersion(value, line) else: self.warn.append('Line %d: Ignoring Commit-%s' % - (self.linenum, name)) + (self.linenum, name)) # Detect the start of a new commit elif commit_match: @@ -376,7 +379,7 @@ class PatchStream: # Suppress duplicate signoffs elif signoff_match: if (self.is_log or not self.commit or - self.commit.CheckDuplicateSignoff(signoff_match.group(1))): + self.commit.CheckDuplicateSignoff(signoff_match.group(1))): out = [line] # Well that means this is an ordinary line @@ -385,7 +388,7 @@ class PatchStream: m = re_space_before_tab.match(line) if m: self.warn.append('Line %d/%d has space before tab' % - (self.linenum, m.start())) + (self.linenum, m.start())) # OK, we have a valid non-blank line out = [line] @@ -418,7 +421,7 @@ class PatchStream: self.CloseCommit() if self.lines_after_test: self.warn.append('Found %d lines after TEST=' % - self.lines_after_test) + self.lines_after_test) def WriteMessageId(self, outfd): """Write the Message-Id into the output. @@ -494,7 +497,7 @@ class PatchStream: else: if self.blank_count and (line == '-- ' or match): self.warn.append("Found possible blank line(s) at " - "end of file '%s'" % last_fname) + "end of file '%s'" % last_fname) outfd.write('+\n' * self.blank_count) outfd.write(line + '\n') self.blank_count = 0 @@ -502,7 +505,7 @@ class PatchStream: def GetMetaDataForList(commit_range, git_dir=None, count=None, - series = None, allow_overwrite=False): + series=None, allow_overwrite=False): """Reads out patch series metadata from the commits This does a 'git log' on the relevant commits and pulls out the tags we From patchwork Fri Oct 30 03:46:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1390747 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: 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=S0jUNsEc; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4CMpHh0NTdz9sSf for ; Fri, 30 Oct 2020 14:50:39 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 342A28263D; Fri, 30 Oct 2020 04:47:57 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="S0jUNsEc"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 19F4382649; Fri, 30 Oct 2020 04:47:00 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x142.google.com (mail-il1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5E028825CF for ; Fri, 30 Oct 2020 04:46:54 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x142.google.com with SMTP id n5so5340290ile.7 for ; Thu, 29 Oct 2020 20:46:54 -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=dXxOR8q8YE8W1Y6Bidj8U/MJdri+DLe6mRbJ+87LDBg=; b=S0jUNsEcJVqotztHuGzY1C2/JMzGW8RlFrbdvBXd3VnyXjZvxYIhvM7l3QRnuyMJo3 R7u1MiaKzTExcJJH4mq3eOlqd9zQoK8fRX1HRjFNsPv3Q5JVhofgUWilo2r4qD5zOOVL YPdRNT1soLuEYdgJ63mRuwmvD83CWVqBppjuw= 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=dXxOR8q8YE8W1Y6Bidj8U/MJdri+DLe6mRbJ+87LDBg=; b=UCFGHK8+ZPDMafKW9dJ66oI1m0k0GdTimp96RLliVB6Ein4qq1Buf8tPUO1iVaGCIA L7Qu9SDYK/TcXK0c4RXNtLm6Qt+fpkV/ytn1W2Cai9bQnWjntsW5dPapQyxAQRwa+TLY smHf9UF+QFQt5bH1mfx8OUY615p194ugnSvlUhg4LR6h26fVuudy1A8VFWqfyWLxiHNn HOxCqYpe+7l5CAYG05q+XQdkpAcnMw89dqq/FJmceKEcKSc4cDIA2k9w+KNsWRPTgR8L jIZzs8TV94TZER4t54dFKk4CbXk7v2bNevCrXwVLVtc2jmS8fHztWnAWNwQHO1Uyp9HT cGbQ== X-Gm-Message-State: AOAM533QyIuwG0zgXyiGOnQijAXsi0JBzetrByVQ2OzL0PCqStRhqlhe hhrr5mwU1Hgq4ZulUMtwfZ2aXz+G27G2mRpl X-Google-Smtp-Source: ABdhPJwuC629KkUHVKzte/Gl8ehvrRI4HmIsjh5LZlturLZ/LZFKkc6OY7bcCo19v+3G5JLi5qaoLg== X-Received: by 2002:a92:bb8d:: with SMTP id x13mr478229ilk.225.1604029613033; Thu, 29 Oct 2020 20:46:53 -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 n28sm4858693ila.52.2020.10.29.20.46.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 20:46:52 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: patchwork@lists.ozlabs.org, Doug Anderson , Tom Rini , Simon Glass Subject: [PATCH v3 09/29] patman: Fix constant style in patchstream Date: Thu, 29 Oct 2020 21:46:18 -0600 Message-Id: <20201030034638.2858999-10-sjg@chromium.org> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog In-Reply-To: <20201030034638.2858999-1-sjg@chromium.org> References: <20201030034638.2858999-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean These constants should use upper case. Update them to keep pylint3 happy. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/patman/patchstream.py | 44 ++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py index 5fff74918ab..86b03a7a30b 100644 --- a/tools/patman/patchstream.py +++ b/tools/patman/patchstream.py @@ -17,38 +17,38 @@ from patman import gitutil from patman.series import Series # Tags that we detect and remove -re_remove = re.compile(r'^BUG=|^TEST=|^BRANCH=|^Review URL:' +RE_REMOVE = re.compile(r'^BUG=|^TEST=|^BRANCH=|^Review URL:' r'|Reviewed-on:|Commit-\w*:') # Lines which are allowed after a TEST= line -re_allowed_after_test = re.compile('^Signed-off-by:') +RE_ALLOWED_AFTER_TEST = re.compile('^Signed-off-by:') # Signoffs -re_signoff = re.compile('^Signed-off-by: *(.*)') +RE_SIGNOFF = re.compile('^Signed-off-by: *(.*)') # Cover letter tag -re_cover = re.compile('^Cover-([a-z-]*): *(.*)') +RE_COVER = re.compile('^Cover-([a-z-]*): *(.*)') # Patch series tag -re_series_tag = re.compile('^Series-([a-z-]*): *(.*)') +RE_SERIES_TAG = re.compile('^Series-([a-z-]*): *(.*)') # Change-Id will be used to generate the Message-Id and then be stripped -re_change_id = re.compile('^Change-Id: *(.*)') +RE_CHANGE_ID = re.compile('^Change-Id: *(.*)') # Commit series tag -re_commit_tag = re.compile('^Commit-([a-z-]*): *(.*)') +RE_COMMIT_TAG = re.compile('^Commit-([a-z-]*): *(.*)') # Commit tags that we want to collect and keep -re_tag = re.compile('^(Tested-by|Acked-by|Reviewed-by|Patch-cc|Fixes): (.*)') +RE_TAG = re.compile('^(Tested-by|Acked-by|Reviewed-by|Patch-cc|Fixes): (.*)') # The start of a new commit in the git log -re_commit = re.compile('^commit ([0-9a-f]*)$') +RE_COMMIT = re.compile('^commit ([0-9a-f]*)$') # We detect these since checkpatch doesn't always do it -re_space_before_tab = re.compile('^[+].* \t') +RE_SPACE_BEFORE_TAB = re.compile('^[+].* \t') # Match indented lines for changes -re_leading_whitespace = re.compile(r'^\s') +RE_LEADING_WHITESPACE = re.compile(r'^\s') # States we can be in - can we use range() and still have comments? STATE_MSG_HEADER = 0 # Still in the message header @@ -195,22 +195,22 @@ class PatchStream: out = [] line = line.rstrip('\n') - commit_match = re_commit.match(line) if self.is_log else None + commit_match = RE_COMMIT.match(line) if self.is_log else None if self.is_log: if line[:4] == ' ': line = line[4:] # Handle state transition and skipping blank lines - series_tag_match = re_series_tag.match(line) - change_id_match = re_change_id.match(line) - commit_tag_match = re_commit_tag.match(line) - cover_match = re_cover.match(line) - signoff_match = re_signoff.match(line) - leading_whitespace_match = re_leading_whitespace.match(line) + series_tag_match = RE_SERIES_TAG.match(line) + change_id_match = RE_CHANGE_ID.match(line) + commit_tag_match = RE_COMMIT_TAG.match(line) + cover_match = RE_COVER.match(line) + signoff_match = RE_SIGNOFF.match(line) + leading_whitespace_match = RE_LEADING_WHITESPACE.match(line) tag_match = None if self.state == STATE_PATCH_HEADER: - tag_match = re_tag.match(line) + tag_match = RE_TAG.match(line) is_blank = not line.strip() if is_blank: if (self.state == STATE_MSG_HEADER @@ -280,7 +280,7 @@ class PatchStream: self.commit.subject = line # Detect the tags we want to remove, and skip blank lines - elif re_remove.match(line) and not commit_tag_match: + elif RE_REMOVE.match(line) and not commit_tag_match: self.skip_blank = True # TEST= should be the last thing in the commit, so remove @@ -385,7 +385,7 @@ class PatchStream: # Well that means this is an ordinary line else: # Look for space before tab - m = re_space_before_tab.match(line) + m = RE_SPACE_BEFORE_TAB.match(line) if m: self.warn.append('Line %d/%d has space before tab' % (self.linenum, m.start())) @@ -410,7 +410,7 @@ class PatchStream: out += self.commit.notes out += [''] + log elif self.found_test: - if not re_allowed_after_test.match(line): + if not RE_ALLOWED_AFTER_TEST.match(line): self.lines_after_test += 1 return out From patchwork Fri Oct 30 03:46:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1390732 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: 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=B8qFFPS8; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (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 4CMpFP6nznz9sPB for ; Fri, 30 Oct 2020 14:48:41 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3FE2D82646; Fri, 30 Oct 2020 04:47:26 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="B8qFFPS8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 251868264D; Fri, 30 Oct 2020 04:47:01 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x141.google.com (mail-il1-x141.google.com [IPv6:2607:f8b0:4864:20::141]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5FAE782604 for ; Fri, 30 Oct 2020 04:46:55 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x141.google.com with SMTP id c11so5337458iln.9 for ; Thu, 29 Oct 2020 20:46:55 -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=HnuKQ3Q3xtAsONZX9QxbBCMjxwiKVVPN8EW/6l45aOM=; b=B8qFFPS8TljxrU7+24Hy6XQ2ylYaQrmDvit4lhN0ITFGoht2lbbpz8b2kmD5ftwZqx mHiw16O32gcw44UnpaG68Rt21xLiRwuI2NufUPIj3vU2EKQLgaUAfHBV1XPgbLY/Oo5q zZPfelXBB1uyZVxoncl1ILyOEJzUcm+HDWEQ0= 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=HnuKQ3Q3xtAsONZX9QxbBCMjxwiKVVPN8EW/6l45aOM=; b=sQEP7lrld/yL9FMHeE1zr1gs1z8cyT1w3mUILn9afiUkHWwdV4mXYTZKq2fw08VDCw XxqWjhAGtFN9DJegThPsx6kfWZEKq3Ja6ZDBiE5WsZw9/iTUvZB7dS+QeiEMR1jMAzA+ 7iNZT2W6DzyEVnG1fOEELH8ZA8SliEA/HmBM+fLP+XEwa8bVIIlMpwjNCDLWoN0SlkvL RzvM0BVkdk2K26lqUocW6pgoR1tSPnIzLCO+2VnF73tmoOknCIsfObqprv8anXgr5n9f p4zTYe+XgPYiJ14WVfVbp1/86P2qADPnY9HvjwJCYhVhatPFjXz5QhEyjH2wfWuRui7m U/3w== X-Gm-Message-State: AOAM530OyA096glwYVnqYhD2YiSbd01Nf4gizS9v3sUob5Q/xO/+EpFa vqwqoW8pxa6Tk4+wNDmEesiU1OFwQ+sQgapm X-Google-Smtp-Source: ABdhPJz5vYY7oJCRdKnV8l9StlYTqJumu6Vof0AHZ3zALnaYCUP00NyaRhhhYWvG6wtyaFU0zsr3rg== X-Received: by 2002:a05:6e02:60c:: with SMTP id t12mr508353ils.167.1604029613963; Thu, 29 Oct 2020 20:46:53 -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 n28sm4858693ila.52.2020.10.29.20.46.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 20:46:53 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: patchwork@lists.ozlabs.org, Doug Anderson , Tom Rini , Simon Glass Subject: [PATCH v3 10/29] patman: Rename functions in patchstream Date: Thu, 29 Oct 2020 21:46:19 -0600 Message-Id: <20201030034638.2858999-11-sjg@chromium.org> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog In-Reply-To: <20201030034638.2858999-1-sjg@chromium.org> References: <20201030034638.2858999-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Rename these functions to lower case as per PEP8. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/buildman/control.py | 6 +-- tools/patman/control.py | 6 +-- tools/patman/func_test.py | 6 +-- tools/patman/patchstream.py | 88 ++++++++++++++++----------------- tools/patman/test_checkpatch.py | 6 +-- 5 files changed, 56 insertions(+), 56 deletions(-) diff --git a/tools/buildman/control.py b/tools/buildman/control.py index b81ecf6a539..fe874b8165b 100644 --- a/tools/buildman/control.py +++ b/tools/buildman/control.py @@ -276,14 +276,14 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None, options.branch) upstream_commit = gitutil.GetUpstream(options.git_dir, options.branch) - series = patchstream.GetMetaDataForList(upstream_commit, + series = patchstream.get_metadata_for_list(upstream_commit, options.git_dir, 1, series=None, allow_overwrite=True) - series = patchstream.GetMetaDataForList(range_expr, + series = patchstream.get_metadata_for_list(range_expr, options.git_dir, None, series, allow_overwrite=True) else: # Honour the count - series = patchstream.GetMetaDataForList(options.branch, + series = patchstream.get_metadata_for_list(options.branch, options.git_dir, count, series=None, allow_overwrite=True) else: series = None diff --git a/tools/patman/control.py b/tools/patman/control.py index aea9df8c8d1..6555a4018a4 100644 --- a/tools/patman/control.py +++ b/tools/patman/control.py @@ -54,14 +54,14 @@ def prepare_patches(col, branch, count, start, end, ignore_binary): # Read the metadata from the commits to_do = count - end - series = patchstream.GetMetaData(branch, start, to_do) + series = patchstream.get_metadata(branch, start, to_do) cover_fname, patch_files = gitutil.CreatePatches( branch, start, to_do, ignore_binary, series) # Fix up the patch files to our liking, and insert the cover letter - patchstream.FixPatches(series, patch_files) + patchstream.fix_patches(series, patch_files) if cover_fname and series.get('cover'): - patchstream.InsertCoverLetter(cover_fname, series, to_do) + patchstream.insert_cover_letter(cover_fname, series, to_do) return series, cover_fname, patch_files def check_patches(series, patch_files, run_checkpatch, verbose): diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py index ea3c84632c0..bdeccafda0b 100644 --- a/tools/patman/func_test.py +++ b/tools/patman/func_test.py @@ -191,12 +191,12 @@ class TestFunctional(unittest.TestCase): } text = self._get_text('test01.txt') - series = patchstream.GetMetaDataForTest(text) + series = patchstream.get_metadata_for_test(text) cover_fname, args = self._create_patches_for_test(series) with capture_sys_output() as out: - patchstream.FixPatches(series, args) + patchstream.fix_patches(series, args) if cover_fname and series.get('cover'): - patchstream.InsertCoverLetter(cover_fname, series, count) + patchstream.insert_cover_letter(cover_fname, series, count) series.DoChecks() cc_file = series.MakeCcFile(process_tags, cover_fname, not ignore_bad_tags, add_maintainers, diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py index 86b03a7a30b..5487799bbee 100644 --- a/tools/patman/patchstream.py +++ b/tools/patman/patchstream.py @@ -83,7 +83,7 @@ class PatchStream: self.signoff = [] # Contents of signoff line self.commit = None # Current commit - def AddToSeries(self, line, name, value): + def _add_to_series(self, line, name, value): """Add a new Series-xxx tag. When a Series-xxx tag is detected, we come here to record it, if we @@ -100,7 +100,7 @@ class PatchStream: if self.is_log: self.series.AddTag(self.commit, line, name, value) - def AddToCommit(self, line, name, value): + def _add_to_commit(self, line, name, value): """Add a new Commit-xxx tag. When a Commit-xxx tag is detected, we come here to record it. @@ -114,7 +114,7 @@ class PatchStream: self.in_section = 'commit-' + name self.skip_blank = False - def AddCommitRtag(self, rtag_type, who): + def _add_commit_rtag(self, rtag_type, who): """Add a response tag to the current commit Args: @@ -123,7 +123,7 @@ class PatchStream: """ self.commit.AddRtag(rtag_type, who) - def CloseCommit(self): + def _close_commit(self): """Save the current commit into our commit list, and reset our state""" if self.commit and self.is_log: self.series.AddCommit(self.commit) @@ -137,7 +137,7 @@ class PatchStream: self.skip_blank = True self.section = [] - def ParseVersion(self, value, line): + def _parse_version(self, value, line): """Parse a version from a *-changes tag Args: @@ -153,8 +153,8 @@ class PatchStream: raise ValueError("%s: Cannot decode version info '%s'" % (self.commit.hash, line)) - def FinalizeChange(self): - """Finalize a (multi-line) change and add it to the series or commit""" + def _finalise_change(self): + """_finalise a (multi-line) change and add it to the series or commit""" if not self.change_lines: return change = '\n'.join(self.change_lines) @@ -167,7 +167,7 @@ class PatchStream: self.commit.AddChange(self.change_version, change) self.change_lines = [] - def ProcessLine(self, line): + def process_line(self, line): """Process a single line of a patch file or commit log This process a line and returns a list of lines to output. The list @@ -248,7 +248,7 @@ class PatchStream: # is missing, fix it up. if self.in_change: self.warn.append("Missing 'blank line' in section '%s-changes'" % self.in_change) - self.FinalizeChange() + self._finalise_change() self.in_change = None self.change_version = 0 @@ -298,26 +298,26 @@ class PatchStream: self.in_section = 'cover' self.skip_blank = False elif name == 'letter-cc': - self.AddToSeries(line, 'cover-cc', value) + self._add_to_series(line, 'cover-cc', value) elif name == 'changes': self.in_change = 'Cover' - self.change_version = self.ParseVersion(value, line) + self.change_version = self._parse_version(value, line) # If we are in a change list, key collected lines until a blank one elif self.in_change: if is_blank: # Blank line ends this change list - self.FinalizeChange() + self._finalise_change() self.in_change = None self.change_version = 0 elif line == '---': - self.FinalizeChange() + self._finalise_change() self.in_change = None self.change_version = 0 - out = self.ProcessLine(line) + out = self.process_line(line) elif self.is_log: if not leading_whitespace_match: - self.FinalizeChange() + self._finalise_change() self.change_lines.append(line) self.skip_blank = False @@ -328,9 +328,9 @@ class PatchStream: if name == 'changes': # value is the version number: e.g. 1, or 2 self.in_change = 'Series' - self.change_version = self.ParseVersion(value, line) + self.change_version = self._parse_version(value, line) else: - self.AddToSeries(line, name, value) + self._add_to_series(line, name, value) self.skip_blank = True # Detect Change-Id tags @@ -349,24 +349,24 @@ class PatchStream: name = commit_tag_match.group(1) value = commit_tag_match.group(2) if name == 'notes': - self.AddToCommit(line, name, value) + self._add_to_commit(line, name, value) self.skip_blank = True elif name == 'changes': self.in_change = 'Commit' - self.change_version = self.ParseVersion(value, line) + self.change_version = self._parse_version(value, line) else: self.warn.append('Line %d: Ignoring Commit-%s' % (self.linenum, name)) # Detect the start of a new commit elif commit_match: - self.CloseCommit() + self._close_commit() self.commit = commit.Commit(commit_match.group(1)) # Detect tags in the commit message elif tag_match: rtag_type, who = tag_match.groups() - self.AddCommitRtag(rtag_type, who) + self._add_commit_rtag(rtag_type, who) # Remove Tested-by self, since few will take much notice if (rtag_type == 'Tested-by' and who.find(os.getenv('USER') + '@') != -1): @@ -415,15 +415,15 @@ class PatchStream: return out - def Finalize(self): + def finalise(self): """Close out processing of this patch stream""" - self.FinalizeChange() - self.CloseCommit() + self._finalise_change() + self._close_commit() if self.lines_after_test: self.warn.append('Found %d lines after TEST=' % self.lines_after_test) - def WriteMessageId(self, outfd): + def _write_message_id(self, outfd): """Write the Message-Id into the output. This is based on the Change-Id in the original patch, the version, @@ -464,7 +464,7 @@ class PatchStream: # Join parts together with "." and write it out. outfd.write('Message-Id: <%s@changeid>\n' % '.'.join(parts)) - def ProcessStream(self, infd, outfd): + def process_stream(self, infd, outfd): """Copy a stream from infd to outfd, filtering out unwanting things. This is used to process patch files one at a time. @@ -478,13 +478,13 @@ class PatchStream: last_fname = None re_fname = re.compile('diff --git a/(.*) b/.*') - self.WriteMessageId(outfd) + self._write_message_id(outfd) while True: line = infd.readline() if not line: break - out = self.ProcessLine(line) + out = self.process_line(line) # Try to detect blank lines at EOF for line in out: @@ -501,11 +501,11 @@ class PatchStream: outfd.write('+\n' * self.blank_count) outfd.write(line + '\n') self.blank_count = 0 - self.Finalize() + self.finalise() -def GetMetaDataForList(commit_range, git_dir=None, count=None, - series=None, allow_overwrite=False): +def get_metadata_for_list(commit_range, git_dir=None, count=None, + series=None, allow_overwrite=False): """Reads out patch series metadata from the commits This does a 'git log' on the relevant commits and pulls out the tags we @@ -529,11 +529,11 @@ def GetMetaDataForList(commit_range, git_dir=None, count=None, stdout = command.RunPipe([params], capture=True).stdout ps = PatchStream(series, is_log=True) for line in stdout.splitlines(): - ps.ProcessLine(line) - ps.Finalize() + ps.process_line(line) + ps.finalise() return series -def GetMetaData(branch, start, count): +def get_metadata(branch, start, count): """Reads out patch series metadata from the commits This does a 'git log' on the relevant commits and pulls out the tags we @@ -544,10 +544,10 @@ def GetMetaData(branch, start, count): start: Commit to start from: 0=branch HEAD, 1=next one, etc. count: Number of commits to list """ - return GetMetaDataForList('%s~%d' % (branch if branch else 'HEAD', start), - None, count) + return get_metadata_for_list( + '%s~%d' % (branch if branch else 'HEAD', start), None, count) -def GetMetaDataForTest(text): +def get_metadata_for_test(text): """Process metadata from a file containing a git log. Used for tests Args: @@ -556,11 +556,11 @@ def GetMetaDataForTest(text): series = Series() ps = PatchStream(series, is_log=True) for line in text.splitlines(): - ps.ProcessLine(line) - ps.Finalize() + ps.process_line(line) + ps.finalise() return series -def FixPatch(backup_dir, fname, series, commit): +def fix_patch(backup_dir, fname, series, commit): """Fix up a patch file, by adding/removing as required. We remove our tags from the patch file, insert changes lists, etc. @@ -580,7 +580,7 @@ def FixPatch(backup_dir, fname, series, commit): infd = open(fname, 'r', encoding='utf-8') ps = PatchStream(series) ps.commit = commit - ps.ProcessStream(infd, outfd) + ps.process_stream(infd, outfd) infd.close() outfd.close() @@ -590,7 +590,7 @@ def FixPatch(backup_dir, fname, series, commit): shutil.move(tmpname, fname) return ps.warn -def FixPatches(series, fnames): +def fix_patches(series, fnames): """Fix up a list of patches identified by filenames The patch files are processed in place, and overwritten. @@ -606,7 +606,7 @@ def FixPatches(series, fnames): commit = series.commits[count] commit.patch = fname commit.count = count - result = FixPatch(backup_dir, fname, series, commit) + result = fix_patch(backup_dir, fname, series, commit) if result: print('%d warnings for %s:' % (len(result), fname)) for warn in result: @@ -615,7 +615,7 @@ def FixPatches(series, fnames): count += 1 print('Cleaned %d patches' % count) -def InsertCoverLetter(fname, series, count): +def insert_cover_letter(fname, series, count): """Inserts a cover letter with the required info into patch 0 Args: diff --git a/tools/patman/test_checkpatch.py b/tools/patman/test_checkpatch.py index f71c70fb13a..1f7c38c4e90 100644 --- a/tools/patman/test_checkpatch.py +++ b/tools/patman/test_checkpatch.py @@ -148,15 +148,15 @@ Signed-off-by: Simon Glass expfd.write(expected) expfd.close() - # Normally by the time we call FixPatch we've already collected + # Normally by the time we call fix_patch we've already collected # metadata. Here, we haven't, but at least fake up something. - # Set the "count" to -1 which tells FixPatch to use a bogus/fixed + # Set the "count" to -1 which tells fix_patch to use a bogus/fixed # time for generating the Message-Id. com = commit.Commit('') com.change_id = 'I80fe1d0c0b7dd10aa58ce5bb1d9290b6664d5413' com.count = -1 - patchstream.FixPatch(None, inname, series.Series(), com) + patchstream.fix_patch(None, inname, series.Series(), com) rc = os.system('diff -u %s %s' % (inname, expname)) self.assertEqual(rc, 0) From patchwork Fri Oct 30 03:46:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1390735 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: 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=M9kyck4d; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (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 4CMpFw3bj2z9sSf for ; Fri, 30 Oct 2020 14:49:08 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 294C28266C; Fri, 30 Oct 2020 04:47:29 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="M9kyck4d"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 041DC8264A; Fri, 30 Oct 2020 04:47:03 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x143.google.com (mail-il1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1C00982637 for ; Fri, 30 Oct 2020 04:46:56 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x143.google.com with SMTP id g7so5323692ilr.12 for ; Thu, 29 Oct 2020 20:46:56 -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=cI0CQoeAwjxa+x6klry8D5JDCrbdqGE+vZdMurDsn7w=; b=M9kyck4dhj66dmc+VoipUOWh5zJBXO7+IW7BF5GHJdyI33QafncG4OuvySUjDdCdob hQL0ax3TZnuZo9o64jQUx+TIk3S57WUPrM+qo7YVDz9nLbObVagz/cHiVPPGL6xIPMjT Lkkp0ooxUj/Gd+yklHzgCHL+MFdYxw6zfeQRI= 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=cI0CQoeAwjxa+x6klry8D5JDCrbdqGE+vZdMurDsn7w=; b=kUPvur/Ro4Re1WmCMq/6kO/opabMN1L6cQ36LOpphbIZjlBoU36N2/TVuRcFD3XsvG as8aqJx8n6Z7Q6DOzCAz7xa/MK0f7rnFOFMMIpg8Iar0lWd5H3tMOf/lX0RGXGDSDcrW 8hQlIuR50UoaS2Avvb4WtB2eAfilfhrXfkzbOUu9rcNwZKvpS3kjecVamRsMBH5gEFdh 1hELGhwwb0H0EFFSxKw6nAQs45l2f2wk8jv64xb4OErXgaUBPtJ6ZfK1bfFdCzI0TX7Y GqMgnYYXJAdy2ycsO4GsvSc0DVMTWsuazJVTsf5v/+WmfTyDw86QcTtKjj9Y30VfI9dQ 4Ktg== X-Gm-Message-State: AOAM532E3ZdTOaePYmk+xIPC/9n4BVdeEuCK9riNBGOU3Vn24LoM3/Jt tIJSjB7z9afgemqAcSG1XlPifWeM+S6qO7Tz X-Google-Smtp-Source: ABdhPJyV0aNlNLoBqaucPS3Ev+NrxGuquDy5y498Hcl4+0SQqYeSNC509d9r30c8oO0NmfHde6I8nQ== X-Received: by 2002:a92:c8c5:: with SMTP id c5mr470143ilq.269.1604029614839; Thu, 29 Oct 2020 20:46:54 -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 n28sm4858693ila.52.2020.10.29.20.46.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 20:46:54 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: patchwork@lists.ozlabs.org, Doug Anderson , Tom Rini , Simon Glass Subject: [PATCH v3 11/29] patman: Rename variables in patchstream Date: Thu, 29 Oct 2020 21:46:20 -0600 Message-Id: <20201030034638.2858999-12-sjg@chromium.org> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog In-Reply-To: <20201030034638.2858999-1-sjg@chromium.org> References: <20201030034638.2858999-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Some variables are too short or shadow other variables or types. Fix these to keep pylint3 happy. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/patman/patchstream.py | 52 ++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py index 5487799bbee..3a057fbd6c4 100644 --- a/tools/patman/patchstream.py +++ b/tools/patman/patchstream.py @@ -149,7 +149,7 @@ class PatchStream: """ try: return int(value) - except ValueError as str: + except ValueError: raise ValueError("%s: Cannot decode version info '%s'" % (self.commit.hash, line)) @@ -385,10 +385,10 @@ class PatchStream: # Well that means this is an ordinary line else: # Look for space before tab - m = RE_SPACE_BEFORE_TAB.match(line) - if m: + mat = RE_SPACE_BEFORE_TAB.match(line) + if mat: self.warn.append('Line %d/%d has space before tab' % - (self.linenum, m.start())) + (self.linenum, mat.start())) # OK, we have a valid non-blank line out = [line] @@ -527,10 +527,10 @@ def get_metadata_for_list(commit_range, git_dir=None, count=None, params = gitutil.LogCmd(commit_range, reverse=True, count=count, git_dir=git_dir) stdout = command.RunPipe([params], capture=True).stdout - ps = PatchStream(series, is_log=True) + pst = PatchStream(series, is_log=True) for line in stdout.splitlines(): - ps.process_line(line) - ps.finalise() + pst.process_line(line) + pst.finalise() return series def get_metadata(branch, start, count): @@ -554,13 +554,13 @@ def get_metadata_for_test(text): text: """ series = Series() - ps = PatchStream(series, is_log=True) + pst = PatchStream(series, is_log=True) for line in text.splitlines(): - ps.process_line(line) - ps.finalise() + pst.process_line(line) + pst.finalise() return series -def fix_patch(backup_dir, fname, series, commit): +def fix_patch(backup_dir, fname, series, cmt): """Fix up a patch file, by adding/removing as required. We remove our tags from the patch file, insert changes lists, etc. @@ -571,16 +571,16 @@ def fix_patch(backup_dir, fname, series, commit): Args: fname: Filename to patch file to process series: Series information about this patch set - commit: Commit object for this patch file + cmt: Commit object for this patch file Return: A list of errors, or [] if all ok. """ handle, tmpname = tempfile.mkstemp() outfd = os.fdopen(handle, 'w', encoding='utf-8') infd = open(fname, 'r', encoding='utf-8') - ps = PatchStream(series) - ps.commit = commit - ps.process_stream(infd, outfd) + pst = PatchStream(series) + pst.commit = cmt + pst.process_stream(infd, outfd) infd.close() outfd.close() @@ -588,7 +588,7 @@ def fix_patch(backup_dir, fname, series, commit): if backup_dir: shutil.copy(fname, os.path.join(backup_dir, os.path.basename(fname))) shutil.move(tmpname, fname) - return ps.warn + return pst.warn def fix_patches(series, fnames): """Fix up a list of patches identified by filenames @@ -603,10 +603,10 @@ def fix_patches(series, fnames): backup_dir = None #tempfile.mkdtemp('clean-patch') count = 0 for fname in fnames: - commit = series.commits[count] - commit.patch = fname - commit.count = count - result = fix_patch(backup_dir, fname, series, commit) + cmt = series.commits[count] + cmt.patch = fname + cmt.count = count + result = fix_patch(backup_dir, fname, series, cmt) if result: print('%d warnings for %s:' % (len(result), fname)) for warn in result: @@ -623,11 +623,11 @@ def insert_cover_letter(fname, series, count): series: Series object count: Number of patches in the series """ - fd = open(fname, 'r') - lines = fd.readlines() - fd.close() + fil = open(fname, 'r') + lines = fil.readlines() + fil.close() - fd = open(fname, 'w') + fil = open(fname, 'w') text = series.cover prefix = series.GetPatchPrefix() for line in lines: @@ -647,5 +647,5 @@ def insert_cover_letter(fname, series, count): # Now the change list out = series.MakeChangeLog(None) line += '\n' + '\n'.join(out) - fd.write(line) - fd.close() + fil.write(line) + fil.close() From patchwork Fri Oct 30 03:46:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1390733 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: 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=RSJGxt4F; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4CMpFg6n7Wz9sPB for ; Fri, 30 Oct 2020 14:48:55 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9990F8266A; Fri, 30 Oct 2020 04:47:27 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="RSJGxt4F"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9FBF782653; Fri, 30 Oct 2020 04:47:01 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x142.google.com (mail-il1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id DBEFF82638 for ; Fri, 30 Oct 2020 04:46:56 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x142.google.com with SMTP id x20so5334152ilj.8 for ; Thu, 29 Oct 2020 20:46:56 -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=+WclaPIMQ9K4GJQFHchtpP7pR0forxIg9n8ll4hCyYM=; b=RSJGxt4FggJmhjiy0GBdFGyZF692N9TtCmLU01bCri/sQfVsJEUqFj9cvcPa1DhrKY qzX6oKG5EnHVHH8WzzwLGorfoiIF7HoDWX531vTleyDGUfBl3StpPmdNb4NiLAPZzgDG D6/R8sURQftAV0nNWWhLEFjLjtstm5xdXSVO0= 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=+WclaPIMQ9K4GJQFHchtpP7pR0forxIg9n8ll4hCyYM=; b=ClYeVh/SJ/nAilu2NDhYdqoIrvq1CnjTwlRcBglJOBzSjr0f6LHpkgLIVvcyvhvUoT 98EVOKmaemHxsNzx6xvGGxZnWvdbLil9HKktRvmeAVXnjIic+xIKS+/tHHtszaBNwyvR wI1kBF3ZCj8nMsQlPl1WQFBTuOtIhFaE8XpEyHxm8+3WDu8J/j4xfakcgOO9KgIShG3j gjxQgwxKCuxssGsrE6TJ0/ztjGZ4rZGULO/6XT1jRAOZHPPyGAVNYZmtsSLiOh8CYY1U hqKcOnxBQqCDTHWsmM3JpeuXz//Eqnf1yv/LYT4Upqr4YYpS+CfvZWEipVC96ne9BEX3 dFsw== X-Gm-Message-State: AOAM5300c3V89NgdDzVj9fR+XFDDEmx0oTI5tfTfM2z90B/W0lC1HirC gUl3PR72WlIhBiO3n5pNTZzjTDJUMY+73cb/ X-Google-Smtp-Source: ABdhPJx82T2DBrpV+YA/LQ6jvq3qu8oSdCeey3teSJYEChh8fFfu8KwVq3LCh+u7TLtXeEmJip6ABQ== X-Received: by 2002:a92:c529:: with SMTP id m9mr464291ili.195.1604029615696; Thu, 29 Oct 2020 20:46:55 -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 n28sm4858693ila.52.2020.10.29.20.46.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 20:46:55 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: patchwork@lists.ozlabs.org, Doug Anderson , Tom Rini , Simon Glass Subject: [PATCH v3 12/29] patman: Drop unused args in patchstream Date: Thu, 29 Oct 2020 21:46:21 -0600 Message-Id: <20201030034638.2858999-13-sjg@chromium.org> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog In-Reply-To: <20201030034638.2858999-1-sjg@chromium.org> References: <20201030034638.2858999-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Drop a few arguments that are not used in functions. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/patman/patchstream.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py index 3a057fbd6c4..c5402dd896a 100644 --- a/tools/patman/patchstream.py +++ b/tools/patman/patchstream.py @@ -64,7 +64,7 @@ class PatchStream: unwanted tags or inject additional ones. These correspond to the two phases of processing. """ - def __init__(self, series, name=None, is_log=False): + def __init__(self, series, is_log=False): 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= @@ -100,15 +100,13 @@ class PatchStream: if self.is_log: self.series.AddTag(self.commit, line, name, value) - def _add_to_commit(self, line, name, value): + def _add_to_commit(self, name): """Add a new Commit-xxx tag. When a Commit-xxx tag is detected, we come here to record it. Args: - line: Source line containing tag (useful for debug/error messages) name: Tag name (part after 'Commit-') - value: Tag value (part after 'Commit-xxx: ') """ if name == 'notes': self.in_section = 'commit-' + name @@ -349,7 +347,7 @@ class PatchStream: name = commit_tag_match.group(1) value = commit_tag_match.group(2) if name == 'notes': - self._add_to_commit(line, name, value) + self._add_to_commit(name) self.skip_blank = True elif name == 'changes': self.in_change = 'Commit' From patchwork Fri Oct 30 03:46:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1390736 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: 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=kFj3IYQ4; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (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 4CMpG73h6qz9sPB for ; Fri, 30 Oct 2020 14:49:19 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AA7C682644; Fri, 30 Oct 2020 04:47:30 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="kFj3IYQ4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3D1A482655; Fri, 30 Oct 2020 04:47:03 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x143.google.com (mail-il1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id DCA1E82636 for ; Fri, 30 Oct 2020 04:46:57 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x143.google.com with SMTP id p10so5365014ile.3 for ; Thu, 29 Oct 2020 20:46:57 -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=ZQw+qoqTZn4Raperkb2P97QV/yVUdbo3azfEmsuTxBk=; b=kFj3IYQ43CIqT+GvfBlCucB1bLxzj9OfeEB5r/ayludo2laz28VZnP9NDC1dZpn3JA +4gmWH5foVpuBvrPY4vTksmGCPPpI6XAOwf+yAUIUl24P0o0Qsm1wkKLiIZ+W6CHR3GL xG7k1qZkzeQz2lTIzkBsvdu19Y+Ej7A6fAJJo= 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=ZQw+qoqTZn4Raperkb2P97QV/yVUdbo3azfEmsuTxBk=; b=GP/YNejXu8LMhjVwqvdGAT5Mg2CmhfORupTvPiRrO8M9Fgf3TyWzxMnoxT3DJn4PYs /f7l8qyIIzaOraX24UcfOlwF3nJTePphDPdfYhDGveZ20RTkWV2nSFkJ7IPX00byg+Fu CezXANZxBJ3Dt51+uR3c7Ea1rRfrxpWi3ar8CLcuXw6PExOSVYUTo6L8WaNKoXuCryZz Hw62nmLaHNQHDHyFDxxpVu5rCYeN9ezFL6e27SAuKWR/odrM8z7dkgYibYpenBWOfnLM YmV52MpzbnSqM3vaObZFHTckGCdJ+eGTZzzH/kLO2E//fV4fuoGo7jE1GQe1Dfwa5Cnw N3/Q== X-Gm-Message-State: AOAM530ZthTznqThIlwazM9y5L4+i5UcpqGq8oBQQHOoKUOV7I7Xxv4G l/a318nAMG7eYny2H43foA3FZZQbcgbs3N1f X-Google-Smtp-Source: ABdhPJyS6/nWvuciOHxIUqThLPDLy/voQ/J+GgO3v+rHXj7UW9jGaBu3fB91/prm830F+W7RUQVwZQ== X-Received: by 2002:a92:db05:: with SMTP id b5mr451926iln.279.1604029616567; Thu, 29 Oct 2020 20:46:56 -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 n28sm4858693ila.52.2020.10.29.20.46.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 20:46:56 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: patchwork@lists.ozlabs.org, Doug Anderson , Tom Rini , Simon Glass Subject: [PATCH v3 13/29] patman: Fix up argument/return docs in patchstream Date: Thu, 29 Oct 2020 21:46:22 -0600 Message-Id: <20201030034638.2858999-14-sjg@chromium.org> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog In-Reply-To: <20201030034638.2858999-1-sjg@chromium.org> References: <20201030034638.2858999-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Add missing documentation and type information. Fix up some missing docs on exceptions also. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/patman/patchstream.py | 82 ++++++++++++++++++++++--------------- 1 file changed, 50 insertions(+), 32 deletions(-) diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py index c5402dd896a..b2cb2debeee 100644 --- a/tools/patman/patchstream.py +++ b/tools/patman/patchstream.py @@ -90,9 +90,10 @@ class PatchStream: are scanning a 'git log'. Args: - line: Source line containing tag (useful for debug/error messages) - name: Tag name (part after 'Series-') - value: Tag value (part after 'Series-xxx: ') + line (str): Source line containing tag (useful for debug/error + messages) + name (str): Tag name (part after 'Series-') + value (str): Tag value (part after 'Series-xxx: ') """ if name == 'notes': self.in_section = name @@ -106,7 +107,7 @@ class PatchStream: When a Commit-xxx tag is detected, we come here to record it. Args: - name: Tag name (part after 'Commit-') + name (str): Tag name (part after 'Commit-') """ if name == 'notes': self.in_section = 'commit-' + name @@ -116,8 +117,9 @@ class PatchStream: """Add a response tag to the current commit Args: - key: rtag type (e.g. 'Reviewed-by') - who: Person who gave that rtag, e.g. 'Fred Bloggs ' + rtag_type (str): rtag type (e.g. 'Reviewed-by') + who (str): Person who gave that rtag, e.g. + 'Fred Bloggs ' """ self.commit.AddRtag(rtag_type, who) @@ -139,11 +141,14 @@ class PatchStream: """Parse a version from a *-changes tag Args: - value: Tag value (part after 'xxx-changes: ' - line: Source line containing tag + value (str): Tag value (part after 'xxx-changes: ' + line (str): Source line containing tag Returns: - The version as an integer + int: The version as an integer + + Raises: + ValueError: the value cannot be converted """ try: return int(value) @@ -184,10 +189,14 @@ class PatchStream: don't want, and add things we think are required. Args: - line: text line to process + line (str): text line to process Returns: - list of output lines, or [] if nothing should be output + list: list of output lines, or [] if nothing should be output + + Raises: + ValueError: a fatal error occurred while parsing, e.g. an END + without a starting tag, or two commits with two change IDs """ # Initially we have no output. Prepare the input line string out = [] @@ -428,7 +437,7 @@ class PatchStream: and the prefix. Args: - outfd: Output stream file object + outfd (io.IOBase): Output stream file object """ if not self.commit.change_id: return @@ -468,8 +477,8 @@ class PatchStream: This is used to process patch files one at a time. Args: - infd: Input stream file object - outfd: Output stream file object + infd (io.IOBase): Input stream file object + outfd (io.IOBase): Output stream file object """ # Extract the filename from each diff, for nice warnings fname = None @@ -510,14 +519,15 @@ def get_metadata_for_list(commit_range, git_dir=None, count=None, are interested in. Args: - commit_range: Range of commits to count (e.g. 'HEAD..base') - git_dir: Path to git repositiory (None to use default) - count: Number of commits to list, or None for no limit - series: Series object to add information into. By default a new series + commit_range (str): Range of commits to count (e.g. 'HEAD..base') + git_dir (str): Path to git repositiory (None to use default) + count (int): Number of commits to list, or None for no limit + series (Series): Object to add information into. By default a new series is started. - allow_overwrite: Allow tags to overwrite an existing tag + allow_overwrite (bool): Allow tags to overwrite an existing tag + Returns: - A Series object containing information about the commits. + Series: Object containing information about the commits. """ if not series: series = Series() @@ -538,9 +548,12 @@ def get_metadata(branch, start, count): are interested in. Args: - branch: Branch to use (None for current branch) - start: Commit to start from: 0=branch HEAD, 1=next one, etc. - count: Number of commits to list + branch (str): Branch to use (None for current branch) + start (int): Commit to start from: 0=branch HEAD, 1=next one, etc. + count (int): Number of commits to list + + Returns: + Series: Object containing information about the commits. """ return get_metadata_for_list( '%s~%d' % (branch if branch else 'HEAD', start), None, count) @@ -550,6 +563,9 @@ def get_metadata_for_test(text): Args: text: + + Returns: + Series: Object containing information about the commits. """ series = Series() pst = PatchStream(series, is_log=True) @@ -567,11 +583,13 @@ def fix_patch(backup_dir, fname, series, cmt): A backup file is put into backup_dir (if not None). Args: - fname: Filename to patch file to process - series: Series information about this patch set - cmt: Commit object for this patch file + backup_dir (str): Path to directory to use to backup the file + fname (str): Filename to patch file to process + series (Series): Series information about this patch set + cmt (Commit): Commit object for this patch file + Return: - A list of errors, or [] if all ok. + list: A list of errors, each str, or [] if all ok. """ handle, tmpname = tempfile.mkstemp() outfd = os.fdopen(handle, 'w', encoding='utf-8') @@ -594,8 +612,8 @@ def fix_patches(series, fnames): The patch files are processed in place, and overwritten. Args: - series: The series object - fnames: List of patch files to process + series (Series): The Series object + fnames (:type: list of str): List of patch files to process """ # Current workflow creates patches, so we shouldn't need a backup backup_dir = None #tempfile.mkdtemp('clean-patch') @@ -617,9 +635,9 @@ def insert_cover_letter(fname, series, count): """Inserts a cover letter with the required info into patch 0 Args: - fname: Input / output filename of the cover letter file - series: Series object - count: Number of patches in the series + fname (str): Input / output filename of the cover letter file + series (Series): Series object + count (int): Number of patches in the series """ fil = open(fname, 'r') lines = fil.readlines() From patchwork Fri Oct 30 03:46:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1390738 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: 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=Z3wD2i3k; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (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 4CMpGL58kcz9sPB for ; Fri, 30 Oct 2020 14:49:30 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 57BBC82678; Fri, 30 Oct 2020 04:47:32 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Z3wD2i3k"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AE11E8264D; Fri, 30 Oct 2020 04:47:03 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x144.google.com (mail-il1-x144.google.com [IPv6:2607:f8b0:4864:20::144]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B710E82625 for ; Fri, 30 Oct 2020 04:46:58 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x144.google.com with SMTP id g7so5323769ilr.12 for ; Thu, 29 Oct 2020 20:46:58 -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=b8i6rNhYkVCznVt4YIpM76IjFjMuzQfj7A6zPGyY3qE=; b=Z3wD2i3kEtiUxSiWp/4IzaiJJ8Mj1WhtIzJ0dWrpQSfdoheGJYkFpkXMwE60fGNxeO tR/0/c8oggz9wp5ym3ijvpcrM8IEQzDdAkMMhwI2DvAu3xZFqzkVu5pI8KjytNXu7kXE 12rFd1yhYI8loT4CNGBfpbe1FgnZpk+fQ0hNk= 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=b8i6rNhYkVCznVt4YIpM76IjFjMuzQfj7A6zPGyY3qE=; b=rUBe+K+Kt3WKiLw5feLhevrWVjAemg5lYptXcWzsQlQf9fSpi1qPMnG2OV/RWZAAzG OFvtJ2WLactGHJKK2T9Ms8fRhrOrVEWdXTqjL8gpMl8IGvRflz40Kd16qLbvLdgXeZ+J GUHuXGAV91kLg0orlj9TgFSgDVk6MZ+Ll+tBmvykVpD6baUi4KxdxYsd7C5/XY0/8qo8 n1RrE0idoJZzZpx52XjOGcJ1iCNjLFHR5asWMLOx2iqnJQfz7Tcjvk2TjQxbCtosEviH HdmopQnjov7VAV7MJso2kOfc1r1rdbgmSGYAlBFI0PSLPvmlIbIpOe+tn2yxW/rYv37J oz9A== X-Gm-Message-State: AOAM532n0jwgVxee3rHwKxW1jKwkHzumlphiyxJ2ykWVGi8dwPs+idWu x0m1ZnxPj2vuIwt4kOCvT3gfFYKkT4jWrou1 X-Google-Smtp-Source: ABdhPJxeHbWWiPfm7qHC71dRK0/F1E1aoTN3+DA8nxwxMRwzRmVMf9DLoX1/619AOYqKiHmpHWqf+w== X-Received: by 2002:a05:6e02:112:: with SMTP id t18mr473504ilm.299.1604029617463; Thu, 29 Oct 2020 20:46:57 -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 n28sm4858693ila.52.2020.10.29.20.46.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 20:46:57 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: patchwork@lists.ozlabs.org, Doug Anderson , Tom Rini , Simon Glass Subject: [PATCH v3 14/29] patman: Move warning collection to a function Date: Thu, 29 Oct 2020 21:46:23 -0600 Message-Id: <20201030034638.2858999-15-sjg@chromium.org> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog In-Reply-To: <20201030034638.2858999-1-sjg@chromium.org> References: <20201030034638.2858999-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Add a new function in PatchStream to collect the warnings generated while parsing the stream. This will allow us to adjust the logic, such as dealing with per-commit warnings. Two of the warnings are in fact internal errors, so change them to raise and exception. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/patman/patchstream.py | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py index b2cb2debeee..9f283470bc2 100644 --- a/tools/patman/patchstream.py +++ b/tools/patman/patchstream.py @@ -83,6 +83,14 @@ class PatchStream: self.signoff = [] # Contents of signoff line self.commit = None # Current commit + def _add_warn(self, warn): + """Add a new warning to report to the user + + Args: + warn (str): Warning to report + """ + self.warn.append(warn) + def _add_to_series(self, line, name, value): """Add a new Series-xxx tag. @@ -237,7 +245,7 @@ class PatchStream: # but we are already in a section, this means 'END' is missing # for that section, fix it up. if self.in_section: - self.warn.append("Missing 'END' in section '%s'" % self.in_section) + self._add_warn("Missing 'END' in section '%s'" % self.in_section) if self.in_section == 'cover': self.series.cover = self.section elif self.in_section == 'notes': @@ -247,14 +255,16 @@ class PatchStream: if self.is_log: self.commit.notes += self.section else: - self.warn.append("Unknown section '%s'" % self.in_section) + # This should not happen + raise ValueError("Unknown section '%s'" % self.in_section) self.in_section = None self.skip_blank = True self.section = [] # but we are already in a change list, that means a blank line # is missing, fix it up. if self.in_change: - self.warn.append("Missing 'blank line' in section '%s-changes'" % self.in_change) + self._add_warn("Missing 'blank line' in section '%s-changes'" % + self.in_change) self._finalise_change() self.in_change = None self.change_version = 0 @@ -271,7 +281,8 @@ class PatchStream: if self.is_log: self.commit.notes += self.section else: - self.warn.append("Unknown section '%s'" % self.in_section) + # This should not happen + raise ValueError("Unknown section '%s'" % self.in_section) self.in_section = None self.skip_blank = True self.section = [] @@ -362,8 +373,8 @@ class PatchStream: self.in_change = 'Commit' self.change_version = self._parse_version(value, line) else: - self.warn.append('Line %d: Ignoring Commit-%s' % - (self.linenum, name)) + self._add_warn('Line %d: Ignoring Commit-%s' % + (self.linenum, name)) # Detect the start of a new commit elif commit_match: @@ -377,7 +388,7 @@ class PatchStream: # Remove Tested-by self, since few will take much notice if (rtag_type == 'Tested-by' and who.find(os.getenv('USER') + '@') != -1): - self.warn.append("Ignoring %s" % line) + self._add_warn("Ignoring %s" % line) elif rtag_type == 'Patch-cc': self.commit.AddCc(who.split(',')) else: @@ -394,8 +405,8 @@ class PatchStream: # Look for space before tab mat = RE_SPACE_BEFORE_TAB.match(line) if mat: - self.warn.append('Line %d/%d has space before tab' % - (self.linenum, mat.start())) + self._add_warn('Line %d/%d has space before tab' % + (self.linenum, mat.start())) # OK, we have a valid non-blank line out = [line] @@ -427,8 +438,7 @@ class PatchStream: self._finalise_change() self._close_commit() if self.lines_after_test: - self.warn.append('Found %d lines after TEST=' % - self.lines_after_test) + self._add_warn('Found %d lines after TEST=' % self.lines_after_test) def _write_message_id(self, outfd): """Write the Message-Id into the output. @@ -503,8 +513,8 @@ class PatchStream: self.blank_count += 1 else: if self.blank_count and (line == '-- ' or match): - self.warn.append("Found possible blank line(s) at " - "end of file '%s'" % last_fname) + self._add_warn("Found possible blank line(s) at end of file '%s'" % + last_fname) outfd.write('+\n' * self.blank_count) outfd.write(line + '\n') self.blank_count = 0 From patchwork Fri Oct 30 03:46:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1390741 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: 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=QLXILvEc; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (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 4CMpGn51GWz9sPB for ; Fri, 30 Oct 2020 14:49:53 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 611AF82689; Fri, 30 Oct 2020 04:47:35 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="QLXILvEc"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6E2DC82658; Fri, 30 Oct 2020 04:47:05 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x142.google.com (mail-il1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 919668263C for ; Fri, 30 Oct 2020 04:46:59 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x142.google.com with SMTP id n5so5340437ile.7 for ; Thu, 29 Oct 2020 20:46:59 -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=byM3wBEBBtwzzX9Ue5qQnzo485LTzWQpGJF47oKjihE=; b=QLXILvEcc/jR/vZEgNIuaaGxGxKgEcznjJ9iJQmUOzaQ1GThuR1EH8vuvMO2Dys2o3 HojgvdFuG/S/zTOo4Gz/qKzpByC5B5ej+XcN7ihv9xPAVQTLI51qhTnu6U73ri/bHEKd 08Lwtn4LEdS9aTkjlCcym/QCug8bfURxNgbnQ= 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=byM3wBEBBtwzzX9Ue5qQnzo485LTzWQpGJF47oKjihE=; b=UEexO8hoJgBY/XVqDcPkWY7qP0bL0OAo3rp9FG0vNmCD2sQdVvUBJXqPI4+GIIeIRQ 6Xr61horTzJ8uf/XG7w67XcIWAfmJLl9KzLbEpk5S0YRUt4n1vcv0RKbnloiMixdCfiR R6u2C+rsgt2jvwEsWXjuGvHZE6y/rXYOJcsIfTf8o4rVhe3M6VlTnJK8bzmF6idwj3MV DRYCSduv6xU8yZwIhxbLwPreussx/4nhOE+iDdFqTWu+LG6G5+zHqgBhqzd+I9US0sE9 /CMP478m/PIgKkiCaXBu71RSOD3OEKTQ4/AN8KKS7xcoF3TLAz6GmH2nbEBgOQPPOwit pE+Q== X-Gm-Message-State: AOAM532dCxls7Nl1aA5H1ZQDvJ5wZeorCRtqtnvvYDGjvzqjro96d4E8 cIvo+1CE8pililA7fMuMa85AMfDi6A+wwVJi X-Google-Smtp-Source: ABdhPJxIKMfXvUIGPhEAITfePp6MWsqfU1ZeZlKaOVsPmCV0v73t522XDAbmQn3i1y4Knw5BfxSUIg== X-Received: by 2002:a92:6403:: with SMTP id y3mr509369ilb.72.1604029618339; Thu, 29 Oct 2020 20:46:58 -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 n28sm4858693ila.52.2020.10.29.20.46.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 20:46:57 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: patchwork@lists.ozlabs.org, Doug Anderson , Tom Rini , Simon Glass Subject: [PATCH v3 15/29] patman: Attach warnings to individual patches Date: Thu, 29 Oct 2020 21:46:24 -0600 Message-Id: <20201030034638.2858999-16-sjg@chromium.org> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog In-Reply-To: <20201030034638.2858999-1-sjg@chromium.org> References: <20201030034638.2858999-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean 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 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 From patchwork Fri Oct 30 03:46:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1390743 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: 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=YBXbmZNe; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (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 4CMpH10V7hz9sSf for ; Fri, 30 Oct 2020 14:50:04 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 740DD82690; Fri, 30 Oct 2020 04:47:36 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="YBXbmZNe"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E35A482654; Fri, 30 Oct 2020 04:47:06 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd42.google.com (mail-io1-xd42.google.com [IPv6:2607:f8b0:4864:20::d42]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6D82282645 for ; Fri, 30 Oct 2020 04:47:00 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd42.google.com with SMTP id b15so6113132iod.13 for ; Thu, 29 Oct 2020 20:47:00 -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=eog3k5AUX3Kgfa8+0WB0ORsAemAseJlfckBMZ4KFS9M=; b=YBXbmZNebplo6+ZMMrqHaQBIfSTV197I2Led6kfE0GSxDVGr6nNL+dr9v+VbWV97rn o+1UDle6dYHRcOt4A7WHhtHAE7U1Su78EXjfW/PUtSrRv+zSVfTXNJFTDuiUntNEUSUJ ZrKXXLIi7viyMlAzx3C1JSqToR8W+xt/Y6kJU= 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=eog3k5AUX3Kgfa8+0WB0ORsAemAseJlfckBMZ4KFS9M=; b=EwJZyA+F4Vv8PFvl9GtH3ciSFKmEdJhv1H9Gx5ihELDHmRb/P3fs1k8l3MbKawAnzS /DYq3ZqL9D5bUP1exHB8NWO8BzA5DKDvQEgjWV/+8lvns8Zv5TX+/sGblEt/zpmwp8va TjwmlfYS+h4r90qXtBzCe32NKMw6PzJ/vY0/DX+Qhfd5ucG4TscS2KCKvxzivEbwNO5p m4uXsKDFOGcIwL1aeXGP3fhMgGFT93A++llXSGMN9QSQvNFC7lR/zQKYjMjLEIMF2Bs2 EI68D7Hoxfx3q7nC3XYr2uTAGK6+qaGgkRvCJiQ2tjBYhyb2v3y8snxibLXvXiasZJf6 0FDw== X-Gm-Message-State: AOAM533rEdYhuI0ShoHugPxes4Q4uMUOEP2fDdNiw4lf2pFOWN6GhsS3 bVqCAdZKWNtYergcQ+bmskN3hDCDREDLkqFB X-Google-Smtp-Source: ABdhPJz6uzLdwERRGb6ENHk7ozPd5lO1ViuG+tfBwsrqRPcpSo0QnAtx5pdexj5qvYrtqgXb6pcljw== X-Received: by 2002:a5d:91c7:: with SMTP id k7mr433173ior.74.1604029619175; Thu, 29 Oct 2020 20:46:59 -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 n28sm4858693ila.52.2020.10.29.20.46.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 20:46:58 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: patchwork@lists.ozlabs.org, Doug Anderson , Tom Rini , Simon Glass Subject: [PATCH v3 16/29] patman: Convert 'Series-xxx' tag errors into warnings Date: Thu, 29 Oct 2020 21:46:25 -0600 Message-Id: <20201030034638.2858999-17-sjg@chromium.org> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog In-Reply-To: <20201030034638.2858999-1-sjg@chromium.org> References: <20201030034638.2858999-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean If the Series-xxx tag is not recognised patman currently reports a fatal error. This is inconvenient if a new feature is later added to patman that an earlier version does not support. Report a warning instead, to allow the user to take action if needed, but still allow operation to proceed. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/patman/patchstream.py | 4 +++- tools/patman/series.py | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py index 880d7ddc7f2..24040d43d62 100644 --- a/tools/patman/patchstream.py +++ b/tools/patman/patchstream.py @@ -114,7 +114,9 @@ class PatchStream: self.in_section = name self.skip_blank = False if self.is_log: - self.series.AddTag(self.commit, line, name, value) + warn = self.series.AddTag(self.commit, line, name, value) + if warn: + self.commit.warn.append(warn) def _add_to_commit(self, name): """Add a new Commit-xxx tag. diff --git a/tools/patman/series.py b/tools/patman/series.py index 393a44241bd..4457719f2ef 100644 --- a/tools/patman/series.py +++ b/tools/patman/series.py @@ -59,6 +59,9 @@ class Series(dict): line: Source line containing tag (useful for debug/error messages) name: Tag name (part after 'Series-') value: Tag value (part after 'Series-xxx: ') + + Returns: + String warning if something went wrong, else None """ # If we already have it, then add to our list name = name.replace('-', '_') @@ -78,9 +81,10 @@ class Series(dict): else: self[name] = value else: - raise ValueError("In %s: line '%s': Unknown 'Series-%s': valid " + return ("In %s: line '%s': Unknown 'Series-%s': valid " "options are %s" % (commit.hash, line, name, ', '.join(valid_series))) + return None def AddCommit(self, commit): """Add a commit into our list of commits From patchwork Fri Oct 30 03:46:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1390739 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: 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=BrjpATLb; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4CMpGZ6Y1hz9sPB for ; Fri, 30 Oct 2020 14:49:42 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B884282681; Fri, 30 Oct 2020 04:47:33 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="BrjpATLb"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 12BB18265C; Fri, 30 Oct 2020 04:47:06 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd42.google.com (mail-io1-xd42.google.com [IPv6:2607:f8b0:4864:20::d42]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5DE7F82604 for ; Fri, 30 Oct 2020 04:47:01 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd42.google.com with SMTP id k6so6176533ior.2 for ; Thu, 29 Oct 2020 20:47:01 -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=q2doFHgWs7iNlhq04iElfIHK+8bfgTn7lJKMPTdIlz0=; b=BrjpATLbbPn9aY7oB9K0r8CjJbtu6eXySTHUA5rmyXf+fBEWNOi0agTefNRSDAthKI 5KKg4vaiA9Q+l+XHyCWoetNRBtolHNQmaGBA7KVxW2dmgwdnrDxAMeNXrjRZdKEdVzst YuCisjduJgtrfCzR7qd4XxsyUWsNiteM3d3Qw= 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=q2doFHgWs7iNlhq04iElfIHK+8bfgTn7lJKMPTdIlz0=; b=TZloqyRUJ9cJk0phdkb1MpAQaTZFJ+t/ILQi8CKy3Dl+Hvb3ZKyOnIpbXmAOfahU4S xle5vVsdu7sh4sax/DFleUYaKzGoooUl5AsTw6jxGY7Pks2j4WAANCQWz7QgcAarcV2Y zvkfSQvWNT9Ashwv5DxzLhrxY8GHb4aOMIps36Oi1Y7m1z5RLUFae8L80DYHXztEsU0z wTDZ3V26zKOat5v395rS0nIhVzquQ0ElIUd4CMWj+7VCqUQR703c2QxphvHNA7l0rbW/ GfsYNC9pD1DTMMqYHXiVnq7y90URXr0C5tMJzzX15TBBpxzCoYGlIh45/6CEch2dIVYU P41Q== X-Gm-Message-State: AOAM531de7Y2/ORHYhAmn3w3SVKU5nDSACUOWBL0yc+8EptWraOoEbeu pQuC7InHCp7m94YQiFuHWpQ90esBPv/pPJZB X-Google-Smtp-Source: ABdhPJwPP6PLNo8SXPnRdkTqGz8ze/L4xehy9xebRZEsdAuHwDo2gqeEHkqaUQ5TWOVztKJlHLdokA== X-Received: by 2002:a6b:c8c1:: with SMTP id y184mr409382iof.109.1604029620120; Thu, 29 Oct 2020 20:47:00 -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 n28sm4858693ila.52.2020.10.29.20.46.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 20:46:59 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: patchwork@lists.ozlabs.org, Doug Anderson , Tom Rini , Simon Glass Subject: [PATCH v3 17/29] patman: Drop unused signoff member Date: Thu, 29 Oct 2020 21:46:26 -0600 Message-Id: <20201030034638.2858999-18-sjg@chromium.org> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog In-Reply-To: <20201030034638.2858999-1-sjg@chromium.org> References: <20201030034638.2858999-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean This is not used. Drop it. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/patman/func_test.py | 1 + tools/patman/patchstream.py | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py index bdeccafda0b..2290ba95e9d 100644 --- a/tools/patman/func_test.py +++ b/tools/patman/func_test.py @@ -16,6 +16,7 @@ import unittest from patman import control from patman import gitutil from patman import patchstream +from patman.patchstream import PatchStream from patman import settings from patman import terminal from patman import tools diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py index 24040d43d62..cf591b27573 100644 --- a/tools/patman/patchstream.py +++ b/tools/patman/patchstream.py @@ -79,7 +79,6 @@ class PatchStream: self.change_lines = [] # Lines of the current change self.blank_count = 0 # Number of blank lines stored up self.state = STATE_MSG_HEADER # What state are we in? - self.signoff = [] # Contents of signoff line self.commit = None # Current commit def _add_warn(self, warn): From patchwork Fri Oct 30 03:46: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: 1390744 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: 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=HrX0U6/H; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (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 4CMpHD2jTGz9sPB for ; Fri, 30 Oct 2020 14:50:16 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7E7CA8269B; Fri, 30 Oct 2020 04:47:37 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="HrX0U6/H"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 283CC8264E; Fri, 30 Oct 2020 04:47:07 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 69A2C8264E for ; Fri, 30 Oct 2020 04:47:02 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd44.google.com with SMTP id p7so6137013ioo.6 for ; Thu, 29 Oct 2020 20:47:02 -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=8k1NUNDfLC/5Dalmq+nRLVIdH9AZUvf4ti76U+7M/24=; b=HrX0U6/HgzSUTtBNxtX8b99/Twy9S29SqNNPhJjX+A9GwjY3S1CpuWkByXT+kASGvB FqS50A1hdLtWH4yVwRHuSnYmchxJj7/FzJl1Kfc8h5/5ie6C6xmKQ/FCCXg7KIKUwLTr Hi8ruJ+ypf79t7i935WIHJYdWC8Z/1eJRCF2Q= 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=8k1NUNDfLC/5Dalmq+nRLVIdH9AZUvf4ti76U+7M/24=; b=KTkp6v86QOCQ+eXWoWl0adQlbaxBuBTF9wc/AmZOIM1fZY5sRthPfZ9QsBdJ3imVGw C/BCtFmJpT5xV2zz2gsZiveY1RoyAvUqvXk4Gm+MMUAEGskU8G+DlAKBQZYw61igC4nv BVPPdEteTJU4JX81GnmNtwFV8ukXJ65aWhrGVBKgTWD1qhiKI9naYdjfvHvBaDyekPJ+ 4FjS4FiSfe6M29H84AfIm5EMEI1PAieT01pEaW9f+tutncqIBwYQCfgVDGRs8QoYkr1l 2uLX/celgvfJJBMI8ZK0Y3ATvTnbPG3lUgf+PjbIlEZAXxgI7YrjsmlB0jG4FdOE8bUI ZcDg== X-Gm-Message-State: AOAM530ziD68AObkFNWLJh5NNcQGFudmreaYd88LsscLM1KQUKlt0UgK 4RTMyVNIYOfcoKvpfwxP0uMJxIZQF4qzDteb X-Google-Smtp-Source: ABdhPJzB4HBQ8Cxwj5gRtPqiwz62YeWD+ZJea+HtnqimvXshHb214Ey1ZObVIkvFZ4oi71BXRFpBiQ== X-Received: by 2002:a05:6602:1305:: with SMTP id h5mr412501iov.41.1604029621029; Thu, 29 Oct 2020 20:47:01 -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 n28sm4858693ila.52.2020.10.29.20.47.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 20:47:00 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: patchwork@lists.ozlabs.org, Doug Anderson , Tom Rini , Simon Glass Subject: [PATCH v3 18/29] patman: Add a test for PatchStream tags Date: Thu, 29 Oct 2020 21:46:27 -0600 Message-Id: <20201030034638.2858999-19-sjg@chromium.org> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog In-Reply-To: <20201030034638.2858999-1-sjg@chromium.org> References: <20201030034638.2858999-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean The current functional tests run most of patman. Add a smaller test that just checks tag handling with the PatchStream class. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/patman/func_test.py | 26 +++++++++++++++++++++----- tools/patman/patchstream.py | 23 +++++++++++++++++++++++ 2 files changed, 44 insertions(+), 5 deletions(-) diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py index 2290ba95e9d..2a0da8b3ccf 100644 --- a/tools/patman/func_test.py +++ b/tools/patman/func_test.py @@ -31,6 +31,9 @@ except ModuleNotFoundError: class TestFunctional(unittest.TestCase): """Functional tests for checking that patman behaves correctly""" + leb = (b'Lord Edmund Blackadd\xc3\xabr '. + decode('utf-8')) + def setUp(self): self.tmpdir = tempfile.mkdtemp(prefix='patman.') self.gitdir = os.path.join(self.tmpdir, 'git') @@ -177,8 +180,6 @@ class TestFunctional(unittest.TestCase): stefan = b'Stefan Br\xc3\xbcns '.decode('utf-8') rick = 'Richard III ' mel = b'Lord M\xc3\xablchett '.decode('utf-8') - leb = (b'Lond Edmund Blackadd\xc3\xabr +Reviewed-by: Mary Bloggs +Tested-by: %s +''' % self.leb + pstrm = PatchStream.process_text(text) + self.assertEqual(pstrm.commit.rtags, { + 'Reviewed-by': {'Mary Bloggs ', + 'Joe Bloggs '}, + 'Tested-by': {self.leb}}) diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py index cf591b27573..d6f6ae92513 100644 --- a/tools/patman/patchstream.py +++ b/tools/patman/patchstream.py @@ -5,6 +5,7 @@ """Handles parsing a stream of commits/emails from 'git log' or other source""" import datetime +import io import math import os import re @@ -81,6 +82,28 @@ class PatchStream: self.state = STATE_MSG_HEADER # What state are we in? self.commit = None # Current commit + @staticmethod + def process_text(text, is_comment=False): + """Process some text through this class using a default Commit/Series + + Args: + text (str): Text to parse + is_comment (bool): True if this is a comment rather than a patch. + If True, PatchStream doesn't expect a patch subject at the + start, but jumps straight into the body + + Returns: + PatchStream: object with results + """ + pstrm = PatchStream(Series()) + pstrm.commit = commit.Commit(None) + infd = io.StringIO(text) + outfd = io.StringIO() + if is_comment: + pstrm.state = STATE_PATCH_HEADER + pstrm.process_stream(infd, outfd) + return pstrm + def _add_warn(self, warn): """Add a new warning to report to the user about the current commit From patchwork Fri Oct 30 03:46:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1390749 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: 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=m0qG540Q; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4CMpHt5Pggz9sPB for ; Fri, 30 Oct 2020 14:50:50 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3D05B82687; Fri, 30 Oct 2020 04:47:58 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="m0qG540Q"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1E3AE8265E; Fri, 30 Oct 2020 04:47:10 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd42.google.com (mail-io1-xd42.google.com [IPv6:2607:f8b0:4864:20::d42]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 53BE782636 for ; Fri, 30 Oct 2020 04:47:03 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd42.google.com with SMTP id y20so6167101iod.5 for ; Thu, 29 Oct 2020 20:47:03 -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=KQQubj8M7VflkTUIMdc7QmE/q+nhCKIhJDHYHebrVjk=; b=m0qG540QADdTwejTaUZKBUUf8F2mfkbqUDSrKHnvmjQXF3Mp8S5y/kgc/jQLovbIYj 9aFBz7/SzY83qJvZaAux4CEv3HXvbdoCYqdt2Dd0ZkIlfP89RCxo8jsIK2wHh7kn/o8q Mt5vRcMHP0fCE4KNaTZoacZdhq90NLatkAXP0= 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=KQQubj8M7VflkTUIMdc7QmE/q+nhCKIhJDHYHebrVjk=; b=SvihqdARs2b92zNui8gI4ib9pWJOgHbWqm6M8JZbJeP2uoyPIiRRT1pIrAoMOp3+xU clygWwXyPHzRIe0Gp600jFRfJPPhv7w0LH9VhL0/E7qyOjh0h8ONwjQoSqtdGz2JyTXu OTBcOG2VZRTaUNNkZPvH0ipNUEicZRP8eZslzPuO24a+fGuggp0JLi2YqvmhqEi0z0AY Nd5YQivdUW7RIgLfLvRwR9JD9AWS2HM7jQ5nWRnlxItHrqkHqtCGjtIsgHnyYyiWLmW4 m+UYrq+Wa2rlpBW57I7wJ3dH0ROjdY2KW1+qM5ViHrZ+VcIknvXQtQsGpAuUzr1Ld3kO SzOg== X-Gm-Message-State: AOAM532t+tPNeG01bwq7CXDon9Ni8SqzMmFZ0dxvLwVVzCW34CioD+tO x1x/VgJQQCN85RUTdDG65pXZGmlMWBjXxxK9 X-Google-Smtp-Source: ABdhPJyKVN0Jj5PPO3jBIce6ROdtKffslPanvbMYNLF1XqnL0R5vGGQc7I5FrmlJBo5tbh0FKUckAg== X-Received: by 2002:a05:6602:2b90:: with SMTP id r16mr420240iov.31.1604029621943; Thu, 29 Oct 2020 20:47:01 -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 n28sm4858693ila.52.2020.10.29.20.47.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 20:47:01 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: patchwork@lists.ozlabs.org, Doug Anderson , Tom Rini , Simon Glass Subject: [PATCH v3 19/29] patman: Add some tests for warnings Date: Thu, 29 Oct 2020 21:46:28 -0600 Message-Id: <20201030034638.2858999-20-sjg@chromium.org> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog In-Reply-To: <20201030034638.2858999-1-sjg@chromium.org> References: <20201030034638.2858999-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Add tests that check that warnings are generated when expected. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/patman/func_test.py | 111 +++++++++++++++++++++++++++++++++--- tools/patman/main.py | 16 +++++- tools/patman/patchstream.py | 2 +- 3 files changed, 116 insertions(+), 13 deletions(-) diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py index 2a0da8b3ccf..02d46ae5f73 100644 --- a/tools/patman/func_test.py +++ b/tools/patman/func_test.py @@ -33,6 +33,9 @@ class TestFunctional(unittest.TestCase): """Functional tests for checking that patman behaves correctly""" leb = (b'Lord Edmund Blackadd\xc3\xabr '. decode('utf-8')) + fred = 'Fred Bloggs ' + joe = 'Joe Bloggs ' + mary = 'Mary Bloggs ' def setUp(self): self.tmpdir = tempfile.mkdtemp(prefix='patman.') @@ -180,7 +183,6 @@ class TestFunctional(unittest.TestCase): stefan = b'Stefan Br\xc3\xbcns '.decode('utf-8') rick = 'Richard III ' mel = b'Lord M\xc3\xablchett '.decode('utf-8') - fred = 'Fred Bloggs ' add_maintainers = [stefan, rick] dry_run = True in_reply_to = mel @@ -189,7 +191,7 @@ class TestFunctional(unittest.TestCase): 'fdt': ['simon'], 'u-boot': ['u-boot@lists.denx.de'], 'simon': [self.leb], - 'fred': [fred], + 'fred': [self.fred], } text = self._get_text('test01.txt') @@ -231,7 +233,7 @@ class TestFunctional(unittest.TestCase): self.assertEqual('Prefix:\t RFC', lines[line + 3]) self.assertEqual('Cover: 4 lines', lines[line + 4]) line += 5 - self.assertEqual(' Cc: %s' % fred, lines[line + 0]) + self.assertEqual(' Cc: %s' % self.fred, lines[line + 0]) self.assertEqual(' Cc: %s' % tools.FromUnicode(self.leb), lines[line + 1]) self.assertEqual(' Cc: %s' % tools.FromUnicode(mel), @@ -248,7 +250,7 @@ class TestFunctional(unittest.TestCase): self.assertEqual(('%s %s\0%s' % (args[0], rick, stefan)), tools.ToUnicode(cc_lines[0])) self.assertEqual( - '%s %s\0%s\0%s\0%s' % (args[1], fred, self.leb, rick, stefan), + '%s %s\0%s\0%s\0%s' % (args[1], self.fred, self.leb, rick, stefan), tools.ToUnicode(cc_lines[1])) expected = ''' @@ -487,12 +489,103 @@ complicated as possible''') text = '''This is a patch Signed-off-by: Terminator -Reviewed-by: Joe Bloggs -Reviewed-by: Mary Bloggs +Reviewed-by: %s +Reviewed-by: %s Tested-by: %s -''' % self.leb +''' % (self.joe, self.mary, self.leb) pstrm = PatchStream.process_text(text) self.assertEqual(pstrm.commit.rtags, { - 'Reviewed-by': {'Mary Bloggs ', - 'Joe Bloggs '}, + 'Reviewed-by': {self.joe, self.mary}, 'Tested-by': {self.leb}}) + + def testMissingEnd(self): + """Test a missing END tag""" + text = '''This is a patch + +Cover-letter: +This is the title +missing END after this line +Signed-off-by: Fred +''' + pstrm = PatchStream.process_text(text) + self.assertEqual(["Missing 'END' in section 'cover'"], + pstrm.commit.warn) + + def testMissingBlankLine(self): + """Test a missing blank line after a tag""" + text = '''This is a patch + +Series-changes: 2 +- First line of changes +- Missing blank line after this line +Signed-off-by: Fred +''' + pstrm = PatchStream.process_text(text) + self.assertEqual(["Missing 'blank line' in section 'Series-changes'"], + pstrm.commit.warn) + + def testInvalidCommitTag(self): + """Test an invalid Commit-xxx tag""" + text = '''This is a patch + +Commit-fred: testing +''' + pstrm = PatchStream.process_text(text) + self.assertEqual(["Line 3: Ignoring Commit-fred"], pstrm.commit.warn) + + def testSelfTest(self): + """Test a tested by tag by this user""" + test_line = 'Tested-by: %s@napier.com' % os.getenv('USER') + text = '''This is a patch + +%s +''' % test_line + pstrm = PatchStream.process_text(text) + self.assertEqual(["Ignoring '%s'" % test_line], pstrm.commit.warn) + + def testSpaceBeforeTab(self): + """Test a space before a tab""" + text = '''This is a patch + ++ \tSomething +''' + pstrm = PatchStream.process_text(text) + self.assertEqual(["Line 3/0 has space before tab"], pstrm.commit.warn) + + def testLinesAfterTest(self): + """Test detecting lines after TEST= line""" + text = '''This is a patch + +TEST=sometest +more lines +here +''' + pstrm = PatchStream.process_text(text) + self.assertEqual(["Found 2 lines after TEST="], pstrm.commit.warn) + + def testBlankLineAtEnd(self): + """Test detecting a blank line at the end of a file""" + text = '''This is a patch + +diff --git a/lib/fdtdec.c b/lib/fdtdec.c +index c072e54..942244f 100644 +--- a/lib/fdtdec.c ++++ b/lib/fdtdec.c +@@ -1200,7 +1200,8 @@ int fdtdec_setup_mem_size_base(void) + } + + gd->ram_size = (phys_size_t)(res.end - res.start + 1); +- debug("%s: Initial DRAM size %llx\n", __func__, (u64)gd->ram_size); ++ debug("%s: Initial DRAM size %llx\n", __func__, ++ (unsigned long long)gd->ram_size); ++ +diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c + +-- +2.7.4 + + ''' + pstrm = PatchStream.process_text(text) + self.assertEqual( + ["Found possible blank line(s) at end of file 'lib/fdtdec.c'"], + pstrm.commit.warn) diff --git a/tools/patman/main.py b/tools/patman/main.py index b96000807eb..d1a43c44fcd 100755 --- a/tools/patman/main.py +++ b/tools/patman/main.py @@ -86,6 +86,8 @@ AddCommonArgs(send) send.add_argument('patchfiles', nargs='*') test_parser = subparsers.add_parser('test', help='Run tests') +test_parser.add_argument('testname', type=str, default=None, nargs='?', + help="Specify the test to run") AddCommonArgs(test_parser) # Parse options twice: first to get the project and second to handle @@ -111,15 +113,23 @@ if args.cmd == 'test': sys.argv = [sys.argv[0]] result = unittest.TestResult() + suite = unittest.TestSuite() + loader = unittest.TestLoader() for module in (test_checkpatch.TestPatch, func_test.TestFunctional): - suite = unittest.TestLoader().loadTestsFromTestCase(module) - suite.run(result) + if args.testname: + try: + suite.addTests(loader.loadTestsFromName(args.testname, module)) + except AttributeError: + continue + else: + suite.addTests(loader.loadTestsFromTestCase(module)) + suite.run(result) for module in ['gitutil', 'settings', 'terminal']: suite = doctest.DocTestSuite(module) suite.run(result) - sys.exit(test_util.ReportResult('patman', None, result)) + sys.exit(test_util.ReportResult('patman', args.testname, result)) # Process commits, produce patches files, check them, email them elif args.cmd == 'send': diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py index d6f6ae92513..1cb4d6ed0dd 100644 --- a/tools/patman/patchstream.py +++ b/tools/patman/patchstream.py @@ -419,7 +419,7 @@ class PatchStream: # Remove Tested-by self, since few will take much notice if (rtag_type == 'Tested-by' and who.find(os.getenv('USER') + '@') != -1): - self._add_warn("Ignoring %s" % line) + self._add_warn("Ignoring '%s'" % line) elif rtag_type == 'Patch-cc': self.commit.AddCc(who.split(',')) else: From patchwork Fri Oct 30 03:46:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1390746 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: 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=iQ+HyxDf; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (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 4CMpHS0ygyz9sSf for ; Fri, 30 Oct 2020 14:50:28 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 076E682686; Fri, 30 Oct 2020 04:47:39 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="iQ+HyxDf"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9D09282662; Fri, 30 Oct 2020 04:47:09 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x142.google.com (mail-il1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 26E7A825B5 for ; Fri, 30 Oct 2020 04:47:04 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x142.google.com with SMTP id a20so5310983ilk.13 for ; Thu, 29 Oct 2020 20:47:04 -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=1YDymWEDei3fp355/0N5sk9IfQf/28hKh5ap0NPGgP8=; b=iQ+HyxDfaWomJQc2IbzcnarosJGRTKjDQLuGyeHsaSSA7hQ52ogtkhcqDelEpAx0C4 zvnMM9LYL7qp4Q1aR65SZ3/pZNs4waMPC7/DBKPA+Z33ukLQRpTXdYm/5omTpijJ6py0 QgAwoGDP0Kf+AoeRv5Ddwg8lotmlQOcBDjrAQ= 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=1YDymWEDei3fp355/0N5sk9IfQf/28hKh5ap0NPGgP8=; b=Lrgg+oXofYPM713QCAN2fn9z7UzJjtpQZ5eE21PmZajFUlZPWdog+5l5g4KlFvke8Q TknMSNhdM6QoN6JF4lkr7splrjA+pudkOwgLAkGsBJmiDMWKVwWGMPDqQImz4tx8UHEJ O4F9X7FAyb8jw9vA4mWnj6I2cVx+ygqjrS/oAtd1VLA0Tr/P64UOu/ocBosMsPACB53G DjhN11ALG4Q2TNEHRS3hb+Ex47m1lqUiQOZ7l9j8T+4Vcg5e9yajIzmtzc4FB5MjBkPL ODfQDI5SYSU8jVjSJroDUCm4J9dofdgzDNRcBi64l+Lh0hKCoBLEu8i43DCTGu50JuRp F9Gg== X-Gm-Message-State: AOAM532IIU90qrbQvRA/DSZ/81RUHfc68wOR3KvEbqPiGmtM0dgyyrQH PFuxCDENgDSr/YTUAwZZpt1g/eHlIMWfWcSF X-Google-Smtp-Source: ABdhPJxv7UoDuI6MhZg4HOwV8seeBSeRkhsU5UO9p0QXkD0DJ4F0VlefNTwmlAIHbBIsL2LpP5INCg== X-Received: by 2002:a92:dcc5:: with SMTP id b5mr514029ilr.236.1604029622887; Thu, 29 Oct 2020 20:47:02 -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 n28sm4858693ila.52.2020.10.29.20.47.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 20:47:02 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: patchwork@lists.ozlabs.org, Doug Anderson , Tom Rini , Simon Glass Subject: [PATCH v3 20/29] patman: Convert testBasic() to use an interator Date: Thu, 29 Oct 2020 21:46:29 -0600 Message-Id: <20201030034638.2858999-21-sjg@chromium.org> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog In-Reply-To: <20201030034638.2858999-1-sjg@chromium.org> References: <20201030034638.2858999-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean On balance it is easier to use an iterator here, particularly if we need to insert lines due to new functionality. The only niggle is the need to keep the previous iterator value around in one case. Convert this test to use iter(). Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/patman/func_test.py | 55 +++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py index 02d46ae5f73..b39e3f671dc 100644 --- a/tools/patman/func_test.py +++ b/tools/patman/func_test.py @@ -212,40 +212,39 @@ class TestFunctional(unittest.TestCase): cc_lines = open(cc_file, encoding='utf-8').read().splitlines() os.remove(cc_file) - lines = out[0].getvalue().splitlines() - self.assertEqual('Cleaned %s patches' % len(series.commits), lines[0]) - self.assertEqual('Change log missing for v2', lines[1]) - self.assertEqual('Change log missing for v3', lines[2]) - self.assertEqual('Change log for unknown version v4', lines[3]) - self.assertEqual("Alias 'pci' not found", lines[4]) - self.assertIn('Dry run', lines[5]) - self.assertIn('Send a total of %d patches' % count, lines[7]) - line = 8 - for i in range(len(series.commits)): - self.assertEqual(' %s' % args[i], lines[line + 0]) - line += 1 - while 'Cc:' in lines[line]: - line += 1 - self.assertEqual('To: u-boot@lists.denx.de', lines[line]) - self.assertEqual('Cc: %s' % tools.FromUnicode(stefan), - lines[line + 1]) - self.assertEqual('Version: 3', lines[line + 2]) - self.assertEqual('Prefix:\t RFC', lines[line + 3]) - self.assertEqual('Cover: 4 lines', lines[line + 4]) - line += 5 - self.assertEqual(' Cc: %s' % self.fred, lines[line + 0]) + lines = iter(out[0].getvalue().splitlines()) + self.assertEqual('Cleaned %s patches' % len(series.commits), + next(lines)) + self.assertEqual('Change log missing for v2', next(lines)) + self.assertEqual('Change log missing for v3', next(lines)) + self.assertEqual('Change log for unknown version v4', next(lines)) + self.assertEqual("Alias 'pci' not found", next(lines)) + self.assertIn('Dry run', next(lines)) + self.assertEqual('', next(lines)) + self.assertIn('Send a total of %d patches' % count, next(lines)) + prev = next(lines) + for i, commit in enumerate(series.commits): + self.assertEqual(' %s' % args[i], prev) + while True: + prev = next(lines) + if 'Cc:' not in prev: + break + self.assertEqual('To: u-boot@lists.denx.de', prev) + self.assertEqual('Cc: %s' % tools.FromUnicode(stefan), next(lines)) + self.assertEqual('Version: 3', next(lines)) + self.assertEqual('Prefix:\t RFC', next(lines)) + self.assertEqual('Cover: 4 lines', next(lines)) + self.assertEqual(' Cc: %s' % self.fred, next(lines)) self.assertEqual(' Cc: %s' % tools.FromUnicode(self.leb), - lines[line + 1]) - self.assertEqual(' Cc: %s' % tools.FromUnicode(mel), - lines[line + 2]) - self.assertEqual(' Cc: %s' % rick, lines[line + 3]) + next(lines)) + self.assertEqual(' Cc: %s' % tools.FromUnicode(mel), next(lines)) + self.assertEqual(' Cc: %s' % rick, next(lines)) expected = ('Git command: git send-email --annotate ' '--in-reply-to="%s" --to "u-boot@lists.denx.de" ' '--cc "%s" --cc-cmd "%s --cc-cmd %s" %s %s' % (in_reply_to, stefan, sys.argv[0], cc_file, cover_fname, ' '.join(args))) - line += 4 - self.assertEqual(expected, tools.ToUnicode(lines[line])) + self.assertEqual(expected, tools.ToUnicode(next(lines))) self.assertEqual(('%s %s\0%s' % (args[0], rick, stefan)), tools.ToUnicode(cc_lines[0])) From patchwork Fri Oct 30 03:46:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1390751 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: 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=Nhh42vgG; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4CMpJ617sXz9sPB for ; Fri, 30 Oct 2020 14:51:01 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AD857826A4; Fri, 30 Oct 2020 04:47:59 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Nhh42vgG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2596A82664; Fri, 30 Oct 2020 04:47:11 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id F099882656 for ; Fri, 30 Oct 2020 04:47:04 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd44.google.com with SMTP id p15so6183590ioh.0 for ; Thu, 29 Oct 2020 20:47:04 -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=IWohDPVBlhAzHDmg+DbU8VTWSYUUYOO1aZaSeFvA3Yc=; b=Nhh42vgGWQc4QeN4igBpBQ0F0e+lugQo/sTEFATNe6mPDjWwt79HGQPk+h60v3yu4J l1ehH5sJCWJkqLsq1ngVt7JzoDzAbImNiFdRf8iKPTanwauCX9KBjkS+jhBCtT40BguL SxlGfNnBmUooJjlrWqbALx786j6LjImEtTGck= 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=IWohDPVBlhAzHDmg+DbU8VTWSYUUYOO1aZaSeFvA3Yc=; b=JkCOtctfXpZHYvSr72PXrAnr0GCN2x9uC/6M0qYsxDsnzktpLnARcqfgmmViIxLo64 yDCKq/4z95SLv+W0hRsI3Ue2kQfyNwz+8at+ns5hH+kWCU7uks8Slt7tREhzBEFYQ6CK Cqc1hzlec67gC6go06Kk7t7USVI1Z/TrZlUy67tTw5b2SgTrYquSAutxCuQkGIavS0fp hwQBYaZViMGDXkh06nwTOkVWuWI4rsBLLQ/9eqnjHAjglgdm0nLN9/QID7pd4mIS6r0K 43A9OZiRn0QIvgpN73DvrkLQY5yRTS5ivxg/JtuHKPrYNNlJtfbOAnOjKtL2oGk4HRDE dXRA== X-Gm-Message-State: AOAM532R50opAoiwzSxDdTaRNTIZTfiEGJBWI3+be9rShvtyPMBwKNMV oxIuDFT5HoYCSWVtr0xtABArOd7j3eLEVGcW X-Google-Smtp-Source: ABdhPJybjjDO0d/doZMr/S+OvGpa63bQm6CaB7wYTW/XrxafslLc2aMu8j9xe5UIwF88JQyvMX4rAw== X-Received: by 2002:a02:6948:: with SMTP id e69mr495900jac.6.1604029623687; Thu, 29 Oct 2020 20:47:03 -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 n28sm4858693ila.52.2020.10.29.20.47.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 20:47:03 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: patchwork@lists.ozlabs.org, Doug Anderson , Tom Rini , Simon Glass Subject: [PATCH v3 21/29] patman: Fix spelling of plural for warning Date: Thu, 29 Oct 2020 21:46:30 -0600 Message-Id: <20201030034638.2858999-22-sjg@chromium.org> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog In-Reply-To: <20201030034638.2858999-1-sjg@chromium.org> References: <20201030034638.2858999-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Tidy up the extra 's' when there is only a single warning. Fix the empty print statement also. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/patman/patchstream.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py index 1cb4d6ed0dd..cf6a6c6fc3e 100644 --- a/tools/patman/patchstream.py +++ b/tools/patman/patchstream.py @@ -665,12 +665,13 @@ def fix_patches(series, fnames): cmt.count = count result = fix_patch(backup_dir, fname, series, cmt) if result: - print('%d warnings for %s:' % (len(result), fname)) + print('%d warning%s for %s:' % + (len(result), 's' if len(result) > 1 else '', fname)) for warn in result: - print('\t', warn) - print + print('\t%s' % warn) + print() count += 1 - print('Cleaned %d patches' % count) + print('Cleaned %d patche%s' % (count, 's' if count > 1 else '')) def insert_cover_letter(fname, series, count): """Inserts a cover letter with the required info into patch 0 From patchwork Fri Oct 30 03:46:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1390752 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: 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=BY3n/edH; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (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 4CMpJK0js7z9sPB for ; Fri, 30 Oct 2020 14:51:12 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5D1A7826AE; Fri, 30 Oct 2020 04:48:01 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="BY3n/edH"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D4F0382665; Fri, 30 Oct 2020 04:47:10 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd42.google.com (mail-io1-xd42.google.com [IPv6:2607:f8b0:4864:20::d42]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id AFD308265B for ; Fri, 30 Oct 2020 04:47:05 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd42.google.com with SMTP id q25so6156931ioh.4 for ; Thu, 29 Oct 2020 20:47:05 -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=FgAdq70COWSEoebG06oOlUl+JSE+oftDU38UPEavFb0=; b=BY3n/edH0iY9+rBNlBz8pIiylVKNCGOdf/iJ60tJ94Omtz4XS1Hpw5pm/jRO1Fueg0 LPBAZRXvl+2dfDpBTQwR6K548fApnc/p2SHhswLrBqGO8euN2uLcbUm+o4TTuSMOczBk ZcrF8beZWsppFtxWi9IYV031mnCoAy6aYOWcA= 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=FgAdq70COWSEoebG06oOlUl+JSE+oftDU38UPEavFb0=; b=ncR4r7ZN1cgngnOqyVvO0BaQswqTnYlUIO1ImpOKOlj3iY2olPaISvuFM3GE/ri+tH RQGnTTppxJHEKudzRAZAORl+GVGhowaq4J4SUARwXH738HGvk+O55gb9rxsbx79KR9GZ Xc7RhQA/oz/CHSlyF2VWL83DMLArwQCCmIEhdm963uXVgXBoeVfJAX8U03R2PwHeYEhW nPMsA6YluSDwS4X+SeczrA0XLhmryi+uYYei+U2QuWh7vluvq7+KkQO59OYJ7cOKD+4R ErCWfPHiKJ5I5PL0/SBmBOb7DUIYDZ3n41xYaIkw5tRFBpBghMEGFJUVteESCLmRAKJD CD7A== X-Gm-Message-State: AOAM531muKlFz9Qjktyb3sFD51jra0FXEfXBSFw/eKHfhtIEOMitUcfv WYdWDc3GHu2nmukGc2HOOI34htaoD74eItZF X-Google-Smtp-Source: ABdhPJx32f60y9mmW69zkWiP/mhUloGKBwcREB5cZe8Xbz50kxSfR55jc1s+NrbFMLTh6sHwn+BWAQ== X-Received: by 2002:a05:6638:d0c:: with SMTP id q12mr443281jaj.95.1604029624531; Thu, 29 Oct 2020 20:47:04 -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 n28sm4858693ila.52.2020.10.29.20.47.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 20:47:04 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: patchwork@lists.ozlabs.org, Doug Anderson , Tom Rini , Simon Glass Subject: [PATCH v3 22/29] patman: Don't ignore lines starting with hash Date: Thu, 29 Oct 2020 21:46:31 -0600 Message-Id: <20201030034638.2858999-23-sjg@chromium.org> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog In-Reply-To: <20201030034638.2858999-1-sjg@chromium.org> References: <20201030034638.2858999-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean These lines can indicate a continuation of an error and should not be ignored. Fix this. Fixes: 666eb15e923 ("patman: Handle checkpatch output with notes and code") Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/patman/checkpatch.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/patman/checkpatch.py b/tools/patman/checkpatch.py index 263bac3fc90..98d962cd50d 100644 --- a/tools/patman/checkpatch.py +++ b/tools/patman/checkpatch.py @@ -95,6 +95,7 @@ def CheckPatch(fname, verbose=False, show_types=False): re_check = re.compile('CHECK:%s (.*)' % type_name) re_file = re.compile('#\d+: FILE: ([^:]*):(\d+):') re_note = re.compile('NOTE: (.*)') + re_new_file = re.compile('new file mode .*') indent = ' ' * 6 for line in result.stdout.splitlines(): if verbose: @@ -111,8 +112,10 @@ def CheckPatch(fname, verbose=False, show_types=False): # Skip lines which quote code if line.startswith(indent): continue - # Skip code quotes and # - if line.startswith('+') or line.startswith('#'): + # Skip code quotes + if line.startswith('+'): + continue + if re_new_file.match(line): continue match = re_stats_full.match(line) if not match: From patchwork Fri Oct 30 03:46:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1390754 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: 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=ieVd7mld; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (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 4CMpJW69FCz9sPB for ; Fri, 30 Oct 2020 14:51:23 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6446E826B0; Fri, 30 Oct 2020 04:48:04 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="ieVd7mld"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9373582664; Fri, 30 Oct 2020 04:47:11 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 80E5382658 for ; Fri, 30 Oct 2020 04:47:06 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd41.google.com with SMTP id k6so6176668ior.2 for ; Thu, 29 Oct 2020 20:47:06 -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=vdgUyO9a5mYjyLuW14nPFRkhDwy/a2hb/qebH30yU4A=; b=ieVd7mldF4CT3vFsO/c6mWi0VOEPUz2rc30+qNd2+KdxtSuEdbulinN3FdNfEsCI7P baHbF9yDHuXGskjVBsArgHaLFTZTRhCfSe3dPoBg0L6jRZ1giOd3m78zHSZEMQItm15y Gew8igvpTVpiiGprHwuONdqCd3fKVPAX+4c7Q= 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=vdgUyO9a5mYjyLuW14nPFRkhDwy/a2hb/qebH30yU4A=; b=rYnGygDRpTMK10np7c2wWYnkbKqBzWrxBkvadWg4O8w5fvK9KqW166Zp+yq1hUwWvT Kg7N3M3jWR6ZnJUYJJkqz9a3xpfN5dIiUAfa1HTw2+/ERZiNzbvjcDRaRRHAQj2dLTSC v3zEwrpMFqp+CoCMSUQKK+DuVSTkL7g+5NeqgpcTJv2vQHEwNWdBEKueLhMlf7W7VTFQ 2xSAzAvSw7g15qPFpyzaezjKgnx95V/pGmpI02f5YfH3lv4J6Qq8tAToY2Srk+AcZfOE 1vAnD6XwJc6INvGboWAxLmeXg2b75hvNsf7w5MwjBTEea/Jn8tTAYyjZNYM9sOJw3ruX /NWA== X-Gm-Message-State: AOAM533ix4bJET+NQpGF7XAIr12s/YvHsGqoQvptyHg4NJDEwYVLMhw7 OtDS6RsU2IdVyYYKsF/94fUXLGhgp6rwAWzX X-Google-Smtp-Source: ABdhPJzeZ5jr5jI4HRBsINYhkpucvyCxSCWRdssG9DR04UnNxCG2R0ZktA/NdRvKsSc8zrwCK5coLg== X-Received: by 2002:a5d:9c4f:: with SMTP id 15mr441587iof.44.1604029625366; Thu, 29 Oct 2020 20:47:05 -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 n28sm4858693ila.52.2020.10.29.20.47.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 20:47:05 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: patchwork@lists.ozlabs.org, Doug Anderson , Tom Rini , Simon Glass Subject: [PATCH v3 23/29] patman: Allow showing a Commit as a string Date: Thu, 29 Oct 2020 21:46:32 -0600 Message-Id: <20201030034638.2858999-24-sjg@chromium.org> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog In-Reply-To: <20201030034638.2858999-1-sjg@chromium.org> References: <20201030034638.2858999-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Use the subject of the Commit object when printing it out. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/patman/commit.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/patman/commit.py b/tools/patman/commit.py index e49bf87dfc8..5bf2b940299 100644 --- a/tools/patman/commit.py +++ b/tools/patman/commit.py @@ -41,6 +41,9 @@ class Commit: self.rtags = collections.defaultdict(set) self.warn = [] + def __str__(self): + return self.subject + def AddChange(self, version, info): """Add a new change line to the change list for a version. From patchwork Fri Oct 30 03:46:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1390756 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: 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=FQeLBntm; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4CMpJl618kz9sPB for ; Fri, 30 Oct 2020 14:51:35 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 64A12826A7; Fri, 30 Oct 2020 04:48:05 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="FQeLBntm"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 531D682665; Fri, 30 Oct 2020 04:47:12 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6790082638 for ; Fri, 30 Oct 2020 04:47:07 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd41.google.com with SMTP id y20so6167206iod.5 for ; Thu, 29 Oct 2020 20:47:07 -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=jWcBd0kGa5SPBD/DoSommYq4JE0rU5omiEQBazXUQ+U=; b=FQeLBntmrMSWiWRV4HpSqZaJ/UxNMnEt1deVPLJ3JXYqIs5Lu4Ch3WI6RPgxV/8cHX avUA7DXdzUfnpohPt4Ag2IZEzMfmbSCcCYK5lLp2i7p9EefOBpiyrXVoPCig5NiUkdSA iI79bugadh0eIeLJxm9WXM1xMeJp8G3VKWaI4= 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=jWcBd0kGa5SPBD/DoSommYq4JE0rU5omiEQBazXUQ+U=; b=A0uA3zGv6OyvU+ss8e40VArABhm3THE50SmcnRWZiGc9vNE05SbJ4RNN4XiMD9/+ER pEc2h5lIgAJPKjTgNbuLQtzQqoPmBktSsFCVwjWgR2r2pyj9zTNX0RjcsguReUTn1vNN nds4Z7AZyB59+FI+ND6vIyzy5oA+xl1UaLb+lXggKo8L6zADV1ObycGijrUZgtxwo2LA DZOHWMq+FPBsIkpCpQRv7yuX6hgxvUgT+yQGDqHtVB1T7tIHOzAI+O5K9zvs/ze1zdAN 45zTAX3IiBtQCaxCpBWvsbY3AhiEp1IKw/yGbT1tmiMtBNsueeMIbdlU0JNRqlfDHWZN CxWg== X-Gm-Message-State: AOAM531cvO5WFpGRlCfP38wH3IIySrlpcdt2/lWx6k8ymGJBVG/bNlcT CvRwi9641G7Jz9UizBwUx2egAAkpt6eU4+rA X-Google-Smtp-Source: ABdhPJxMehMvfP4+8lqjHQkBd95XmQESGJ80Nmft0t9ECni/ASySES6nLajeg/bPo1vUCef19TZe2Q== X-Received: by 2002:a05:6602:5c7:: with SMTP id w7mr448029iox.108.1604029626188; Thu, 29 Oct 2020 20:47:06 -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 n28sm4858693ila.52.2020.10.29.20.47.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 20:47:05 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: patchwork@lists.ozlabs.org, Doug Anderson , Tom Rini , Simon Glass Subject: [PATCH v3 24/29] patman: Improve handling of files Date: Thu, 29 Oct 2020 21:46:33 -0600 Message-Id: <20201030034638.2858999-25-sjg@chromium.org> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog In-Reply-To: <20201030034638.2858999-1-sjg@chromium.org> References: <20201030034638.2858999-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Sometimes warnings are associated with a file and sometimes with the patch as a whole. Update the regular expression to handle both cases, even in emacs mode. Also add support for detecting new files. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/patman/checkpatch.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/patman/checkpatch.py b/tools/patman/checkpatch.py index 98d962cd50d..63a8e37e8c5 100644 --- a/tools/patman/checkpatch.py +++ b/tools/patman/checkpatch.py @@ -93,7 +93,7 @@ def CheckPatch(fname, verbose=False, show_types=False): re_error = re.compile('ERROR:%s (.*)' % type_name) re_warning = re.compile(emacs_prefix + 'WARNING:%s (.*)' % type_name) re_check = re.compile('CHECK:%s (.*)' % type_name) - re_file = re.compile('#\d+: FILE: ([^:]*):(\d+):') + re_file = re.compile('#(\d+): (FILE: ([^:]*):(\d+):)?') re_note = re.compile('NOTE: (.*)') re_new_file = re.compile('new file mode .*') indent = ' ' * 6 @@ -153,8 +153,13 @@ def CheckPatch(fname, verbose=False, show_types=False): item['msg'] = check_match.group(2) item['type'] = 'check' elif file_match: - item['file'] = file_match.group(1) - item['line'] = int(file_match.group(2)) + err_fname = file_match.group(3) + if err_fname: + item['file'] = err_fname + item['line'] = int(file_match.group(4)) + else: + item['file'] = '' + item['line'] = int(file_match.group(1)) elif subject_match: item['file'] = '' item['line'] = None From patchwork Fri Oct 30 03:46:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1390765 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: 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=hVQ20vaL; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (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 4CMpKw72Kkz9sSf for ; Fri, 30 Oct 2020 14:52:36 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1F49082657; Fri, 30 Oct 2020 04:48:20 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="hVQ20vaL"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9699C82667; Fri, 30 Oct 2020 04:47:13 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 49A808264A for ; Fri, 30 Oct 2020 04:47:08 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd43.google.com with SMTP id q25so6156999ioh.4 for ; Thu, 29 Oct 2020 20:47:08 -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=3uiha9Yg3r8MkRzmweNVec2w36QkhaVezCTkt20nRog=; b=hVQ20vaLNUxMe/MmNEUdlsXZ96q/4NHWH0CMiwhnpQQqbrzSzlaqxqzVSUvU6t9DKd 9NNjiBXfxQiCgQREcPo9rfmF8MZFe0dMV0/sZ4obH+AGEmzo4eW6DdDKGNOJG38B8Uvz lBr+jdckLJ/nWlOfqIESuWAeWmkVOVjM334i0= 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=3uiha9Yg3r8MkRzmweNVec2w36QkhaVezCTkt20nRog=; b=iEvRPjvO0cY48zLMJk8S4oR9ZIUdyK1HtVCVz8Itvflx0/uf4ERAbZdiegLWJz/YPd Ct1zhYT5ywMt4j6EBW+AlHYicEHR7fww1uShLW4dP6/sVy2jdr1WQoBWru0v96HmHjjb ngRQUtDQl3+8nQfY3WucKjZTsohBdbrj0kQfSXtW6L3DJvlQ00HmE/HgCvxMAKWua69p cKQkkbRBKhA8WnxC48Sa1sAvTn0m56JipClmJ562+QKERr3QcV/Au9u1S7Koa71GGFei oAj3XDVP7AFbW4mtAWlrXjB+E33OXB72l6uoemM7WMzbrRtcwhYbjCZ8KJNy7W9qLEZ3 PL6A== X-Gm-Message-State: AOAM533HVHuNbUv8xTPLVhr3WtZvSoeJUDoMNxoeKzc3AGZ51CfD+yGl 0+M0q4fQcEwZ5IPY8KN0TCDLmdF0kG2oW2BR X-Google-Smtp-Source: ABdhPJzdvyTcZl0sOUYBmpoFdm8SOnnhtHDy2puOg1W+WahLbmv9Cr6lG4LlRCpK7b5bAI+W56sqFQ== X-Received: by 2002:a05:6638:451:: with SMTP id r17mr497902jap.8.1604029627061; Thu, 29 Oct 2020 20:47:07 -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 n28sm4858693ila.52.2020.10.29.20.47.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 20:47:06 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: patchwork@lists.ozlabs.org, Doug Anderson , Tom Rini , Simon Glass Subject: [PATCH v3 25/29] patman: Detect missing upstream in CountCommitsToBranch Date: Thu, 29 Oct 2020 21:46:34 -0600 Message-Id: <20201030034638.2858999-26-sjg@chromium.org> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog In-Reply-To: <20201030034638.2858999-1-sjg@chromium.org> References: <20201030034638.2858999-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean At present if we fail to find the upstream then the error output is piped to wc, resulting in bogus results. Avoid the pipe and check the output directly. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/patman/func_test.py | 19 +++++++++++++++++++ tools/patman/gitutil.py | 10 +++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py index b39e3f671dc..cce3905c093 100644 --- a/tools/patman/func_test.py +++ b/tools/patman/func_test.py @@ -588,3 +588,22 @@ diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c self.assertEqual( ["Found possible blank line(s) at end of file 'lib/fdtdec.c'"], pstrm.commit.warn) + + @unittest.skipIf(not HAVE_PYGIT2, 'Missing python3-pygit2') + def testNoUpstream(self): + """Test CountCommitsToBranch when there is no upstream""" + repo = self.make_git_tree() + target = repo.lookup_reference('refs/heads/base') + self.repo.checkout(target, strategy=pygit2.GIT_CHECKOUT_FORCE) + + # Check that it can detect the current branch + try: + orig_dir = os.getcwd() + os.chdir(self.gitdir) + with self.assertRaises(ValueError) as exc: + gitutil.CountCommitsToBranch(None) + self.assertIn( + "Failed to determine upstream: fatal: no upstream configured for branch 'base'", + str(exc.exception)) + finally: + os.chdir(orig_dir) diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py index 27a0a9fbc1f..3a2366bcf59 100644 --- a/tools/patman/gitutil.py +++ b/tools/patman/gitutil.py @@ -66,9 +66,13 @@ def CountCommitsToBranch(branch): rev_range = '%s..%s' % (us, branch) else: rev_range = '@{upstream}..' - pipe = [LogCmd(rev_range, oneline=True), ['wc', '-l']] - stdout = command.RunPipe(pipe, capture=True, oneline=True).stdout - patch_count = int(stdout) + pipe = [LogCmd(rev_range, oneline=True)] + result = command.RunPipe(pipe, capture=True, capture_stderr=True, + oneline=True, raise_on_error=False) + if result.return_code: + raise ValueError('Failed to determine upstream: %s' % + result.stderr.strip()) + patch_count = len(result.stdout.splitlines()) return patch_count def NameRevision(commit_hash): From patchwork Fri Oct 30 03:46:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1390761 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: 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=CUCBzmcN; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (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 4CMpKQ4XHjz9sPB for ; Fri, 30 Oct 2020 14:52:10 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 174FD8265F; Fri, 30 Oct 2020 04:48:18 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="CUCBzmcN"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D83438266D; Fri, 30 Oct 2020 04:47:16 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 13FC1825B5 for ; Fri, 30 Oct 2020 04:47:10 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd43.google.com with SMTP id y20so6167278iod.5 for ; Thu, 29 Oct 2020 20:47:10 -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=GWZaGvXkf7DfK05DghX2Y1OmsnfiSDQs/d7tuoU3484=; b=CUCBzmcNduKn3oegvtSpGUXoLLpf/3C+TAbjdVaJRlY73XWv36gCGSbW2rLQxuMzE/ JJx6nxdzAvUj6i+u+24TMfboNY4W8zP3W0B63E3cLLdXqubxD40nTWgSBwXX73SaPmyn xh3ZZyrdosC3GRo4LZx2Hk07XmzGaFad/MeKg= 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=GWZaGvXkf7DfK05DghX2Y1OmsnfiSDQs/d7tuoU3484=; b=iQVgBzz+U9owu6ZHjVlLsY4D7aKglsR/IX0EbIX9RabQPjXvpYJe6u/es7TMaoVWQ2 g1SETslYwTEI5IZ3qPIpdKQrGJ1PMjAjeAaGX0l0LsGY25cATClGprTV3o/jLN4Mvrqu pjPQFESGThtems4r/TWDXwqhqVP1Osh+OeTDdWnkxF7rDm2Jh06QOxVQVH47+fPg08LD Jz155sl1OYkTwk8+fb3QQJHJR+GTG4aERiZfDM0StBAXrgMPPb1lkKXfYX80lmu8321U E/p0fI/U6dl3QY2KVCE12Xtr7XjT3UVb7hYMBCG40XKuk2I8ZrZXClRSnhdzix4QGCmm BANQ== X-Gm-Message-State: AOAM531kHgh1fPQG6MdrrPhDuV4JvtnPdo/VwGGoQDqi1/9cs0pSJYCG ng/IFORzzW7qRijEiSz0aDbFnfLxRj1W5sVt X-Google-Smtp-Source: ABdhPJy5Y47jrGQUOWOPG2Vjlpp9MDrTyUZbx6wGV8qWtaq62bEtyGEtimDT3VWukioEa0WpphcqbA== X-Received: by 2002:a02:b786:: with SMTP id f6mr454804jam.75.1604029628020; Thu, 29 Oct 2020 20:47:08 -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 n28sm4858693ila.52.2020.10.29.20.47.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 20:47:07 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: patchwork@lists.ozlabs.org, Doug Anderson , Tom Rini , Simon Glass Subject: [PATCH v3 26/29] patman: Support checking for review tags in patchwork Date: Thu, 29 Oct 2020 21:46:35 -0600 Message-Id: <20201030034638.2858999-27-sjg@chromium.org> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog In-Reply-To: <20201030034638.2858999-1-sjg@chromium.org> References: <20201030034638.2858999-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Before sending out a new version of a series for review, it is important to add any review tags (e.g. Reviewed-by, Acked-by) collected by patchwork. Otherwise people waste time reviewing the same patch repeatedly, become frustrated and stop reviewing your patches. To help with this, add a new 'status' subcommand that checks patchwork for review tags, showing those which are not present in the local branch. This allows users to see what new review tags have been received and then add them. Sample output: $ patman status 1 Subject 1 Reviewed-by: Joe Bloggs 2 Subject 2 Tested-by: Lord Edmund Blackaddër Reviewed-by: Fred Bloggs + Reviewed-by: Mary Bloggs 1 new response available in patchwork The '+' indicates a new tag. Colours are used to make it easier to read. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- Changes in v3: - Rename GetMetaData() function to snake case - Fix incorrect commenting on a line in prepare_patches() Changes in v2: - Adjust the algorithm to handle patch/commit mismatch - Correct Python style problems - Use REST API instead of web pages tools/patman/README | 34 ++++ tools/patman/control.py | 46 +++++ tools/patman/func_test.py | 315 +++++++++++++++++++++++++++++++++ tools/patman/main.py | 18 ++ tools/patman/status.py | 356 ++++++++++++++++++++++++++++++++++++++ tools/patman/terminal.py | 21 ++- 6 files changed, 784 insertions(+), 6 deletions(-) create mode 100644 tools/patman/status.py diff --git a/tools/patman/README b/tools/patman/README index 6664027ed7d..46b8e251ca5 100644 --- a/tools/patman/README +++ b/tools/patman/README @@ -11,6 +11,8 @@ This tool is a Python script which: - Runs the patches through checkpatch.pl and its own checks - Optionally emails them out to selected people +It also shows review tags from Patchwork so you can update your local patches. + It is intended to automate patch creation and make it a less error-prone process. It is useful for U-Boot and Linux work so far, since it uses the checkpatch.pl script. @@ -352,6 +354,38 @@ These people will get the cover letter even if they are not on the To/Cc list for any of the patches. +Patchwork Integration +===================== + +Patman has a very basic integration with Patchwork. If you point patman to +your series on patchwork it can show you what new reviews have appears since +you sent your series. + +To set this up, add a Series-link tag to one of the commits in your series +(see above). + +Then you can type + + patman status + +and patman will show you each patch and what review tags have been collected, +for example: + +... + 21 x86: mtrr: Update the command to use the new mtrr + Reviewed-by: Wolfgang Wallner + + Reviewed-by: Bin Meng + 22 x86: mtrr: Restructure so command execution is in + Reviewed-by: Wolfgang Wallner + + Reviewed-by: Bin Meng +... + +This shows that patch 21 and 22 were sent out with one review but have since +attracted another review each. If the series needs changes, you can update +these commits with the new review tag before sending the next version of the +series. + + Example Work Flow ================= diff --git a/tools/patman/control.py b/tools/patman/control.py index 6555a4018a4..7a5469add1b 100644 --- a/tools/patman/control.py +++ b/tools/patman/control.py @@ -175,3 +175,49 @@ def send(args): its_a_go, args.ignore_bad_tags, args.add_maintainers, args.limit, args.dry_run, args.in_reply_to, args.thread, args.smtp_server) + +def patchwork_status(branch, count, start, end): + """Check the status of patches in patchwork + + This finds the series in patchwork using the Series-link tag, checks for new + comments / review tags and displays them + + Args: + branch (str): Branch to create patches from (None = current) + count (int): Number of patches to produce, or -1 to produce patches for + the current branch back to the upstream commit + start (int): Start partch to use (0=first / top of branch) + end (int): End patch to use (0=last one in series, 1=one before that, + etc.) + + Raises: + ValueError: if the branch has no Series-link value + """ + if count == -1: + # Work out how many patches to send if we can + count = (gitutil.CountCommitsToBranch(branch) - start) + + series = patchstream.get_metadata(branch, start, count - end) + warnings = 0 + for cmt in series.commits: + if cmt.warn: + print('%d warnings for %s:' % (len(cmt.warn), cmt.hash)) + for warn in cmt.warn: + print('\t', warn) + warnings += 1 + print + if warnings: + raise ValueError('Please fix warnings before running status') + links = series.get('links') + if not links: + raise ValueError("Branch has no Series-links value") + + # Find the link without a version number (we don't support versions yet) + found = [link for link in links.split() if not ':' in link] + if not found: + raise ValueError('Series-links has no current version (without :)') + + # Import this here to avoid failing on other commands if the dependencies + # are not present + from patman import status + status.check_patchwork_status(series, found[0]) diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py index cce3905c093..722844e15d3 100644 --- a/tools/patman/func_test.py +++ b/tools/patman/func_test.py @@ -13,10 +13,13 @@ import sys import tempfile import unittest + +from patman.commit import Commit from patman import control from patman import gitutil from patman import patchstream from patman.patchstream import PatchStream +from patman.series import Series from patman import settings from patman import terminal from patman import tools @@ -25,6 +28,7 @@ from patman.test_util import capture_sys_output try: import pygit2 HAVE_PYGIT2 = True + from patman import status except ModuleNotFoundError: HAVE_PYGIT2 = False @@ -36,6 +40,8 @@ class TestFunctional(unittest.TestCase): fred = 'Fred Bloggs ' joe = 'Joe Bloggs ' mary = 'Mary Bloggs ' + commits = None + patches = None def setUp(self): self.tmpdir = tempfile.mkdtemp(prefix='patman.') @@ -44,6 +50,7 @@ class TestFunctional(unittest.TestCase): def tearDown(self): shutil.rmtree(self.tmpdir) + terminal.SetPrintTestMode(False) @staticmethod def _get_path(fname): @@ -607,3 +614,311 @@ diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c str(exc.exception)) finally: os.chdir(orig_dir) + + @staticmethod + def _fake_patchwork(subpath): + """Fake Patchwork server for the function below + + This handles accessing a series, providing a list consisting of a + single patch + """ + re_series = re.match(r'series/(\d*)/$', subpath) + if re_series: + series_num = re_series.group(1) + if series_num == '1234': + return {'patches': [ + {'id': '1', 'name': 'Some patch'}]} + raise ValueError('Fake Patchwork does not understand: %s' % subpath) + + @unittest.skipIf(not HAVE_PYGIT2, 'Missing python3-pygit2') + def testStatusMismatch(self): + """Test Patchwork patches not matching the series""" + series = Series() + + with capture_sys_output() as (_, err): + status.collect_patches(series, 1234, self._fake_patchwork) + self.assertIn('Warning: Patchwork reports 1 patches, series has 0', + err.getvalue()) + + @unittest.skipIf(not HAVE_PYGIT2, 'Missing python3-pygit2') + def testStatusReadPatch(self): + """Test handling a single patch in Patchwork""" + series = Series() + series.commits = [Commit('abcd')] + + patches = status.collect_patches(series, 1234, self._fake_patchwork) + self.assertEqual(1, len(patches)) + patch = patches[0] + self.assertEqual('1', patch.id) + self.assertEqual('Some patch', patch.raw_subject) + + @unittest.skipIf(not HAVE_PYGIT2, 'Missing python3-pygit2') + def testParseSubject(self): + """Test parsing of the patch subject""" + patch = status.Patch('1') + + # Simple patch not in a series + patch.parse_subject('Testing') + self.assertEqual('Testing', patch.raw_subject) + self.assertEqual('Testing', patch.subject) + self.assertEqual(1, patch.seq) + self.assertEqual(1, patch.count) + self.assertEqual(None, patch.prefix) + self.assertEqual(None, patch.version) + + # First patch in a series + patch.parse_subject('[1/2] Testing') + self.assertEqual('[1/2] Testing', patch.raw_subject) + self.assertEqual('Testing', patch.subject) + self.assertEqual(1, patch.seq) + self.assertEqual(2, patch.count) + self.assertEqual(None, patch.prefix) + self.assertEqual(None, patch.version) + + # Second patch in a series + patch.parse_subject('[2/2] Testing') + self.assertEqual('Testing', patch.subject) + self.assertEqual(2, patch.seq) + self.assertEqual(2, patch.count) + self.assertEqual(None, patch.prefix) + self.assertEqual(None, patch.version) + + # RFC patch + patch.parse_subject('[RFC,3/7] Testing') + self.assertEqual('Testing', patch.subject) + self.assertEqual(3, patch.seq) + self.assertEqual(7, patch.count) + self.assertEqual('RFC', patch.prefix) + self.assertEqual(None, patch.version) + + # Version patch + patch.parse_subject('[v2,3/7] Testing') + self.assertEqual('Testing', patch.subject) + self.assertEqual(3, patch.seq) + self.assertEqual(7, patch.count) + self.assertEqual(None, patch.prefix) + self.assertEqual('v2', patch.version) + + # All fields + patch.parse_subject('[RESEND,v2,3/7] Testing') + self.assertEqual('Testing', patch.subject) + self.assertEqual(3, patch.seq) + self.assertEqual(7, patch.count) + self.assertEqual('RESEND', patch.prefix) + self.assertEqual('v2', patch.version) + + # RFC only + patch.parse_subject('[RESEND] Testing') + self.assertEqual('Testing', patch.subject) + self.assertEqual(1, patch.seq) + self.assertEqual(1, patch.count) + self.assertEqual('RESEND', patch.prefix) + self.assertEqual(None, patch.version) + + @unittest.skipIf(not HAVE_PYGIT2, 'Missing python3-pygit2') + def testCompareSeries(self): + """Test operation of compare_with_series()""" + commit1 = Commit('abcd') + commit1.subject = 'Subject 1' + commit2 = Commit('ef12') + commit2.subject = 'Subject 2' + commit3 = Commit('3456') + commit3.subject = 'Subject 2' + + patch1 = status.Patch('1') + patch1.subject = 'Subject 1' + patch2 = status.Patch('2') + patch2.subject = 'Subject 2' + patch3 = status.Patch('3') + patch3.subject = 'Subject 2' + + series = Series() + series.commits = [commit1] + patches = [patch1] + patch_for_commit, commit_for_patch, warnings = ( + status.compare_with_series(series, patches)) + self.assertEqual(1, len(patch_for_commit)) + self.assertEqual(patch1, patch_for_commit[0]) + self.assertEqual(1, len(commit_for_patch)) + self.assertEqual(commit1, commit_for_patch[0]) + + series.commits = [commit1] + patches = [patch1, patch2] + patch_for_commit, commit_for_patch, warnings = ( + status.compare_with_series(series, patches)) + self.assertEqual(1, len(patch_for_commit)) + self.assertEqual(patch1, patch_for_commit[0]) + self.assertEqual(1, len(commit_for_patch)) + self.assertEqual(commit1, commit_for_patch[0]) + self.assertEqual(["Cannot find commit for patch 2 ('Subject 2')"], + warnings) + + series.commits = [commit1, commit2] + patches = [patch1] + patch_for_commit, commit_for_patch, warnings = ( + status.compare_with_series(series, patches)) + self.assertEqual(1, len(patch_for_commit)) + self.assertEqual(patch1, patch_for_commit[0]) + self.assertEqual(1, len(commit_for_patch)) + self.assertEqual(commit1, commit_for_patch[0]) + self.assertEqual(["Cannot find patch for commit 2 ('Subject 2')"], + warnings) + + series.commits = [commit1, commit2, commit3] + patches = [patch1, patch2] + patch_for_commit, commit_for_patch, warnings = ( + status.compare_with_series(series, patches)) + self.assertEqual(2, len(patch_for_commit)) + self.assertEqual(patch1, patch_for_commit[0]) + self.assertEqual(patch2, patch_for_commit[1]) + self.assertEqual(1, len(commit_for_patch)) + self.assertEqual(commit1, commit_for_patch[0]) + self.assertEqual(["Cannot find patch for commit 3 ('Subject 2')", + "Multiple commits match patch 2 ('Subject 2'):\n" + ' Subject 2\n Subject 2'], + warnings) + + series.commits = [commit1, commit2] + patches = [patch1, patch2, patch3] + patch_for_commit, commit_for_patch, warnings = ( + status.compare_with_series(series, patches)) + self.assertEqual(1, len(patch_for_commit)) + self.assertEqual(patch1, patch_for_commit[0]) + self.assertEqual(2, len(commit_for_patch)) + self.assertEqual(commit1, commit_for_patch[0]) + self.assertEqual(["Multiple patches match commit 2 ('Subject 2'):\n" + ' Subject 2\n Subject 2', + "Cannot find commit for patch 3 ('Subject 2')"], + warnings) + + def _fake_patchwork2(self, subpath): + """Fake Patchwork server for the function below + + This handles accessing series, patches and comments, providing the data + in self.patches to the caller + """ + re_series = re.match(r'series/(\d*)/$', subpath) + re_patch = re.match(r'patches/(\d*)/$', subpath) + re_comments = re.match(r'patches/(\d*)/comments/$', subpath) + if re_series: + series_num = re_series.group(1) + if series_num == '1234': + return {'patches': self.patches} + elif re_patch: + patch_num = int(re_patch.group(1)) + patch = self.patches[patch_num - 1] + return patch + elif re_comments: + patch_num = int(re_comments.group(1)) + patch = self.patches[patch_num - 1] + return patch.comments + raise ValueError('Fake Patchwork does not understand: %s' % subpath) + + @unittest.skipIf(not HAVE_PYGIT2, 'Missing python3-pygit2') + def testFindNewResponses(self): + """Test operation of find_new_responses()""" + commit1 = Commit('abcd') + commit1.subject = 'Subject 1' + commit2 = Commit('ef12') + commit2.subject = 'Subject 2' + + patch1 = status.Patch('1') + patch1.parse_subject('[1/2] Subject 1') + patch1.name = patch1.raw_subject + patch1.content = 'This is my patch content' + comment1a = {'content': 'Reviewed-by: %s\n' % self.joe} + + patch1.comments = [comment1a] + + patch2 = status.Patch('2') + patch2.parse_subject('[2/2] Subject 2') + patch2.name = patch2.raw_subject + patch2.content = 'Some other patch content' + comment2a = { + 'content': 'Reviewed-by: %s\nTested-by: %s\n' % + (self.mary, self.leb)} + comment2b = {'content': 'Reviewed-by: %s' % self.fred} + patch2.comments = [comment2a, comment2b] + + # This test works by setting up commits and patch for use by the fake + # Rest API function _fake_patchwork2(). It calls various functions in + # the status module after setting up tags in the commits, checking that + # things behaves as expected + self.commits = [commit1, commit2] + self.patches = [patch1, patch2] + count = 2 + new_rtag_list = [None] * count + + # Check that the tags are picked up on the first patch + status.find_new_responses(new_rtag_list, 0, commit1, patch1, + self._fake_patchwork2) + self.assertEqual(new_rtag_list[0], {'Reviewed-by': {self.joe}}) + + # Now the second patch + status.find_new_responses(new_rtag_list, 1, commit2, patch2, + self._fake_patchwork2) + self.assertEqual(new_rtag_list[1], { + 'Reviewed-by': {self.mary, self.fred}, + 'Tested-by': {self.leb}}) + + # Now add some tags to the commit, which means they should not appear as + # 'new' tags when scanning comments + new_rtag_list = [None] * count + commit1.rtags = {'Reviewed-by': {self.joe}} + status.find_new_responses(new_rtag_list, 0, commit1, patch1, + self._fake_patchwork2) + self.assertEqual(new_rtag_list[0], {}) + + # For the second commit, add Ed and Fred, so only Mary should be left + commit2.rtags = { + 'Tested-by': {self.leb}, + 'Reviewed-by': {self.fred}} + status.find_new_responses(new_rtag_list, 1, commit2, patch2, + self._fake_patchwork2) + self.assertEqual(new_rtag_list[1], {'Reviewed-by': {self.mary}}) + + # Check that the output patches expectations: + # 1 Subject 1 + # Reviewed-by: Joe Bloggs + # 2 Subject 2 + # Tested-by: Lord Edmund Blackaddër + # Reviewed-by: Fred Bloggs + # + Reviewed-by: Mary Bloggs + # 1 new response available in patchwork + + series = Series() + series.commits = [commit1, commit2] + terminal.SetPrintTestMode() + status.check_patchwork_status(series, '1234', self._fake_patchwork2) + lines = iter(terminal.GetPrintTestLines()) + col = terminal.Color() + self.assertEqual(terminal.PrintLine(' 1 Subject 1', col.BLUE), + next(lines)) + self.assertEqual( + terminal.PrintLine(' Reviewed-by: ', col.GREEN, newline=False, + bright=False), + next(lines)) + self.assertEqual(terminal.PrintLine(self.joe, col.WHITE, bright=False), + next(lines)) + + self.assertEqual(terminal.PrintLine(' 2 Subject 2', col.BLUE), + next(lines)) + self.assertEqual( + terminal.PrintLine(' Tested-by: ', col.GREEN, newline=False, + bright=False), + next(lines)) + self.assertEqual(terminal.PrintLine(self.leb, col.WHITE, bright=False), + next(lines)) + self.assertEqual( + terminal.PrintLine(' Reviewed-by: ', col.GREEN, newline=False, + bright=False), + next(lines)) + self.assertEqual(terminal.PrintLine(self.fred, col.WHITE, bright=False), + next(lines)) + self.assertEqual( + terminal.PrintLine(' + Reviewed-by: ', col.GREEN, newline=False), + next(lines)) + self.assertEqual(terminal.PrintLine(self.mary, col.WHITE), + next(lines)) + self.assertEqual(terminal.PrintLine( + '1 new response available in patchwork', None), next(lines)) diff --git a/tools/patman/main.py b/tools/patman/main.py index d1a43c44fcd..7f4ae1125a1 100755 --- a/tools/patman/main.py +++ b/tools/patman/main.py @@ -90,6 +90,10 @@ test_parser.add_argument('testname', type=str, default=None, nargs='?', help="Specify the test to run") AddCommonArgs(test_parser) +status = subparsers.add_parser('status', + help='Check status of patches in patchwork') +AddCommonArgs(status) + # Parse options twice: first to get the project and second to handle # defaults properly (which depends on project). argv = sys.argv[1:] @@ -157,3 +161,17 @@ elif args.cmd == 'send': else: control.send(args) + +# Check status of patches in patchwork +elif args.cmd == 'status': + ret_code = 0 + try: + control.patchwork_status(args.branch, args.count, args.start, args.end) + except Exception as e: + terminal.Print('patman: %s: %s' % (type(e).__name__, e), + colour=terminal.Color.RED) + if args.debug: + print() + traceback.print_exc() + ret_code = 1 + sys.exit(ret_code) diff --git a/tools/patman/status.py b/tools/patman/status.py new file mode 100644 index 00000000000..f41b2d4c776 --- /dev/null +++ b/tools/patman/status.py @@ -0,0 +1,356 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright 2020 Google LLC +# +"""Talks to the patchwork service to figure out what patches have been reviewed +and commented on. +""" + +import collections +import concurrent.futures +from itertools import repeat +import re +import requests + +from patman.patchstream import PatchStream +from patman import terminal +from patman import tout + +# Patches which are part of a multi-patch series are shown with a prefix like +# [prefix, version, sequence], for example '[RFC, v2, 3/5]'. All but the last +# part is optional. This decodes the string into groups. For single patches +# the [] part is not present: +# Groups: (ignore, ignore, ignore, prefix, version, sequence, subject) +RE_PATCH = re.compile(r'(\[(((.*),)?(.*),)?(.*)\]\s)?(.*)$') + +# This decodes the sequence string into a patch number and patch count +RE_SEQ = re.compile(r'(\d+)/(\d+)') + +def to_int(vals): + """Convert a list of strings into integers, using 0 if not an integer + + Args: + vals (list): List of strings + + Returns: + list: List of integers, one for each input string + """ + out = [int(val) if val.isdigit() else 0 for val in vals] + return out + + +class Patch(dict): + """Models a patch in patchwork + + This class records information obtained from patchwork + + Some of this information comes from the 'Patch' column: + + [RFC,v2,1/3] dm: Driver and uclass changes for tiny-dm + + This shows the prefix, version, seq, count and subject. + + The other properties come from other columns in the display. + + Properties: + pid (str): ID of the patch (typically an integer) + seq (int): Sequence number within series (1=first) parsed from sequence + string + count (int): Number of patches in series, parsed from sequence string + raw_subject (str): Entire subject line, e.g. + "[1/2,v2] efi_loader: Sort header file ordering" + prefix (str): Prefix string or None (e.g. 'RFC') + version (str): Version string or None (e.g. 'v2') + raw_subject (str): Raw patch subject + subject (str): Patch subject with [..] part removed (same as commit + subject) + """ + def __init__(self, pid): + super().__init__() + self.id = pid # Use 'id' to match what the Rest API provides + self.seq = None + self.count = None + self.prefix = None + self.version = None + self.raw_subject = None + self.subject = None + + # These make us more like a dictionary + def __setattr__(self, name, value): + self[name] = value + + def __getattr__(self, name): + return self[name] + + def __hash__(self): + return hash(frozenset(self.items())) + + def __str__(self): + return self.raw_subject + + def parse_subject(self, raw_subject): + """Parse the subject of a patch into its component parts + + See RE_PATCH for details. The parsed info is placed into seq, count, + prefix, version, subject + + Args: + raw_subject (str): Subject string to parse + + Raises: + ValueError: the subject cannot be parsed + """ + self.raw_subject = raw_subject.strip() + mat = RE_PATCH.search(raw_subject.strip()) + if not mat: + raise ValueError("Cannot parse subject '%s'" % raw_subject) + self.prefix, self.version, seq_info, self.subject = mat.groups()[3:] + mat_seq = RE_SEQ.match(seq_info) if seq_info else False + if mat_seq is None: + self.version = seq_info + seq_info = None + if self.version and not self.version.startswith('v'): + self.prefix = self.version + self.version = None + if seq_info: + if mat_seq: + self.seq = int(mat_seq.group(1)) + self.count = int(mat_seq.group(2)) + else: + self.seq = 1 + self.count = 1 + +def compare_with_series(series, patches): + """Compare a list of patches with a series it came from + + This prints any problems as warnings + + Args: + series (Series): Series to compare against + patches (:type: list of Patch): list of Patch objects to compare with + + Returns: + tuple + dict: + key: Commit number (0...n-1) + value: Patch object for that commit + dict: + key: Patch number (0...n-1) + value: Commit object for that patch + """ + # Check the names match + warnings = [] + patch_for_commit = {} + all_patches = set(patches) + for seq, cmt in enumerate(series.commits): + pmatch = [p for p in all_patches if p.subject == cmt.subject] + if len(pmatch) == 1: + patch_for_commit[seq] = pmatch[0] + all_patches.remove(pmatch[0]) + elif len(pmatch) > 1: + warnings.append("Multiple patches match commit %d ('%s'):\n %s" % + (seq + 1, cmt.subject, + '\n '.join([p.subject for p in pmatch]))) + else: + warnings.append("Cannot find patch for commit %d ('%s')" % + (seq + 1, cmt.subject)) + + + # Check the names match + commit_for_patch = {} + all_commits = set(series.commits) + for seq, patch in enumerate(patches): + cmatch = [c for c in all_commits if c.subject == patch.subject] + if len(cmatch) == 1: + commit_for_patch[seq] = cmatch[0] + all_commits.remove(cmatch[0]) + elif len(cmatch) > 1: + warnings.append("Multiple commits match patch %d ('%s'):\n %s" % + (seq + 1, patch.subject, + '\n '.join([c.subject for c in cmatch]))) + else: + warnings.append("Cannot find commit for patch %d ('%s')" % + (seq + 1, patch.subject)) + + return patch_for_commit, commit_for_patch, warnings + +def call_rest_api(subpath): + """Call the patchwork API and return the result as JSON + + Args: + subpath (str): URL subpath to use + + Returns: + dict: Json result + + Raises: + ValueError: the URL could not be read + """ + url = 'https://patchwork.ozlabs.org/api/1.2/%s' % subpath + response = requests.get(url) + if response.status_code != 200: + raise ValueError("Could not read URL '%s'" % url) + return response.json() + +def collect_patches(series, series_id, rest_api=call_rest_api): + """Collect patch information about a series from patchwork + + Uses the Patchwork REST API to collect information provided by patchwork + about the status of each patch. + + Args: + series (Series): Series object corresponding to the local branch + containing the series + series_id (str): Patch series ID number + rest_api (function): API function to call to access Patchwork, for + testing + + Returns: + list: List of patches sorted by sequence number, each a Patch object + + Raises: + ValueError: if the URL could not be read or the web page does not follow + the expected structure + """ + data = rest_api('series/%s/' % series_id) + + # Get all the rows, which are patches + patch_dict = data['patches'] + count = len(patch_dict) + num_commits = len(series.commits) + if count != num_commits: + tout.Warning('Warning: Patchwork reports %d patches, series has %d' % + (count, num_commits)) + + patches = [] + + # Work through each row (patch) one at a time, collecting the information + warn_count = 0 + for pw_patch in patch_dict: + patch = Patch(pw_patch['id']) + patch.parse_subject(pw_patch['name']) + patches.append(patch) + if warn_count > 1: + tout.Warning(' (total of %d warnings)' % warn_count) + + # Sort patches by patch number + patches = sorted(patches, key=lambda x: x.seq) + return patches + +def find_new_responses(new_rtag_list, seq, cmt, patch, rest_api=call_rest_api): + """Find new rtags collected by patchwork that we don't know about + + This is designed to be run in parallel, once for each commit/patch + + Args: + new_rtag_list (list): New rtags are written to new_rtag_list[seq] + list, each a dict: + key: Response tag (e.g. 'Reviewed-by') + value: Set of people who gave that response, each a name/email + string + seq (int): Position in new_rtag_list to update + cmt (Commit): Commit object for this commit + patch (Patch): Corresponding Patch object for this patch + rest_api (function): API function to call to access Patchwork, for + testing + """ + if not patch: + return + + # Get the content for the patch email itself as well as all comments + data = rest_api('patches/%s/' % patch.id) + pstrm = PatchStream.process_text(data['content'], True) + + rtags = collections.defaultdict(set) + for response, people in pstrm.commit.rtags.items(): + rtags[response].update(people) + + data = rest_api('patches/%s/comments/' % patch.id) + + for comment in data: + pstrm = PatchStream.process_text(comment['content'], True) + for response, people in pstrm.commit.rtags.items(): + rtags[response].update(people) + + # Find the tags that are not in the commit + new_rtags = collections.defaultdict(set) + base_rtags = cmt.rtags + for tag, people in rtags.items(): + for who in people: + is_new = (tag not in base_rtags or + who not in base_rtags[tag]) + if is_new: + new_rtags[tag].add(who) + new_rtag_list[seq] = new_rtags + +def show_responses(rtags, indent, is_new): + """Show rtags collected + + Args: + rtags (dict): review tags to show + key: Response tag (e.g. 'Reviewed-by') + value: Set of people who gave that response, each a name/email string + indent (str): Indentation string to write before each line + is_new (bool): True if this output should be highlighted + + Returns: + int: Number of review tags displayed + """ + col = terminal.Color() + count = 0 + for tag, people in rtags.items(): + for who in people: + terminal.Print(indent + '%s %s: ' % ('+' if is_new else ' ', tag), + newline=False, colour=col.GREEN, bright=is_new) + terminal.Print(who, colour=col.WHITE, bright=is_new) + count += 1 + return count + +def check_patchwork_status(series, series_id, rest_api=call_rest_api): + """Check the status of a series on Patchwork + + This finds review tags and comments for a series in Patchwork, displaying + them to show what is new compared to the local series. + + Args: + series (Series): Series object for the existing branch + series_id (str): Patch series ID number + rest_api (function): API function to call to access Patchwork, for + testing + """ + patches = collect_patches(series, series_id, rest_api) + col = terminal.Color() + count = len(series.commits) + new_rtag_list = [None] * count + + patch_for_commit, _, warnings = compare_with_series(series, patches) + for warn in warnings: + tout.Warning(warn) + + patch_list = [patch_for_commit.get(c) for c in range(len(series.commits))] + + with concurrent.futures.ThreadPoolExecutor(max_workers=16) as executor: + futures = executor.map( + find_new_responses, repeat(new_rtag_list), range(count), + series.commits, patch_list, repeat(rest_api)) + for fresponse in futures: + if fresponse: + raise fresponse.exception() + + num_to_add = 0 + for seq, cmt in enumerate(series.commits): + patch = patch_for_commit.get(seq) + if not patch: + continue + terminal.Print('%3d %s' % (patch.seq, patch.subject[:50]), + colour=col.BLUE) + cmt = series.commits[seq] + base_rtags = cmt.rtags + new_rtags = new_rtag_list[seq] + + indent = ' ' * 2 + show_responses(base_rtags, indent, False) + num_to_add += show_responses(new_rtags, indent, True) + + terminal.Print("%d new response%s available in patchwork" % + (num_to_add, 's' if num_to_add != 1 else '')) diff --git a/tools/patman/terminal.py b/tools/patman/terminal.py index 60dbce3ce1f..9be03b3a6fd 100644 --- a/tools/patman/terminal.py +++ b/tools/patman/terminal.py @@ -34,14 +34,22 @@ class PrintLine: newline: True to output a newline after the text colour: Text colour to use """ - def __init__(self, text, newline, colour): + def __init__(self, text, colour, newline=True, bright=True): self.text = text self.newline = newline self.colour = colour + self.bright = bright + + def __eq__(self, other): + return (self.text == other.text and + self.newline == other.newline and + self.colour == other.colour and + self.bright == other.bright) def __str__(self): - return 'newline=%s, colour=%s, text=%s' % (self.newline, self.colour, - self.text) + return ("newline=%s, colour=%s, bright=%d, text='%s'" % + (self.newline, self.colour, self.bright, self.text)) + def CalcAsciiLen(text): """Calculate the length of a string, ignoring any ANSI sequences @@ -136,7 +144,7 @@ def Print(text='', newline=True, colour=None, limit_to_line=False, bright=True): global last_print_len if print_test_mode: - print_test_list.append(PrintLine(text, newline, colour)) + print_test_list.append(PrintLine(text, colour, newline, bright)) else: if colour: col = Color() @@ -159,11 +167,12 @@ def PrintClear(): print('\r%s\r' % (' '* last_print_len), end='', flush=True) last_print_len = None -def SetPrintTestMode(): +def SetPrintTestMode(enable=True): """Go into test mode, where all printing is recorded""" global print_test_mode - print_test_mode = True + print_test_mode = enable + GetPrintTestLines() def GetPrintTestLines(): """Get a list of all lines output through Print() From patchwork Fri Oct 30 03:46:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1390759 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: 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=H+T1yEQl; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4CMpK86Rlfz9sPB for ; Fri, 30 Oct 2020 14:51:56 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 07044826C2; Fri, 30 Oct 2020 04:48:17 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="H+T1yEQl"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A9DF582663; Fri, 30 Oct 2020 04:47:15 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6DB3082663 for ; Fri, 30 Oct 2020 04:47:10 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd41.google.com with SMTP id u19so6159231ion.3 for ; Thu, 29 Oct 2020 20:47:10 -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=ziy9a4jEFBAMB42YzN1Zr3OgUu4wnggSEHy1NNmdW/E=; b=H+T1yEQlCAO9CN3x74bfHuNwaus4VAHpT5Z64hhs+HQnNOZn0rcN88DdRrm5PgYMHC 3gpj8fnjUittKY9HNU3X5mQ4hn5bzgY4sxQ2EAiaL/A6c33gyhPYfC18J6yCBMkFQ1Y9 +WM6o4CcxLpGJ52SPz/BsKKHOnpvAUpa0wpX0= 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=ziy9a4jEFBAMB42YzN1Zr3OgUu4wnggSEHy1NNmdW/E=; b=B3h2NW2RTrotu1ctuvDTx/DdAwL9GOt/0MaR0rfuVAab4jpbTCjzS318tkDrI0GBqn I6M8J83zJM5IIRHXrwfvPkWOk83ZASXX+IPdDPo1T0IiZfc3rPnrK13Mv27nVxbsgFT1 gQDgNNrtRJqzw5xWAVa9PwynRUoKpxRzZlTiXWznAVq4sDS2nlfjPHxB+GESvokSFMKB 8P0VB404TAZ5DOkXb9bI6aCGlhxhH6Yp2ynNV0Y3Je0o3DKkcB7M8WXDqbCuRQZUK8As dbbYww7Vx++A2euQz5Jy1e+U9vNvnY6uXRuSZCd9iMuCLDNX5kbrwPYlxz4r4cqc7Kev 2gkw== X-Gm-Message-State: AOAM530vaHO5OCdW0+UV69rr55zDEc0CoA858gOBKnnEEFlmR7bBKABc IGmXC70pScCqmroxCW3h8wtrBNYnhgJkdDDR X-Google-Smtp-Source: ABdhPJy1fgds+85mxoA0UG2R2k6eKA+oKeLuY4bVQ2aqe4VsxbMj8kJKeRrwC312Qmd1RMleqcdKuw== X-Received: by 2002:a6b:cf18:: with SMTP id o24mr417918ioa.57.1604029628864; Thu, 29 Oct 2020 20:47:08 -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 n28sm4858693ila.52.2020.10.29.20.47.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 20:47:08 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: patchwork@lists.ozlabs.org, Doug Anderson , Tom Rini , Simon Glass Subject: [PATCH v3 27/29] patman: Support updating a branch with review tags Date: Thu, 29 Oct 2020 21:46:36 -0600 Message-Id: <20201030034638.2858999-28-sjg@chromium.org> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog In-Reply-To: <20201030034638.2858999-1-sjg@chromium.org> References: <20201030034638.2858999-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean It is tedious to add review tags into the local branch and errors can sometimes be made. Add an option to create a new branch with the review tags obtained from patchwork. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- Changes in v3: - Allow tags to be inserted in the middle of the commit message tools/patman/README | 19 +++++- tools/patman/control.py | 9 ++- tools/patman/func_test.py | 127 +++++++++++++++++++++++++++++++++++- tools/patman/main.py | 7 +- tools/patman/patchstream.py | 52 ++++++++++++++- tools/patman/status.py | 91 ++++++++++++++++++++++++-- 6 files changed, 289 insertions(+), 16 deletions(-) diff --git a/tools/patman/README b/tools/patman/README index 46b8e251ca5..15da6dc33cb 100644 --- a/tools/patman/README +++ b/tools/patman/README @@ -11,11 +11,13 @@ This tool is a Python script which: - Runs the patches through checkpatch.pl and its own checks - Optionally emails them out to selected people -It also shows review tags from Patchwork so you can update your local patches. +It also has some Patchwork features: +- shows review tags from Patchwork so you can update your local patches +- pulls these down into a new branch on request It is intended to automate patch creation and make it a less error-prone process. It is useful for U-Boot and Linux work so far, -since it uses the checkpatch.pl script. +since they use the checkpatch.pl script. It is configured almost entirely by tags it finds in your commits. This means that you can work on a number of different branches at @@ -385,6 +387,19 @@ attracted another review each. If the series needs changes, you can update these commits with the new review tag before sending the next version of the series. +To automatically pull into these tags into a new branch, use the -d option: + + patman status -d mtrr4 + +This will create a new 'mtrr4' branch which is the same as your current branch +but has the new review tags in it. The tags are added in alphabetic order and +are placed immediately after any existing ack/review/test/fixes tags, or at the +end. You can check that this worked with: + + patman -b mtrr4 status + +which should show that there are no new responses compared to this new branch. + Example Work Flow ================= diff --git a/tools/patman/control.py b/tools/patman/control.py index 7a5469add1b..6ac258d41d7 100644 --- a/tools/patman/control.py +++ b/tools/patman/control.py @@ -176,11 +176,11 @@ def send(args): args.limit, args.dry_run, args.in_reply_to, args.thread, args.smtp_server) -def patchwork_status(branch, count, start, end): +def patchwork_status(branch, count, start, end, dest_branch, force): """Check the status of patches in patchwork This finds the series in patchwork using the Series-link tag, checks for new - comments / review tags and displays them + review tags, displays then and creates a new branch with the review tags. Args: branch (str): Branch to create patches from (None = current) @@ -189,6 +189,9 @@ def patchwork_status(branch, count, start, end): start (int): Start partch to use (0=first / top of branch) end (int): End patch to use (0=last one in series, 1=one before that, etc.) + dest_branch (str): Name of new branch to create with the updated tags + (None to not create a branch) + force (bool): With dest_branch, force overwriting an existing branch Raises: ValueError: if the branch has no Series-link value @@ -220,4 +223,4 @@ def patchwork_status(branch, count, start, end): # Import this here to avoid failing on other commands if the dependencies # are not present from patman import status - status.check_patchwork_status(series, found[0]) + status.check_patchwork_status(series, found[0], branch, dest_branch, force) diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py index 722844e15d3..2e1529525eb 100644 --- a/tools/patman/func_test.py +++ b/tools/patman/func_test.py @@ -403,7 +403,16 @@ with some I2C-related things in it''') self.make_commit_with_file('spi: SPI fixes', ''' SPI needs some fixes and here they are -''', 'spi.c', '''Some fixes for SPI in this + +Signed-off-by: %s + +Series-to: u-boot +Commit-notes: +title of the series +This is the cover letter for the series +with various details +END +''' % self.leb, 'spi.c', '''Some fixes for SPI in this file to make SPI work better than before''') first_target = repo.revparse_single('HEAD') @@ -889,7 +898,8 @@ diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c series = Series() series.commits = [commit1, commit2] terminal.SetPrintTestMode() - status.check_patchwork_status(series, '1234', self._fake_patchwork2) + status.check_patchwork_status(series, '1234', None, None, False, + self._fake_patchwork2) lines = iter(terminal.GetPrintTestLines()) col = terminal.Color() self.assertEqual(terminal.PrintLine(' 1 Subject 1', col.BLUE), @@ -921,4 +931,115 @@ diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c self.assertEqual(terminal.PrintLine(self.mary, col.WHITE), next(lines)) self.assertEqual(terminal.PrintLine( - '1 new response available in patchwork', None), next(lines)) + '1 new response available in patchwork (use -d to write them to a new branch)', + None), next(lines)) + + def _fake_patchwork3(self, subpath): + """Fake Patchwork server for the function below + + This handles accessing series, patches and comments, providing the data + in self.patches to the caller + """ + re_series = re.match(r'series/(\d*)/$', subpath) + re_patch = re.match(r'patches/(\d*)/$', subpath) + re_comments = re.match(r'patches/(\d*)/comments/$', subpath) + if re_series: + series_num = re_series.group(1) + if series_num == '1234': + return {'patches': self.patches} + elif re_patch: + patch_num = int(re_patch.group(1)) + patch = self.patches[patch_num - 1] + return patch + elif re_comments: + patch_num = int(re_comments.group(1)) + patch = self.patches[patch_num - 1] + return patch.comments + raise ValueError('Fake Patchwork does not understand: %s' % subpath) + + @unittest.skipIf(not HAVE_PYGIT2, 'Missing python3-pygit2') + def testCreateBranch(self): + """Test operation of create_branch()""" + repo = self.make_git_tree() + branch = 'first' + dest_branch = 'first2' + count = 2 + gitdir = os.path.join(self.gitdir, '.git') + + # Set up the test git tree. We use branch 'first' which has two commits + # in it + series = patchstream.get_metadata_for_list(branch, gitdir, count) + self.assertEqual(2, len(series.commits)) + + patch1 = status.Patch('1') + patch1.parse_subject('[1/2] %s' % series.commits[0].subject) + patch1.name = patch1.raw_subject + patch1.content = 'This is my patch content' + comment1a = {'content': 'Reviewed-by: %s\n' % self.joe} + + patch1.comments = [comment1a] + + patch2 = status.Patch('2') + patch2.parse_subject('[2/2] %s' % series.commits[1].subject) + patch2.name = patch2.raw_subject + patch2.content = 'Some other patch content' + comment2a = { + 'content': 'Reviewed-by: %s\nTested-by: %s\n' % + (self.mary, self.leb)} + comment2b = { + 'content': 'Reviewed-by: %s' % self.fred} + patch2.comments = [comment2a, comment2b] + + # This test works by setting up patches for use by the fake Rest API + # function _fake_patchwork3(). The fake patch comments above should + # result in new review tags that are collected and added to the commits + # created in the destination branch. + self.patches = [patch1, patch2] + count = 2 + + # Expected output: + # 1 i2c: I2C things + # + Reviewed-by: Joe Bloggs + # 2 spi: SPI fixes + # + Reviewed-by: Fred Bloggs + # + Reviewed-by: Mary Bloggs + # + Tested-by: Lord Edmund Blackaddër + # 4 new responses available in patchwork + # 4 responses added from patchwork into new branch 'first2' + # + + terminal.SetPrintTestMode() + status.check_patchwork_status(series, '1234', branch, dest_branch, + False, self._fake_patchwork3, repo) + lines = terminal.GetPrintTestLines() + self.assertEqual(12, len(lines)) + self.assertEqual( + "4 responses added from patchwork into new branch 'first2'", + lines[11].text) + + # Check that the destination branch has the new tags + new_series = patchstream.get_metadata_for_list(dest_branch, gitdir, + count) + self.assertEqual( + {'Reviewed-by': {self.joe}}, + new_series.commits[0].rtags) + self.assertEqual( + {'Tested-by': {self.leb}, + 'Reviewed-by': {self.fred, self.mary}}, + new_series.commits[1].rtags) + + # Now check the actual test of the first commit message. We expect to + # see the new tags immediately below the old ones. + stdout = patchstream.get_list(dest_branch, count=count, git_dir=gitdir) + lines = iter([line.strip() for line in stdout.splitlines() + if '-by:' in line]) + + # First patch should have the review tag + self.assertEqual('Reviewed-by: %s' % self.joe, next(lines)) + + # Second patch should have the sign-off then the tested-by and two + # reviewed-by tags + self.assertEqual('Signed-off-by: %s' % self.leb, next(lines)) + self.assertEqual('Reviewed-by: %s' % self.fred, next(lines)) + self.assertEqual('Reviewed-by: %s' % self.mary, next(lines)) + self.assertEqual('Tested-by: %s' % self.leb, next(lines)) diff --git a/tools/patman/main.py b/tools/patman/main.py index 7f4ae1125a1..8f139a6e3ba 100755 --- a/tools/patman/main.py +++ b/tools/patman/main.py @@ -92,6 +92,10 @@ AddCommonArgs(test_parser) status = subparsers.add_parser('status', help='Check status of patches in patchwork') +status.add_argument('-d', '--dest-branch', type=str, + help='Name of branch to create with collected responses') +status.add_argument('-f', '--force', action='store_true', + help='Force overwriting an existing branch') AddCommonArgs(status) # Parse options twice: first to get the project and second to handle @@ -166,7 +170,8 @@ elif args.cmd == 'send': elif args.cmd == 'status': ret_code = 0 try: - control.patchwork_status(args.branch, args.count, args.start, args.end) + control.patchwork_status(args.branch, args.count, args.start, args.end, + args.dest_branch, args.force) except Exception as e: terminal.Print('patman: %s: %s' % (type(e).__name__, e), colour=terminal.Color.RED) diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py index cf6a6c6fc3e..7b0805e9e14 100644 --- a/tools/patman/patchstream.py +++ b/tools/patman/patchstream.py @@ -551,6 +551,54 @@ class PatchStream: self.blank_count = 0 self.finalise() +def insert_tags(msg, tags_to_emit): + """Add extra tags to a commit message + + The tags are added after an existing block of tags if found, otherwise at + the end. + + Args: + msg (str): Commit message + tags_to_emit (list): List of tags to emit, each a str + + Returns: + (str) new message + """ + out = [] + done = False + emit_tags = False + for line in msg.splitlines(): + if not done: + signoff_match = RE_SIGNOFF.match(line) + tag_match = RE_TAG.match(line) + if tag_match or signoff_match: + emit_tags = True + if emit_tags and not tag_match and not signoff_match: + out += tags_to_emit + emit_tags = False + done = True + out.append(line) + if not done: + out.append('') + out += tags_to_emit + return '\n'.join(out) + +def get_list(commit_range, git_dir=None, count=None): + """Get a log of a list of comments + + This returns the output of 'git log' for the selected commits + + Args: + commit_range (str): Range of commits to count (e.g. 'HEAD..base') + git_dir (str): Path to git repositiory (None to use default) + count (int): Number of commits to list, or None for no limit + + Returns + str: String containing the contents of the git log + """ + params = gitutil.LogCmd(commit_range, reverse=True, count=count, + git_dir=git_dir) + return command.RunPipe([params], capture=True).stdout def get_metadata_for_list(commit_range, git_dir=None, count=None, series=None, allow_overwrite=False): @@ -573,9 +621,7 @@ def get_metadata_for_list(commit_range, git_dir=None, count=None, if not series: series = Series() series.allow_overwrite = allow_overwrite - params = gitutil.LogCmd(commit_range, reverse=True, count=count, - git_dir=git_dir) - stdout = command.RunPipe([params], capture=True).stdout + stdout = get_list(commit_range, git_dir, count) pst = PatchStream(series, is_log=True) for line in stdout.splitlines(): pst.process_line(line) diff --git a/tools/patman/status.py b/tools/patman/status.py index f41b2d4c776..f3a654160ec 100644 --- a/tools/patman/status.py +++ b/tools/patman/status.py @@ -3,15 +3,19 @@ # Copyright 2020 Google LLC # """Talks to the patchwork service to figure out what patches have been reviewed -and commented on. +and commented on. Allows creation of a new branch based on the old but with the +review tags collected from patchwork. """ import collections import concurrent.futures from itertools import repeat import re + +import pygit2 import requests +from patman import patchstream from patman.patchstream import PatchStream from patman import terminal from patman import tout @@ -306,7 +310,73 @@ def show_responses(rtags, indent, is_new): count += 1 return count -def check_patchwork_status(series, series_id, rest_api=call_rest_api): +def create_branch(series, new_rtag_list, branch, dest_branch, overwrite, + repo=None): + """Create a new branch with review tags added + + Args: + series (Series): Series object for the existing branch + new_rtag_list (list): List of review tags to add, one for each commit, + each a dict: + key: Response tag (e.g. 'Reviewed-by') + value: Set of people who gave that response, each a name/email + string + branch (str): Existing branch to update + dest_branch (str): Name of new branch to create + overwrite (bool): True to force overwriting dest_branch if it exists + repo (pygit2.Repository): Repo to use (use None unless testing) + + Returns: + int: Total number of review tags added across all commits + + Raises: + ValueError: if the destination branch name is the same as the original + branch, or it already exists and @overwrite is False + """ + if branch == dest_branch: + raise ValueError( + 'Destination branch must not be the same as the original branch') + if not repo: + repo = pygit2.Repository('.') + count = len(series.commits) + new_br = repo.branches.get(dest_branch) + if new_br: + if not overwrite: + raise ValueError("Branch '%s' already exists (-f to overwrite)" % + dest_branch) + new_br.delete() + if not branch: + branch = 'HEAD' + target = repo.revparse_single('%s~%d' % (branch, count)) + repo.branches.local.create(dest_branch, target) + + num_added = 0 + for seq in range(count): + parent = repo.branches.get(dest_branch) + cherry = repo.revparse_single('%s~%d' % (branch, count - seq - 1)) + + repo.merge_base(cherry.oid, parent.target) + base_tree = cherry.parents[0].tree + + index = repo.merge_trees(base_tree, parent, cherry) + tree_id = index.write_tree(repo) + + lines = [] + if new_rtag_list[seq]: + for tag, people in new_rtag_list[seq].items(): + for who in people: + lines.append('%s: %s' % (tag, who)) + num_added += 1 + message = patchstream.insert_tags(cherry.message.rstrip(), + sorted(lines)) + + repo.create_commit( + parent.name, cherry.author, cherry.committer, message, tree_id, + [parent.target]) + return num_added + +def check_patchwork_status(series, series_id, branch, dest_branch, force, + rest_api=call_rest_api, test_repo=None): """Check the status of a series on Patchwork This finds review tags and comments for a series in Patchwork, displaying @@ -315,8 +385,12 @@ def check_patchwork_status(series, series_id, rest_api=call_rest_api): Args: series (Series): Series object for the existing branch series_id (str): Patch series ID number + branch (str): Existing branch to update, or None + dest_branch (str): Name of new branch to create, or None + force (bool): True to force overwriting dest_branch if it exists rest_api (function): API function to call to access Patchwork, for testing + test_repo (pygit2.Repository): Repo to use (use None unless testing) """ patches = collect_patches(series, series_id, rest_api) col = terminal.Color() @@ -352,5 +426,14 @@ def check_patchwork_status(series, series_id, rest_api=call_rest_api): show_responses(base_rtags, indent, False) num_to_add += show_responses(new_rtags, indent, True) - terminal.Print("%d new response%s available in patchwork" % - (num_to_add, 's' if num_to_add != 1 else '')) + terminal.Print("%d new response%s available in patchwork%s" % + (num_to_add, 's' if num_to_add != 1 else '', + '' if dest_branch + else ' (use -d to write them to a new branch)')) + + if dest_branch: + num_added = create_branch(series, new_rtag_list, branch, + dest_branch, force, test_repo) + terminal.Print( + "%d response%s added from patchwork into new branch '%s'" % + (num_added, 's' if num_added != 1 else '', dest_branch)) From patchwork Fri Oct 30 03:46:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1390757 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: 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=ah/ycVFW; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (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 4CMpJx4f61z9sPB for ; Fri, 30 Oct 2020 14:51:45 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6A4DB826B9; Fri, 30 Oct 2020 04:48:15 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="ah/ycVFW"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E3D848266C; Fri, 30 Oct 2020 04:47:14 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4ACE382656 for ; Fri, 30 Oct 2020 04:47:11 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd41.google.com with SMTP id q25so6157078ioh.4 for ; Thu, 29 Oct 2020 20:47:11 -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=IEeKFv/zw9nGfno4wnGRWbTr2c59JJztM4sSL/77FxU=; b=ah/ycVFWvGSCYJdVKd561NErl29MF4MutJ2o7o+d1Cbf9nQRxDd6v+fHR/6i2zNJFw b4R3f0myN82S5Ft3YnC1IT3Jv34lwxBlj9h7xdy3Se9oAckjlhtNHTT+N6/iugambNSY zl/YOicGEai6BuYRYxshmLxQ0Y6GfPC02+zDg= 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=IEeKFv/zw9nGfno4wnGRWbTr2c59JJztM4sSL/77FxU=; b=SpGmLZZVL4plL+ptvyHyX2o+uj6G6sUrk/B4rzyaUiKZKVdsabXu+mleM0GTJ42IkB SpMIVll5rfNcfsVZYvOSI4FjHDR3u33YlD0nMu7AkaON8ZHrDgNUfxGjxBxd9Ewd5GTB Y6jZR/GWyHqCR40RN1AHTdOEoDC9B1F8gDjo2fTYaz/eYM/XkHjecAKsjbG6/eDKrQuz yxYF7ttBbA24c5bOr+2QtIdY2HijOe7ZLr1GzKRSSviepiuAdFNybwesRTnia6v5JlcK a/Fh+9Z5XfXh7KohR+yWH/BViPP+VMqxZaQVvTY87nFI9oxsSSCr0Z6ElawghI+tcsGp t98Q== X-Gm-Message-State: AOAM533rztTwC3VmVnV5XXPF+1V2oUZ2EFIY4HOwXAIQbQxxpBbh/0HB fCrAYGbBXohYAdvoNLBy3kcWn38UO3vjRCJA X-Google-Smtp-Source: ABdhPJzbZ0w+ZD0BIsz0147xbzE61SyIK5APgWZ++R5IUUZhtnnk0hmMAlxmgEOUT3OhKaquGjxwPQ== X-Received: by 2002:a05:6638:531:: with SMTP id j17mr457998jar.69.1604029629919; Thu, 29 Oct 2020 20:47:09 -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 n28sm4858693ila.52.2020.10.29.20.47.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 20:47:09 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: patchwork@lists.ozlabs.org, Doug Anderson , Tom Rini , Simon Glass Subject: [PATCH v3 28/29] patman: Support parsing of review snippets Date: Thu, 29 Oct 2020 21:46:37 -0600 Message-Id: <20201030034638.2858999-29-sjg@chromium.org> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog In-Reply-To: <20201030034638.2858999-1-sjg@chromium.org> References: <20201030034638.2858999-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Add support for parsing the contents of a patchwork 'patch' web page containing comments received from reviewers. This allows patman to show these comments in a simple 'snippets' format. A snippet is some quoted code plus some unquoted comments below it. Each review is from a unique person/email and can produce multiple snippets, one for each part of the code that attracts a comment. Show the file and line-number info at the top of each snippet if available. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/patman/func_test.py | 83 ++++++++++++++++++++++++++++++++++++ tools/patman/patchstream.py | 85 +++++++++++++++++++++++++++++++++++++ 2 files changed, 168 insertions(+) diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py index 2e1529525eb..bbee4b77d66 100644 --- a/tools/patman/func_test.py +++ b/tools/patman/func_test.py @@ -1043,3 +1043,86 @@ diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c self.assertEqual('Reviewed-by: %s' % self.fred, next(lines)) self.assertEqual('Reviewed-by: %s' % self.mary, next(lines)) self.assertEqual('Tested-by: %s' % self.leb, next(lines)) + + def testParseSnippets(self): + """Test parsing of review snippets""" + text = '''Hi Fred, + +This is a comment from someone. + +Something else + +On some recent date, Fred wrote: +> This is why I wrote the patch +> so here it is + +Now a comment about the commit message +A little more to say + +Even more + +> diff --git a/file.c b/file.c +> Some more code +> Code line 2 +> Code line 3 +> Code line 4 +> Code line 5 +> Code line 6 +> Code line 7 +> Code line 8 +> Code line 9 + +And another comment + +> @@ -153,8 +143,13 @@ def CheckPatch(fname, show_types=False): +> further down on the file +> and more code +> +Addition here +> +Another addition here +> codey +> more codey + +and another thing in same file + +> @@ -253,8 +243,13 @@ +> with no function context + +one more thing + +> diff --git a/tools/patman/main.py b/tools/patman/main.py +> +line of code +now a very long comment in a different file +line2 +line3 +line4 +line5 +line6 +line7 +line8 +''' + pstrm = PatchStream.process_text(text, True) + self.assertEqual([], pstrm.commit.warn) + + # We expect to the filename and up to 5 lines of code context before + # each comment. The 'On xxx wrote:' bit should be removed. + self.assertEqual( + [['Hi Fred,', + 'This is a comment from someone.', + 'Something else'], + ['> This is why I wrote the patch', + '> so here it is', + 'Now a comment about the commit message', + 'A little more to say', 'Even more'], + ['> File: file.c', '> Code line 5', '> Code line 6', + '> Code line 7', '> Code line 8', '> Code line 9', + 'And another comment'], + ['> File: file.c', + '> Line: 153 / 143: def CheckPatch(fname, show_types=False):', + '> and more code', '> +Addition here', '> +Another addition here', + '> codey', '> more codey', 'and another thing in same file'], + ['> File: file.c', '> Line: 253 / 243', + '> with no function context', 'one more thing'], + ['> File: tools/patman/main.py', '> +line of code', + 'now a very long comment in a different file', + 'line2', 'line3', 'line4', 'line5', 'line6', 'line7', 'line8']], + pstrm.snippets) diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py index 7b0805e9e14..9dc3b29216d 100644 --- a/tools/patman/patchstream.py +++ b/tools/patman/patchstream.py @@ -4,11 +4,13 @@ """Handles parsing a stream of commits/emails from 'git log' or other source""" +import collections import datetime import io import math import os import re +import queue import shutil import tempfile @@ -51,6 +53,12 @@ RE_SPACE_BEFORE_TAB = re.compile('^[+].* \t') # Match indented lines for changes RE_LEADING_WHITESPACE = re.compile(r'^\s') +# Detect a 'diff' line +RE_DIFF = re.compile(r'^>.*diff --git a/(.*) b/(.*)$') + +# Detect a context line, like '> @@ -153,8 +153,13 @@ CheckPatch +RE_LINE = re.compile(r'>.*@@ \-(\d+),\d+ \+(\d+),\d+ @@ *(.*)') + # States we can be in - can we use range() and still have comments? STATE_MSG_HEADER = 0 # Still in the message header STATE_PATCH_SUBJECT = 1 # In patch subject (first line of log for a commit) @@ -81,6 +89,14 @@ class PatchStream: self.blank_count = 0 # Number of blank lines stored up self.state = STATE_MSG_HEADER # What state are we in? self.commit = None # Current commit + self.snippets = [] # List of unquoted test blocks + self.cur_diff = None # Last 'diff' line seen (str) + self.cur_line = None # Last context (@@) line seen (str) + self.recent_diff= None # 'diff' line for current snippet (str) + self.recent_line= None # '@@' line for current snippet (str) + self.recent_quoted = collections.deque([], 5) + self.recent_unquoted = queue.Queue() + self.was_quoted = None @staticmethod def process_text(text, is_comment=False): @@ -176,6 +192,10 @@ class PatchStream: self.skip_blank = True self.section = [] + self.cur_diff = None + self.recent_diff = None + self.recent_line = None + def _parse_version(self, value, line): """Parse a version from a *-changes tag @@ -209,6 +229,47 @@ class PatchStream: self.commit.AddChange(self.change_version, change) self.change_lines = [] + def _finalise_snippet(self): + """Finish off a snippet and add it to the list + + This is called when we get to the end of a snippet, i.e. the we enter + the next block of quoted text: + + This is a comment from someone. + + Something else + + > Now we have some code <----- end of snippet + > more code + + Now a comment about the above code + + This adds the snippet to our list + """ + quoted_lines = [] + while self.recent_quoted: + quoted_lines.append(self.recent_quoted.popleft()) + unquoted_lines = [] + valid = False + while not self.recent_unquoted.empty(): + text = self.recent_unquoted.get() + if not (text.startswith('On ') and text.endswith('wrote:')): + unquoted_lines.append(text) + if text: + valid = True + if valid: + lines = [] + if self.recent_diff: + lines.append('> File: %s' % self.recent_diff) + if self.recent_line: + out = '> Line: %s / %s' % self.recent_line[:2] + if self.recent_line[2]: + out += ': %s' % self.recent_line[2] + lines.append(out) + lines += quoted_lines + unquoted_lines + if lines: + self.snippets.append(lines) + def process_line(self, line): """Process a single line of a patch file or commit log @@ -254,6 +315,8 @@ class PatchStream: cover_match = RE_COVER.match(line) signoff_match = RE_SIGNOFF.match(line) leading_whitespace_match = RE_LEADING_WHITESPACE.match(line) + diff_match = RE_DIFF.match(line) + line_match = RE_LINE.match(line) tag_match = None if self.state == STATE_PATCH_HEADER: tag_match = RE_TAG.match(line) @@ -443,6 +506,27 @@ class PatchStream: out = [line] self.linenum += 1 self.skip_blank = False + + if diff_match: + self.cur_diff = diff_match.group(1) + + # If this is quoted, keep recent lines + if not diff_match and self.linenum > 1 and line: + if line.startswith('>'): + if not self.was_quoted: + self._finalise_snippet() + self.recent_line = None + if not line_match: + self.recent_quoted.append(line) + self.was_quoted = True + self.recent_diff = self.cur_diff + else: + self.recent_unquoted.put(line) + self.was_quoted = False + + if line_match: + self.recent_line = line_match.groups() + if self.state == STATE_DIFFS: pass @@ -466,6 +550,7 @@ class PatchStream: def finalise(self): """Close out processing of this patch stream""" + self._finalise_snippet() self._finalise_change() self._close_commit() if self.lines_after_test: From patchwork Fri Oct 30 03:46:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1390763 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: 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=HgTvNbZJ; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (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 4CMpKg67sMz9sSf for ; Fri, 30 Oct 2020 14:52:23 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 25888826C7; Fri, 30 Oct 2020 04:48:19 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="HgTvNbZJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F408782656; Fri, 30 Oct 2020 04:47:17 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9950F82666 for ; Fri, 30 Oct 2020 04:47:12 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd41.google.com with SMTP id z17so6118096iog.11 for ; Thu, 29 Oct 2020 20:47:12 -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=79Eb4rFXmUP2PTYOspQZyLIzBEZ2fuT4HMI47Cy+CKk=; b=HgTvNbZJJhSxUYLRVt4lg9C1SNV+sJi5VNpty6HR5xYB1dOrTmjM9bHRhQvupcPZAE 6oS0bEXuEypm0h561ZJ75vPcikTcT0Z11xbORbDK3b3bHzHhd4ELUHExG863QlpbCPWF Z0OGV6CEP2aOvCDnYzJnMlA8bSuhfcUn2SMGI= 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=79Eb4rFXmUP2PTYOspQZyLIzBEZ2fuT4HMI47Cy+CKk=; b=iwY8iaetpXMYgl+TY1aqpqor9WMwKdDv2L2w43RlGzKeYvN/Au/+/GfzLBLVxJ5/Mz XoavBJ8ztEygKPv8HiD1GERPeN4XMfl8DlSxOT4AibNiXzagQdvU4qrLSrdX7MwEbefw 1OPOR51qgOUYnoLX7eiM+eyvSlGBZCyF1K0KzJNdj98m4ytVqDzdVTptQ1o0CEVqBw78 zu5eTcR0f2/43DtaTBVLgl4lPkHpw3f8/FUl7pWwMysgeJC7kRRJEKQzfO27+W5Ljqk1 iGxqrgpHpFG95NStg32Y7Qp3G50y2K5cXij/ARin+wlyyn0NM2jN4CFPhqg4igUbhiWT KcVQ== X-Gm-Message-State: AOAM5325svxmpaOuWcndhVPa9RI57J7C7qr+x2+LKuQwWN2BHYHQwXwY 5ewsDc4j63f4Fwgs0mKzNe77YEmIi1xYiUmp X-Google-Smtp-Source: ABdhPJxsj9dePavFUd/5NJ+oVl9mjdMEsGFSh4VsUIzP7ZXP8g4oZxfLkBDTE9xDO4AN+STfHo6hXg== X-Received: by 2002:a05:6602:d7:: with SMTP id z23mr444681ioe.142.1604029630982; Thu, 29 Oct 2020 20:47:10 -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 n28sm4858693ila.52.2020.10.29.20.47.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 20:47:10 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: patchwork@lists.ozlabs.org, Doug Anderson , Tom Rini , Simon Glass Subject: [PATCH v3 29/29] patman: Support listing comments from patchwork Date: Thu, 29 Oct 2020 21:46:38 -0600 Message-Id: <20201030034638.2858999-30-sjg@chromium.org> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog In-Reply-To: <20201030034638.2858999-1-sjg@chromium.org> References: <20201030034638.2858999-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean While reviewing feedback it is helpful to see the review comments on the command line to check that each has been addressed. Add an option to support that. Update the workflow documentation to describe the new features. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v2) Changes in v2: - Many changes to the whole series, including new patches - Use of REST API instead of the web site tools/patman/README | 36 +++++-- tools/patman/control.py | 11 ++- tools/patman/func_test.py | 186 +++++++++++++++++++++++++++++++++--- tools/patman/main.py | 5 +- tools/patman/patchstream.py | 7 +- tools/patman/status.py | 59 ++++++++++-- 6 files changed, 268 insertions(+), 36 deletions(-) diff --git a/tools/patman/README b/tools/patman/README index 15da6dc33cb..49b73590cf0 100644 --- a/tools/patman/README +++ b/tools/patman/README @@ -14,6 +14,7 @@ This tool is a Python script which: It also has some Patchwork features: - shows review tags from Patchwork so you can update your local patches - pulls these down into a new branch on request +- lists comments received on a series It is intended to automate patch creation and make it a less error-prone process. It is useful for U-Boot and Linux work so far, @@ -400,6 +401,8 @@ end. You can check that this worked with: which should show that there are no new responses compared to this new branch. +There is also a -C option to list the comments received for each patch. + Example Work Flow ================= @@ -484,17 +487,33 @@ people on the list don't see your secret info. Of course patches often attract comments and you need to make some updates. Let's say one person sent comments and you get an Acked-by: on one patch. Also, the patch on the list that you were waiting for has been merged, -so you can drop your wip commit. So you resync with upstream: +so you can drop your wip commit. + +Take a look on patchwork and find out the URL of the series. This will be +something like http://patchwork.ozlabs.org/project/uboot/list/?series=187331 +Add this to a tag in your top commit: + + Series-link: http://patchwork.ozlabs.org/project/uboot/list/?series=187331 + +You can use then patman to collect the Acked-by tag to the correct commit, +creating a new 'version 2' branch for us-cmd: + + patman status -d us-cmd2 + git checkout us-cmd2 + +You can look at the comments in Patchwork or with: + + patman status -C + +Then you can resync with upstream: git fetch origin (or whatever upstream is called) git rebase origin/master -and use git rebase -i to edit the commits, dropping the wip one. You add -the ack tag to one commit: - - Acked-by: Heiko Schocher +and use git rebase -i to edit the commits, dropping the wip one. -update the Series-cc: in the top commit: +Then update the Series-cc: in the top commit to add the person who reviewed +the v1 series: Series-cc: bfin, marex, Heiko Schocher @@ -533,7 +552,9 @@ so to send them: and it will create and send the version 2 series. -General points: + +General points +============== 1. When you change back to the us-cmd branch days or weeks later all your information is still there, safely stored in the commits. You don't need @@ -613,3 +634,4 @@ a bad thing. Simon Glass v1, v2, 19-Oct-11 revised v3 24-Nov-11 +revised v4 Independence Day 2020, with Patchwork integration diff --git a/tools/patman/control.py b/tools/patman/control.py index 6ac258d41d7..f4a6ca145d4 100644 --- a/tools/patman/control.py +++ b/tools/patman/control.py @@ -176,11 +176,13 @@ def send(args): args.limit, args.dry_run, args.in_reply_to, args.thread, args.smtp_server) -def patchwork_status(branch, count, start, end, dest_branch, force): +def patchwork_status(branch, count, start, end, dest_branch, force, + show_comments): """Check the status of patches in patchwork This finds the series in patchwork using the Series-link tag, checks for new - review tags, displays then and creates a new branch with the review tags. + comments and review tags, displays then and creates a new branch with the + review tags. Args: branch (str): Branch to create patches from (None = current) @@ -192,6 +194,8 @@ def patchwork_status(branch, count, start, end, dest_branch, force): dest_branch (str): Name of new branch to create with the updated tags (None to not create a branch) force (bool): With dest_branch, force overwriting an existing branch + show_comments (bool): True to display snippets from the comments + provided by reviewers Raises: ValueError: if the branch has no Series-link value @@ -223,4 +227,5 @@ def patchwork_status(branch, count, start, end, dest_branch, force): # Import this here to avoid failing on other commands if the dependencies # are not present from patman import status - status.check_patchwork_status(series, found[0], branch, dest_branch, force) + status.check_patchwork_status(series, found[0], branch, dest_branch, force, + show_comments) diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py index bbee4b77d66..e2adf32c739 100644 --- a/tools/patman/func_test.py +++ b/tools/patman/func_test.py @@ -857,15 +857,16 @@ diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c self.patches = [patch1, patch2] count = 2 new_rtag_list = [None] * count + review_list = [None, None] # Check that the tags are picked up on the first patch - status.find_new_responses(new_rtag_list, 0, commit1, patch1, - self._fake_patchwork2) + status.find_new_responses(new_rtag_list, review_list, 0, commit1, + patch1, self._fake_patchwork2) self.assertEqual(new_rtag_list[0], {'Reviewed-by': {self.joe}}) # Now the second patch - status.find_new_responses(new_rtag_list, 1, commit2, patch2, - self._fake_patchwork2) + status.find_new_responses(new_rtag_list, review_list, 1, commit2, + patch2, self._fake_patchwork2) self.assertEqual(new_rtag_list[1], { 'Reviewed-by': {self.mary, self.fred}, 'Tested-by': {self.leb}}) @@ -874,16 +875,16 @@ diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c # 'new' tags when scanning comments new_rtag_list = [None] * count commit1.rtags = {'Reviewed-by': {self.joe}} - status.find_new_responses(new_rtag_list, 0, commit1, patch1, - self._fake_patchwork2) + status.find_new_responses(new_rtag_list, review_list, 0, commit1, + patch1, self._fake_patchwork2) self.assertEqual(new_rtag_list[0], {}) # For the second commit, add Ed and Fred, so only Mary should be left commit2.rtags = { 'Tested-by': {self.leb}, 'Reviewed-by': {self.fred}} - status.find_new_responses(new_rtag_list, 1, commit2, patch2, - self._fake_patchwork2) + status.find_new_responses(new_rtag_list, review_list, 1, commit2, + patch2, self._fake_patchwork2) self.assertEqual(new_rtag_list[1], {'Reviewed-by': {self.mary}}) # Check that the output patches expectations: @@ -898,7 +899,7 @@ diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c series = Series() series.commits = [commit1, commit2] terminal.SetPrintTestMode() - status.check_patchwork_status(series, '1234', None, None, False, + status.check_patchwork_status(series, '1234', None, None, False, False, self._fake_patchwork2) lines = iter(terminal.GetPrintTestLines()) col = terminal.Color() @@ -914,16 +915,16 @@ diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c self.assertEqual(terminal.PrintLine(' 2 Subject 2', col.BLUE), next(lines)) self.assertEqual( - terminal.PrintLine(' Tested-by: ', col.GREEN, newline=False, + terminal.PrintLine(' Reviewed-by: ', col.GREEN, newline=False, bright=False), next(lines)) - self.assertEqual(terminal.PrintLine(self.leb, col.WHITE, bright=False), + self.assertEqual(terminal.PrintLine(self.fred, col.WHITE, bright=False), next(lines)) self.assertEqual( - terminal.PrintLine(' Reviewed-by: ', col.GREEN, newline=False, + terminal.PrintLine(' Tested-by: ', col.GREEN, newline=False, bright=False), next(lines)) - self.assertEqual(terminal.PrintLine(self.fred, col.WHITE, bright=False), + self.assertEqual(terminal.PrintLine(self.leb, col.WHITE, bright=False), next(lines)) self.assertEqual( terminal.PrintLine(' + Reviewed-by: ', col.GREEN, newline=False), @@ -1010,7 +1011,7 @@ diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c terminal.SetPrintTestMode() status.check_patchwork_status(series, '1234', branch, dest_branch, - False, self._fake_patchwork3, repo) + False, False, self._fake_patchwork3, repo) lines = terminal.GetPrintTestLines() self.assertEqual(12, len(lines)) self.assertEqual( @@ -1044,6 +1045,7 @@ diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c self.assertEqual('Reviewed-by: %s' % self.mary, next(lines)) self.assertEqual('Tested-by: %s' % self.leb, next(lines)) + @unittest.skipIf(not HAVE_PYGIT2, 'Missing python3-pygit2') def testParseSnippets(self): """Test parsing of review snippets""" text = '''Hi Fred, @@ -1126,3 +1128,159 @@ line8 'now a very long comment in a different file', 'line2', 'line3', 'line4', 'line5', 'line6', 'line7', 'line8']], pstrm.snippets) + + @unittest.skipIf(not HAVE_PYGIT2, 'Missing python3-pygit2') + def testReviewSnippets(self): + """Test showing of review snippets""" + def _to_submitter(who): + m_who = re.match('(.*) <(.*)>', who) + return { + 'name': m_who.group(1), + 'email': m_who.group(2) + } + + commit1 = Commit('abcd') + commit1.subject = 'Subject 1' + commit2 = Commit('ef12') + commit2.subject = 'Subject 2' + + patch1 = status.Patch('1') + patch1.parse_subject('[1/2] Subject 1') + patch1.name = patch1.raw_subject + patch1.content = 'This is my patch content' + comment1a = {'submitter': _to_submitter(self.joe), + 'content': '''Hi Fred, + +On some date Fred wrote: + +> diff --git a/file.c b/file.c +> Some code +> and more code + +Here is my comment above the above... + + +Reviewed-by: %s +''' % self.joe} + + patch1.comments = [comment1a] + + patch2 = status.Patch('2') + patch2.parse_subject('[2/2] Subject 2') + patch2.name = patch2.raw_subject + patch2.content = 'Some other patch content' + comment2a = { + 'content': 'Reviewed-by: %s\nTested-by: %s\n' % + (self.mary, self.leb)} + comment2b = {'submitter': _to_submitter(self.fred), + 'content': '''Hi Fred, + +On some date Fred wrote: + +> diff --git a/tools/patman/commit.py b/tools/patman/commit.py +> @@ -41,6 +41,9 @@ class Commit: +> self.rtags = collections.defaultdict(set) +> self.warn = [] +> +> + def __str__(self): +> + return self.subject +> + +> def AddChange(self, version, info): +> """Add a new change line to the change list for a version. +> +A comment + +Reviewed-by: %s +''' % self.fred} + patch2.comments = [comment2a, comment2b] + + # This test works by setting up commits and patch for use by the fake + # Rest API function _fake_patchwork2(). It calls various functions in + # the status module after setting up tags in the commits, checking that + # things behaves as expected + self.commits = [commit1, commit2] + self.patches = [patch1, patch2] + + # Check that the output patches expectations: + # 1 Subject 1 + # Reviewed-by: Joe Bloggs + # 2 Subject 2 + # Tested-by: Lord Edmund Blackaddër + # Reviewed-by: Fred Bloggs + # + Reviewed-by: Mary Bloggs + # 1 new response available in patchwork + + series = Series() + series.commits = [commit1, commit2] + terminal.SetPrintTestMode() + status.check_patchwork_status(series, '1234', None, None, False, True, + self._fake_patchwork2) + lines = iter(terminal.GetPrintTestLines()) + col = terminal.Color() + self.assertEqual(terminal.PrintLine(' 1 Subject 1', col.BLUE), + next(lines)) + self.assertEqual( + terminal.PrintLine(' + Reviewed-by: ', col.GREEN, newline=False), + next(lines)) + self.assertEqual(terminal.PrintLine(self.joe, col.WHITE), next(lines)) + + self.assertEqual(terminal.PrintLine('Review: %s' % self.joe, col.RED), + next(lines)) + self.assertEqual(terminal.PrintLine(' Hi Fred,', None), next(lines)) + self.assertEqual(terminal.PrintLine('', None), next(lines)) + self.assertEqual(terminal.PrintLine(' > File: file.c', col.MAGENTA), + next(lines)) + self.assertEqual(terminal.PrintLine(' > Some code', col.MAGENTA), + next(lines)) + self.assertEqual(terminal.PrintLine(' > and more code', col.MAGENTA), + next(lines)) + self.assertEqual(terminal.PrintLine( + ' Here is my comment above the above...', None), next(lines)) + self.assertEqual(terminal.PrintLine('', None), next(lines)) + + self.assertEqual(terminal.PrintLine(' 2 Subject 2', col.BLUE), + next(lines)) + self.assertEqual( + terminal.PrintLine(' + Reviewed-by: ', col.GREEN, newline=False), + next(lines)) + self.assertEqual(terminal.PrintLine(self.fred, col.WHITE), + next(lines)) + self.assertEqual( + terminal.PrintLine(' + Reviewed-by: ', col.GREEN, newline=False), + next(lines)) + self.assertEqual(terminal.PrintLine(self.mary, col.WHITE), + next(lines)) + self.assertEqual( + terminal.PrintLine(' + Tested-by: ', col.GREEN, newline=False), + next(lines)) + self.assertEqual(terminal.PrintLine(self.leb, col.WHITE), + next(lines)) + + self.assertEqual(terminal.PrintLine('Review: %s' % self.fred, col.RED), + next(lines)) + self.assertEqual(terminal.PrintLine(' Hi Fred,', None), next(lines)) + self.assertEqual(terminal.PrintLine('', None), next(lines)) + self.assertEqual(terminal.PrintLine( + ' > File: tools/patman/commit.py', col.MAGENTA), next(lines)) + self.assertEqual(terminal.PrintLine( + ' > Line: 41 / 41: class Commit:', col.MAGENTA), next(lines)) + self.assertEqual(terminal.PrintLine( + ' > + return self.subject', col.MAGENTA), next(lines)) + self.assertEqual(terminal.PrintLine( + ' > +', col.MAGENTA), next(lines)) + self.assertEqual( + terminal.PrintLine(' > def AddChange(self, version, info):', + col.MAGENTA), + next(lines)) + self.assertEqual(terminal.PrintLine( + ' > """Add a new change line to the change list for a version.', + col.MAGENTA), next(lines)) + self.assertEqual(terminal.PrintLine( + ' >', col.MAGENTA), next(lines)) + self.assertEqual(terminal.PrintLine( + ' A comment', None), next(lines)) + self.assertEqual(terminal.PrintLine('', None), next(lines)) + + self.assertEqual(terminal.PrintLine( + '4 new responses available in patchwork (use -d to write them to a new branch)', + None), next(lines)) diff --git a/tools/patman/main.py b/tools/patman/main.py index 8f139a6e3ba..c7f425522b2 100755 --- a/tools/patman/main.py +++ b/tools/patman/main.py @@ -92,6 +92,8 @@ AddCommonArgs(test_parser) status = subparsers.add_parser('status', help='Check status of patches in patchwork') +status.add_argument('-C', '--show-comments', action='store_true', + help='Show comments from each patch') status.add_argument('-d', '--dest-branch', type=str, help='Name of branch to create with collected responses') status.add_argument('-f', '--force', action='store_true', @@ -171,7 +173,8 @@ elif args.cmd == 'status': ret_code = 0 try: control.patchwork_status(args.branch, args.count, args.start, args.end, - args.dest_branch, args.force) + args.dest_branch, args.force, + args.show_comments) except Exception as e: terminal.Print('patman: %s: %s' % (type(e).__name__, e), colour=terminal.Color.RED) diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py index 9dc3b29216d..d8dcf8c4561 100644 --- a/tools/patman/patchstream.py +++ b/tools/patman/patchstream.py @@ -89,11 +89,12 @@ class PatchStream: self.blank_count = 0 # Number of blank lines stored up self.state = STATE_MSG_HEADER # What state are we in? self.commit = None # Current commit - self.snippets = [] # List of unquoted test blocks + # List of unquoted test blocks, each a list of str lines + self.snippets = [] self.cur_diff = None # Last 'diff' line seen (str) self.cur_line = None # Last context (@@) line seen (str) - self.recent_diff= None # 'diff' line for current snippet (str) - self.recent_line= None # '@@' line for current snippet (str) + self.recent_diff = None # 'diff' line for current snippet (str) + self.recent_line = None # '@@' line for current snippet (str) self.recent_quoted = collections.deque([], 5) self.recent_unquoted = queue.Queue() self.was_quoted = None diff --git a/tools/patman/status.py b/tools/patman/status.py index f3a654160ec..a369d655c5e 100644 --- a/tools/patman/status.py +++ b/tools/patman/status.py @@ -3,8 +3,9 @@ # Copyright 2020 Google LLC # """Talks to the patchwork service to figure out what patches have been reviewed -and commented on. Allows creation of a new branch based on the old but with the -review tags collected from patchwork. +and commented on. Provides a way to display review tags and comments. +Allows creation of a new branch based on the old but with the review tags +collected from patchwork. """ import collections @@ -124,6 +125,25 @@ class Patch(dict): self.seq = 1 self.count = 1 + +class Review: + """Represents a single review email collected in Patchwork + + Patches can attract multiple reviews. Each consists of an author/date and + a variable number of 'snippets', which are groups of quoted and unquoted + text. + """ + def __init__(self, meta, snippets): + """Create new Review object + + Args: + meta (str): Text containing review author and date + snippets (list): List of snippets in th review, each a list of text + lines + """ + self.meta = ' : '.join([line for line in meta.splitlines() if line]) + self.snippets = snippets + def compare_with_series(series, patches): """Compare a list of patches with a series it came from @@ -241,7 +261,8 @@ def collect_patches(series, series_id, rest_api=call_rest_api): patches = sorted(patches, key=lambda x: x.seq) return patches -def find_new_responses(new_rtag_list, seq, cmt, patch, rest_api=call_rest_api): +def find_new_responses(new_rtag_list, review_list, seq, cmt, patch, + rest_api=call_rest_api): """Find new rtags collected by patchwork that we don't know about This is designed to be run in parallel, once for each commit/patch @@ -252,6 +273,9 @@ def find_new_responses(new_rtag_list, seq, cmt, patch, rest_api=call_rest_api): key: Response tag (e.g. 'Reviewed-by') value: Set of people who gave that response, each a name/email string + review_list (list): New reviews are written to review_list[seq] + list, each a + List of reviews for the patch, each a Review seq (int): Position in new_rtag_list to update cmt (Commit): Commit object for this commit patch (Patch): Corresponding Patch object for this patch @@ -271,8 +295,13 @@ def find_new_responses(new_rtag_list, seq, cmt, patch, rest_api=call_rest_api): data = rest_api('patches/%s/comments/' % patch.id) + reviews = [] for comment in data: pstrm = PatchStream.process_text(comment['content'], True) + if pstrm.snippets: + submitter = comment['submitter'] + person = '%s <%s>' % (submitter['name'], submitter['email']) + reviews.append(Review(person, pstrm.snippets)) for response, people in pstrm.commit.rtags.items(): rtags[response].update(people) @@ -286,6 +315,7 @@ def find_new_responses(new_rtag_list, seq, cmt, patch, rest_api=call_rest_api): if is_new: new_rtags[tag].add(who) new_rtag_list[seq] = new_rtags + review_list[seq] = reviews def show_responses(rtags, indent, is_new): """Show rtags collected @@ -302,8 +332,9 @@ def show_responses(rtags, indent, is_new): """ col = terminal.Color() count = 0 - for tag, people in rtags.items(): - for who in people: + for tag in sorted(rtags.keys()): + people = rtags[tag] + for who in sorted(people): terminal.Print(indent + '%s %s: ' % ('+' if is_new else ' ', tag), newline=False, colour=col.GREEN, bright=is_new) terminal.Print(who, colour=col.WHITE, bright=is_new) @@ -376,7 +407,8 @@ def create_branch(series, new_rtag_list, branch, dest_branch, overwrite, return num_added def check_patchwork_status(series, series_id, branch, dest_branch, force, - rest_api=call_rest_api, test_repo=None): + show_comments, rest_api=call_rest_api, + test_repo=None): """Check the status of a series on Patchwork This finds review tags and comments for a series in Patchwork, displaying @@ -388,6 +420,7 @@ def check_patchwork_status(series, series_id, branch, dest_branch, force, branch (str): Existing branch to update, or None dest_branch (str): Name of new branch to create, or None force (bool): True to force overwriting dest_branch if it exists + show_comments (bool): True to show the comments on each patch rest_api (function): API function to call to access Patchwork, for testing test_repo (pygit2.Repository): Repo to use (use None unless testing) @@ -396,6 +429,7 @@ def check_patchwork_status(series, series_id, branch, dest_branch, force, col = terminal.Color() count = len(series.commits) new_rtag_list = [None] * count + review_list = [None] * count patch_for_commit, _, warnings = compare_with_series(series, patches) for warn in warnings: @@ -405,8 +439,8 @@ def check_patchwork_status(series, series_id, branch, dest_branch, force, with concurrent.futures.ThreadPoolExecutor(max_workers=16) as executor: futures = executor.map( - find_new_responses, repeat(new_rtag_list), range(count), - series.commits, patch_list, repeat(rest_api)) + find_new_responses, repeat(new_rtag_list), repeat(review_list), + range(count), series.commits, patch_list, repeat(rest_api)) for fresponse in futures: if fresponse: raise fresponse.exception() @@ -425,6 +459,15 @@ def check_patchwork_status(series, series_id, branch, dest_branch, force, indent = ' ' * 2 show_responses(base_rtags, indent, False) num_to_add += show_responses(new_rtags, indent, True) + if show_comments: + for review in review_list[seq]: + terminal.Print('Review: %s' % review.meta, colour=col.RED) + for snippet in review.snippets: + for line in snippet: + quoted = line.startswith('>') + terminal.Print(' %s' % line, + colour=col.MAGENTA if quoted else None) + terminal.Print() terminal.Print("%d new response%s available in patchwork%s" % (num_to_add, 's' if num_to_add != 1 else '',