-
-
Notifications
You must be signed in to change notification settings - Fork 608
Description
Linux Distribution
postmarketOS (based on Alpine Linux)
What happened
I am working on a cross-platform branch, and noticed that any exception is swallowed by the outer scope for the entire Moonraker dependencies area. When I trie d to diagnose the error, I had to add more errors and change "info" to "warning" for several instances.
Basically:
- whenever the number of dependencies is 0, the exception is swallowed and there is no explanation (hidden by "info" calls, changed to "warning" in my branch. It just says Error installing Moonraker dependencies and/or Error parsing Moonraker dependencies.
- There are many parsing errors that are hidden, also due to logging levels, related to distro version checking. There is a whole mini parser there for dependencies and it is not clear it works at all, because when I show the errors, pretty much everything seems to cause an error.
What did you expect to happen
- Make the mini-parser show errors, at least the errors that indicate the mini-parser doesn't work (or that the data is invalid or not implemented in the parser)
- Hard exceptions should be allowed and shown when the code (as opposed to the data) is invalid.
- Show explicit errors for any problem that makes the number of dependencies 0, instead of just saying "Error processing Moonraker dependencies"
- Never handle bare except (nor
except Exception). At the very least,except Exception as e:then show whateis.
How to reproduce
Install Moonraker dependencies on a distro not marked as a "debian" derivative in /etc/os-release. Unhide errors. Un-swallow exception. Add parser errors (avoid obscure str to int comparison error by adding explicit type checking). My branch must therefore be used: https://github.com/Hierosoft/kiauh/tree/crossplatform
Additional information
Maybe wait on doing anything with this until you decide on whether to accept my upcoming PR which will change this. I posted the issue beforehand to accept comments and to reveal this issue in case you can fix it more easily than I can since you may understand the code there better.
output (using my branch)
[INFO] Parsing system dependencies from system-dependencies.json ...
/home/pi/moonraker/scripts/system-dependencies.json: {'debian': ['python3-virtualenv', 'python3-dev', 'libopenjp2-7', 'libsodium-dev', 'zlib1g-dev', 'libjpeg-dev', 'packagekit', "wireless-tools; distro_id != 'ubuntu' or distro_version <= '24.04'", "iw; distro_id == 'ubuntu' and distro_version >= '24.10'", "python3-libcamera; vendor == 'raspberry-pi' and distro_version >= '11'", 'curl', 'build-essential']}
WARNING:root:Translating package names from debian to ['postmarketos', 'alpine']
ERROR:root:Expected int for left_op, got str('postmarketos') in ['distro_id ', '!=', " 'ubuntu'"]
ERROR:root:Expected int for right_op, got str('ubuntu') in ['distro_id ', '!=', " 'ubuntu'"]
ERROR:root:Expected int for left_op, got tuple(('edge',)) in ['distro_version ', '<=', " '24.04'"]
ERROR:root:Expected int for right_op, got tuple((24, 4)) in ['distro_version ', '<=', " '24.04'"]
ERROR:root:Error comparing requirements: wireless-tools; distro_id != 'ubuntu' or distro_version <= '24.04'
Traceback (most recent call last):
File "/home/pi/kiauh/kiauh/components/moonraker/utils/sysdeps_parser.py", line 155, in _parse_spec
result = compfunc(left_op, right_op)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pi/kiauh/kiauh/components/moonraker/utils/sysdeps_parser.py", line 153, in
"<=": lambda x, y: x <= y,
^^^^^^
TypeError: '<=' not supported between instances of 'str' and 'int'
ERROR:root:Expected int for left_op, got str('postmarketos') in ['distro_id ', '==', " 'ubuntu'"]
ERROR:root:Expected int for right_op, got str('ubuntu') in ['distro_id ', '==', " 'ubuntu'"]
ERROR:root:Expected int for left_op, got tuple(('edge',)) in ['distro_version ', '>=', " '24.10'"]
ERROR:root:Expected int for right_op, got tuple((24, 10)) in ['distro_version ', '>=', " '24.10'"]
ERROR:root:Error comparing requirements: iw; distro_id == 'ubuntu' and distro_version >= '24.10'
Traceback (most recent call last):
File "/home/pi/kiauh/kiauh/components/moonraker/utils/sysdeps_parser.py", line 155, in _parse_spec
result = compfunc(left_op, right_op)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pi/kiauh/kiauh/components/moonraker/utils/sysdeps_parser.py", line 152, in
">=": lambda x, y: x >= y,
^^^^^^
TypeError: '>=' not supported between instances of 'str' and 'int'
ERROR:root:Expected int for left_op, got str('') in ['vendor ', '==', " 'raspberry-pi'"]
ERROR:root:Expected int for right_op, got str('raspberry-pi') in ['vendor ', '==', " 'raspberry-pi'"]
ERROR:root:Expected int for left_op, got tuple(('edge',)) in ['distro_version ', '>=', " '11'"]
ERROR:root:Expected int for right_op, got tuple((11,)) in ['distro_version ', '>=', " '11'"]
ERROR:root:Error comparing requirements: python3-libcamera; vendor == 'raspberry-pi' and distro_version >= '11'
Traceback (most recent call last):
File "/home/pi/kiauh/kiauh/components/moonraker/utils/sysdeps_parser.py", line 155, in _parse_spec
result = compfunc(left_op, right_op)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pi/kiauh/kiauh/components/moonraker/utils/sysdeps_parser.py", line 152, in
">=": lambda x, y: x >= y,
^^^^^^
TypeError: '>=' not supported between instances of 'str' and 'int'
Listing packages...OK