From: Jan Stancek <[email protected]>

redhat: sanity check yaml files

Signed-off-by: Jan Stancek <[email protected]>

diff --git a/redhat/Makefile b/redhat/Makefile
index blahblah..blahblah 100644
--- a/redhat/Makefile
+++ b/redhat/Makefile
@@ -716,6 +716,11 @@ sources-rh: $(TARBALL) $(KABI_TARBALL) $(KABIDW_TARBALL) 
generate-testpatch-tmp
                cp kabi/Module.kabi_$$KABIARCH $(SOURCES)/; \
                cp kabi/Module.kabi_dup_$$KABIARCH $(SOURCES)/; \
        done
+       @find $(SOURCES)/ -name "*.yaml" -o -name "*.yaml.fedora" -o -name 
"*.yaml.rhel" | \
+               xargs -i{} $(REDHAT)/scripts/yamlsanity.py {}
+       @echo Sanity checking filtermods configs
+       @$(REDHAT)/scripts/filtermods.py -q sort -c 
$(SOURCES)/def_variants.yaml.fedora -d /dev/null
+       @$(REDHAT)/scripts/filtermods.py -q sort -c 
$(SOURCES)/def_variants.yaml.rhel -d /dev/null
 
 dist-sources: dist-kabi dist-kabi-dup sources-rh
 
diff --git a/redhat/scripts/yamlsanity.py b/redhat/scripts/yamlsanity.py
new file mode 100755
index blahblah..blahblah 100755
--- /dev/null
+++ b/redhat/scripts/yamlsanity.py
@@ -0,0 +1,17 @@
+#!/usr/bin/env python3
+
+import sys
+import yaml
+
+def default_ctor(loader, tag_suffix, node):
+    return None
+
+if __name__ == '__main__':
+    print('yaml sanity check', sys.argv[1], end=' ')
+
+    loader = yaml.SafeLoader
+    loader.add_multi_constructor('', default_ctor)
+
+    with open(sys.argv[1], 'r') as file:
+        yaml.load(file, Loader=loader)
+    print('OK')

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2943
--
_______________________________________________
kernel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/[email protected]
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to