From 606c2191150cd9c0113d2a0579db429367c69305 Mon Sep 17 00:00:00 2001 From: Alan King Date: Thu, 12 Dec 2024 13:23:24 -0500 Subject: [PATCH] [#286] Build hook: Add --debug_build option Based on the --debug_build option in the build hook in the main iRODS repository. --- ...rtium_continuous_integration_build_hook.py | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/irods_consortium_continuous_integration_build_hook.py b/irods_consortium_continuous_integration_build_hook.py index 3f4a1f2..96ef0db 100644 --- a/irods_consortium_continuous_integration_build_hook.py +++ b/irods_consortium_continuous_integration_build_hook.py @@ -1,14 +1,11 @@ -from __future__ import print_function - +import argparse import glob import multiprocessing -import optparse import os import tempfile import irods_python_ci_utilities - def add_cmake_to_front_of_path(): cmake_path = '/opt/irods-externals/cmake3.21.4-0/bin' os.environ['PATH'] = os.pathsep.join([cmake_path, os.environ['PATH']]) @@ -61,25 +58,30 @@ def copy_output_packages(build_directory, output_root_directory): irods_python_ci_utilities.append_os_specific_directory(output_root_directory), lambda s:s.endswith(irods_python_ci_utilities.get_package_suffix())) -def main(build_directory, output_root_directory, irods_packages_root_directory, externals_directory): +def main(build_directory, output_root_directory, irods_packages_root_directory, externals_directory, debug_build=False): install_building_dependencies(externals_directory) if irods_packages_root_directory: irods_python_ci_utilities.install_irods_dev_and_runtime_packages(irods_packages_root_directory) build_directory = os.path.abspath(build_directory or tempfile.mkdtemp(prefix='irods_storage_tiering_plugin_build_directory')) - irods_python_ci_utilities.subprocess_get_output(['cmake', os.path.dirname(os.path.realpath(__file__))], check_rc=True, cwd=build_directory) + build_type = "Debug" if debug_build else "Release" + cmake_command = ['cmake', f"-DCMAKE_BUILD_TYPE={build_type}", os.path.dirname(os.path.realpath(__file__))] + print(cmake_command) + irods_python_ci_utilities.subprocess_get_output(cmake_command, check_rc=True, cwd=build_directory) irods_python_ci_utilities.subprocess_get_output(['make', '-j', str(multiprocessing.cpu_count()), 'package'], check_rc=True, cwd=build_directory) if output_root_directory: copy_output_packages(build_directory, output_root_directory) if __name__ == '__main__': - parser = optparse.OptionParser() - parser.add_option('--build_directory') - parser.add_option('--output_root_directory') - parser.add_option('--irods_packages_root_directory') - parser.add_option('--externals_packages_directory') - options, _ = parser.parse_args() + parser = argparse.ArgumentParser(description='Build unified storage tiering plugin.') + parser.add_argument('--build_directory') + parser.add_argument('--output_root_directory') + parser.add_argument('--irods_packages_root_directory') + parser.add_argument('--externals_packages_directory') + parser.add_argument('--debug_build', action='store_true') + args = parser.parse_args() - main(options.build_directory, - options.output_root_directory, - options.irods_packages_root_directory, - options.externals_packages_directory) + main(args.build_directory, + args.output_root_directory, + args.irods_packages_root_directory, + args.externals_packages_directory, + args.debug_build)