From patchwork Wed Nov 9 17:09:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 119625 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5DA95A034C; Wed, 9 Nov 2022 18:09:50 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 06242410EF; Wed, 9 Nov 2022 18:09:46 +0100 (CET) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by mails.dpdk.org (Postfix) with ESMTP id 0307D400D4 for ; Wed, 9 Nov 2022 18:09:44 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id B11A55C0215; Wed, 9 Nov 2022 12:09:43 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Wed, 09 Nov 2022 12:09:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:sender:subject:subject:to:to; s=fm1; t=1668013783; x=1668100183; bh=kXwezEbUdQawBCOjEbQIO9J02 f2/1lzoIWX/WQwNyxc=; b=hAgULuSSNCliv62Rw+ANJRmT/ceyTP0ChFUAenfTY oycStrRegy4Uif8T0zm8ren9DDDtljgtSdQJH6QSHLmojAm+Ia3PNer6zs1UZ2k8 5xLz4v7LPyNeQ6ARymT9+N+02/KMHBr18YssRHCGlZmNSb2lQkFGsxsm7IvRPce+ pYVPiy5L7sF4pSYIMMuiipOrhxJeN8Ilhp+7LgqFBSA7MC8+Kh0akh1p66SKtq7Q xAk6A7h20zTMR4uUdvQ2k9oBp8Df5UmBobxRJoQ8Oz4XhWGDEGRRHpM/eFcqdVSH iLa9Jhz8HnNSuRgF+v2sEOFtcsbaosrkhpxP/dStM+MkA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1668013783; x=1668100183; bh=kXwezEbUdQawBCOjEbQIO9J02f2/1lzoIWX /WQwNyxc=; b=S67TktxYjXFrVdi9nzVEHNl6rCJTjAq5ATHNt20EOlKRQqVOBmJ Joqb+LchR5PU84x7Jdw161VeHxTEl509BdCs9Bm44R9aWEOWsxfiQZKfftKqgTFb bIOyYDXo3uz3AFPWLYHGGVeJvDxnMtEaViq8H2lUSkLP/olV08MQrcMNIaBxdb8S 4rudWiIjIzM7pdc9/RFf9+4533qnJWwbkFIFeoV0Gfe6HfDAKqTz4KBt8/wxGSLQ DCQcUIw47QrSH8CdJbecW6Xlv85OA7GcLyEbn1DoK5mK8qeQgC19ewu/fRInWWtS 5emgNO0Pq7pXVBLjDzdyW8sNfke1HoeNXyg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrfedvgdeljecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgrshcu ofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecuggftrf grthhtvghrnhepveevfeevieeihfetudekgeekleeigeffueekveduteeuffeiudevteei udekfeelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Feedback-ID: i47234305:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 9 Nov 2022 12:09:42 -0500 (EST) From: Thomas Monjalon To: dev@dpdk.org Cc: juraj.linkes@pantheon.tech, Lijuan Tu , Owen Hilyard Subject: [PATCH] devtools: set DTS directory to format check Date: Wed, 9 Nov 2022 18:09:21 +0100 Message-Id: <20221109170921.625192-1-thomas@monjalon.net> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The script was running on the current directory. If not in the DTS directory, it would re-format every Python files. A new positional argument is added to specify the directory to check. In most cases, the (new) default value should be enough. While updating argument handling, the usage is printed in case of wrong argument. Signed-off-by: Thomas Monjalon Reviewed-by: Owen Hilyard Reviewed-by: Juraj Linkeš Tested-by: Juraj Linkeš --- devtools/dts-check-format.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/devtools/dts-check-format.sh b/devtools/dts-check-format.sh index dc07150775..eb1bdd2a01 100755 --- a/devtools/dts-check-format.sh +++ b/devtools/dts-check-format.sh @@ -3,11 +3,10 @@ # Copyright(c) 2022 University of New Hampshire usage() { - echo "Run formatting and linting programs for DTS. Usage:" - + echo 'Usage: $(basename $0) [options] [directory]' + echo 'Options:' # Get source code comments after getopts arguments and print them both grep -E '[a-zA-Z]+\) +#' "$0" | tr -d '#' - exit 0 } format=true @@ -17,7 +16,9 @@ lint=true while getopts "hfl" arg; do case $arg in h) # Display this message + echo 'Run formatting and linting programs for DTS.' usage + exit 0 ;; f) # Don't run formatters format=false @@ -25,10 +26,15 @@ while getopts "hfl" arg; do l) # Don't run linter lint=false ;; - *) + ?) + usage + exit 1 esac done +shift $(($OPTIND - 1)) +directory=${1:-$(dirname $0)/../dts} +cd $directory || exit 1 errors=0