diff --git a/ros_buildfarm/argument.py b/ros_buildfarm/argument.py index 20faefddf..81944aa5d 100644 --- a/ros_buildfarm/argument.py +++ b/ros_buildfarm/argument.py @@ -496,6 +496,12 @@ def add_argument_skip_tests(parser): help='Skip execution of tests as part of the package build process.') +def add_argument_install_ccache(parser): + parser.add_argument( + '--install-ccache', action='store_true', + help='Install the ccache binary packages in the system.') + + def check_len_action(minargs, maxargs): class CheckLength(argparse.Action): diff --git a/ros_buildfarm/scripts/release/create_binarydeb_task_generator.py b/ros_buildfarm/scripts/release/create_binarydeb_task_generator.py index 569801026..94390820f 100644 --- a/ros_buildfarm/scripts/release/create_binarydeb_task_generator.py +++ b/ros_buildfarm/scripts/release/create_binarydeb_task_generator.py @@ -26,6 +26,7 @@ from ros_buildfarm.argument import add_argument_distribution_repository_urls from ros_buildfarm.argument import add_argument_dockerfile_dir from ros_buildfarm.argument import add_argument_env_vars +from ros_buildfarm.argument import add_argument_install_ccache from ros_buildfarm.argument import add_argument_os_code_name from ros_buildfarm.argument import add_argument_os_name from ros_buildfarm.argument import add_argument_package_name @@ -56,6 +57,7 @@ def main(argv=sys.argv[1:]): add_argument_dockerfile_dir(parser) add_argument_env_vars(parser) add_argument_skip_tests(parser) + add_argument_install_ccache(parser) args = parser.parse_args(argv) debian_package_name = get_os_package_name( @@ -107,6 +109,7 @@ def main(argv=sys.argv[1:]): 'dependencies': debian_pkg_names, 'dependency_versions': debian_pkg_versions, 'skip_tests': args.skip_tests, + 'install_ccache': args.install_ccache, 'install_lists': [], 'rosdistro_name': args.rosdistro_name, diff --git a/ros_buildfarm/scripts/release/run_binarydeb_job.py b/ros_buildfarm/scripts/release/run_binarydeb_job.py index c7c4ad068..47fa83455 100644 --- a/ros_buildfarm/scripts/release/run_binarydeb_job.py +++ b/ros_buildfarm/scripts/release/run_binarydeb_job.py @@ -24,6 +24,7 @@ from ros_buildfarm.argument import add_argument_distribution_repository_urls from ros_buildfarm.argument import add_argument_dockerfile_dir from ros_buildfarm.argument import add_argument_env_vars +from ros_buildfarm.argument import add_argument_install_ccache from ros_buildfarm.argument import add_argument_os_code_name from ros_buildfarm.argument import add_argument_os_name from ros_buildfarm.argument import add_argument_package_name @@ -55,6 +56,7 @@ def main(argv=sys.argv[1:]): add_argument_append_timestamp(parser) add_argument_env_vars(parser) add_argument_skip_tests(parser) + add_argument_install_ccache(parser) args = parser.parse_args(argv) data = copy.deepcopy(args.__dict__) @@ -69,6 +71,7 @@ def main(argv=sys.argv[1:]): 'skip_download_sourcepkg': args.skip_download_sourcepkg, 'skip_tests': args.skip_tests, + 'install_ccache': args.install_ccache, 'binarypkg_dir': '/tmp/binarydeb', 'build_environment_variables': ['%s=%s' % key_value for key_value in args.env_vars.items()], diff --git a/ros_buildfarm/templates/release/deb/binarypkg_create_task.Dockerfile.em b/ros_buildfarm/templates/release/deb/binarypkg_create_task.Dockerfile.em index 5ecc9ff29..3ff2f2217 100644 --- a/ros_buildfarm/templates/release/deb/binarypkg_create_task.Dockerfile.em +++ b/ros_buildfarm/templates/release/deb/binarypkg_create_task.Dockerfile.em @@ -105,6 +105,7 @@ cmds.append( ' --binarypkg-dir ' + binarypkg_dir + ' --env-vars ' + ' '.join(build_environment_variables) + ' --dockerfile-dir ' + dockerfile_dir + + (' --install-ccache ' if install_ccache else '') + (' --skip-tests' if skip_tests else '')) }@ CMD ["@(' && '.join(cmds))"] diff --git a/ros_buildfarm/templates/release/deb/binarypkg_job.xml.em b/ros_buildfarm/templates/release/deb/binarypkg_job.xml.em index 41e1ee362..24d0d1490 100644 --- a/ros_buildfarm/templates/release/deb/binarypkg_job.xml.em +++ b/ros_buildfarm/templates/release/deb/binarypkg_job.xml.em @@ -112,6 +112,7 @@ but disabled since the package is blacklisted (or not whitelisted) in the config ' --dockerfile-dir $WORKSPACE/docker_generating_docker' + ' --env-vars ' + ' '.join(build_environment_variables) + (' --append-timestamp' if append_timestamp else '') + + (' --install-ccache' if shared_ccache else '') + (' --skip-tests' if skip_tests else ''), 'echo "# END SECTION"', '', diff --git a/ros_buildfarm/templates/release/deb/binarypkg_task.Dockerfile.em b/ros_buildfarm/templates/release/deb/binarypkg_task.Dockerfile.em index da24e7d8e..61e7d4822 100644 --- a/ros_buildfarm/templates/release/deb/binarypkg_task.Dockerfile.em +++ b/ros_buildfarm/templates/release/deb/binarypkg_task.Dockerfile.em @@ -66,11 +66,13 @@ RUN . /etc/os-release && test "$VERSION_ID" = "20.04" && test "$(uname -m)" = "a os_code_name=os_code_name, ))@ +@[if install_ccache]@ @(TEMPLATE( 'snippet/install_ccache.Dockerfile.em', os_name=os_name, os_code_name=os_code_name, ))@ +@[end if]@ @(TEMPLATE( 'snippet/set_environment_variables.Dockerfile.em',