scripts/clean_functional_cache: tolerate missing .stamp files
PATCH 1/1 scripts/clean_functional_cache: tolerate missing .stamp files
Assets cached before the stamp files were introduced have no corresponding .stamp file. The script already copes with that when reading the timestamp, by assuming the QEMU v10.1 release date, which makes such assets eligible for removal.
However, since commit c1bb594fe41, removing the asset also unconditionally unlinks its .stamp file. For these old entries that file does not exist, so unlink() raises FileNotFoundError and the script aborts after deleting the first such asset, leaving the rest of the cache uncleaned and returning an error.
Pass missing_ok=True so that a missing .stamp file is not an error.
--- scripts/clean_functional_cache.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/clean_functional_cache.py +1 -1
@@ -44,4 +44,4 @@ print(f"Removing {cache_dir}/{file.name}.") file.chmod(stat.S_IWRITE) file.unlink() - stampfile.unlink() + stampfile.unlink(missing_ok=True)
Signature · 1 line
2.34.1
Quoted 24 lines · Brian Cain
Assets cached before the stamp files were introduced have no corresponding .stamp file. The script already copes with that when reading the timestamp, by assuming the QEMU v10.1 release date, which makes such assets eligible for removal.
However, since commit
c1bb594fe41, removing the asset also unconditionally unlinks its .stamp file. For these old entries that file does not exist, sounlink()raises FileNotFoundError and the script aborts after deleting the first such asset, leaving the rest of the cache uncleaned and returning an error.Pass missing_ok=True so that a missing .stamp file is not an error.
Fixes c1bb594fe415 ("scripts/clean_functional_cache: Remove also .stamp files")Signed-off-by Brian Cain <[email protected]>--- scripts/clean_functional_cache.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)scripts/clean_functional_cache.py +0
-0
scripts/clean_functional_cache.py line 47
Quoted 5 lines
scripts/clean_functional_cache.py +1
-1@@ -44,4 +44,4 @@ print(f"Removing {cache_dir}/{file.name}.") file.chmod(stat.S_IWRITE) file.unlink() - stampfile.unlink() + stampfile.unlink(missing_ok=True)
Quoted 11 lines · Brian Cain
Assets cached before the stamp files were introduced have no corresponding .stamp file. The script already copes with that when reading the timestamp, by assuming the QEMU v10.1 release date, which makes such assets eligible for removal.
However, since commit
c1bb594fe41, removing the asset also unconditionally unlinks its .stamp file. For these old entries that file does not exist, sounlink()raises FileNotFoundError and the script aborts after deleting the first such asset, leaving the rest of the cache uncleaned and returning an error.
Quoted 7 lines
Pass missing_ok=True so that a missing .stamp file is not an error.
Fixes c1bb594fe415 ("scripts/clean_functional_cache: Remove also .stamp files")Signed-off-by Brian Cain <[email protected]>--- scripts/clean_functional_cache.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)