[gimp/wip/jtojnar/tagged-vcs-build] meson: Warn when git is missing in non-dist builds



commit e5e3e6370394d564b9ec3a6dc6f684eab7f81f98
Author: Jan Tojnar <jtojnar gmail com>
Date:   Thu Nov 21 14:10:34 2019 +0100

    meson: Warn when git is missing in non-dist builds
    
    8b5060349a95ca552cc1afa9f9c6f4becc2fe7f6 fixes the issue of version headers
    not being available when building out of VCS tarball (without .git directory)
    but we were getting `unknown (unsupported)` version still. Turns out the version
    silently fell back to `unknown` when git was not available.
    
    Let's warn the user when this is the case.

 meson.build | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/meson.build b/meson.build
index 2a0191bcba..5f129af457 100644
--- a/meson.build
+++ b/meson.build
@@ -1435,6 +1435,8 @@ has_version_h = run_command('python', '-c',
   'import sys,os; sys.exit(0 if os.path.exists("git-version.h") else 1)'
 ).returncode() == 0
 if is_git_repository or not has_version_h
+  git = find_program('git', required: false)
+
   gitversion_h1 = vcs_tag(
     input : 'app/git-version.h.in',
     output: 'git-version.h.in.1',
@@ -1456,15 +1458,17 @@ if is_git_repository or not has_version_h
     replace_string: '@GIMP_GIT_LAST_COMMIT_YEAR@',
     fallback: 'unknown (unsupported)',
   )
-  if not is_git_repository
+  if not is_git_repository or not git.found()
   # We create git-version.h but know it will be useless because we are
   # not in a git repository. Output a warning.
   git_warning = '''
 
         UNSUPPORTED BUILD!
 
-        This is not a distribution tarball (git-version.h missing) nor is it
-        a git repository. Therefore we have no reference for debugging.
+        This is not a distribution tarball (git-version.h missing) and
+        we could not establish the corresponding commit (either this is
+        not a git repository or git command is missing). Therefore
+        we have no reference for debugging.
         Please either use release tarballs or build from the repository.
   '''
   warning(git_warning)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]