summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmil Velikov <emil.l.velikov@gmail.com>2023-03-01 18:51:31 +0000
committerJosh Boyer <jwboyer@kernel.org>2023-05-08 08:37:54 -0400
commit05183b7bd5593edec62018c30dd52b9603df0368 (patch)
tree4c9c1fdf4915ce71cd33f6eafbf6f9bddb302ac2
parentc4423c9147d6147b85568a758d0719659f62e753 (diff)
downloadlinux-firmware-05183b7bd5593edec62018c30dd52b9603df0368.tar.gz
check_whence: error on duplicate file entries
There's little point in copying (or compressing with later patches) the same files multiple times. So let's error out when duplicate entries are present. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Signed-off-by: Josh Boyer <jwboyer@kernel.org>
-rwxr-xr-xcheck_whence.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/check_whence.py b/check_whence.py
index 8805e99..9d99e94 100755
--- a/check_whence.py
+++ b/check_whence.py
@@ -28,6 +28,14 @@ def list_whence():
yield match.group(2)
continue
+def list_whence_files():
+ with open('WHENCE', encoding='utf-8') as whence:
+ for line in whence:
+ match = re.match(r'File:\s*(.*)', line)
+ if match:
+ yield match.group(1).replace("\ ", " ")
+ continue
+
def list_git():
with os.popen('git ls-files') as git_files:
for line in git_files:
@@ -36,12 +44,17 @@ def list_git():
def main():
ret = 0
whence_list = list(list_whence())
+ whence_files = list(list_whence_files())
known_files = set(name for name in whence_list if not name.endswith('/')) | \
set(['check_whence.py', 'configure', 'Makefile',
'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 set(fw for fw in whence_files if whence_files.count(fw) > 1):
+ sys.stderr.write('E: %s listed in WHENCE twice\n' % name)
+ ret = 1
+
for name in sorted(list(known_files - git_files)):
sys.stderr.write('E: %s listed in WHENCE does not exist\n' % name)
ret = 1