-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Report] Detecting new versions of Visual C++ Runtime (and other dependencies) #267
Comments
Speaking of which... https://github.com/bottlesdevs/dependencies/blob/main/Essentials/vcredist2022.yml is outdated. ;) |
I don't think dependency updates is something that can be easily automated since there may be metadata in the dependency manifest (e.g. full version numbers) which needs manual intervention to update. For Microsoft Visual C++ Redistributable ( https://github.com/abbodi1406/vcredist/tree/master/source_links The tool would only really tell us that something is out of date, but the download links in certain cases aren't very enlightening. For example, the |
@commiterate After getting the URL, if we see a changed URL, we need to download it and hash it. At the same time we'll use pefile to extract the exe version. |
Here's a quick example of how we'll do that: from pathlib import Path
import pefile
def get_exe_version(file_path: Path) -> str:
pe = pefile.PE(file_path)
# Access the VS_VERSIONINFO resource in the PE file.
for file_info_section in pe.FileInfo:
for file_info in file_info_section:
if file_info.Key == b"StringFileInfo":
for string_table in file_info.StringTable:
if b"FileVersion" in string_table.entries:
return string_table.entries[b"FileVersion"].decode("utf-8")
return "Version information not found"
file_path = Path.home() / ".var/app/com.usebottles.bottles/data/bottles/temp/vcredist2022_x64.exe"
version = get_exe_version(file_path)
print(f"EXE Version: {version}") Result:
|
Does that library handle |
MSI is not a PE format. They are some kind of zip-like format with embedded CAB archives. A RedHat employee wrote a tool for inspecting those files: https://manpages.ubuntu.com/manpages/focal/man1/msiinfo.1.html It's part of msitools: https://wiki.gnome.org/msitools Those can be called via https://pypi.org/project/packagedcode-msitools/ Edit: MSI files seem to store their version in a Edit: There's also a reference here from Microsoft. Seems like https://learn.microsoft.com/en-us/windows/win32/msi/summary-information-stream-property-set The Unix |
I don't see an existing auto-update tool, but it'll probably be straightforward to write something that parses all the dependency YAML files, looks at the Version information in the It's not clear how the tool would handle that case if there's version mismatches between the variants, so it probably just needs to give up and ask for human intervention. Also not clear on how to communicate that multiple install binaries in a given dependency manifest are just architectural variants rather than a dependency that just wraps multiple programs into a single manifest. That might need a schema change for the Steps:
- action: install_exe
variants:
- for:
- win32
url: "{x86 installer URL}"
checksum: "{md5 checksum}"
file_size: "{file size}"
arguments: "{arguments}"
- for:
- win64
url: "{x64 installer URL}"
checksum: "{md5 checksum}"
file_size: "{file size}"
arguments: "{arguments}" |
Yeah, and the dependency updater would need to know the upstream URL that points at the latest version, which is where something like this becomes necessary: Steps:
- action: install_exe
file_name: VC_redist.x86.exe
url: https://download.visualstudio.microsoft.com/download/pr/e9ff90f1-424e-4489-9302-28cbaed0fec1/E57FF114114F08F97977887A56975AF754374888E534D87622CEFEB7448653AE/VC_redist.x86.exe
rename: vcredist2022_x86.exe
file_checksum: 822551b098e93c504de2c7865216928f
file_size: 13949168
arguments: /quiet /norestart
x-version-checker:
type: rotating-url
url: https://aka.ms/vs/17/release/VC_redist.x86.exe Type is inspired by Flathub's automatic dependency updater. They have the So... an initial plan would be:
Edit: And you are right, there's no clear solution for how to denote the version when a dependency installer has multiple EXE/MSI files in its Steps. So we'd need to think about that... I can imagine a YAML layout where one of the Steps is marked as "this is the file to get the version information from". Something like a Something like this ( Name: vcredist2022
Description: Microsoft Visual C++ Redistributable (2015-2022)
*Version: 14.42.34430.0
Steps:
- action: install_exe
file_name: VC_redist.x86.exe
url: https://download.visualstudio.microsoft.com/download/pr/e9ff90f1-424e-4489-9302-28cbaed0fec1/E57FF114114F08F97977887A56975AF754374888E534D87622CEFEB7448653AE/VC_redist.x86.exe
rename: vcredist2022_x86.exe
file_checksum: 822551b098e93c504de2c7865216928f
file_size: 13949168
arguments: /quiet /norestart
*x-version-checker:
type: rotating-url
url: https://aka.ms/vs/17/release/VC_redist.x86.exe
*get_version_info: true The Bottles GUI could show the dependency description as "{Description} v{Version}" then. Edit: And if it's difficult to extract version for some dependency (nested zip files perhaps), the manifest would omit To do that, it's a matter of counting how many
|
#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?
Result:
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 aurl:
can also take ax-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
The text was updated successfully, but these errors were encountered: