meson: add git-snapshot target

The output is systemd-<sha1abbrev>.tar.gz in source root.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2017-04-24 19:28:05 -04:00
parent ad68714d5c
commit dd6ab3df74
1 changed files with 19 additions and 0 deletions

View File

@ -2321,3 +2321,22 @@ if git.found()
'git-contrib',
command : [meson_git_contrib_sh])
endif
if git.found()
git_head = run_command(
git,
['--git-dir=@0@/.git'.format(meson.source_root()),
'rev-parse', 'HEAD']).stdout().strip()
git_head_short = run_command(
git,
['--git-dir=@0@/.git'.format(meson.source_root()),
'rev-parse', '--short=7', 'HEAD']).stdout().strip()
run_target(
'git-snapshot',
command : ['git', 'archive',
'-o', '@0@/systemd-@1@.tar.gz'.format(meson.source_root(),
git_head_short),
'--prefix', 'systemd-@0@/'.format(git_head),
'HEAD'])
endif