mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-07-27 00:03:31 +00:00
meson: Fix on shallow git trees
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
This commit is contained in:
parent
d5dff814ac
commit
f7de7d7adf
12
meson.build
12
meson.build
@ -225,10 +225,14 @@ git = find_program('git', required: false)
|
|||||||
time_epoch = run_command(sh, '-c', 'echo "$SOURCE_DATE_EPOCH"', check: true).stdout().strip()
|
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 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.
|
# 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()
|
latest_tag = run_command(git, 'describe', '--abbrev=0', '--tags', check: false).stdout().strip()
|
||||||
time_epoch = run_command(git, 'log', '--no-show-signature', '-1', '--format=%at', latest_tag, check: true).stdout()
|
if latest_tag != ''
|
||||||
else
|
time_epoch = run_command(git, 'log', '--no-show-signature', '-1', '--format=%at', latest_tag, check: true).stdout()
|
||||||
# Fallback to current epoch.
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Fallback to current epoch.
|
||||||
|
if time_epoch == ''
|
||||||
time_epoch = run_command(date, '+%s', check: true).stdout()
|
time_epoch = run_command(date, '+%s', check: true).stdout()
|
||||||
endif
|
endif
|
||||||
generate_date = run_command(date, '--utc', '--date=@' + time_epoch, '+%Y-%m-%d', check: true).stdout().strip()
|
generate_date = run_command(date, '--utc', '--date=@' + time_epoch, '+%Y-%m-%d', check: true).stdout().strip()
|
||||||
|
Loading…
Reference in New Issue
Block a user