aboutsummaryrefslogtreecommitdiffstats
path: root/check_whence.py
diff options
authorEmil Velikov <emil.l.velikov@gmail.com>2024-10-18 13:58:01 +0100
committerMario Limonciello <superm1@gmail.com>2024-10-18 15:08:24 +0000
commit2f0464118f404b8adc4e245a4903c9a1385e00b0 (patch)
treeeee8b270915ffde6ddde80d95e23d72264561cf3 /check_whence.py
parent1f83bd21e40bdaeb59a291ef5b59f5584f647899 (diff)
check_whence.py: skip some validation if git ls-files fails
Recently we started running check_whence.py to validate WHENCE before installing files with copy-firmware.sh. It did not consider the fact that people may be using the distribution tarball, which lacks the relevant git metadata. Throw a warning and skip the relevant validation. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Diffstat (limited to 'check_whence.py')
-rwxr-xr-xcheck_whence.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/check_whence.py b/check_whence.py
index c3d4a2e3..1fece4f4 100755
--- a/check_whence.py
+++ b/check_whence.py
@@ -60,9 +60,12 @@ def list_links_list():
def list_git():
- with os.popen("git ls-files") as git_files:
- for line in git_files:
- yield line.rstrip("\n")
+ git_files = os.popen("git ls-files")
+ for line in git_files:
+ yield line.rstrip("\n")
+
+ if git_files.close():
+ sys.stderr.write("W: git file listing failed, skipping some validation\n")
def main():
@@ -135,7 +138,7 @@ def main():
)
ret = 1
- for name in sorted(list(known_files - git_files)):
+ for name in sorted(list(known_files - git_files) if len(git_files) else list()):
sys.stderr.write("E: %s listed in WHENCE does not exist\n" % name)
ret = 1
@@ -151,10 +154,10 @@ def main():
break
valid_targets.add(dirname)
- for link, target in sorted(links_list):
+ for link, target in sorted(links_list if len(git_files) else list()):
if target not in valid_targets:
sys.stderr.write(
- "E: target %s of link %s in WHENCE" " does not exist\n" % (target, link)
+ "E: target %s of link %s in WHENCE does not exist\n" % (target, link)
)
ret = 1