From 8a507494f3febe8f6b4e933fc951fdb16e3932df Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Sun, 22 Sep 2024 17:31:24 +0100 Subject: [PATCH] check_whence.py: ban link-to-a-link Using link-to-a-link reduces legibility and changes to the root link, also changes the leafs. Where the latter may be undesired and in some cases just wrong. We have a couple of instances in-tree, so fix them up and ban the combination. One particularly good example, why we'd want this is: https://gitlab.com/kernel-firmware/linux-firmware/-/merge_requests/272 In there we have the following: File: ti/tas2781/TAS2XXX1EB30.bin [snip] Link: TAS2XXX1EB3.bin -> ti/tas2781/TAS2XXX1EB3.bin Link: ti/tas2781/TAS2XXX1EB3.bin -> TAS2XXX1EB30.bin Link: TAS2XXX1EB30.bin -> ti/tas2781/TAS2XXX1EB30.bin Signed-off-by: Emil Velikov --- WHENCE | 14 +++++++------- check_whence.py | 12 ++++++++++-- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/WHENCE b/WHENCE index e3e085b8..9678e670 100644 --- a/WHENCE +++ b/WHENCE @@ -3699,7 +3699,7 @@ File: ath10k/WCN3990/hw1.0/qcm2290/wlanmdsp.mbn Version: WLAN.HL.3.3.7.c2-00931-QCAHLSWMTPLZ-1 Link: ath10k/WCN3990/hw1.0/qrb4210/wlanmdsp.mbn -> ../qcm2290/wlanmdsp.mbn Link: qcom/qcm2290/wlanmdsp.mbn -> ../../ath10k/WCN3990/hw1.0/qcm2290/wlanmdsp.mbn -Link: qcom/qrb4210/wlanmdsp.mbn -> ../../ath10k/WCN3990/hw1.0/qrb4210/wlanmdsp.mbn +Link: qcom/qrb4210/wlanmdsp.mbn -> ../../ath10k/WCN3990/hw1.0/qcm2290/wlanmdsp.mbn File: ath10k/WCN3990/hw1.0/qcm2290/firmware-5.bin Link: ath10k/WCN3990/hw1.0/qrb4210/firmware-5.bin -> ../qcm2290/firmware-5.bin @@ -5227,11 +5227,11 @@ Link: nvidia/gp104/acr/bl.bin -> ../../gp102/acr/bl.bin Link: nvidia/gp104/acr/ucode_load.bin -> ../../gp102/acr/ucode_load.bin Link: nvidia/gp104/acr/ucode_unload.bin -> ../../gp102/acr/ucode_unload.bin Link: nvidia/gp104/acr/unload_bl.bin -> ../../gp102/acr/unload_bl.bin -Link: nvidia/gp104/gr/fecs_bl.bin -> ../../gp102/gr/fecs_bl.bin +Link: nvidia/gp104/gr/fecs_bl.bin -> ../../gm200/gr/fecs_bl.bin File: nvidia/gp104/gr/fecs_data.bin File: nvidia/gp104/gr/fecs_inst.bin File: nvidia/gp104/gr/fecs_sig.bin -Link: nvidia/gp104/gr/gpccs_bl.bin -> ../../gp102/gr/gpccs_bl.bin +Link: nvidia/gp104/gr/gpccs_bl.bin -> ../../gm200/gr/gpccs_bl.bin File: nvidia/gp104/gr/gpccs_data.bin File: nvidia/gp104/gr/gpccs_inst.bin File: nvidia/gp104/gr/gpccs_sig.bin @@ -5250,11 +5250,11 @@ Link: nvidia/gp106/acr/bl.bin -> ../../gp102/acr/bl.bin Link: nvidia/gp106/acr/ucode_load.bin -> ../../gp102/acr/ucode_load.bin Link: nvidia/gp106/acr/ucode_unload.bin -> ../../gp102/acr/ucode_unload.bin Link: nvidia/gp106/acr/unload_bl.bin -> ../../gp102/acr/unload_bl.bin -Link: nvidia/gp106/gr/fecs_bl.bin -> ../../gp102/gr/fecs_bl.bin +Link: nvidia/gp106/gr/fecs_bl.bin -> ../../gm200/gr/fecs_bl.bin File: nvidia/gp106/gr/fecs_data.bin Link: nvidia/gp106/gr/fecs_inst.bin -> ../../gp102/gr/fecs_inst.bin File: nvidia/gp106/gr/fecs_sig.bin -Link: nvidia/gp106/gr/gpccs_bl.bin -> ../../gp102/gr/gpccs_bl.bin +Link: nvidia/gp106/gr/gpccs_bl.bin -> ../../gm200/gr/gpccs_bl.bin File: nvidia/gp106/gr/gpccs_data.bin Link: nvidia/gp106/gr/gpccs_inst.bin -> ../../gp102/gr/gpccs_inst.bin File: nvidia/gp106/gr/gpccs_sig.bin @@ -5998,10 +5998,10 @@ File: netronome/flower/nic_AMDA0096.nffw File: netronome/flower/nic_AMDA0097.nffw File: netronome/flower/nic_AMDA0058.nffw Link: netronome/flower/nic_AMDA0081.nffw -> nic_AMDA0097.nffw -Link: netronome/flower/nic_AMDA0081-0001_1x40.nffw -> nic_AMDA0081.nffw +Link: netronome/flower/nic_AMDA0081-0001_1x40.nffw -> nic_AMDA0097.nffw Link: netronome/flower/nic_AMDA0097-0001_2x40.nffw -> nic_AMDA0097.nffw Link: netronome/flower/nic_AMDA0099-0001_2x10.nffw -> nic_AMDA0099.nffw -Link: netronome/flower/nic_AMDA0081-0001_4x10.nffw -> nic_AMDA0081.nffw +Link: netronome/flower/nic_AMDA0081-0001_4x10.nffw -> nic_AMDA0097.nffw Link: netronome/flower/nic_AMDA0097-0001_4x10_1x40.nffw -> nic_AMDA0097.nffw Link: netronome/flower/nic_AMDA0099-0001_2x25.nffw -> nic_AMDA0099.nffw Link: netronome/flower/nic_AMDA0096-0001_2x10.nffw -> nic_AMDA0096.nffw diff --git a/check_whence.py b/check_whence.py index c270ee60..d7742f1e 100755 --- a/check_whence.py +++ b/check_whence.py @@ -115,12 +115,20 @@ def main(): sys.stderr.write("E: %s listed in WHENCE as Link, is in tree\n" % name) ret = 1 + invalid_targets = set(link[0] for link in links_list) + for link, target in sorted(links_list): + if target in invalid_targets: + sys.stderr.write( + "E: target %s of link %s is also a link\n" % (target, link) + ) + 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 - # A link can point to another link, or to a file... - valid_targets = set(link[0] for link in links_list) | git_files + # A link can point to a file... + valid_targets = set(git_files) # ... or to a directory for target in set(valid_targets):