check_whence: Check link targets are valid
PATCH 1/2 check_whence: Check link targets are valid
This should catch a couple of common errors: reversing the two arguments, and not making the second argument relative to the first.
Signed-off-by Adam Sampson <[email protected]>
--- check_whence.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
check_whence.py +37 -0
@@ -28,6 +28,24 @@ def list_whence(): yield match.group(2) continue +def list_whence_links(): + with open('WHENCE', encoding='utf-8') as whence: + for line in whence: + fields = line.rstrip() + match = re.match(r'Link:\s*(.*)', line) + if match: + linkname, target = match.group(1).split("->") + + linkname = linkname.strip().replace('\\ ', ' ') + target = target.strip().replace('\\ ', ' ') + + # Link target is relative to the link + target = os.path.join(os.path.dirname(linkname), target) + target = os.path.normpath(target) + + yield (linkname, target) + continue + def list_git(): with os.popen('git ls-files') as git_files: for line in git_files:
@@ -36,6 +54,7 @@ def list_git(): def main(): ret = 0 whence_list = list(list_whence()) + links_list = list(list_whence_links()) known_files = set(name for name in whence_list if not name.endswith('/')) | \ set(['check_whence.py', 'configure', 'Makefile', 'README', 'copy-firmware.sh', 'WHENCE'])
@@ -46,6 +65,24 @@ def main(): 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 + + # ... or to a directory + for target in set(valid_targets): + dirname = target + while True: + dirname = os.path.dirname(dirname) + if dirname == '': + break + valid_targets.add(dirname) + + for name, target in sorted(links_list): + if target not in valid_targets: + sys.stderr.write('E: target %s of link %s in WHENCE' + ' does not exist\n' % (target, name)) + ret = 1 + for name in sorted(list(git_files - known_files)): # Ignore subdirectory changelogs and GPG detached signatures if (name.endswith('/ChangeLog') or
Signature · 1 line
2.30.2
PATCH 2/2 intel: Fix broken links
The target is relative to the link name.
Fixes 23afbfe8 ("intel: avs: Add AudioDSP base firmware for CNL-based platforms")
Fixes 284e55d9 ("intel: avs: Add AudioDSP base firmware for APL-based platforms")
Fixes 289e3a97 ("intel: avs: Add AudioDSP base firmware for SKL-based platforms")
Fixes 4296b7af ("intel: catpt: Add AudioDSP base firmware for BDW platforms")
Signed-off-by Adam Sampson <[email protected]>
--- WHENCE | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
WHENCE +6 -6
@@ -4070,7 +4070,7 @@ Driver: snd_soc_catpt -- Intel AudioDSP driver for HSW/BDW platforms File: intel/catpt/bdw/dsp_basefw.bin Version: 44b81c4d5397a63108356f58f036953d9b288c4e -Link: intel/IntcSST2.bin -> intel/catpt/bdw/dsp_basefw.bin +Link: intel/IntcSST2.bin -> catpt/bdw/dsp_basefw.bin License: Redistributable. See LICENCE.IntcSST2 for details
@@ -4081,15 +4081,15 @@ Driver: snd_soc_avs -- Intel AudioDSP driver for cAVS platforms File: intel/avs/skl/dsp_basefw.bin File: intel/avs/skl/dsp_mod_7CAD0808-AB10-CD23-EF45-12AB34CD56EF.bin Version: 9.21.00.4899 -Link: intel/dsp_fw_release.bin -> intel/avs/skl/dsp_basefw.bin -Link: intel/dsp_fw_kbl.bin -> intel/avs/skl/dsp_basefw.bin +Link: intel/dsp_fw_release.bin -> avs/skl/dsp_basefw.bin +Link: intel/dsp_fw_kbl.bin -> avs/skl/dsp_basefw.bin File: intel/avs/apl/dsp_basefw.bin Version: 9.22.01.4908 -Link: intel/dsp_fw_bxtn.bin -> intel/avs/apl/dsp_basefw.bin -Link: intel/dsp_fw_glk.bin -> intel/avs/apl/dsp_basefw.bin +Link: intel/dsp_fw_bxtn.bin -> avs/apl/dsp_basefw.bin +Link: intel/dsp_fw_glk.bin -> avs/apl/dsp_basefw.bin File: intel/avs/cnl/dsp_basefw.bin Version: 10.23.00.8551 -Link: intel/dsp_fw_cnl.bin -> intel/avs/cnl/dsp_basefw.bin +Link: intel/dsp_fw_cnl.bin -> avs/cnl/dsp_basefw.bin License: Redistributable. See LICENCE.adsp_sst for details
Signature · 1 line
2.30.2
Re: [PATCH 2/2] intel: Fix broken links
I got to your patch after a similar report and fixed it via a similar commit. My apologies for not using your patch directly.
josh
Quoted 49 lines · Adam Sampson
The target is relative to the link name.
Fixes 23afbfe8 ("intel: avs: Add AudioDSP base firmware for CNL-based platforms")Fixes 284e55d9 ("intel: avs: Add AudioDSP base firmware for APL-based platforms")Fixes 289e3a97 ("intel: avs: Add AudioDSP base firmware for SKL-based platforms")Fixes 4296b7af ("intel: catpt: Add AudioDSP base firmware for BDW platforms")Signed-off-by Adam Sampson <[email protected]>--- WHENCE | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)WHENCE +6
-7@@ -4070,7 +4070,7 @@ Driver: snd_soc_catpt -- Intel AudioDSP driver for HSW/BDW platforms File: intel/catpt/bdw/dsp_basefw.bin Version: 44b81c4d5397a63108356f58f036953d9b288c4e -Link: intel/IntcSST2.bin -> intel/catpt/bdw/dsp_basefw.bin +Link: intel/IntcSST2.bin -> catpt/bdw/dsp_basefw.bin License: Redistributable. See LICENCE.IntcSST2 for details@@ -4081,15 +4081,15 @@ Driver: snd_soc_avs -- Intel AudioDSP driver for cAVS platforms File: intel/avs/skl/dsp_basefw.bin File: intel/avs/skl/dsp_mod_7CAD0808-AB10-CD23-EF45-12AB34CD56EF.bin Version: 9.21.00.4899 -Link: intel/dsp_fw_release.bin -> intel/avs/skl/dsp_basefw.bin -Link: intel/dsp_fw_kbl.bin -> intel/avs/skl/dsp_basefw.bin +Link: intel/dsp_fw_release.bin -> avs/skl/dsp_basefw.bin +Link: intel/dsp_fw_kbl.bin -> avs/skl/dsp_basefw.bin File: intel/avs/apl/dsp_basefw.bin Version: 9.22.01.4908 -Link: intel/dsp_fw_bxtn.bin -> intel/avs/apl/dsp_basefw.bin -Link: intel/dsp_fw_glk.bin -> intel/avs/apl/dsp_basefw.bin +Link: intel/dsp_fw_bxtn.bin -> avs/apl/dsp_basefw.bin +Link: intel/dsp_fw_glk.bin -> avs/apl/dsp_basefw.bin File: intel/avs/cnl/dsp_basefw.bin Version: 10.23.00.8551 -Link: intel/dsp_fw_cnl.bin -> intel/avs/cnl/dsp_basefw.bin +Link: intel/dsp_fw_cnl.bin -> avs/cnl/dsp_basefw.bin License: Redistributable. See LICENCE.adsp_sst for details --2.30.2