]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: add git-snapshot target
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 24 Apr 2017 23:28:05 +0000 (19:28 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 24 Apr 2017 23:28:05 +0000 (19:28 -0400)
The output is systemd-<sha1abbrev>.tar.gz in source root.

meson.build

index 59318a9a5db9152e39e8f274bdb181e0f6514567..991836a97693ac4803699843a38361c6178180cb 100644 (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