Skip to content
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

handle cases where extensions don't exist. #852

Merged
merged 5 commits into from
Dec 16, 2024

Conversation

tsteven4
Copy link
Contributor

for example with windows desktop 6.8.1 win64_msvc2022_arm64_cross_compiled both qtwebengine and qtpdf don't exist.

this resolves #851

for example with windows desktop 6.8.1 win64_msvc2022_arm64_cross_compiled
both qtwebengine and qtpdf don't exist.
@jdpurcell
Copy link
Contributor

jdpurcell commented Dec 14, 2024

Should list-qt try to hide extensions that aren't available for the architecture? I was trying something like this approach but I'm not sure if I like it 😄

@tsteven4
Copy link
Contributor Author

tsteven4 commented Dec 14, 2024

you are correct, there are additional problems with list-qt.

  1. --long-modules can die trying to download an non-existent Updates.xml
aqt list-qt windows desktop --long-modules 6.8.1 win64_llvm_mingw
ERROR   : Failed to download checksum for the file 'Updates.xml' from mirrors '['https://download.qt.io']
==============================Suggested follow-up:==============================
* Check your internet connection
* Consider modifying `requests.max_retries_to_retrieve_hash` in settings.ini
* 

with the tail of the debug log

2024-12-14 11:22:46,941 - aqt.helper - DEBUG - helper 139732248014976 Attempt to download checksum at https://download.qt.io/online/qtsdkrepository/windows_x86/extensions/qtwebengine/681/llvm_mingw/Updates.xml.sha256
2024-12-14 11:22:47,593 - aqt.main - ERROR - installer 139732248014976 Failed to download checksum for the file 'Updates.xml' from mirrors '['https://download.qt.io']
  1. --modules can report extensions that don't exist.
aqt list-qt windows desktop --modules 6.8.1 win64_llvm_mingw

finds both qtpdf and qtwebengine, but only qtpdf actual exists.

@tsteven4
Copy link
Contributor Author

If the availability of extensions by host/target sdk/VERSION/ARCHITECTURE is static then hardcoding a repo property as you suggest is easy and runs faster as we don't have to speculatively fetch urls. OTOH, if the availability changes from release to release we may want to figure it out dynamically as I attempted (except for a hardcoded list of possible extensions that is used by install-qt but not list-qt!)

@Kidev
Copy link
Contributor

Kidev commented Dec 14, 2024

@tsteven4 Check the Qt LTS part: #846 (comment)

From now on, they will decouple extensions versions from Qt versions. That's why the repo structure changed

Also, I think that the check error you see is just a timeout from a bad mirror:

