All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] MAINTAINERS: enforce file entries are consistent from meson
@ 2026-06-15 20:17 Pierrick Bouvier
  2026-06-15 20:17 ` [PATCH 1/2] MAINTAINERS: fix entry for 'Python scripts' Pierrick Bouvier
  2026-06-15 20:17 ` [PATCH 2/2] meson.build: check MAINTAINERS file is consistent with source tree Pierrick Bouvier
  0 siblings, 2 replies; 9+ messages in thread
From: Pierrick Bouvier @ 2026-06-15 20:17 UTC (permalink / raw)
  To: qemu-devel
  Cc: Marc-André Lureau, John Snow, Cleber Rosa, philmd,
	Daniel P. Berrangé, Paolo Bonzini, armbru,
	Philippe Mathieu-Daudé, Pierrick Bouvier

Recently, Markus and Philippe made a great effort [1] to cleanup file entries in
MAINTAINERS that do not match any real file.
Now it's clean, we can ensure it will stay consistent in the future, by checking
those entries are consistent, directly at start of meson.build.
Forcing this through the build system makes sure it can't be skipped, whether on
local machine, or in CI. And since anyone needs to trigger it to add tests, doc
or code, it will be detected as soon as possible.

[1] https://lore.kernel.org/qemu-devel/20260521080511.999266-1-armbru@redhat.com/

In terms of performance, it takes 0.26s on a slow machine, where full configure
takes 35s, thus a slow down < 1%: worth it for the consistency we get IMHO.

The first patch cleans up the latest inconsistent entry left, which we solve
pragmatically. Commit mentions another alternative suggested.

The second patch is the check in itself. There was a conversation about
comparing files vs list of files returned by git ls-files. I would prefer to
stick comparing files instead of playing with regex, but I'm open to implement
it another way if that's really important.

The usage is quite simple if you want to play with it manually:
./scripts/check-maintainers-file.py MAINTAINERS

Pierrick Bouvier (2):
  MAINTAINERS: fix entry for 'Python scripts'
  meson.build: check MAINTAINERS file is consistent with source tree

 MAINTAINERS                       |  4 ++-
 meson.build                       |  5 +++
 scripts/check-maintainers-file.py | 53 +++++++++++++++++++++++++++++++
 3 files changed, 61 insertions(+), 1 deletion(-)
 create mode 100755 scripts/check-maintainers-file.py

-- 
2.43.0



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/2] MAINTAINERS: fix entry for 'Python scripts'
  2026-06-15 20:17 [PATCH 0/2] MAINTAINERS: enforce file entries are consistent from meson Pierrick Bouvier
@ 2026-06-15 20:17 ` Pierrick Bouvier
  2026-06-15 20:17 ` [PATCH 2/2] meson.build: check MAINTAINERS file is consistent with source tree Pierrick Bouvier
  1 sibling, 0 replies; 9+ messages in thread
From: Pierrick Bouvier @ 2026-06-15 20:17 UTC (permalink / raw)
  To: qemu-devel
  Cc: Marc-André Lureau, John Snow, Cleber Rosa, philmd,
	Daniel P. Berrangé, Paolo Bonzini, armbru,
	Philippe Mathieu-Daudé, Pierrick Bouvier

