From: Stéphane Graber Date: Fri, 29 Apr 2022 02:35:21 +0000 (-0400) Subject: meson: Fix unix epoch X-Git-Tag: lxc-5.0.0~22^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=23ba778f9fd70a09e1c0fe3578664ee036e8ae54;p=thirdparty%2Flxc.git meson: Fix unix epoch Signed-off-by: Stéphane Graber --- diff --git a/meson.build b/meson.build index d3b4f590d..a835a3e53 100644 --- a/meson.build +++ b/meson.build @@ -182,12 +182,16 @@ endif ## Time EPOCH. sh = find_program('sh') +date = find_program('date') git = find_program('git', required: false) time_epoch = run_command(sh, '-c', 'echo "$SOURCE_DATE_EPOCH"', check: true).stdout().strip() if time_epoch == '' and git.found() and run_command('test', '-e', '.git', check: false).returncode() == 0 # If we're in a git repository, use the creation time of the latest git tag. latest_tag = run_command(git, 'describe', '--abbrev=0', '--tags', check: true).stdout().strip() time_epoch = run_command(git, 'log', '--no-show-signature', '-1', '--format=%at', latest_tag, check: true).stdout() +else + # Fallback to current epoch + time_epoch = run_command(date, '+%s', check: true).stdout() endif time_epoch = time_epoch.to_int() conf.set('TIME_EPOCH', time_epoch)