diff --git a/meson.build b/meson.build index 3f1d2ecf..9e0e575c 100644 --- a/meson.build +++ b/meson.build @@ -334,6 +334,8 @@ subdir('tests') subdir('examples') +meson.add_dist_script(sync_unsupported_files, '--check', udev_hwdb_list_file) + pkgconfig = import('pkgconfig') pkgconfig.generate( name: versioned_libname, diff --git a/scripts/sync-unsupported-devices.py b/scripts/sync-unsupported-devices.py index d0b55e17..11b45fdd 100755 --- a/scripts/sync-unsupported-devices.py +++ b/scripts/sync-unsupported-devices.py @@ -4,6 +4,7 @@ # fprint-list-udev-hwdb.c from the libfprint wiki page. import argparse +import os import re import sys from urllib.request import urlopen @@ -40,6 +41,11 @@ def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("source_file", help="Path to hwdb file") parser.add_argument("--url", default=DEFAULT_URL, help="Wiki page URL") + parser.add_argument( + "--check", + action="store_true", + help="Do not modify files, fail if an update is needed", + ) args = parser.parse_args() entries = parse_entries(fetch(args.url)) @@ -61,6 +67,10 @@ def main(): print("allowlist_id_table is already up to date") return + if args.check: + print("allowlist_id_table is out of date", file=sys.stderr) + sys.exit(1) + with open(args.source_file, "w", encoding="utf-8") as f: f.write(new_content)