pmb.helpers.run_core: Better handle invalid timeout values

As we accept arbitrary timeouts via the command line, we cannot guarantee that the specified one actually will be valid. Consequently, it isn't really a bug that illegal ones can be specified, so let's handle such cases.

This changes the output from

$ pmb -t 9999999999 build gtk4.0 --arch aarch64
[13:25:11] ERROR: timestamp out of range for platform time_t
[13:25:11] See also: <https://postmarketos.org/troubleshooting>

Run 'pmbootstrap log' for details.

Before you report this error, ensure that pmbootstrap is up to date.
Find the latest version here: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/tags
Your version: 3.6.0

to

$ pmb -t 9999999999 build gtk4.0 --arch aarch64
[15:56:07] ERROR: Specified timeout (9999999999.0) isn't valid on this platform, maybe try something smaller (timestamp out of range for platform time_t).

which I think is a lot less noisy and makes it clear that this is not a bug we can fix but rather expected behaviour. While it would have been nice to include the limits of time_t for the current platform in this error message, I couldn't find any way to do that in Python short of bruteforcing it1 which would not be a clean solution.

Merge request reports

Loading