2024-12-14 16:26:16,313 - aqt.helper - INFO - helper 1516 Redirected: mirrors.ustc.edu.cn
2024-12-14 16:26:16,635 - aqt.installer - WARNING - installer 1724 Caught ArchiveChecksumError, terminating installer workers
2024-12-14 16:26:16,651 - aqt.main - ERROR - installer 1724 Downloaded file 6.7.3-202409200836qtbase-Windows-Windows_11_23H2-Clang-Windows-Windows_11_23H2-X86_64.7z is corrupted! Detect checksum error.
Expect 886180fdff4d17a77cb751654607c1ab39f1d9a12edb23282e550695b44a012b: https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt6_673/qt.qt6.673.win64_llvm_mingw/6.7.3-202409200836qtbase-Windows-Windows_11_23H2-Clang-Windows-Windows_11_23H2-X86_64.7z
Actual 0ee6b318f1716ab86de0ee4abbed96a007530c13cd51727e0c8e73740bf5674a: qtbase-Windows-Windows_11_23H2-Clang-Windows-Windows_11_23H2-X86_64.7z
I had the same issue with the same mirror on the same test here (https://mirrors.ustc.edu.cn)
2024-12-12T04:20:40.1307030Z 2024-12-12 04:20:40,121 - aqt.helper - INFO - helper 4892 Redirected: mirrors.ustc.edu.cn
2024-12-12T04:20:40.4775778Z 2024-12-12 04:20:40,465 - aqt.installer - WARNING - installer 6676 Caught ArchiveChecksumError, terminating installer workers
2024-12-12T04:20:40.4904276Z 2024-12-12 04:20:40,481 - aqt.main - ERROR - installer 6676 Downloaded file 6.7.3-202409200836qtbase-Windows-Windows_11_23H2-Clang-Windows-Windows_11_23H2-X86_64.7z is corrupted! Detect checksum error.
2024-12-12T04:20:40.4905554Z Expect 886180fdff4d17a77cb751654607c1ab39f1d9a12edb23282e550695b44a012b: https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt6_673/qt.qt6.673.win64_llvm_mingw/6.7.3-202409200836qtbase-Windows-Windows_11_23H2-Clang-Windows-Windows_11_23H2-X86_64.7z
2024-12-12T04:20:40.4906857Z Actual a3c1d925d7db1dd8d7e71f37958a2c82ee2bfd3f00c88696dbf3c3d98aa66d30: qtbase-Windows-Windows_11_23H2-Clang-Windows-Windows_11_23H2-X86_64.7z
2024-12-12T04:20:40.5625452Z 
2024-12-12T04:20:40.5670643Z ##[error]Bash exited with code '1'.
2024-12-12T04:20:40.5725107Z ##[section]Finishing: Run Aqt

And doing a simple git commit -m"Update checks" --allow-empty reran the checks and it worked this time
image

Note

Maybe using the Qt online installer could be useful to get the extensions dynamically:

❯ ./qt-installer search 'extensions.*.680$'
<availablepackages>
    <package name="extensions.qtinsighttracker.680" displayname="Qt 6.8.0 " version="6.8.0-0-202410030748"/>
    <package name="extensions.qtpdf.680" displayname="Qt 6.8.0 " version="6.8.0-0-202410030748"/>
    <package name="extensions.qtwebengine.680" displayname="Qt 6.8.0 " version="6.8.0-0-202410030749"/>
</availablepackages>

@tsteven4
Copy link
Contributor Author

from @Kidev's scrapper the currently available extensions are as folllow. 6.8.1 and 6.8.0 don't show any differences in availablity.

qtwebengine:

/online/qtsdkrepository/windows_x86/extensions/qtwebengine/681/msvc2022_64
/online/qtsdkrepository/windows_x86/extensions/qtwebengine/680/msvc2022_64
/online/qtsdkrepository/mac_x64/extensions/qtwebengine/681/clang_64
/online/qtsdkrepository/mac_x64/extensions/qtwebengine/680/clang_64
/online/qtsdkrepository/linux_x64/extensions/qtwebengine/681/x86_64
/online/qtsdkrepository/linux_x64/extensions/qtwebengine/680/x86_64
/online/qtsdkrepository/linux_arm64/extensions/qtwebengine/681/arm64
/online/qtsdkrepository/linux_arm64/extensions/qtwebengine/680/arm64

qtpdf:

/online/qtsdkrepository/windows_x86/extensions/qtpdf/681/msvc2022_64
/online/qtsdkrepository/windows_x86/extensions/qtpdf/681/mingw
/online/qtsdkrepository/windows_x86/extensions/qtpdf/681/llvm_mingw
/online/qtsdkrepository/windows_x86/extensions/qtpdf/680/msvc2022_64
/online/qtsdkrepository/windows_x86/extensions/qtpdf/680/mingw
/online/qtsdkrepository/windows_x86/extensions/qtpdf/680/llvm_mingw
/online/qtsdkrepository/mac_x64/extensions/qtpdf/681/ios
/online/qtsdkrepository/mac_x64/extensions/qtpdf/681/clang_64
/online/qtsdkrepository/mac_x64/extensions/qtpdf/680/ios
/online/qtsdkrepository/mac_x64/extensions/qtpdf/680/clang_64
/online/qtsdkrepository/linux_x64/extensions/qtpdf/681/x86_64
/online/qtsdkrepository/linux_x64/extensions/qtpdf/680/x86_64
/online/qtsdkrepository/linux_arm64/extensions/qtpdf/681/arm64
/online/qtsdkrepository/linux_arm64/extensions/qtpdf/680/arm64
/online/qtsdkrepository/all_os/extensions/qtpdf/681/qt6_681_x86_64
/online/qtsdkrepository/all_os/extensions/qtpdf/681/qt6_681_x86
/online/qtsdkrepository/all_os/extensions/qtpdf/681/qt6_681_armv7
/online/qtsdkrepository/all_os/extensions/qtpdf/681/qt6_681_arm64_v8a
/online/qtsdkrepository/all_os/extensions/qtpdf/680/qt6_680_x86_64
/online/qtsdkrepository/all_os/extensions/qtpdf/680/qt6_680_x86
/online/qtsdkrepository/all_os/extensions/qtpdf/680/qt6_680_armv7
/online/qtsdkrepository/all_os/extensions/qtpdf/680/qt6_680_arm64_v8a

@tsteven4
Copy link
Contributor Author

I believe the last two commits fix the issues with list-qt --modules and list-qt --long-modules.

there are still issues with android that are beyond the scope of this work.

@tsteven4
Copy link
Contributor Author

if we are going to go this way it would be nice to de-duplicate at least between list-qt --modules and --long-modules. it would be even nicer to de-duplicate with install-qt and list-qt.

@@ -886,9 +899,19 @@ def to_module_arch(name: str) -> Tuple[Optional[str], Optional[str]]:
module, _arch = to_module_arch(name)
if _arch == arch:
modules.add(cast(str, module))
if version >= Version("6.8.0"):
for ext in self.fetch_extensions():
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fetch_extensions is no longer used.

@miurahr
Copy link
Owner

miurahr commented Dec 15, 2024

The approach is acceptable and good enough in the current situation.
I want to merge here and release the next.

@tsteven4
Copy link
Contributor Author

I want to merge here and release the next.

ok by me.

@tsteven4
Copy link
Contributor Author

my list-qt testing looks good. Both --modules and --long-modules are tested. This is a log of aqt arguments followed by two digits. The first digit indicates the qtpdf extension exists, the second indicates if the qtwebengine extensions exists.

list-qt windows desktop --modules 6.8.1 win64_msvc2022_64 1 1
list-qt windows desktop --modules 6.8.1 win64_mingw 1 0
list-qt windows desktop --modules 6.8.1 win64_llvm_mingw 1 0
list-qt windows desktop --modules 6.8.1 win64_msvc2022_arm64_cross_compiled 0 0
list-qt mac ios --modules 6.8.1 ios 1 0
list-qt mac desktop --modules 6.8.1 clang_64 1 1
list-qt linux desktop --modules 6.8.1 linux_gcc_64 1 1
list-qt linux_arm64 desktop --modules 6.8.1 linux_gcc_arm64 1 1
list-qt windows desktop --long-modules 6.8.1 win64_msvc2022_64 1 1
list-qt windows desktop --long-modules 6.8.1 win64_mingw 1 0
list-qt windows desktop --long-modules 6.8.1 win64_llvm_mingw 1 0
list-qt windows desktop --long-modules 6.8.1 win64_msvc2022_arm64_cross_compiled 0 0
list-qt mac ios --long-modules 6.8.1 ios 1 0
list-qt mac desktop --long-modules 6.8.1 clang_64 1 1
list-qt linux desktop --long-modules 6.8.1 linux_gcc_64 1 1
list-qt linux_arm64 desktop --long-modules 6.8.1 linux_gcc_arm64 1 1

@Kidev
Copy link
Contributor

Kidev commented Dec 15, 2024

@tsteven4 You may have missed some android versions in all_os: https://download.qt.io/online/qtsdkrepository/all_os/extensions/qtpdf/681/
Yeah it's pretty much all over the place. There is only source folders for qtwebengine for example... It's to try to not lose my mind over stuff like this that I wrote the scrapper because it's painful otherwise to search the repo tree

@tsteven4
Copy link
Contributor Author

@Kidev,
The scrapper was useful, I wanted to pass a url to find.

I intentionally ignored android. android has issues beyond extensions. I also considered source/debug/examples functionality to be beyond the scope of this work as well.

@Kidev
Copy link
Contributor

Kidev commented Dec 15, 2024

I intentionally ignored android. android has issues beyond extensions. I also considered source/debug/examples functionality to be beyond the scope of this work as well.

I agree on the idea, features are nice, but adding too much too few people use just makes the tool less user friendly. Maybe I'm wrong, but I think people use aqt to install Qt quickly without having to deal with the Qt's installer. But devs and so on use the Maintenance tool to get the sources or the SDK.

However for android I'm split, it is present in users bug reports, and is typically one of the use case of aqt in CIs...

I think the current code of aqt is missing something that would make the code much more easy to maintain. It needs a consistent data structure abstracting the download.qt.io data. So the CLI code would never need to change, only the data structure would need to handle the additions of new folders and patterns and make it fit a consistent model over which we have control. This data structure could be automatically built by Github Action workflow running each day for example, creating a data file that can be pulled whenever a user runs aqt update for example. So users would get updates very quickly, without having to push releases

@Kidev
Copy link
Contributor

Kidev commented Dec 15, 2024

@tsteven4 I think you changed it in this PR, but in master, this in _get_archives_base(self, name, target_packages) in archives.py

for ext in ["qtwebengine", "qtpdf"]:
    extensions_target_folder = posixpath.join(
        "online/qtsdkrepository", os_name, "extensions", ext, self._version_str(), arch
    )
    extensions_xml_url = posixpath.join(extensions_target_folder, "Updates.xml")
    extensions_xml_text = self._download_update_xml(extensions_xml_url)
    update_xmls.append(UpdateXmls(extensions_target_folder, extensions_xml_text))

is very bad when there is no qtwebengine available. It was making downloading 6.8+ wasm impossible as it triggered a 'too much timeouts' even if the wasm package was found first:

2024-12-15 22:45:20,543 - aqt.main - WARNING - installer 129600515533696 You are installing the Qt6-WASM version of Qt, which requires that the desktop version of Qt is also installed. You can install it with the following command:
          `aqt install-qt linux desktop 6.8.1 linux_gcc_64`
2024-12-15 22:45:20,543 - aqt.helper - DEBUG - helper 129600515533696 Attempt to download checksum at https://download.qt.io/online/qtsdkrepository/all_os/wasm/qt6_681/qt6_681_wasm_multithread/Updates.xml.sha256
2024-12-15 22:45:20,935 - aqt.helper - DEBUG - helper 129600515533696 Attempt to download checksum at https://download.qt.io/online/qtsdkrepository/all_os/extensions/qtwebengine/681/wasm_multithread/Updates.xml.sha256
2024-12-15 22:45:21,205 - aqt.helper - DEBUG - helper 129600515533696 Attempt to download checksum at https://download.qt.io/online/qtsdkrepository/all_os/extensions/qtwebengine/681/wasm_multithread/Updates.xml.sha256
2024-12-15 22:45:21,409 - aqt.helper - DEBUG - helper 129600515533696 Attempt to download checksum at https://download.qt.io/online/qtsdkrepository/all_os/extensions/qtwebengine/681/wasm_multithread/Updates.xml.sha256
2024-12-15 22:45:21,601 - aqt.helper - DEBUG - helper 129600515533696 Attempt to download checksum at https://download.qt.io/online/qtsdkrepository/all_os/extensions/qtwebengine/681/wasm_multithread/Updates.xml.sha256
2024-12-15 22:45:21,795 - aqt.helper - DEBUG - helper 129600515533696 Attempt to download checksum at https://download.qt.io/online/qtsdkrepository/all_os/extensions/qtwebengine/681/wasm_multithread/Updates.xml.sha256
2024-12-15 22:45:21,988 - aqt.archives - WARNING - archives 129600515533696 Failed to download checksum for the file 'Updates.xml'. This may happen on unofficial mirrors.
2024-12-15 22:45:22,196 - aqt.main - ERROR - installer 129600515533696 Failed to locate XML data for Qt version '6.8.1'.

For my PR I simply did:

if self.target != 'wasm':
    for ext in ["qtwebengine", "qtpdf"]:
        extensions_target_folder = posixpath.join(
            "online/qtsdkrepository", os_name, "extensions", ext, self._version_str(), arch
        )
        extensions_xml_url = posixpath.join(extensions_target_folder, "Updates.xml")
        extensions_xml_text = self._download_update_xml(extensions_xml_url)
        update_xmls.append(UpdateXmls(extensions_target_folder, extensions_xml_text))

But we'll need to see what we do to merge properly

@tsteven4
Copy link
Contributor Author

tsteven4 commented Dec 15, 2024

@Kidev, I agree that code introducing extensions caused problems like #851 and your wasm failure. This PR solves those by catching and passing the exceptions that might occur from the SPECULATIVE fetching of *extension*Update.xml files that may or may not exist.

@Kidev
Copy link
Contributor

Kidev commented Dec 15, 2024

@Kidev, I agree that code introducing extensions caused problems like #851 and your wasm failure. This PR solves those by catching and passing the exceptions that might occur from the SPECULATIVE fetching of *extension*Update.xml files that may or may not exist.

Ok that's what I thought, I wanted to be sure as it was the last thing preventing me from updating my PR. I'll pull your changes into my PR as soon as they are merged, should be straightforward to remove the conflict as I don't change anything in this function otherwise

@Kidev Kidev mentioned this pull request Dec 16, 2024
@miurahr miurahr merged commit b8683af into miurahr:master Dec 16, 2024
51 checks passed
@tsteven4 tsteven4 deleted the extensionsmaynotexist branch December 17, 2024 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Failed to download checksum for the file 'Updates.xml'
4 participants