Description
#259 introduced versioned URLs which means that we can no longer detect when the upstream Visual C++ runtime has new releases with bugfixes.
We used to get hash errors since we retrieved the "latest version" URL at all times. Now we silently install older versions instead. This leads to a risk of not discovering updates.
But I wrote a small script to demonstrate how we can detect when new runtimes are available. Does Bottles have a dependency version checker/updater script somewhere where this can be integrated?
import urllib.request
urls = [
# vcredist2019
"https://aka.ms/vs/16/release/VC_redist.x86.exe",
"https://aka.ms/vs/16/release/VC_redist.x64.exe",
# vcredist2022
"https://aka.ms/vs/17/release/VC_redist.x86.exe",
"https://aka.ms/vs/17/release/VC_redist.x64.exe",
]
for url in urls:
request = urllib.request.Request(url, method="HEAD")
try:
response = urllib.request.urlopen(request)
final_url = response.geturl()
print(f'"{url}
660D
": "{final_url}"')
except urllib.error.URLError as e:
print(f"Error fetching URL {url}: {e}")
Result:
"https://aka.ms/vs/16/release/VC_redist.x86.exe": "https://download.visualstudio.microsoft.com/download/pr/5efdbcb7-d3bd-4432-a2fb-b267c386e2f3/49545CB0F6499C4A65E1E8D5033441EEEB4EDFAE465A68489A70832C6A4F6399/VC_redist.x86.exe"
"https://aka.ms/vs/16/release/VC_redist.x64.exe": "https://download.visualstudio.microsoft.com/download/pr/453680ea-b88a-411f-80fd-5db37fdc9dbb/5D9999036F2B3A930F83B7FE3E2186B12E79AE7C007D538F52E3582E986A37C3/VC_redist.x64.exe"
"https://aka.ms/vs/17/release/VC_redist.x86.exe": "https://download.visualstudio.microsoft.com/download/pr/5319f718-2a84-4aff-86be-8dbdefd92ca1/DD1A8BE03398367745A87A5E35BEBDAB00FDAD080CF42AF0C3F20802D08C25D4/VC_redist.x86.exe"
"https://aka.ms/vs/17/release/VC_redist.x64.exe": "https://download.visualstudio.microsoft.com/download/pr/c7dac50a-e3e8-40f6-bbb2-9cc4e3dfcabe/1821577409C35B2B9505AC833E246376CC68A8262972100444010B57226F0940/VC_redist.x64.exe"
If there's no infrastructure for detecting dependency updates yet, then it could be an excellent idea to extend the current dependency .yml
format so that any field which takes a url:
can also take a x-version-checker:
array with details such as how and what to check (similar to Flathub's flatpak-external-data-checker.
There, we'd be able to say "check the redirect-target of this URL, and if the target URL changes, hash the new file and its size and update the dependency manifest with the new URL". It may even be possible to use the Flatpak checker library to do it, since it's written in Python and has all functions we'd need.
Their "rotating-url" checker, without any "pattern" specified, is able to follow redirects and detect new redirect URLs, for example.
Ping: @mirkobrombin @commiterate