[Lldb-commits] [lldb] r309631 - [build-script] Bring in modernizations from downstream:

Sean Callanan via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 31 14:50:01 PDT 2017


Author: spyffe
Date: Mon Jul 31 14:50:00 2017
New Revision: 309631

URL: http://llvm.org/viewvc/llvm-project?rev=309631&view=rev
Log:
[build-script] Bring in modernizations from downstream:

- Don't do any checks of the current SCM repository if the
  llvm repositories are already there.  Useful for bots.
- When symlinking, remove old symlinks.
- Support loading build-script as a library, not necessarily
  under Xcode.
- Stringify args before passing them to subprocess.

Modified:
    lldb/trunk/scripts/Xcode/build-llvm.py
    lldb/trunk/scripts/Xcode/lldbbuild.py

Modified: lldb/trunk/scripts/Xcode/build-llvm.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Xcode/build-llvm.py?rev=309631&r1=309630&r2=309631&view=diff
==============================================================================
--- lldb/trunk/scripts/Xcode/build-llvm.py (original)
+++ lldb/trunk/scripts/Xcode/build-llvm.py Mon Jul 31 14:50:00 2017
@@ -14,7 +14,6 @@ from lldbbuild import *
 
 #### SETTINGS ####
 
-
 def LLVM_HASH_INCLUDES_DIFFS():
     return False
 
@@ -42,7 +41,25 @@ def process_repo(r):
         'ref': r["ref"]
     }
 
+def fallback_repo(name):
+    return {
+        'name': name,
+        'vcs': None,
+        'root': process_root(name),
+        'url': None,
+        'ref': None
+    }
+
+def dirs_exist(names):
+    for name in names:
+        if not os.path.isdir(process_root(name)):
+            return False
+    return True
+
 def XCODE_REPOSITORIES():
+    names = ["llvm", "clang", "ninja"]
+    if dirs_exist(names):
+        return [fallback_repo(n) for n in names]
     override = repo.get_override()
     if override:
         return [process_repo(r) for r in override]
@@ -233,6 +250,8 @@ def should_build_llvm():
 
 def do_symlink(source_path, link_path):
     print "Symlinking " + source_path + " to " + link_path
+    if os.path.islink(link_path):
+        os.remove(link_path)
     if not os.path.exists(link_path):
         os.symlink(source_path, link_path)
 
@@ -433,8 +452,8 @@ def build_llvm_if_needed():
 
 #### MAIN LOGIC ####
 
-all_check_out_if_needed()
-build_llvm_if_needed()
-write_archives_txt()
-
-sys.exit(0)
+if __name__ == "__main__":
+    all_check_out_if_needed()
+    build_llvm_if_needed()
+    write_archives_txt()
+    sys.exit(0)

Modified: lldb/trunk/scripts/Xcode/lldbbuild.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Xcode/lldbbuild.py?rev=309631&r1=309630&r2=309631&view=diff
==============================================================================
--- lldb/trunk/scripts/Xcode/lldbbuild.py (original)
+++ lldb/trunk/scripts/Xcode/lldbbuild.py Mon Jul 31 14:50:00 2017
@@ -1,5 +1,6 @@
 import os
 import subprocess
+import sys
 
 #### UTILITIES ####
 
@@ -14,7 +15,11 @@ def enum(*sequential, **named):
 
 
 def lldb_source_path():
-    return os.environ.get('SRCROOT')
+    path = os.environ.get('SRCROOT')
+    if path:
+         return path
+    else:
+         return "./"
 
 
 def expected_llvm_build_path():
@@ -80,7 +85,7 @@ VCS = enum('git',
 
 
 def run_in_directory(args, path):
-    return subprocess.check_output(args, cwd=path)
+    return subprocess.check_output([str(arg) for arg in args], cwd=path)
 
 
 class Git:




More information about the lldb-commits mailing list