]> git.ipfire.org Git - thirdparty/linux-firmware.git/blobdiff - check_whence.py
amdgpu: update renoir firmware for 20.10
[thirdparty/linux-firmware.git] / check_whence.py
index f83fb197aa579a9097c0d7108049b710232a4474..2d31f38391063f4c95ecc15e72e8f68fb3faa8c0 100755 (executable)
@@ -1,11 +1,16 @@
 #!/usr/bin/python
 
 import os, re, sys
+from io import open
 
 def list_whence():
-    with open('WHENCE') as whence:
+    with open('WHENCE', encoding='utf-8') as whence:
         for line in whence:
-            match = re.match(r'(?:File|Link|Source):\s*(\S*)', line)
+            match = re.match(r'(?:File|Source):\s*"(.*)"', line)
+            if match:
+                yield match.group(1)
+                continue
+            match = re.match(r'(?:File|Source):\s*(\S*)', line)
             if match:
                 yield match.group(1)
                 continue
@@ -29,15 +34,17 @@ def list_git():
             yield line.rstrip('\n')
 
 def main():
+    ret = 0
     whence_list = list(list_whence())
     known_files = set(name for name in whence_list if not name.endswith('/')) | \
                   set(['check_whence.py', 'configure', 'Makefile',
-                       'README', 'WHENCE'])
+                       'README', 'copy-firmware.sh', 'WHENCE'])
     known_prefixes = set(name for name in whence_list if name.endswith('/'))
     git_files = set(list_git())
 
     for name in sorted(list(known_files - git_files)):
         sys.stderr.write('E: %s listed in WHENCE does not exist\n' % name)
+        ret = 1
 
     for name in sorted(list(git_files - known_files)):
         # Ignore subdirectory changelogs and GPG detached signatures
@@ -51,6 +58,8 @@ def main():
                 break
         else:
             sys.stderr.write('E: %s not listed in WHENCE\n' % name)
+            ret = 1
+    return ret
 
 if __name__ == '__main__':
-    main()
+    sys.exit(main())