flatpak-external-data-checker
flatpak-external-data-checker copied to clipboard
Crashes on appdata update if no sources in top-level manifest
Observed with ElectronMail flatpak, which has all its flatpak-builder modules in separate files:
2022-05-06T12:53:08.5105460Z INFO src.manifest: Preparing to update appdata /github/workspace/flathub/com.github.vladimiry.ElectronMail/com.github.vladimiry.ElectronMail.metainfo.xml
2022-05-06T12:53:08.5122338Z Traceback (most recent call last):
2022-05-06T12:53:08.5122820Z File "/app/flatpak-external-data-checker", line 30, in <module>
2022-05-06T12:53:08.5123091Z main()
2022-05-06T12:53:08.5123310Z File "/app/src/main.py", line 438, in main
2022-05-06T12:53:08.5123611Z outdated_num, errors_num, updated = asyncio.run(run_with_args(args))
2022-05-06T12:53:08.5123940Z File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
2022-05-06T12:53:08.5124231Z return loop.run_until_complete(main)
2022-05-06T12:53:08.5124555Z File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
2022-05-06T12:53:08.5124847Z return future.result()
2022-05-06T12:53:08.5125100Z File "/app/src/main.py", line 406, in run_with_args
2022-05-06T12:53:08.5125392Z changes = manifest_checker.update_manifests()
2022-05-06T12:53:08.5125701Z File "/app/src/manifest.py", line 483, in update_manifests
2022-05-06T12:53:08.5125959Z self._update_appdata()
2022-05-06T12:53:08.5126218Z File "/app/src/manifest.py", line 432, in _update_appdata
2022-05-06T12:53:08.5126481Z assert selected_data is not None
2022-05-06T12:53:08.5126699Z AssertionError
My userscripts extension for qutebrowser is also affected by this. Maybe allow to disable metainfo updates via flathub.json property?
I think we should just avoid updating metainfo when there are no sources in the root manifest. In such case we have no reliable way to determine what's main app source anyway.
In the future, we can probably invent a more clever algorithm to associate a metainfo.xml file with a source (e.g. if they belong to the same module).