From nobody Sun Feb 8 18:31:16 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1594894882; cv=none; d=zohomail.com; s=zohoarc; b=Sunhc45dDadkQPSfLcsRHbprSLnwxwAh2EZLGDS9rYyBcoLpebwAHMQYOCBvC9n29+WR65+x2LfNTXEZeW+0vUsuAzo3Nd+bkNCXeQdVDtrSlh4FKjFk52SYF1QoCtMo0uon5/LNaTjlKs7E8dNPsCXwLUFZVui64TaniIgt8fc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594894882; 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=CUbkXs1tfXe+AnNccyQMRMuzaHWH3SCHSbxJeVDJQtY=; b=evNDbr0pd3hgFUpoYOcvksdPbYuIBS4zGyPavsJOko7TFo8L9h7+SzD/sjCXn3j2vZpFNnewexPiEjDYtaD4xC8u4sh+B7K0UD7eqz1Ca1AtMecTb5RL4f1ayd2210/WG7zxooLHnCfIFvLldj8EmLsSQIar1JKwqcf27NUX4sM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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 [205.139.110.61]) by mx.zohomail.com with SMTPS id 1594894882943146.38400439253348; Thu, 16 Jul 2020 03:21:22 -0700 (PDT) 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-251-ldbqH9VONC2djxNVhx-Xeg-1; Thu, 16 Jul 2020 06:15:10 -0400 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 A847A8015F7; Thu, 16 Jul 2020 10:15:03 +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 86A967B421; Thu, 16 Jul 2020 10:15:03 +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 53CE59A128; Thu, 16 Jul 2020 10:15:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06GA7krT021214 for ; Thu, 16 Jul 2020 06:07:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6DC3F2DE96; Thu, 16 Jul 2020 10:07:46 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.194.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC1F72DE6B for ; Thu, 16 Jul 2020 10:07:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594894881; 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=CUbkXs1tfXe+AnNccyQMRMuzaHWH3SCHSbxJeVDJQtY=; b=dn2Ycndr+oNr0V7BTuRcXm5cvDI5yZ1rleO3ej8f+zv4YpEXG+yLcRIbioatJ/Alp2Dut6 UGBnrIFLvE/MG0J3XC1C78t/JTQmnoi9VVyQgSA3fcmYxAJIRsCyELHNvI+4OyplZfH70Z XIRB2aQ9C3J7ia9j4rdXAMT2ShjvDlk= X-MC-Unique: ldbqH9VONC2djxNVhx-Xeg-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 342/351] meson: add syntax-check Date: Thu, 16 Jul 2020 11:59:38 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com 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-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Pavel Hrdina --- build-aux/Makefile.in | 9 +++ .../Makefile.nonreentrant | 0 build-aux/meson.build | 30 +++++++++ build-aux/syntax-check.mk | 62 +++++++++---------- meson.build | 2 + 5 files changed, 72 insertions(+), 31 deletions(-) create mode 100644 build-aux/Makefile.in rename Makefile.nonreentrant =3D> build-aux/Makefile.nonreentrant (100%) create mode 100644 build-aux/meson.build diff --git a/build-aux/Makefile.in b/build-aux/Makefile.in new file mode 100644 index 00000000000..601f1ad7a19 --- /dev/null +++ b/build-aux/Makefile.in @@ -0,0 +1,9 @@ +# define variables + +top_srcdir =3D @top_srcdir@ +top_builddir =3D @top_builddir@ +FLAKE8 =3D @flake8_path@ +RUNUTF8 =3D @runutf8@ + +# include syntax-check.mk file +include $(top_srcdir)/build-aux/syntax-check.mk diff --git a/Makefile.nonreentrant b/build-aux/Makefile.nonreentrant similarity index 100% rename from Makefile.nonreentrant rename to build-aux/Makefile.nonreentrant diff --git a/build-aux/meson.build b/build-aux/meson.build new file mode 100644 index 00000000000..de916793cad --- /dev/null +++ b/build-aux/meson.build @@ -0,0 +1,30 @@ +syntax_check_conf =3D configuration_data() +syntax_check_conf.set('top_srcdir', meson.source_root()) +syntax_check_conf.set('top_builddir', meson.build_root()) + +flake8_path =3D '' +if flake8_prog.found() + flake8_path =3D flake8_prog.path() +endif +syntax_check_conf.set('flake8_path', flake8_path) +syntax_check_conf.set('runutf8', ' '.join(runutf8)) + +configure_file( + input: 'Makefile.in', + output: '@BASENAME@', + configuration: syntax_check_conf, +) + +make_prog =3D find_program('make') + +# There is no way how to pass value to -j using run_target so let's use +# it without any value to run all tests in parallel. +run_target( + 'syntax-check', + command: [ + make_prog, '-C', meson.current_build_dir(), '-j', 'syntax-check', + ], + depends: [ + potfiles_dep, + ], +) diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk index 3d7b644f01f..1fe2da4e637 100644 --- a/build-aux/syntax-check.mk +++ b/build-aux/syntax-check.mk @@ -21,7 +21,7 @@ =20 # This is reported not to work with make-3.79.1 # ME :=3D $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) -ME :=3D $(_build-aux)/syntax-check.mk +ME :=3D build-aux/syntax-check.mk =20 # These variables ought to be defined through the configure.ac section # of the module description. But some packages import this file directly, @@ -42,29 +42,29 @@ _equal =3D $(and $(findstring $(1),$(2)),$(findstring $= (2),$(1))) GIT =3D git VC =3D $(GIT) =20 -VC_LIST =3D $(srcdir)/$(_build-aux)/vc-list-files -C $(srcdir) +VC_LIST =3D $(top_srcdir)/build-aux/vc-list-files -C $(top_srcdir) =20 # You can override this variable in syntax-check.mk to set your own regexp # matching files to ignore. VC_LIST_ALWAYS_EXCLUDE_REGEX ?=3D ^$$ =20 # This is to preprocess robustly the output of $(VC_LIST), so that even -# when $(srcdir) is a pathological name like "....", the leading sed comma= nd +# when $(top_srcdir) is a pathological name like "....", the leading sed c= ommand # removes only the intended prefix. -_dot_escaped_srcdir =3D $(subst .,\.,$(srcdir)) -_dot_escaped_builddir =3D $(subst .,\.,$(builddir)) +_dot_escaped_srcdir =3D $(subst .,\.,$(top_srcdir)) +_dot_escaped_builddir =3D $(subst .,\.,$(top_builddir)) =20 -# Post-process $(VC_LIST) output, prepending $(srcdir)/, but only -# when $(srcdir) is not ".". -ifeq ($(srcdir),.) +# Post-process $(VC_LIST) output, prepending $(top_srcdir)/, but only +# when $(top_srcdir) is not ".". +ifeq ($(top_srcdir),.) _prepend_srcdir_prefix =3D else - _prepend_srcdir_prefix =3D | $(SED) 's|^|$(srcdir)/|' + _prepend_srcdir_prefix =3D | $(SED) 's|^|$(top_srcdir)/|' endif =20 # In order to be able to consistently filter "."-relative names, -# (i.e., with no $(srcdir) prefix), this definition is careful to -# remove any $(srcdir) prefix, and to restore what it removes. +# (i.e., with no $(top_srcdir) prefix), this definition is careful to +# remove any $(top_srcdir) prefix, and to restore what it removes. _sc_excl =3D \ $(or $(exclude_file_name_regexp--$@),^$$) VC_LIST_EXCEPT =3D \ @@ -84,11 +84,11 @@ export LC_ALL =3D C ## Sanity checks. ## ## --------------- ## =20 -_cfg_mk :=3D $(wildcard $(srcdir)/$(_build-aux)/syntax-check.mk) +_cfg_mk :=3D $(wildcard $(top_srcdir)/build-aux/syntax-check.mk) =20 # Collect the names of rules starting with 'sc_'. syntax-check-rules :=3D $(sort $(shell $(SED) -n \ - 's/^\(sc_[a-zA-Z0-9_-]*\):.*/\1/p' $(srcdir)/$(ME) $(_cfg_mk))) + 's/^\(sc_[a-zA-Z0-9_-]*\):.*/\1/p' $(top_srcdir)/$(ME) $(_cfg_mk))) .PHONY: $(syntax-check-rules) =20 ifeq ($(shell $(VC_LIST) >/dev/null 2>&1; echo $$?),0) @@ -333,11 +333,11 @@ sc_flags_debug: # than d). The existence of long long, and of documentation about # flags, makes the regex in the third test slightly harder. sc_flags_usage: - @test "$$(cat $(srcdir)/include/libvirt/libvirt-domain.h \ - $(srcdir)/include/libvirt/virterror.h \ - $(srcdir)/include/libvirt/libvirt-qemu.h \ - $(srcdir)/include/libvirt/libvirt-lxc.h \ - $(srcdir)/include/libvirt/libvirt-admin.h \ + @test "$$(cat $(top_srcdir)/include/libvirt/libvirt-domain.h \ + $(top_srcdir)/include/libvirt/virterror.h \ + $(top_srcdir)/include/libvirt/libvirt-qemu.h \ + $(top_srcdir)/include/libvirt/libvirt-lxc.h \ + $(top_srcdir)/include/libvirt/libvirt-admin.h \ | $(GREP) -c '\(long\|unsigned\) flags')" !=3D 4 && \ { echo '$(ME): new API should use "unsigned int flags"' 1>&2; \ exit 1; } || : @@ -496,7 +496,7 @@ sc_prohibit_PATH_MAX: halt=3D'dynamically allocate paths, do not use PATH_MAX' \ $(_sc_search_regexp) =20 -include $(srcdir)/Makefile.nonreentrant +include $(top_srcdir)/build-aux/Makefile.nonreentrant sc_prohibit_nonreentrant: @prohibit=3D"\\<(${NON_REENTRANT_RE}) *\\(" \ halt=3D"use re-entrant functions (usually ending with _r)" \ @@ -833,7 +833,7 @@ sc_prohibit_gettext_markup: =20 # Our code is divided into modular subdirectories for a reason, and # lower-level code must not include higher-level headers. -cross_dirs=3D$(patsubst $(srcdir)/src/%.,%,$(wildcard $(srcdir)/src/*/.)) +cross_dirs=3D$(patsubst $(top_srcdir)/src/%.,%,$(wildcard $(top_srcdir)/sr= c/*/.)) cross_dirs_re=3D($(subst / ,/|,$(cross_dirs))) mid_dirs=3Daccess|admin|conf|cpu|locking|logging|rpc|security sc_prohibit_cross_inclusion: @@ -1177,7 +1177,7 @@ sc_prohibit_dirent_d_type: # grep-E-style regexp selecting the files to check. For in_vc_files, # the regexp is used to select matching files from the list of all # version-controlled files; for in_files, it's from the names printed -# by "find $(srcdir)". When neither is specified, use all files that +# by "find $(top_srcdir)". When neither is specified, use all files t= hat # are under version control. # # containing | non_containing @@ -1249,7 +1249,7 @@ define _sc_search_regexp \ : Filter by file name; \ if test -n "$$in_files"; then \ - files=3D$$(find $(srcdir) | $(GREP) -E "$$in_files" \ + files=3D$$(find $(top_srcdir) | $(GREP) -E "$$in_files" \ | $(GREP) -Ev '$(_sc_excl)'); \ else \ files=3D$$($(VC_LIST_EXCEPT)); \ @@ -1293,7 +1293,7 @@ sc_avoid_if_before_free: @$(VC_LIST_EXCEPT) \ | $(GREP) -v useless-if-before-free \ | xargs \ - $(srcdir)/$(_build-aux)/useless-if-before-free \ + $(top_srcdir)/build-aux/useless-if-before-free \ $(useless_free_options) \ && { printf '$(ME): found useless "if"' \ ' before "free" above\n' 1>&2; \ @@ -1781,9 +1781,6 @@ sc_const_long_option: halt=3D'add "const" to the above declarations' \ $(_sc_search_regexp) =20 -gen_source_files: - $(MAKE) -C src generated-sources - fix_po_file_diag =3D \ 'you have changed the set of files with translatable diagnostics;\n\ apply the above patch\n' @@ -1805,26 +1802,26 @@ perl_translatable_files_list_ =3D \ =20 # Verify that all source files using _() (more specifically, files that # match $(_gl_translatable_string_re)) are listed in po/POTFILES.in. -po_file ?=3D $(srcdir)/po/POTFILES.in +po_file ?=3D $(top_srcdir)/po/POTFILES.in =20 # List of additional files that we want to pick up in our POTFILES.in # This is all generated files for RPC code. generated_files =3D \ - $(builddir)/src/*.[ch] \ - $(builddir)/src/*/*.[ch] + $(top_builddir)/src/*.[ch] \ + $(top_builddir)/src/*/*.[ch] =20 _gl_translatable_string_re ?=3D \b(N?_|gettext *)\([^)"]*("|$$) =20 # sc_po_check can fail if generated files are not built first -sc_po_check: gen_source_files +sc_po_check: @if test -f $(po_file); then \ $(GREP) -E -v '^(#|$$)' $(po_file) \ | $(GREP) -v '^src/false\.c$$' | sort > $@-1; \ { $(VC_LIST_EXCEPT); echo $(generated_files); } \ | xargs perl $(perl_translatable_files_list_) \ | xargs $(GREP) -E -l '$(_gl_translatable_string_re)' \ - | $(SED) 's|^$(_dot_escaped_srcdir)/|@SRCDIR@|' \ | $(SED) 's|^$(_dot_escaped_builddir)/|@BUILDDIR@|' \ + | $(SED) 's|^$(_dot_escaped_srcdir)/|@SRCDIR@|' \ | sort -u > $@-2; \ diff -u -L $(po_file) -L $(po_file) $@-1 $@-2 \ || { printf '$(ME): '$(fix_po_file_diag) 1>&2; exit 1; }; \ @@ -2074,3 +2071,6 @@ exclude_file_name_regexp--sc_prohibit_backslash_align= ment =3D \ =20 exclude_file_name_regexp--sc_prohibit_select =3D \ ^build-aux/syntax-check\.mk|src/util/vireventglibwatch\.c$$ + +exclude_file_name_regexp--sc_prohibit_config_h_in_headers =3D \ + ^config\.h$$ diff --git a/meson.build b/meson.build index d14223829e2..587e05a02da 100644 --- a/meson.build +++ b/meson.build @@ -2213,6 +2213,8 @@ subdir('po') =20 subdir('docs') =20 +subdir('build-aux') + =20 # install pkgconfig files pkgconfig_files =3D [ --=20 2.26.2