Skip to content

Commit

Permalink
Add support for ROS Noetic (ros-tooling#319)
Browse files Browse the repository at this point in the history
* add support for ROS Noetic
* Use the same qemu binaries as the ones provided in https://github.com/osrf/multiarch-docker-image-generation
In order to work around https://bugs.launchpad.net/qemu/+bug/1805913 and so qemu supports renameat2() syscall.

Signed-off-by: TSC21 <[email protected]>
Co-authored-by: Emerson Knapp <[email protected]>
  • Loading branch information
2 people authored and hidmic committed Jun 9, 2021
1 parent 383d6ca commit fb84ad3
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 12 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/e2e_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
matrix:
target_arch: [aarch64, armhf, x86_64]
target_os: [ubuntu, debian]
rosdistro: [dashing, foxy, galactic, rolling, melodic]
rosdistro: [melodic, noetic, dashing, foxy, galactic, rolling]
env:
METRICS_OUT_DIR: /tmp/collected_metrics
steps:
Expand Down Expand Up @@ -51,12 +51,12 @@ jobs:
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- uses: ros-tooling/[email protected]
if: ${{ always() && !github.event.repository.fork && !github.event.pull_request.head.repo.fork && ( matrix.target_arch != 'armhf' || matrix.rosdistro != 'foxy' ) && ( matrix.target_arch != 'armhf' || matrix.rosdistro != 'galactic' ) && ( matrix.target_arch != 'armhf' || matrix.rosdistro != 'rolling' ) }}
if: ${{ always() && !github.event.repository.fork && !github.event.pull_request.head.repo.fork && ( matrix.target_arch != 'armhf' || matrix.target_os != 'debian' || matrix.rosdistro != 'noetic' ) && ( matrix.target_arch != 'armhf' || matrix.rosdistro != 'foxy' ) && ( matrix.target_arch != 'armhf' || matrix.rosdistro != 'galactic' ) && ( matrix.target_arch != 'armhf' || matrix.rosdistro != 'rolling' ) }}
with:
metric-data: "${{ env.METRICS_OUT_DIR }}/${{ matrix.target_arch }}_${{ matrix.target_os }}_${{ matrix.rosdistro }}_a"
namespace: "CrossCompileMetrics"
- uses: ros-tooling/[email protected]
if: ${{ always() && !github.event.repository.fork && !github.event.pull_request.head.repo.fork && ( matrix.target_arch != 'armhf' || matrix.rosdistro != 'foxy' ) && ( matrix.target_arch != 'armhf' || matrix.rosdistro != 'galactic' ) && ( matrix.target_arch != 'armhf' || matrix.rosdistro != 'rolling' ) }}
if: ${{ always() && !github.event.repository.fork && !github.event.pull_request.head.repo.fork && ( matrix.target_arch != 'armhf' || matrix.target_os != 'debian' || matrix.rosdistro != 'noetic' ) && ( matrix.target_arch != 'armhf' || matrix.rosdistro != 'foxy' ) && ( matrix.target_arch != 'armhf' || matrix.rosdistro != 'galactic' ) && ( matrix.target_arch != 'armhf' || matrix.rosdistro != 'rolling' ) }}
with:
metric-data: "${{ env.METRICS_OUT_DIR }}/${{ matrix.target_arch }}_${{ matrix.target_os }}_${{ matrix.rosdistro }}_b"
namespace: "CrossCompileMetrics"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pip_e2e_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
matrix:
target_arch: [aarch64, armhf]
target_os: [ubuntu]
rosdistro: [dashing]
rosdistro: [melodic, noetic, dashing, foxy]
install_type:
- test
- prod
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This tool supports compiling a workspace for all combinations of the following:

* Architecture: `armhf`, `aarch64`, `x86_64`
* ROS Distro
* ROS: `kinetic`, `melodic`
* ROS: `kinetic`, `melodic`, `noetic`
* ROS 2: `dashing`, `foxy`, `galactic`, `rolling`
* OS: `Ubuntu`, `Debian`

Expand Down Expand Up @@ -307,7 +307,7 @@ Here is a detailed look at the arguments passed to the script (`ros_cross_compil
* `.`
* The first argument to `ros_cross_compile` is the directory of the workspace to be built. This could be any relative or absolute path, in this case it's just `.`, the current working directory.
* `--rosdistro foxy`
* You may specify either a ROS and ROS 2 distribution by name, for example `melodic` (ROS) or `galactic` (ROS 2).
* You may specify either a ROS and ROS 2 distribution by name, for example `noetic` (ROS) or `galactic` (ROS 2).
* `--arch aarch64`
* Target the ARMv8 / ARM64 / aarch64 architecture (which are different names for effectively the same thing).
* `--os ubuntu`
Expand Down
6 changes: 5 additions & 1 deletion ros_cross_compile/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
SUPPORTED_ARCHITECTURES = tuple(ARCHITECTURE_NAME_MAP.keys())

SUPPORTED_ROS2_DISTROS = ('dashing', 'foxy', 'galactic', 'rolling')
SUPPORTED_ROS_DISTROS = ('kinetic', 'melodic')
SUPPORTED_ROS_DISTROS = ('kinetic', 'melodic', 'noetic')

ROSDISTRO_OS_MAP = {
'kinetic': {
Expand All @@ -38,6 +38,10 @@
'ubuntu': 'bionic',
'debian': 'stretch',
},
'noetic': {
'ubuntu': 'focal',
'debian': 'buster',
},
'dashing': {
'ubuntu': 'bionic',
'debian': 'stretch',
Expand Down
Binary file added ros_cross_compile/qemu/qemu-aarch64-static
Binary file not shown.
Binary file added ros_cross_compile/qemu/qemu-arm-static
Binary file not shown.
8 changes: 7 additions & 1 deletion ros_cross_compile/sysroot_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,13 @@ def setup_emulator(arch: str, output_dir: Path) -> None:
bin_dir.mkdir(parents=True, exist_ok=True)
needs_emulator = (py_platform.system() != 'Darwin') and (py_platform.machine() != arch)
if needs_emulator:
emulator_path = Path('/') / 'usr' / 'bin' / emulator_name
"""
Using the same qemu binaries as the ones provided in
https://github.com/osrf/multiarch-docker-image-generation in order to
work around https://bugs.launchpad.net/qemu/+bug/1805913 and so qemu
supports renameat2() syscall.
"""
emulator_path = Path(__file__).parent / 'qemu' / emulator_name
if not emulator_path.is_file():
raise RuntimeError('Could not find the expected QEmu emulator binary "{}"'.format(
emulator_path))
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,15 @@
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Topic :: Software Development',
],
description='A tool to build ROS workspaces for various target architectures and platforms.',
long_description=long_description,
long_description_content_type='text/markdown',
license='Apache License, Version 2.0',
package_data={
package_name: ['docker/*.*', 'mixins/*.*'],
package_name: ['docker/*.*', 'mixins/*.*', 'qemu/*.*'],
},
install_requires=[
'docker>=2,<3',
Expand Down
6 changes: 6 additions & 0 deletions test/run_e2e_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ setup(){
error "Foxy, Galactic and Rolling do not have armhf binaries available"
exit 0
fi
if [ "$os" == "debian" ]; then
if [ "$distro" == "noetic" ]; then
error "Noetic does not have armhf binaries available to debian"
exit 0
fi
fi
fi
}

Expand Down
12 changes: 10 additions & 2 deletions test/test_platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,22 @@ def test_get_docker_base_image():
verify_base_docker_images('aarch64', 'ubuntu', 'dashing', 'arm64v8/ubuntu:bionic')
verify_base_docker_images('aarch64', 'ubuntu', 'kinetic', 'arm64v8/ubuntu:xenial')
verify_base_docker_images('aarch64', 'ubuntu', 'melodic', 'arm64v8/ubuntu:bionic')
verify_base_docker_images('aarch64', 'ubuntu', 'noetic', 'arm64v8/ubuntu:focal')

verify_base_docker_images('aarch64', 'debian', 'dashing', 'arm64v8/debian:stretch')
verify_base_docker_images('aarch64', 'debian', 'kinetic', 'arm64v8/debian:jessie')
verify_base_docker_images('aarch64', 'debian', 'melodic', 'arm64v8/debian:stretch')
verify_base_docker_images('aarch64', 'debian', 'noetic', 'arm64v8/debian:buster')

verify_base_docker_images('armhf', 'ubuntu', 'dashing', 'arm32v7/ubuntu:bionic')
verify_base_docker_images('armhf', 'ubuntu', 'kinetic', 'arm32v7/ubuntu:xenial')
verify_base_docker_images('armhf', 'ubuntu', 'melodic', 'arm32v7/ubuntu:bionic')
verify_base_docker_images('armhf', 'ubuntu', 'noetic', 'arm32v7/ubuntu:focal')

verify_base_docker_images('armhf', 'debian', 'dashing', 'arm32v7/debian:stretch')
verify_base_docker_images('armhf', 'debian', 'kinetic', 'arm32v7/debian:jessie')
verify_base_docker_images('armhf', 'debian', 'melodic', 'arm32v7/debian:stretch')
verify_base_docker_images('armhf', 'debian', 'noetic', 'arm32v7/debian:buster')


def test_docker_py_version():
Expand All @@ -98,9 +102,13 @@ def test_docker_py_version():


def test_ros_version_map():
platform = Platform('aarch64', 'ubuntu', 'dashing')
platform = Platform('armhf', 'ubuntu', 'dashing')
assert platform.ros_version == 'ros2'
platform = Platform('aarch64', 'ubuntu', 'kinetic')
platform = Platform('x86_64', 'ubuntu', 'foxy')
assert platform.ros_version == 'ros2'
platform = Platform('armhf', 'ubuntu', 'melodic')
assert platform.ros_version == 'ros'
platform = Platform('aarch64', 'ubuntu', 'noetic')
assert platform.ros_version == 'ros'


Expand Down
2 changes: 1 addition & 1 deletion test/test_sysroot_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def test_prepare_docker_build_basic(tmpdir):

def test_run_twice(tmpdir):
# The test is that this doesn't throw an exception for already existing paths
platform = Platform('armhf', 'debian', 'kinetic')
platform = Platform('armhf', 'debian', 'noetic')
tmp = Path(str(tmpdir))
prepare_docker_build_environment(platform, tmp, None, None)
prepare_docker_build_environment(platform, tmp, None, None)
Expand Down

0 comments on commit fb84ad3

Please sign in to comment.