From: Zbigniew Jędrzejewski-Szmek Date: Thu, 23 Jul 2020 10:23:58 +0000 (+0200) Subject: meson: do not choke on time epoch when there are no git tags X-Git-Tag: v246-rc2~12^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F16557%2Fhead;p=thirdparty%2Fsystemd.git meson: do not choke on time epoch when there are no git tags github ci was failing with: meson.build:685:16: ERROR: String '' cannot be converted to int --- diff --git a/meson.build b/meson.build index 0c0e1343c17..dbbddb68e23 100644 --- a/meson.build +++ b/meson.build @@ -676,17 +676,17 @@ conf.set_quoted('DEFAULT_NET_NAMING_SCHEME', default_net_naming_scheme) time_epoch = get_option('time-epoch') if time_epoch == -1 - source_date_epoch = run_command('sh', ['-c', 'echo "$SOURCE_DATE_EPOCH"']).stdout().strip() - if source_date_epoch != '' - time_epoch = source_date_epoch.to_int() - elif git.found() and run_command('test', '-e', '.git').returncode() == 0 + time_epoch = run_command('sh', ['-c', 'echo "$SOURCE_DATE_EPOCH"']).stdout().strip() + if time_epoch == '' and git.found() and run_command('test', '-e', '.git').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').stdout().strip() - time_epoch = run_command('git', 'log', '-1', '--format=%at', latest_tag).stdout().to_int() - else + time_epoch = run_command('git', 'log', '-1', '--format=%at', latest_tag).stdout() + endif + if time_epoch == '' NEWS = files('NEWS') - time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout().to_int() + time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout() endif + time_epoch = time_epoch.to_int() endif conf.set('TIME_EPOCH', time_epoch)