From nobody Sat May 4 11:47:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1574274800; cv=none; d=zoho.com; s=zohoarc; b=H8ERb81KYndlBD838rXauUk1cllXkPa08ozzHdftkL7GCpIM28AwmRozBRB/UB6S6rnTm2VEFyaHiPxfOXGBtxLXpa+Jj7fYex26vVQYl1AOoQu+5JkDdRGpu3MACUCVd00fSM9TBMhZJalZywSoizbgJgzM5eNhah2d0pHSWTI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574274800; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=whsl2KRNt1g8grAxtNWtxKEwRd9aVjF1pSRkCANbKX0=; b=ROgDEhH5vo279GjYrdUYtdt9ZbepBn/txCfa1qN+f0XYBB3slaF5zewBPOHPLp2daqAgC9j9M5y9aKiO/sBcvyq7ZYkYpi6V0kkn64j/Jf5dxYzd1eSTSGJ8eldE1vUi2xgJtIQC4uL6gg6F5h0xXgM6nnjaXSrN9kCHAe2fWEA= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1574274800469340.32802150843906; Wed, 20 Nov 2019 10:33:20 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-217-SC6wBTOwMaKn3JzmFU4VCg-1; Wed, 20 Nov 2019 13:33:16 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 582E780268B; Wed, 20 Nov 2019 18:33:10 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 297CD6BF98; Wed, 20 Nov 2019 18:33:10 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id D5C7F4E566; Wed, 20 Nov 2019 18:33:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAKIWrPL013462 for ; Wed, 20 Nov 2019 13:32:53 -0500 Received: by smtp.corp.redhat.com (Postfix) id 763E551B6C; Wed, 20 Nov 2019 18:32:53 +0000 (UTC) Received: from icr.redhat.com (unknown [10.43.2.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id EACB551B65 for ; Wed, 20 Nov 2019 18:32:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574274799; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=whsl2KRNt1g8grAxtNWtxKEwRd9aVjF1pSRkCANbKX0=; b=Vg5gt0SsV2UOmn9FwrSJ2hzE5hMPzfM9tNGyOyTrMdjCKZccoktL/BD7OMwtoPAM4K8jyV +fiQoUbi9f0uPsBc+d9FTKERlbO91TFlBnNFunkrpsAqA9RkwFEFPBWSVHWiqC31TSeEc0 gKQ7rxbCWwLJx0TocXP22dqPSb9tK4o= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Wed, 20 Nov 2019 19:32:44 +0100 Message-Id: <9e14d339365355208549c6edee02a6d16ea6cf85.1574274649.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/3] scripts: speedup prohibit-duplicate-header X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: SC6wBTOwMaKn3JzmFU4VCg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Running regular expressions with capture groups is expensive. Bail out early if the line does not start with a '#'. This reduces the runtime of the check by two thirds. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Daniel Henrique Barboza Reviewed-by: Erik Skultety --- scripts/prohibit-duplicate-header.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/prohibit-duplicate-header.py b/scripts/prohibit-duplic= ate-header.py index dfdfa0bf0b..420311ccef 100644 --- a/scripts/prohibit-duplicate-header.py +++ b/scripts/prohibit-duplicate-header.py @@ -30,6 +30,10 @@ def check_file(filename): for line in fh: lineno =3D lineno + 1 =20 + # skip non-matching lines early + if line[0] !=3D '#': + continue + headermatch =3D re.search(r'''^# *include *[<"]([^>"]*\.h)[">]= ''', line) if headermatch is not None: inc =3D headermatch.group(1) --=20 2.19.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 11:47:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1574274790; cv=none; d=zoho.com; s=zohoarc; b=XFutuEwt0IsdYoHm2Q0IUL2ZnVtSgdTowMofOyCy48pWvEfOjHR+oDXX6pE/C0dCpo98ruLCZNyXJjuMcPyxwE2mA9YL9K7RiavX/dzQyNoSHQYnTJF1cqv8MV7U0PRJGDiGsLGIHx3j0RHSrdlDgw3lJ+QZ52cMYERa127xUYA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574274790; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=hrEx3pLbcKJhjeSCY/G7O0EElJohIXjlAIR1HzPYYso=; b=AyWGKEXmy8WVwmY4uKJiUIEZ42l0EZolmjivrzH6WoFU8OS7Wz226jF7BaLZU6VKR3ECJ6klsIg7fzQoLIopna7NjTkcdmpGU/nWLV+3oJHV4yp80z/hJzrBIT8gKFk2xW2nwUvrgCJKgL66yOSdbTjWVDZY5oqP1cm7YQfG1c8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1574274790002103.89842083469716; Wed, 20 Nov 2019 10:33:10 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-172-nHkA17rUNhqdfnqO0lDeNA-1; Wed, 20 Nov 2019 13:33:05 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2E45D107ACC7; Wed, 20 Nov 2019 18:33:00 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AAA5360BBF; Wed, 20 Nov 2019 18:32:58 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5A45618089CD; Wed, 20 Nov 2019 18:32:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAKIWsrr013468 for ; Wed, 20 Nov 2019 13:32:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id 498B151B6C; Wed, 20 Nov 2019 18:32:54 +0000 (UTC) Received: from icr.redhat.com (unknown [10.43.2.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id C3CF651B65 for ; Wed, 20 Nov 2019 18:32:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574274788; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=hrEx3pLbcKJhjeSCY/G7O0EElJohIXjlAIR1HzPYYso=; b=OOnYgPS71Yy8vHTJ9cMjc5QSShU3SnKZ/LPNmRAeZQXIaOBzxJi7P0Abx9aN/ZjzPqLj9e aLDUM8Ts6FbmGEEb5w/TCOUXh1mcf4Kw/b+K1h/BPZ24xuoYuqJkF9ZvF4Fk0l1b1Bkw84 JByYGwvXiQADsAlN+kwqaUHg17VUvw4= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Wed, 20 Nov 2019 19:32:45 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/3] scripts: check-aclrules: use in instead of find X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: nHkA17rUNhqdfnqO0lDeNA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" For checking whether a substring is present in a string, using the pattern: "str" in string is slightly faster than: string.find("str") !=3D -1 Use it to shave off 4 % of the runtime of this script that processes quite a few long source files. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Daniel Henrique Barboza Reviewed-by: Erik Skultety --- scripts/check-aclrules.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/check-aclrules.py b/scripts/check-aclrules.py index e06a019b00..d145e59164 100755 --- a/scripts/check-aclrules.py +++ b/scripts/check-aclrules.py @@ -97,7 +97,7 @@ def fixup_name(name): =20 def name_to_ProcName(name): elems =3D [] - if name.find("_") !=3D -1 or name.lower() in ["open", "close"]: + if "_" in name or name.lower() in ["open", "close"]: elems =3D [n.lower().capitalize() for n in name.split("_")] else: elems =3D [name] @@ -116,11 +116,11 @@ with open(proto, "r") as fh: filtered =3D False =20 for line in fh: - if line.find("/**") !=3D -1: + if "/**" in line: incomment =3D True filtered =3D False elif incomment: - if line.find("* @aclfilter") !=3D -1: + if "* @aclfilter" in line: filtered =3D True elif filtered: m =3D re.search(r'''REMOTE_PROC_(.*)\s+=3D\s*\d+''', line) @@ -211,7 +211,7 @@ def process_file(filename): # an ACL function if intable: assign =3D re.search(r'''\.(\w+)\s*=3D\s*(\w+),?''', line) - if line.find("}") !=3D -1: + if "}" in line: intable =3D False table =3D None elif assign is not None: @@ -247,9 +247,9 @@ def process_file(filename): intable =3D True table =3D name =20 - if line.find("{") !=3D -1: + if "{" in line: brace =3D brace + 1 - if line.find("}") !=3D -1: + if "}" in line: brace =3D brace - 1 =20 return errs --=20 2.19.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 11:47:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1574274799; cv=none; d=zoho.com; s=zohoarc; b=oZQR2tPHCjIyoLrUgKTCaHjP+b0slxw1nA9XxtgoKJNCu59jimXic8+U7P64xSJ7BYqA0IHZTXpvgqFAzt7qBHE7K4zEKhdaVVcp3qGMe4R55KAKyhkC5IzkfLya3iPNoI/91Dsbb5EdmCpp4v+sBI6IGGdxrbkJVnsNOEgL5xk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574274799; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=C7+EJkS9E6zGeDt1Yxcscw4ZZq30+dPfy5pyyrTM7RM=; b=TLdhfd5xc5pMkbVhzSLB5FklPxg3rWYDsq1OkYCbgPMWw2IxjLfWUdATGXh3be9eK06sCiZpFH1HQAFMnLOGiK0oH7y+yis6yoi4nUQgaiRm3nWi+xB9oXrOZxkvx0o+OY7XwHY8/HBOGy5JA5H7O5pCoAjAGcoGkiXno8cLW/w= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 15742747999291000.7340040975748; Wed, 20 Nov 2019 10:33:19 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-323-90xEnGqNOIS5y14RefJFgg-1; Wed, 20 Nov 2019 13:33:16 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 536E6107ACCD; Wed, 20 Nov 2019 18:33:10 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 27A4E5F916; Wed, 20 Nov 2019 18:33:10 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id CE5174E562; Wed, 20 Nov 2019 18:33:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAKIWtU4013477 for ; Wed, 20 Nov 2019 13:32:55 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1C60D51B6C; Wed, 20 Nov 2019 18:32:55 +0000 (UTC) Received: from icr.redhat.com (unknown [10.43.2.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9786651B65 for ; Wed, 20 Nov 2019 18:32:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574274798; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=C7+EJkS9E6zGeDt1Yxcscw4ZZq30+dPfy5pyyrTM7RM=; b=H5vK6WrphAFLI8EHi1DPaJ4xTuL90SLDMsZZgQSF1JjvTBdpHvwc4SN+GvIhQTBA1OQzMT ZnreCGT2WQyYikIZ4YLDuhYY+NAwjS8BGNrhpq7V6Chx0Y9s/w804C0Y4Kno6rHKQl2TOk stSdzUd9qm4xiXMKLv+kij2uJ4NSR+Q= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Wed, 20 Nov 2019 19:32:46 +0100 Message-Id: <8a358f27b109957b3a031223e83754d16585cb1d.1574274649.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/3] scripts: check-aclrules: use regular expressions less often X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: 90xEnGqNOIS5y14RefJFgg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Use a simple if "substr" in line before running a regular expression, which saves time, especially if the regex has a capture group. This reduces runtime of the check by almost 78 % for me. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Daniel Henrique Barboza Reviewed-by: Erik Skultety --- scripts/check-aclrules.py | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/scripts/check-aclrules.py b/scripts/check-aclrules.py index d145e59164..40c47c1c6b 100755 --- a/scripts/check-aclrules.py +++ b/scripts/check-aclrules.py @@ -150,13 +150,21 @@ def process_file(filename): # Looks for anything which appears to be a function # body name. Doesn't matter if we pick up bogus stuff # here, as long as we don't miss valid stuff - m =3D re.search(r'''\b(\w+)\(''', line) + m =3D None + if "(" in line: + m =3D re.search(r'''\b(\w+)\(''', line) if m is not None: maybefunc =3D m.group(1) elif brace > 0: - ensureacl =3D re.search(r'''(\w+)EnsureACL''', line) - checkacl =3D re.search(r'''(\w+)CheckACL''', line) - stub =3D re.search(r'''\b(\w+)\(''', line) + ensureacl =3D None + checkacl =3D None + stub =3D None + if "EnsureACL" in line: + ensureacl =3D re.search(r'''(\w+)EnsureACL''', line) + if "CheckACL" in line: + checkacl =3D re.search(r'''(\w+)CheckACL''', line) + if "(" in line: + stub =3D re.search(r'''\b(\w+)\(''', line) if ensureacl is not None: # Record the fact that maybefunc contains an # ACL call, and make sure it is the right call! @@ -210,7 +218,9 @@ def process_file(filename): # every func listed there, has an impl which calls # an ACL function if intable: - assign =3D re.search(r'''\.(\w+)\s*=3D\s*(\w+),?''', line) + assign =3D None + if '"' in line: + assign =3D re.search(r'''\.(\w+)\s*=3D\s*(\w+),?''', l= ine) if "}" in line: intable =3D False table =3D None @@ -237,8 +247,10 @@ def process_file(filename): file=3Dsys.stderr) errs =3D True else: - m =3D re.search(r'''^(?:static\s+)?(vir(?:\w+)?Driver)\s+'= '', - line) + m =3D None + if "Driver" in line: + m =3D re.search(r'''^(?:static\s+)?(vir(?:\w+)?Driver)= \s+''', + line) if m is not None: name =3D m.group(1) if name not in ["virNWFilterCallbackDriver", --=20 2.19.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 11:47:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1574277409; cv=none; d=zoho.com; s=zohoarc; b=Vd/slDMQUbkBKlMhpyHoARi6uzGkrd7FiMU1R2gvDcHYJVKsMi7e5rRf3ucmcGmQQmeNeenjpjOpKXoOm7dtSMHomJkX1gn9d/SuSI15ygKVI+hhQi5jRv6hgl23Gub/equP4u+D4mRajHLLTqxwyVuv9g5lewKBBsNxF4gUJEs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574277409; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Q1KGsVsr3F9n6C81zrAjTC5FuMojycwNcaRIVUHbJyA=; b=JyVCGH6P8KEahTO8laotAtnHNQmeSgdTHEllGOgFobtKEJab5MXYU24ImQgI638mkjjkZWCcsLdvbwdS52gSa8UmBfRWNU2h579gdKdvso93sc3LOHujoqk19QgwMfzJVeKHQO53ilsX0zp3uIBM+RztXdjta0D4cdKmsZmwoYU= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1574277409106532.9893381432836; Wed, 20 Nov 2019 11:16:49 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-305-T82kQyTKMLWRdYi05OmrFw-1; Wed, 20 Nov 2019 14:16:45 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0BA3F801E5B; Wed, 20 Nov 2019 19:16:38 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D0F6F67661; Wed, 20 Nov 2019 19:16:36 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C0BD318089CD; Wed, 20 Nov 2019 19:16:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAKJGXCH015205 for ; Wed, 20 Nov 2019 14:16:33 -0500 Received: by smtp.corp.redhat.com (Postfix) id 27A9251C5E; Wed, 20 Nov 2019 19:16:33 +0000 (UTC) Received: from icr.redhat.com (unknown [10.43.2.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id A2F6D68425 for ; Wed, 20 Nov 2019 19:16:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574277407; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Q1KGsVsr3F9n6C81zrAjTC5FuMojycwNcaRIVUHbJyA=; b=X7JhNkbL2GG3KT19CrK6dn2bPuOTlvLop3B/rWJ6x06HRvZNxvrjgjPAaRRE0WwrOAkV7S QZwIRqHUTuoQr73wf2LgScvU3VtyXbiC7M//jEZzCwGehKE7U/EDjD5P2z7L9GEaqoQ+Rd j+au8sFt1zRBtTKtmcAtTKC6Oz3fraE= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Wed, 20 Nov 2019 20:16:27 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/3] scripts: use in even more X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: T82kQyTKMLWRdYi05OmrFw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: J=C3=A1n Tomko Reviewed-by: Daniel Henrique Barboza Reviewed-by: Erik Skultety --- scripts/check-aclrules.py | 2 +- scripts/check-driverimpls.py | 2 +- scripts/check-symfile.py | 6 +++--- scripts/dtrace2systemtap.py | 4 ++-- scripts/genpolkit.py | 4 ++-- scripts/gensystemtap.py | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/check-aclrules.py b/scripts/check-aclrules.py index 40c47c1c6b..1a76ebcb3b 100755 --- a/scripts/check-aclrules.py +++ b/scripts/check-aclrules.py @@ -128,7 +128,7 @@ with open(proto, "r") as fh: api =3D name_to_ProcName(m.group(1)) # Event filtering is handled in daemon/remote.c # instead of drivers - if line.find("_EVENT_REGISTER") =3D=3D -1: + if "_EVENT_REGISTER" not in line: filteredmap[api] =3D True incomment =3D False =20 diff --git a/scripts/check-driverimpls.py b/scripts/check-driverimpls.py index ca7ec3af7f..bc3f16a816 100755 --- a/scripts/check-driverimpls.py +++ b/scripts/check-driverimpls.py @@ -33,7 +33,7 @@ def checkdriverimpls(filename): for line in fh: lineno =3D lineno + 1 if intable: - if line.find("}") !=3D -1: + if "}" in line: intable =3D False mainprefix =3D None continue diff --git a/scripts/check-symfile.py b/scripts/check-symfile.py index a543a0fbcd..0c02591991 100755 --- a/scripts/check-symfile.py +++ b/scripts/check-symfile.py @@ -36,9 +36,9 @@ ret =3D 0 with open(symfile, "r") as fh: for line in fh: line =3D line.strip() - if line.find("{") !=3D -1: + if "{" in line: continue - if line.find("}") !=3D -1: + if "}" in line: continue if line in ["global:", "local:"]: continue @@ -46,7 +46,7 @@ with open(symfile, "r") as fh: continue if line[0] =3D=3D '#': continue - if line.find("*") !=3D -1: + if "*" in line: continue =20 line =3D line.strip(";") diff --git a/scripts/dtrace2systemtap.py b/scripts/dtrace2systemtap.py index 922713e599..cf4d8e1a79 100755 --- a/scripts/dtrace2systemtap.py +++ b/scripts/dtrace2systemtap.py @@ -49,9 +49,9 @@ with open(dtrace, "r") as fh: line =3D line.strip() if line =3D=3D "": continue - if line.find("provider ") !=3D -1 and line.find("{") !=3D -1: + if "provider " in line and "{" in line: continue - if line.find("};") !=3D -1: + if "};" in line: continue =20 if line.startswith("#"): diff --git a/scripts/genpolkit.py b/scripts/genpolkit.py index 0cdba2bd3c..230d920f70 100755 --- a/scripts/genpolkit.py +++ b/scripts/genpolkit.py @@ -55,13 +55,13 @@ aclfile =3D sys.argv[1] with open(aclfile, "r") as fh: for line in fh: if in_opts: - if line.find("*/") !=3D -1: + if "*/" in line: in_opts =3D False else: m =3D re.search(r'''\*\s*\@(\w+):\s*(.*?)\s*$''', line) if m is not None: opts[m.group(1)] =3D m.group(2) - elif line.find("**") !=3D -1: + elif "**" in line: in_opts =3D True else: m =3D re.search(r'''VIR_ACCESS_PERM_(%s)_((?:\w|_)+),''' % diff --git a/scripts/gensystemtap.py b/scripts/gensystemtap.py index c4bc1620d0..7b391cc911 100755 --- a/scripts/gensystemtap.py +++ b/scripts/gensystemtap.py @@ -46,7 +46,7 @@ def load_file(fh): instatus =3D True elif re.search(r'''enum remote_auth_type''', line): inauth =3D True - elif line.find("}") !=3D -1: + elif "}" in line: intype =3D False instatus =3D False inauth =3D False --=20 2.19.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list