From dd6ab3df749172e0b85de00338b485d8f4e24fa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Mon, 24 Apr 2017 19:28:05 -0400 Subject: [PATCH] meson: add git-snapshot target The output is systemd-.tar.gz in source root. --- meson.build | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/meson.build b/meson.build index 59318a9a5d..991836a976 100644 --- a/meson.build +++ b/meson.build @@ -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