Index: zorg/jenkins/build.py =================================================================== --- zorg/jenkins/build.py +++ zorg/jenkins/build.py @@ -72,6 +72,8 @@ self.device = None self._svn_url_cache = None + self.node_name = os.environ.get('NODE_NAME', 'Undefine_node_name') + # Import all of the command line arguments into the config object self.__dict__.update(vars(args)) @@ -169,8 +171,32 @@ conf = None # type: Configuration +def update_svn_checkouts(): + """Check the svn version and upgrade if necessary.""" + out = run_collect_output(["/usr/bin/xcrun", "svn", "--version"], + working_dir=conf.srcdir()) + m = re.search("version.(?P[\d.]+)", out, re.MULTILINE) + if m: + version_str = m.group("version_string") + version_list = [int(x) for x in version_str.split(".")] + if version_list > [1, 7, 22]: + try: + next_section("SVN upgrade") + out = run_collect_output(["/usr/bin/xcrun", "svn", "upgrade"], + working_dir=conf.srcdir()) + except subprocess.CalledProcessError as e: + msg = """Process return code: {}\n + Error: on {} SVN upgrade failed.\n + The error was: {}.\n""" + msg = msg.format(e.returncode, conf.node_name, out) + print msg + else: + assert False, "Unable to parse the svn version: " + out + + def cmake_builder(target): check_repo_state(conf.workspace) + update_svn_checkouts() env = [] dyld_path = "" @@ -284,8 +310,9 @@ def clang_builder(target): """Build to set of commands to compile and test apple-clang""" check_repo_state(conf.workspace) + update_svn_checkouts() + # get rid of old archives from prior builds - run_ws(['sh', '-c', 'rm -rfv *gz']) if target == "all" or target == "build": @@ -328,7 +355,7 @@ './Build', './Root']) install_prefix = conf.installdir() - + # Infer which CMake cache file to use. If ThinLTO we select a specific one. cmake_cachefile_thinlto = '' if conf.thinlto: @@ -581,7 +608,7 @@ def check_repo_state(path): """Check the SVN repo at the path has all the - nessessary repos checked out. Check this by + necessary repos checked out. Check this by looking for the README.txt in each repo. """ if os.environ.get('TESTING', False): @@ -588,7 +615,7 @@ return logging.info("Detecting repos in {}".format(path)) - for r in ['llvm', 'clang', 'clang-tools-extra', 'debuginfo-tests', \ + for r in ['llvm', 'clang', 'clang-tools-extra', 'debuginfo-tests', 'compiler-rt', 'libcxx', 'debuginfo-tests']: detected_path = derived_path('llvm', tree_path(tree='llvm', repo=r)) readme = os.path.join(path, detected_path, readme_name(repo=r)) @@ -742,7 +769,7 @@ footer() -def derive_llvm(repos=['llvm', 'clang', 'libcxx', 'clang-tools-extra', \ +def derive_llvm(repos=['llvm', 'clang', 'libcxx', 'clang-tools-extra', 'compiler-rt', 'debuginfo-tests']): """Build a derived src tree for LLVM""" derive(tree='llvm', repos=repos) @@ -878,6 +905,7 @@ sys.stdout.flush() start_time = datetime.datetime.now() + result = "" if not os.environ.get('TESTING', False): try: os.chdir(working_dir) @@ -926,15 +954,20 @@ } -def run_collect_output(cmd): +def run_collect_output(cmd, working_dir=None, stderr=None): """Run cmd, and return the output""" + last = os.getcwd() if os.getenv("TESTING"): print 'TV: ' + ' '.join(cmd) return TEST_VALS[' '.join(cmd)] + if working_dir: + os.chdir(working_dir) + out = subprocess.check_output(cmd, stderr=stderr) + if working_dir: + os.chdir(last) + return out - return subprocess.check_output(cmd) - def query_sys_tool(sdk_name, tool_name): """Get the path of system tool