[llvm] [AIX] Add git revision to .file string (PR #88164)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue May 7 20:44:25 PDT 2024


================
@@ -1,4 +1,23 @@
 if not "PowerPC" in config.root.targets:
     config.unsupported = True
 
+import subprocess
+
 config.suffixes.add(".py")
+
+def get_revision(repo_path):
+    cmd = ['git', '-C', repo_path, 'rev-parse', 'HEAD']
+    try:
+        return subprocess.run(cmd, stdout=subprocess.PIPE, check=True).stdout.decode()
+    except subprocess.CalledProcessError:
+        print("An error occurred retrieving the git revision.")
+        return None
+
+if config.have_vc_rev:
+    if config.force_vc_rev:
+        git_revision = config.force_vc_rev
+    else:
+        git_revision = get_revision(config.llvm_src_root)
----------------
nikic wrote:

This breaks the LLVM build when git is not installed. Note that LLVM_APPEND_VC_REV only means that the git revision will be used if it's available -- if it's not available, it will be silently ignored.

https://github.com/llvm/llvm-project/pull/88164


More information about the llvm-commits mailing list