From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E1B9C45BD2; Fri, 25 Oct 2024 09:04:39 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2F6E3402CA; Fri, 25 Oct 2024 09:04:39 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 9FAB1402C6 for ; Fri, 25 Oct 2024 09:04:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729839877; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gJDkFmKvEcu2GTP21jbcClSOsSQYwcEcyiw3Bipf574=; b=eL1giYxIP6zX2qA2fBmH0XOAwiAaC4Oq26Rke1KLAzTo9vnhOhxuer/25PBWXlfUBgNUcF 7nSZ+1vt90InCy/4gk4JbfFnpGZqscojgmTuprwZJVBIAlcVCKgZDR3JRKQJtUzcfDcpQu e6tKBQg485tz3l8DlgRRp0jomb4kIOE= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-335-CLG5xFhQOdyoFjQXN7Izsw-1; Fri, 25 Oct 2024 03:04:36 -0400 X-MC-Unique: CLG5xFhQOdyoFjQXN7Izsw-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 87165195608A; Fri, 25 Oct 2024 07:04:34 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.224.57]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5BED71956056; Fri, 25 Oct 2024 07:04:32 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: thomas@monjalon.net, ferruh.yigit@amd.com, stephen@networkplumber.org, mattias.ronnblom@ericsson.com Subject: [PATCH v2 1/6] devtools: handle multiple pattern for skipping files Date: Fri, 25 Oct 2024 09:04:18 +0200 Message-ID: <20241025070424.3916007-2-david.marchand@redhat.com> In-Reply-To: <20241025070424.3916007-1-david.marchand@redhat.com> References: <20241024120535.2722316-1-david.marchand@redhat.com> <20241025070424.3916007-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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 We may want to skip multiple patterns when forbidding use of some expression. Signed-off-by: David Marchand --- devtools/check-forbidden-tokens.awk | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/devtools/check-forbidden-tokens.awk b/devtools/check-forbidden-tokens.awk index 59b1121090..28d32fc086 100755 --- a/devtools/check-forbidden-tokens.awk +++ b/devtools/check-forbidden-tokens.awk @@ -10,6 +10,7 @@ BEGIN { split(FOLDERS,deny_folders," "); split(EXPRESSIONS,deny_expr," "); + split(SKIP_FILES,skip_files," "); in_file=0; in_comment=0; count=0; @@ -56,14 +57,22 @@ BEGIN { } count = 0 for (i in deny_folders) { - re = "^\\+\\+\\+ b/" deny_folders[i]; - if ($0 ~ re) { - # Check only if the files are not part of SKIP_FILES - if (!(length(SKIP_FILES) && ($re ~ SKIP_FILES))) { - in_file = 1 - last_file = $0 + if (!($0 ~ "^\\+\\+\\+ b/" deny_folders[i])) { + continue + } + skip = 0 + for (j in skip_files) { + if (!($0 ~ "^\\+\\+\\+ b/" skip_files[j])) { + continue } + skip = 1 + break + } + if (skip == 0) { + in_file = 1 + last_file = $0 } + break } } END { -- 2.46.2