meson: try BSD-style date(1) for alt_time_epoch as a fallback

If we fail to calculate alt_time_epoch using the GNU-style syntax,
try if BSD-style syntax does not work. Fail for real if that does
not work either.
This commit is contained in:
q66
2025-12-08 21:35:28 +01:00
parent 57f911973a
commit abf73cb072
+6 -2
View File
@@ -3028,8 +3028,12 @@ if conf.get('ENABLE_HWDB') == 1
alias_target('hwdb', auto_suspend_rules, executables_by_name.get('systemd-hwdb'), hwdb_units)
endif
alt_time_epoch = run_command('date', '-Is', '-u', '-d', f'@@time_epoch@',
check : true).stdout().strip()
alt_time_epoch = run_command('date', '-Is', '-u', '-d', f'@@time_epoch@', check : false)
if alt_time_epoch.returncode() != 0
# If the above fails, maybe the date(1) uses BSD-style syntax
alt_time_epoch = run_command('date', '-Iseconds', '-u', '-r', f'@time_epoch@', check : true)
endif
alt_time_epoch = alt_time_epoch.stdout().strip()
summary({
'split bin-sbin' : split_bin,