From 12c18c3990c44bb3207d99d65ab45e0b214f92fe Mon Sep 17 00:00:00 2001 From: Scott K Logan Date: Fri, 1 Nov 2024 10:42:23 -0500 Subject: [PATCH] Add flags to separate generate_release_script parts (#1066) These flags will enable script invocations of the source and binary jobs separately, supporting a build process more like the Jenkins buildfarm. --- .../release/generate_release_script.py | 53 +++++++++++-------- .../templates/release/release_script.sh.em | 2 + 2 files changed, 33 insertions(+), 22 deletions(-) diff --git a/ros_buildfarm/scripts/release/generate_release_script.py b/ros_buildfarm/scripts/release/generate_release_script.py index fb31278af..4dd019c89 100644 --- a/ros_buildfarm/scripts/release/generate_release_script.py +++ b/ros_buildfarm/scripts/release/generate_release_script.py @@ -42,10 +42,18 @@ def main(argv=sys.argv[1:]): add_argument_os_name(parser) add_argument_os_code_name(parser) add_argument_arch(parser) + parser.add_argument( + '--skip-binary', + action='store_true', + help='Skip the entire binary package build process') parser.add_argument( '--skip-install', action='store_true', help='Skip trying to install binarydeb') + parser.add_argument( + '--skip-source', + action='store_true', + help='Skip the entire source package build process') args = parser.parse_args(argv) package_format = package_format_mapping[args.os_name] @@ -103,28 +111,29 @@ def beforeInclude(self, *args, **kwargs): args.package_name, args.os_name, args.os_code_name, args.arch) separator_index = hook.scripts.index('--') - source_scripts = hook.scripts[:separator_index] - binary_scripts = hook.scripts[separator_index + 1:] - - # inject additional argument to skip fetching sourcedeb from repo - script_name = '/run_binary%s_job.py ' % deb_or_pkg - additional_argument = '--skip-download-sourcepkg ' - for i, script in enumerate(binary_scripts): - offset = script.find(script_name) - if offset != -1: - offset += len(script_name) - script = script[:offset] + additional_argument + script[offset:] - binary_scripts[i] = script - break - - # remove rm command for sourcedeb location - rm_command = 'rm -fr $WORKSPACE/binary%s' % deb_or_pkg - for i, script in enumerate(binary_scripts): - offset = script.find(rm_command) - if offset != -1: - script = script[:offset] + script[offset + len(rm_command):] - binary_scripts[i] = script - break + source_scripts = [] if args.skip_source else hook.scripts[:separator_index] + binary_scripts = [] if args.skip_binary else hook.scripts[separator_index + 1:] + + if source_scripts: + # inject additional argument to skip fetching sourcedeb from repo + script_name = '/run_binary%s_job.py ' % deb_or_pkg + additional_argument = '--skip-download-sourcepkg ' + for i, script in enumerate(binary_scripts): + offset = script.find(script_name) + if offset != -1: + offset += len(script_name) + script = script[:offset] + additional_argument + script[offset:] + binary_scripts[i] = script + break + + # remove rm command for sourcedeb location + rm_command = 'rm -fr $WORKSPACE/binary%s' % deb_or_pkg + for i, script in enumerate(binary_scripts): + offset = script.find(rm_command) + if offset != -1: + script = script[:offset] + script[offset + len(rm_command):] + binary_scripts[i] = script + break if args.skip_install: # remove install step diff --git a/ros_buildfarm/templates/release/release_script.sh.em b/ros_buildfarm/templates/release/release_script.sh.em index eda772dc7..9a415b936 100644 --- a/ros_buildfarm/templates/release/release_script.sh.em +++ b/ros_buildfarm/templates/release/release_script.sh.em @@ -45,6 +45,7 @@ echo "Using workspace for binary: $WORKSPACE" mkdir -p $WORKSPACE cd $WORKSPACE +@[if source_scripts]@ echo "" echo "Get artifacts from source job" @[if package_format == 'deb']@ @@ -56,6 +57,7 @@ mkdir -p $WORKSPACE/binarypkg/source @[else]@ @{assert False, "Unsupported packaging format '%s'" % package_format}@ @[end if]@ +@[end if]@ @(TEMPLATE( 'devel/devel_script_build.sh.em',