From 16c7b6a7fe5068c6d5384378759f799ed9e273d6 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 31 Jul 2020 16:04:02 +0200 Subject: Buildbot: make code signing of packages optional with --codesign parameter This is in preparation of doing builds per commit that will not be code signed. Ref D8438 Differential Revision: https://developer.blender.org/D8451 --- build_files/buildbot/buildbot_utils.py | 1 + build_files/buildbot/worker_bundle_dmg.py | 17 +++++++++++++---- build_files/buildbot/worker_compile.py | 5 +++-- build_files/buildbot/worker_pack.py | 5 ++++- 4 files changed, 21 insertions(+), 7 deletions(-) (limited to 'build_files') diff --git a/build_files/buildbot/buildbot_utils.py b/build_files/buildbot/buildbot_utils.py index e8adf5ba810..287c3854377 100644 --- a/build_files/buildbot/buildbot_utils.py +++ b/build_files/buildbot/buildbot_utils.py @@ -67,6 +67,7 @@ def create_builder_from_arguments(): parser = argparse.ArgumentParser() parser.add_argument('builder_name') parser.add_argument('branch', default='master', nargs='?') + parser.add_argument("--codesign", action="store_true") args = parser.parse_args() return Builder(args.builder_name, args.branch) diff --git a/build_files/buildbot/worker_bundle_dmg.py b/build_files/buildbot/worker_bundle_dmg.py index cd3da85e12a..31e10d51610 100755 --- a/build_files/buildbot/worker_bundle_dmg.py +++ b/build_files/buildbot/worker_bundle_dmg.py @@ -82,6 +82,10 @@ def create_argument_parser(): type=Path, help="Optional path to applescript to set up folder looks of DMG." "If not provided default Blender's one is used.") + parser.add_argument( + '--codesign', + action="store_true" + help="Code sign and notarize DMG contents.") return parser @@ -395,7 +399,8 @@ def create_final_dmg(app_bundles: List[Path], dmg_filepath: Path, background_image_filepath: Path, volume_name: str, - applescript: Path) -> None: + applescript: Path, + codesign: bool) -> None: """ Create DMG with all app bundles @@ -421,7 +426,8 @@ def create_final_dmg(app_bundles: List[Path], # # This allows to recurs into the content of bundles without worrying about # possible interfereice of Application symlink. - codesign_app_bundles_in_dmg(mount_directory) + if codesign: + codesign_app_bundles_in_dmg(mount_directory) copy_background_if_needed(background_image_filepath, mount_directory) create_applications_link(mount_directory) @@ -434,7 +440,8 @@ def create_final_dmg(app_bundles: List[Path], compress_dmg(writable_dmg_filepath, dmg_filepath) writable_dmg_filepath.unlink() - codesign_and_notarize_dmg(dmg_filepath) + if codesign: + codesign_and_notarize_dmg(dmg_filepath) def ensure_dmg_extension(filepath: Path) -> Path: @@ -521,6 +528,7 @@ def main(): source_dir = args.source_dir.absolute() background_image_filepath = get_background_image(args.background_image) applescript = get_applescript(args.applescript) + codesign = args.codesign app_bundles = collect_and_log_app_bundles(source_dir) if not app_bundles: @@ -535,7 +543,8 @@ def main(): dmg_filepath, background_image_filepath, volume_name, - applescript) + applescript, + codesign) if __name__ == "__main__": diff --git a/build_files/buildbot/worker_compile.py b/build_files/buildbot/worker_compile.py index f1357e1864f..8e19c9436f8 100644 --- a/build_files/buildbot/worker_compile.py +++ b/build_files/buildbot/worker_compile.py @@ -24,7 +24,7 @@ import shutil import buildbot_utils def get_cmake_options(builder): - post_install_script = os.path.join( + codesign_script = os.path.join( builder.blender_dir, 'build_files', 'buildbot', 'worker_codesign.cmake') config_file = "build_files/cmake/config/blender_release.cmake" @@ -36,7 +36,8 @@ def get_cmake_options(builder): options.append('-DCMAKE_OSX_DEPLOYMENT_TARGET=10.9') elif builder.platform == 'win': options.extend(['-G', 'Visual Studio 16 2019', '-A', 'x64']) - options.extend(['-DPOSTINSTALL_SCRIPT:PATH=' + post_install_script]) + if builder.codesign: + options.extend(['-DPOSTINSTALL_SCRIPT:PATH=' + codesign_script]) elif builder.platform == 'linux': config_file = "build_files/buildbot/config/blender_linux.cmake" diff --git a/build_files/buildbot/worker_pack.py b/build_files/buildbot/worker_pack.py index 87ee49c87d8..96c8db8e6c8 100644 --- a/build_files/buildbot/worker_pack.py +++ b/build_files/buildbot/worker_pack.py @@ -117,6 +117,8 @@ def pack_mac(builder): if info.is_development_build: background_image = os.path.join(release_dir, 'buildbot', 'background.tif') command += ['--background-image', background_image] + if builder.codesign: + command += ['--codesign'] command += [builder.install_dir] buildbot_utils.call(command) @@ -150,7 +152,8 @@ def pack_win(builder): package_filename = package_name + '.msi' package_filepath = os.path.join(builder.build_dir, package_filename) - sign_file_or_directory(package_filepath) + if builder.codesign: + sign_file_or_directory(package_filepath) package_files += [(package_filepath, package_filename)] -- cgit v1.2.3