Existing entry tests/*.py does not match any file at the moment, the
semantic is "any py file under tests".
Kernel MAINTAINERS file supports 'K: regexp' entries to match entries,
but we don't support it, and I'm not sure it's the right solution here.

Instead of adding "yet another generic solution" to this problem, just
add manual entries matching existing sublevels. The Python scripts
section is the only one requiring this, and we can always reconsider the
K: approach later if another use case emerge.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 MAINTAINERS | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 2b5b581e173..61af956ed82 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3472,7 +3472,9 @@ M: John Snow <jsnow@redhat.com>
 M: Cleber Rosa <crosa@redhat.com>
 S: Odd Fixes
 F: scripts/*.py
-F: tests/*.py
+F: tests/*/*.py
+F: tests/*/*/*.py
+F: tests/*/*/*/*.py
 
 Benchmark util
 M: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/2] meson.build: check MAINTAINERS file is consistent with source tree
  2026-06-15 20:17 [PATCH 0/2] MAINTAINERS: enforce file entries are consistent from meson Pierrick Bouvier
  2026-06-15 20:17 ` [PATCH 1/2] MAINTAINERS: fix entry for 'Python scripts' Pierrick Bouvier
@ 2026-06-15 20:17 ` Pierrick Bouvier
  2026-06-15 20:21   ` Pierrick Bouvier
                     ` (2 more replies)
  1 sibling, 3 replies; 9+ messages in thread
From: Pierrick Bouvier @ 2026-06-15 20:17 UTC (permalink / raw)
  To: qemu-devel
  Cc: Marc-André Lureau, John Snow, Cleber Rosa, philmd,
	Daniel P. Berrangé, Paolo Bonzini, armbru,
	Philippe Mathieu-Daudé, Pierrick Bouvier

We add a new script: scripts/check-maintainers-file.py, that will run at
configuration time (and not at build time), to not hurt build time.
This script runs in 0.2s on my dev VM, which has an old cpu.

We can expect things to be mostly in sync since adding or removing a
source or test file will trigger a configure step.
For the rest, like docs, tcg tests, or remaining files, GitLab CI will
build things from scratch and always run the configure step.

With this, it should be impossible by design to have an upstream
MAINTAINERS file with non existing file entries.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 meson.build                       |  5 +++
 scripts/check-maintainers-file.py | 53 +++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+)
 create mode 100755 scripts/check-maintainers-file.py

diff --git a/meson.build b/meson.build
index 19e123423b5..57e9c9de42b 100644
--- a/meson.build
+++ b/meson.build
@@ -17,6 +17,11 @@ add_test_setup('thorough',
 
 meson.add_postconf_script(find_program('scripts/symlink-install-tree.py'))
 
+# check our MAINTAINERS file is consistent
+check_maintainers = find_program('scripts/check-maintainers-file.py')
+maintainers_file = files('MAINTAINERS')
+run_command([check_maintainers, maintainers_file], check: true)
+
 ####################
 # Global variables #
 ####################
diff --git a/scripts/check-maintainers-file.py b/scripts/check-maintainers-file.py
new file mode 100755
index 00000000000..b001816a401
--- /dev/null
+++ b/scripts/check-maintainers-file.py
@@ -0,0 +1,53 @@
+#! /usr/bin/env python3
+
+# Check incorrect file entries in MAINTAINERS
+#
+# Author: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+import argparse
+import glob
+import sys
+
+
+def check_one_entry(line) -> bool:
+    return True
+
+
+def main() -> None:
+    parser = argparse.ArgumentParser(description="Check MAINTAINERS file")
+    parser.add_argument("maintainers", help="Path to MAINTAINERS file")
+    args = parser.parse_args()
+
+    found_file_entry = False
+    found_incorrect_entries = False
+    line_counter = 0
+
+    with open(args.maintainers) as file:
+        for entry in file:
+            line_counter += 1
+
+            if not entry.startswith("F:"):
+                continue
+            entry = entry[2:].strip()
+            found_file_entry = True
+
+            file_exists = len(glob.glob(entry, recursive=True)) > 0
+            if file_exists:
+                continue
+
+            found_incorrect_entries = True
+            print(
+                f"No matching files for {args.maintainers} +{line_counter}: {entry}",
+                file=sys.stderr,
+            )
+
+    if not found_file_entry:
+        raise Exception("no file entry found - is MAINTAINERS path correct?")
+    if found_incorrect_entries:
+        raise Exception(f"incorrect entries found in {args.maintainers}")
+
+
+if __name__ == "__main__":
+    main()
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] meson.build: check MAINTAINERS file is consistent with source tree
  2026-06-15 20:17 ` [PATCH 2/2] meson.build: check MAINTAINERS file is consistent with source tree Pierrick Bouvier
@ 2026-06-15 20:21   ` Pierrick Bouvier
  2026-06-16  0:35   ` Philippe Mathieu-Daudé
  2026-06-16  7:53   ` Daniel P. Berrangé
  2 siblings, 0 replies; 9+ messages in thread
From: Pierrick Bouvier @ 2026-06-15 20:21 UTC (permalink / raw)
  To: qemu-devel
  Cc: Marc-André Lureau, John Snow, Cleber Rosa, philmd,
	Daniel P. Berrangé, Paolo Bonzini, armbru,
	Philippe Mathieu-Daudé

On 6/15/2026 1:17 PM, Pierrick Bouvier wrote:
> We add a new script: scripts/check-maintainers-file.py, that will run at
> configuration time (and not at build time), to not hurt build time.
> This script runs in 0.2s on my dev VM, which has an old cpu.
> 
> We can expect things to be mostly in sync since adding or removing a
> source or test file will trigger a configure step.
> For the rest, like docs, tcg tests, or remaining files, GitLab CI will
> build things from scratch and always run the configure step.
> 
> With this, it should be impossible by design to have an upstream
> MAINTAINERS file with non existing file entries.
> 
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
> ---
>  meson.build                       |  5 +++
>  scripts/check-maintainers-file.py | 53 +++++++++++++++++++++++++++++++
>  2 files changed, 58 insertions(+)
>  create mode 100755 scripts/check-maintainers-file.py
> 
> diff --git a/meson.build b/meson.build
> index 19e123423b5..57e9c9de42b 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -17,6 +17,11 @@ add_test_setup('thorough',
>  
>  meson.add_postconf_script(find_program('scripts/symlink-install-tree.py'))
>  
> +# check our MAINTAINERS file is consistent
> +check_maintainers = find_program('scripts/check-maintainers-file.py')
> +maintainers_file = files('MAINTAINERS')
> +run_command([check_maintainers, maintainers_file], check: true)
> +
>  ####################
>  # Global variables #
>  ####################
> diff --git a/scripts/check-maintainers-file.py b/scripts/check-maintainers-file.py
> new file mode 100755
> index 00000000000..b001816a401
> --- /dev/null
> +++ b/scripts/check-maintainers-file.py
> @@ -0,0 +1,53 @@
> +#! /usr/bin/env python3
> +
> +# Check incorrect file entries in MAINTAINERS
> +#
> +# Author: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
> +#
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +
> +import argparse
> +import glob
> +import sys
> +
> +
> +def check_one_entry(line) -> bool:
> +    return True
> +

This function is dead code, I'll remove it.

> +
> +def main() -> None:
> +    parser = argparse.ArgumentParser(description="Check MAINTAINERS file")
> +    parser.add_argument("maintainers", help="Path to MAINTAINERS file")
> +    args = parser.parse_args()
> +
> +    found_file_entry = False
> +    found_incorrect_entries = False
> +    line_counter = 0
> +
> +    with open(args.maintainers) as file:
> +        for entry in file:
> +            line_counter += 1
> +
> +            if not entry.startswith("F:"):
> +                continue
> +            entry = entry[2:].strip()
> +            found_file_entry = True
> +
> +            file_exists = len(glob.glob(entry, recursive=True)) > 0
> +            if file_exists:
> +                continue
> +
> +            found_incorrect_entries = True
> +            print(
> +                f"No matching files for {args.maintainers} +{line_counter}: {entry}",
> +                file=sys.stderr,
> +            )
> +
> +    if not found_file_entry:
> +        raise Exception("no file entry found - is MAINTAINERS path correct?")
> +    if found_incorrect_entries:
> +        raise Exception(f"incorrect entries found in {args.maintainers}")
> +
> +
> +if __name__ == "__main__":
> +    main()



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] meson.build: check MAINTAINERS file is consistent with source tree
  2026-06-15 20:17 ` [PATCH 2/2] meson.build: check MAINTAINERS file is consistent with source tree Pierrick Bouvier
  2026-06-15 20:21   ` Pierrick Bouvier
@ 2026-06-16  0:35   ` Philippe Mathieu-Daudé
  2026-06-16  2:51     ` Pierrick Bouvier
  2026-06-16  7:53   ` Daniel P. Berrangé
  2 siblings, 1 reply; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-16  0:35 UTC (permalink / raw)
  To: Pierrick Bouvier, qemu-devel
  Cc: Marc-André Lureau, John Snow, Cleber Rosa, philmd,
	Daniel P. Berrangé, Paolo Bonzini, armbru

On 15/6/26 22:17, Pierrick Bouvier wrote:
> We add a new script: scripts/check-maintainers-file.py, that will run at
> configuration time (and not at build time), to not hurt build time.
> This script runs in 0.2s on my dev VM, which has an old cpu.
> 
> We can expect things to be mostly in sync since adding or removing a
> source or test file will trigger a configure step.

You mention adding/removing but this script only checks for removals,
no additions; did I miss something?

> For the rest, like docs, tcg tests, or remaining files, GitLab CI will
> build things from scratch and always run the configure step.
> 
> With this, it should be impossible by design to have an upstream
> MAINTAINERS file with non existing file entries.
> 
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
> ---
>   meson.build                       |  5 +++
>   scripts/check-maintainers-file.py | 53 +++++++++++++++++++++++++++++++
>   2 files changed, 58 insertions(+)
>   create mode 100755 scripts/check-maintainers-file.py
> 
> diff --git a/meson.build b/meson.build
> index 19e123423b5..57e9c9de42b 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -17,6 +17,11 @@ add_test_setup('thorough',
>   
>   meson.add_postconf_script(find_program('scripts/symlink-install-tree.py'))
>   
> +# check our MAINTAINERS file is consistent
> +check_maintainers = find_program('scripts/check-maintainers-file.py')
> +maintainers_file = files('MAINTAINERS')
> +run_command([check_maintainers, maintainers_file], check: true)
> +
>   ####################
>   # Global variables #
>   ####################
> diff --git a/scripts/check-maintainers-file.py b/scripts/check-maintainers-file.py
> new file mode 100755
> index 00000000000..b001816a401
> --- /dev/null
> +++ b/scripts/check-maintainers-file.py
> @@ -0,0 +1,53 @@
> +#! /usr/bin/env python3
> +
> +# Check incorrect file entries in MAINTAINERS
> +#
> +# Author: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
> +#
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +
> +import argparse
> +import glob
> +import sys
> +
> +
> +def check_one_entry(line) -> bool:
> +    return True
> +
> +
> +def main() -> None:
> +    parser = argparse.ArgumentParser(description="Check MAINTAINERS file")
> +    parser.add_argument("maintainers", help="Path to MAINTAINERS file")
> +    args = parser.parse_args()
> +
> +    found_file_entry = False
> +    found_incorrect_entries = False
> +    line_counter = 0
> +
> +    with open(args.maintainers) as file:
> +        for entry in file:
> +            line_counter += 1
> +
> +            if not entry.startswith("F:"):
> +                continue
> +            entry = entry[2:].strip()
> +            found_file_entry = True
> +
> +            file_exists = len(glob.glob(entry, recursive=True)) > 0
> +            if file_exists:
> +                continue
> +
> +            found_incorrect_entries = True
> +            print(
> +                f"No matching files for {args.maintainers} +{line_counter}: {entry}",
> +                file=sys.stderr,
> +            )
> +
> +    if not found_file_entry:
> +        raise Exception("no file entry found - is MAINTAINERS path correct?")
> +    if found_incorrect_entries:
> +        raise Exception(f"incorrect entries found in {args.maintainers}")
> +
> +
> +if __name__ == "__main__":
> +    main()



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] meson.build: check MAINTAINERS file is consistent with source tree
  2026-06-16  0:35   ` Philippe Mathieu-Daudé
@ 2026-06-16  2:51     ` Pierrick Bouvier
  2026-06-16  3:15       ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 9+ messages in thread
From: Pierrick Bouvier @ 2026-06-16  2:51 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Marc-André Lureau, John Snow, Cleber Rosa,
	Daniel P. Berrangé, Paolo Bonzini, armbru

On 6/15/2026 5:35 PM, Philippe Mathieu-Daudé wrote:
> On 15/6/26 22:17, Pierrick Bouvier wrote:
>> We add a new script: scripts/check-maintainers-file.py, that will run at
>> configuration time (and not at build time), to not hurt build time.
>> This script runs in 0.2s on my dev VM, which has an old cpu.
>>
>> We can expect things to be mostly in sync since adding or removing a
>> source or test file will trigger a configure step.
> 
> You mention adding/removing but this script only checks for removals,
> no additions; did I miss something?
>
The initial scope was only to check the MAINTAINERS file itself is
correct. But while we're at it, we could extend the script to check that
all files in the tree belong to at least one maintainer entry. This
could have the benefit to force coverage for all new files. First we can
try to see what is not covered at the moment.

What do you think Markus?

>> For the rest, like docs, tcg tests, or remaining files, GitLab CI will
>> build things from scratch and always run the configure step.
>>
>> With this, it should be impossible by design to have an upstream
>> MAINTAINERS file with non existing file entries.
>>
>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
>> ---
>>   meson.build                       |  5 +++
>>   scripts/check-maintainers-file.py | 53 +++++++++++++++++++++++++++++++
>>   2 files changed, 58 insertions(+)
>>   create mode 100755 scripts/check-maintainers-file.py
>>
>> diff --git a/meson.build b/meson.build
>> index 19e123423b5..57e9c9de42b 100644
>> --- a/meson.build
>> +++ b/meson.build
>> @@ -17,6 +17,11 @@ add_test_setup('thorough',
>>     meson.add_postconf_script(find_program('scripts/symlink-install-
>> tree.py'))
>>   +# check our MAINTAINERS file is consistent
>> +check_maintainers = find_program('scripts/check-maintainers-file.py')
>> +maintainers_file = files('MAINTAINERS')
>> +run_command([check_maintainers, maintainers_file], check: true)
>> +
>>   ####################
>>   # Global variables #
>>   ####################
>> diff --git a/scripts/check-maintainers-file.py b/scripts/check-
>> maintainers-file.py
>> new file mode 100755
>> index 00000000000..b001816a401
>> --- /dev/null
>> +++ b/scripts/check-maintainers-file.py
>> @@ -0,0 +1,53 @@
>> +#! /usr/bin/env python3
>> +
>> +# Check incorrect file entries in MAINTAINERS
>> +#
>> +# Author: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
>> +#
>> +# SPDX-License-Identifier: GPL-2.0-or-later
>> +
>> +import argparse
>> +import glob
>> +import sys
>> +
>> +
>> +def check_one_entry(line) -> bool:
>> +    return True
>> +
>> +
>> +def main() -> None:
>> +    parser = argparse.ArgumentParser(description="Check MAINTAINERS
>> file")
>> +    parser.add_argument("maintainers", help="Path to MAINTAINERS file")
>> +    args = parser.parse_args()
>> +
>> +    found_file_entry = False
>> +    found_incorrect_entries = False
>> +    line_counter = 0
>> +
>> +    with open(args.maintainers) as file:
>> +        for entry in file:
>> +            line_counter += 1
>> +
>> +            if not entry.startswith("F:"):
>> +                continue
>> +            entry = entry[2:].strip()
>> +            found_file_entry = True
>> +
>> +            file_exists = len(glob.glob(entry, recursive=True)) > 0
>> +            if file_exists:
>> +                continue
>> +
>> +            found_incorrect_entries = True
>> +            print(
>> +                f"No matching files for {args.maintainers}
>> +{line_counter}: {entry}",
>> +                file=sys.stderr,
>> +            )
>> +
>> +    if not found_file_entry:
>> +        raise Exception("no file entry found - is MAINTAINERS path
>> correct?")
>> +    if found_incorrect_entries:
>> +        raise Exception(f"incorrect entries found in
>> {args.maintainers}")
>> +
>> +
>> +if __name__ == "__main__":
>> +    main()
> 



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] meson.build: check MAINTAINERS file is consistent with source tree
  2026-06-16  2:51     ` Pierrick Bouvier
@ 2026-06-16  3:15       ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-06-16  3:15 UTC (permalink / raw)
  To: Pierrick Bouvier, qemu-devel
  Cc: Marc-André Lureau, John Snow, Cleber Rosa,
	Daniel P. Berrangé, Paolo Bonzini, armbru

On 16/6/26 04:51, Pierrick Bouvier wrote:
> On 6/15/2026 5:35 PM, Philippe Mathieu-Daudé wrote:
>> On 15/6/26 22:17, Pierrick Bouvier wrote:
>>> We add a new script: scripts/check-maintainers-file.py, that will run at
>>> configuration time (and not at build time), to not hurt build time.
>>> This script runs in 0.2s on my dev VM, which has an old cpu.
>>>
>>> We can expect things to be mostly in sync since adding or removing a
>>> source or test file will trigger a configure step.
>>
>> You mention adding/removing but this script only checks for removals,
>> no additions; did I miss something?
>>
> The initial scope was only to check the MAINTAINERS file itself is
> correct. But while we're at it, we could extend the script to check that
> all files in the tree belong to at least one maintainer entry. This
> could have the benefit to force coverage for all new files. First we can
> try to see what is not covered at the moment.

OK. So far removing "adding or" and check_one_entry():

Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>

> 
> What do you think Markus?
> 
>>> For the rest, like docs, tcg tests, or remaining files, GitLab CI will
>>> build things from scratch and always run the configure step.
>>>
>>> With this, it should be impossible by design to have an upstream
>>> MAINTAINERS file with non existing file entries.
>>>
>>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
>>> ---
>>>    meson.build                       |  5 +++
>>>    scripts/check-maintainers-file.py | 53 +++++++++++++++++++++++++++++++
>>>    2 files changed, 58 insertions(+)
>>>    create mode 100755 scripts/check-maintainers-file.py
>>>
>>> diff --git a/meson.build b/meson.build
>>> index 19e123423b5..57e9c9de42b 100644
>>> --- a/meson.build
>>> +++ b/meson.build
>>> @@ -17,6 +17,11 @@ add_test_setup('thorough',
>>>      meson.add_postconf_script(find_program('scripts/symlink-install-
>>> tree.py'))
>>>    +# check our MAINTAINERS file is consistent
>>> +check_maintainers = find_program('scripts/check-maintainers-file.py')
>>> +maintainers_file = files('MAINTAINERS')
>>> +run_command([check_maintainers, maintainers_file], check: true)
>>> +
>>>    ####################
>>>    # Global variables #
>>>    ####################
>>> diff --git a/scripts/check-maintainers-file.py b/scripts/check-
>>> maintainers-file.py
>>> new file mode 100755
>>> index 00000000000..b001816a401
>>> --- /dev/null
>>> +++ b/scripts/check-maintainers-file.py
>>> @@ -0,0 +1,53 @@
>>> +#! /usr/bin/env python3
>>> +
>>> +# Check incorrect file entries in MAINTAINERS
>>> +#
>>> +# Author: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
>>> +#
>>> +# SPDX-License-Identifier: GPL-2.0-or-later
>>> +
>>> +import argparse
>>> +import glob
>>> +import sys
>>> +
>>> +
>>> +def check_one_entry(line) -> bool:
>>> +    return True
>>> +
>>> +
>>> +def main() -> None:
>>> +    parser = argparse.ArgumentParser(description="Check MAINTAINERS
>>> file")
>>> +    parser.add_argument("maintainers", help="Path to MAINTAINERS file")
>>> +    args = parser.parse_args()
>>> +
>>> +    found_file_entry = False
>>> +    found_incorrect_entries = False
>>> +    line_counter = 0
>>> +
>>> +    with open(args.maintainers) as file:
>>> +        for entry in file:
>>> +            line_counter += 1
>>> +
>>> +            if not entry.startswith("F:"):
>>> +                continue
>>> +            entry = entry[2:].strip()
>>> +            found_file_entry = True
>>> +
>>> +            file_exists = len(glob.glob(entry, recursive=True)) > 0
>>> +            if file_exists:
>>> +                continue
>>> +
>>> +            found_incorrect_entries = True
>>> +            print(
>>> +                f"No matching files for {args.maintainers}
>>> +{line_counter}: {entry}",
>>> +                file=sys.stderr,
>>> +            )
>>> +
>>> +    if not found_file_entry:
>>> +        raise Exception("no file entry found - is MAINTAINERS path
>>> correct?")
>>> +    if found_incorrect_entries:
>>> +        raise Exception(f"incorrect entries found in
>>> {args.maintainers}")
>>> +
>>> +
>>> +if __name__ == "__main__":
>>> +    main()
>>
> 



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] meson.build: check MAINTAINERS file is consistent with source tree
  2026-06-15 20:17 ` [PATCH 2/2] meson.build: check MAINTAINERS file is consistent with source tree Pierrick Bouvier
  2026-06-15 20:21   ` Pierrick Bouvier
  2026-06-16  0:35   ` Philippe Mathieu-Daudé
@ 2026-06-16  7:53   ` Daniel P. Berrangé
  2026-06-16  8:30     ` Peter Maydell
  2 siblings, 1 reply; 9+ messages in thread
From: Daniel P. Berrangé @ 2026-06-16  7:53 UTC (permalink / raw)
  To: Pierrick Bouvier
  Cc: qemu-devel, Marc-André Lureau, John Snow, Cleber Rosa,
	philmd, Paolo Bonzini, armbru, Philippe Mathieu-Daudé

On Mon, Jun 15, 2026 at 01:17:23PM -0700, Pierrick Bouvier wrote:
> We add a new script: scripts/check-maintainers-file.py, that will run at
> configuration time (and not at build time), to not hurt build time.
> This script runs in 0.2s on my dev VM, which has an old cpu.
> 
> We can expect things to be mostly in sync since adding or removing a
> source or test file will trigger a configure step.
> For the rest, like docs, tcg tests, or remaining files, GitLab CI will
> build things from scratch and always run the configure step.
> 
> With this, it should be impossible by design to have an upstream
> MAINTAINERS file with non existing file entries.

Accuracy of the MAINTAINERS file is an upstream-only concern, but
IIUC, this check is going to apply universally to every build of
QEMU which is undesirable. It is irrelevant to end users and not
appropriate to check in downsteam vendors forks.

In a "normal" modern project this kind of check would be done in
a CI job on the merge request, since that's the only place it is
relevant. In our case, the nearest fit is the checkpatch.pl file.

> 
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
> ---
>  meson.build                       |  5 +++
>  scripts/check-maintainers-file.py | 53 +++++++++++++++++++++++++++++++
>  2 files changed, 58 insertions(+)
>  create mode 100755 scripts/check-maintainers-file.py
> 
> diff --git a/meson.build b/meson.build
> index 19e123423b5..57e9c9de42b 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -17,6 +17,11 @@ add_test_setup('thorough',
>  
>  meson.add_postconf_script(find_program('scripts/symlink-install-tree.py'))
>  
> +# check our MAINTAINERS file is consistent
> +check_maintainers = find_program('scripts/check-maintainers-file.py')
> +maintainers_file = files('MAINTAINERS')
> +run_command([check_maintainers, maintainers_file], check: true)
> +
>  ####################
>  # Global variables #
>  ####################
> diff --git a/scripts/check-maintainers-file.py b/scripts/check-maintainers-file.py
> new file mode 100755
> index 00000000000..b001816a401
> --- /dev/null
> +++ b/scripts/check-maintainers-file.py
> @@ -0,0 +1,53 @@
> +#! /usr/bin/env python3
> +
> +# Check incorrect file entries in MAINTAINERS
> +#
> +# Author: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
> +#
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +
> +import argparse
> +import glob
> +import sys
> +
> +
> +def check_one_entry(line) -> bool:
> +    return True
> +
> +
> +def main() -> None:
> +    parser = argparse.ArgumentParser(description="Check MAINTAINERS file")
> +    parser.add_argument("maintainers", help="Path to MAINTAINERS file")
> +    args = parser.parse_args()
> +
> +    found_file_entry = False
> +    found_incorrect_entries = False
> +    line_counter = 0
> +
> +    with open(args.maintainers) as file:
> +        for entry in file:
> +            line_counter += 1
> +
> +            if not entry.startswith("F:"):
> +                continue
> +            entry = entry[2:].strip()
> +            found_file_entry = True
> +
> +            file_exists = len(glob.glob(entry, recursive=True)) > 0
> +            if file_exists:
> +                continue
> +
> +            found_incorrect_entries = True
> +            print(
> +                f"No matching files for {args.maintainers} +{line_counter}: {entry}",
> +                file=sys.stderr,
> +            )
> +
> +    if not found_file_entry:
> +        raise Exception("no file entry found - is MAINTAINERS path correct?")
> +    if found_incorrect_entries:
> +        raise Exception(f"incorrect entries found in {args.maintainers}")
> +
> +
> +if __name__ == "__main__":
> +    main()
> -- 
> 2.43.0
> 

With regards,
Daniel
-- 
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] meson.build: check MAINTAINERS file is consistent with source tree
  2026-06-16  7:53   ` Daniel P. Berrangé
@ 2026-06-16  8:30     ` Peter Maydell
  0 siblings, 0 replies; 9+ messages in thread
From: Peter Maydell @ 2026-06-16  8:30 UTC (permalink / raw)
  To: Daniel P. Berrangé
  Cc: Pierrick Bouvier, qemu-devel, Marc-André Lureau, John Snow,
	Cleber Rosa, philmd, Paolo Bonzini, armbru,
	Philippe Mathieu-Daudé

On Tue, 16 Jun 2026 at 08:54, Daniel P. Berrangé <berrange@redhat.com> wrote:
>
> On Mon, Jun 15, 2026 at 01:17:23PM -0700, Pierrick Bouvier wrote:
> > We add a new script: scripts/check-maintainers-file.py, that will run at
> > configuration time (and not at build time), to not hurt build time.
> > This script runs in 0.2s on my dev VM, which has an old cpu.
> >
> > We can expect things to be mostly in sync since adding or removing a
> > source or test file will trigger a configure step.
> > For the rest, like docs, tcg tests, or remaining files, GitLab CI will
> > build things from scratch and always run the configure step.
> >
> > With this, it should be impossible by design to have an upstream
> > MAINTAINERS file with non existing file entries.
>
> Accuracy of the MAINTAINERS file is an upstream-only concern, but
> IIUC, this check is going to apply universally to every build of
> QEMU which is undesirable. It is irrelevant to end users and not
> appropriate to check in downsteam vendors forks.
>
> In a "normal" modern project this kind of check would be done in
> a CI job on the merge request, since that's the only place it is
> relevant. In our case, the nearest fit is the checkpatch.pl file.

You could put it in "make check", or (if you want to avoid the
downstream-forks issue) in some sub-bit of "make check"
that we don't check by default but do check in one of our CI jobs.

checkpatch isn't a great place for checks that you want to
stay consistent on because so much of its output is "this
is wrong/merely something to check, ignore".

-- PMM


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-06-16  8:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-15 20:17 [PATCH 0/2] MAINTAINERS: enforce file entries are consistent from meson Pierrick Bouvier
2026-06-15 20:17 ` [PATCH 1/2] MAINTAINERS: fix entry for 'Python scripts' Pierrick Bouvier
2026-06-15 20:17 ` [PATCH 2/2] meson.build: check MAINTAINERS file is consistent with source tree Pierrick Bouvier
2026-06-15 20:21   ` Pierrick Bouvier
2026-06-16  0:35   ` Philippe Mathieu-Daudé
2026-06-16  2:51     ` Pierrick Bouvier
2026-06-16  3:15       ` Philippe Mathieu-Daudé
2026-06-16  7:53   ` Daniel P. Berrangé
2026-06-16  8:30     ` Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.