From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 520ABC11F64 for ; Thu, 1 Jul 2021 14:10:38 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 01FC5613FE for ; Thu, 1 Jul 2021 14:10:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 01FC5613FE Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.148707.274840 (Exim 4.92) (envelope-from ) id 1lyxOi-0006Kh-Ns; Thu, 01 Jul 2021 14:10:32 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 148707.274840; Thu, 01 Jul 2021 14:10:32 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lyxOi-0006KQ-K6; Thu, 01 Jul 2021 14:10:32 +0000 Received: by outflank-mailman (input) for mailman id 148707; Thu, 01 Jul 2021 14:10:31 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lyxOg-0005tj-Vv for xen-devel@lists.xenproject.org; Thu, 01 Jul 2021 14:10:31 +0000 Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 55f3a9fb-720c-452f-92ed-fae6b830b800; Thu, 01 Jul 2021 14:10:28 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 55f3a9fb-720c-452f-92ed-fae6b830b800 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1625148628; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WNQw53D2CBl7IfW7DXoevzSfofTFknY56S4ZzC5yIeA=; b=I088QyBYbmJgARWg3Rl1kWwYGKh6OVysOFfctpmQYsAubBdFIKYgeTnm ZlQdcg2xM0y3FfYb4JNNyqZN5ibFk1BE7nn9S7xc6uV+sROVx3m/pZbiE +SBh5maz81JC7ojjj7EyO7Pl02efi6Of4zPCe12jcxA2Y9W1SyEO2aAWn A=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: R+4i4GvhQ/bsJUtm/f25GRNBFTY3QnEzZIDpOXXFfnM5XPyNmcnKTNMALl1I858HTbrVLZVixL FgY6jes9ShraMHqbhQlMzSz8xTfRFUc9jB7H1cETWgAamV0+K9rrCleR8qbkJ0a0BRdAQ9eYaP nUvRrZOqNNPCZlfHQPUvTRpOcY27WfA4TJ5l//hJnCFFvDQvJ2gox59VU6cgAH4FAwStzGRh0f IvuCpRqKjohQzU3SLVpZMJktlV2zWnSMmKVSs5/fCBnhAyBheMMWULR8HDZNLd5afZ0WMwzF3W Izk= X-SBRS: 5.1 X-MesageID: 47093323 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED IronPort-HdrOrdr: A9a23:fExu1qhU81WMd6RejdhUkxV2BnBQXuIji2hC6mlwRA09TySZ// rBoB19726TtN9xYgBZpTnuAsm9qB/nmaKdpLNhWItKPzOW31dATrsSjrcKqgeIc0aVm9K1l5 0QF5SWYOeAdGSS5vya3ODXKbkdKaG8gcKVuds= X-IronPort-AV: E=Sophos;i="5.83,314,1616472000"; d="scan'208";a="47093323" From: Anthony PERARD To: CC: Anthony PERARD , Jan Beulich , Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu Subject: [XEN PATCH v6 07/31] build,include: rework compat-build-source.py Date: Thu, 1 Jul 2021 15:09:47 +0100 Message-ID: <20210701141011.785641-8-anthony.perard@citrix.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210701141011.785641-1-anthony.perard@citrix.com> References: <20210701141011.785641-1-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain Improvement are: - give the path to xlat.lst as argument - include `grep -v` in compat-build-source.py script, we don't need to write this in several scripted language. Also remove dependency on Makefile as the file generation doesn't depend on it anymore. No changes in final compat/%.h headers. Signed-off-by: Anthony PERARD Acked-by: Jan Beulich --- Notes: v6: - remove dependency on Makefile as it's not needed anymore v5: - removed "have 'xlat.lst' path as a variable" from the patch. v4: - new patch xen/include/Makefile | 5 ++--- xen/tools/compat-build-source.py | 8 +++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/xen/include/Makefile b/xen/include/Makefile index c8ca97eed0fc..be3b81485bdc 100644 --- a/xen/include/Makefile +++ b/xen/include/Makefile @@ -59,10 +59,9 @@ compat/%.h: compat/%.i Makefile $(BASEDIR)/tools/compat-build-header.py compat/%.i: compat/%.c Makefile $(CPP) $(filter-out -Wa$(comma)% -include %/include/xen/config.h,$(XEN_CFLAGS)) $(cppflags-y) -o $@ $< -compat/%.c: public/%.h xlat.lst Makefile $(BASEDIR)/tools/compat-build-source.py +compat/%.c: public/%.h xlat.lst $(BASEDIR)/tools/compat-build-source.py mkdir -p $(@D) - grep -v 'DEFINE_XEN_GUEST_HANDLE(long)' $< | \ - $(PYTHON) $(BASEDIR)/tools/compat-build-source.py >$@.new + $(PYTHON) $(BASEDIR)/tools/compat-build-source.py xlat.lst <$< >$@.new mv -f $@.new $@ compat/.xlat/%.h: compat/%.h compat/.xlat/%.lst $(BASEDIR)/tools/get-fields.sh Makefile diff --git a/xen/tools/compat-build-source.py b/xen/tools/compat-build-source.py index 2bcaf27d05a3..274d6917ab7f 100755 --- a/xen/tools/compat-build-source.py +++ b/xen/tools/compat-build-source.py @@ -13,7 +13,11 @@ pats = [ [ r"XEN_GUEST_HANDLE", r"COMPAT_HANDLE" ], ]; -xlatf = open('xlat.lst', 'r') +try: + xlatf = open(sys.argv[1], 'r') +except IndexError: + print('missing path to xlat.lst argument') + sys.exit(1) for line in xlatf.readlines(): match = re.subn(r"^\s*\?\s+(\w*)\s.*", r"\1", line.rstrip()) if match[1]: @@ -25,6 +29,8 @@ for pat in pats: pat[0] = re.compile(pat[0]) for line in sys.stdin.readlines(): + if 'DEFINE_XEN_GUEST_HANDLE(long)' in line: + continue for pat in pats: line = re.sub(pat[0], pat[1], line) print(line.rstrip()) -- Anthony PERARD