Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flags to separate generate_release_script parts #1066

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 31 additions & 22 deletions ros_buildfarm/scripts/release/generate_release_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions ros_buildfarm/templates/release/release_script.sh.em
Original file line number Diff line number Diff line change
Expand Up @@ -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']@
Expand All @@ -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',
Expand Down
Loading