diff options
Diffstat (limited to 'buildscripts/bypass_compile_and_fetch_binaries.py')
-rw-r--r-- | buildscripts/bypass_compile_and_fetch_binaries.py | 53 |
1 files changed, 25 insertions, 28 deletions
diff --git a/buildscripts/bypass_compile_and_fetch_binaries.py b/buildscripts/bypass_compile_and_fetch_binaries.py index ca184e1e046..0612367d498 100644 --- a/buildscripts/bypass_compile_and_fetch_binaries.py +++ b/buildscripts/bypass_compile_and_fetch_binaries.py @@ -85,17 +85,17 @@ def generate_bypass_expansions(project, build_variant, revision, build_id): # With compile bypass we need to update the URL to point to the correct name of the base commit # binaries. expansions["mongo_binaries"] = (archive_name("{}/{}/{}/binaries/mongo-{}".format( - project, build_variant, revision, build_id))) + project, build_variant, revision, build_id))) # With compile bypass we need to update the URL to point to the correct name of the base commit # debug symbols. expansions["mongo_debugsymbols"] = (archive_name("{}/{}/{}/debugsymbols/debugsymbols-{}".format( - project, build_variant, revision, build_id))) + project, build_variant, revision, build_id))) # With compile bypass we need to update the URL to point to the correct name of the base commit # mongo shell. expansions["mongo_shell"] = (archive_name("{}/{}/{}/binaries/mongo-shell-{}".format( - project, build_variant, revision, build_id))) + project, build_variant, revision, build_id))) # Enable bypass compile expansions["bypass_compile"] = True @@ -155,9 +155,8 @@ def should_bypass_compile(): if os.path.isdir(filename): continue - if (filename in requires_compile_files - or any(filename.startswith(directory) - for directory in requires_compile_directories)): + if (filename in requires_compile_files or any( + filename.startswith(directory) for directory in requires_compile_directories)): print("Compile bypass disabled after detecting {} as being modified because" " it is a file known to affect compilation.".format(filename)) return False @@ -173,28 +172,21 @@ def should_bypass_compile(): def parse_args(): parser = argparse.ArgumentParser() - parser.add_argument("--project", - required=True, + parser.add_argument("--project", required=True, help="The Evergreen project. e.g mongodb-mongo-master") - parser.add_argument("--buildVariant", - required=True, + parser.add_argument("--buildVariant", required=True, help="The build variant. e.g enterprise-rhel-62-64-bit") - parser.add_argument("--revision", - required=True, - help="The base commit hash.") + parser.add_argument("--revision", required=True, help="The base commit hash.") - parser.add_argument("--patchFile", - required=True, + parser.add_argument("--patchFile", required=True, help="A list of all files modified in patch build.") - parser.add_argument("--outFile", - required=True, + parser.add_argument("--outFile", required=True, help="The YAML file to write out the macro expansions.") - parser.add_argument("--jsonArtifact", - required=True, + parser.add_argument("--jsonArtifact", required=True, help="The JSON file to write out the metadata of files to attach to task.") return parser.parse_args() @@ -224,7 +216,7 @@ def main(): api_server = "{url.scheme}://{url.netloc}".format( url=urlparse(evg_config.get("api_server_host"))) revision_url = "{}/rest/v1/projects/{}/revisions/{}".format(api_server, args.project, - args.revision) + args.revision) revisions = requests_get_json(revision_url) match = None @@ -240,7 +232,7 @@ def main(): break else: print("Could not find build id for revision {} on project {}." - " Default compile bypass to false.".format(args.revision, args.project)) + " Default compile bypass to false.".format(args.revision, args.project)) return # Generate the compile task id. @@ -270,16 +262,20 @@ def main(): return # Need to extract certain files from the pre-existing artifacts.tgz. - extract_files = [executable_name("dbtest"), executable_name("mongobridge"), - "build/integration_tests.txt"] + extract_files = [ + executable_name("dbtest"), + executable_name("mongobridge"), + "build/integration_tests.txt", + ] with tarfile.open(filename, "r:gz") as tar: # The repo/ directory contains files needed by the package task. May # need to add other files that would otherwise be generated by SCons # if we did not bypass compile. - subdir = [tarinfo for tarinfo in tar.getmembers() - if tarinfo.name.startswith("build/integration_tests/") - or tarinfo.name.startswith("repo/") - or tarinfo.name in extract_files] + subdir = [ + tarinfo for tarinfo in tar.getmembers() + if tarinfo.name.startswith("build/integration_tests/") + or tarinfo.name.startswith("repo/") or tarinfo.name in extract_files + ] print("Extracting the following files from {0}...\n{1}".format( filename, "\n".join(tarinfo.name for tarinfo in subdir))) tar.extractall(members=subdir) @@ -318,8 +314,9 @@ def main(): # Need to apply these expansions for bypassing SCons. expansions = generate_bypass_expansions(args.project, args.buildVariant, args.revision, - build_id) + build_id) write_out_bypass_compile_expansions(args.outFile, **expansions) + if __name__ == "__main__": main() |