From b1ade93ba54e1ddd2ca88dd035c9d46eee57b388 Mon Sep 17 00:00:00 2001 From: dominikn Date: Tue, 27 Aug 2024 21:29:15 +0200 Subject: [PATCH] building for humble/jazzy and for amd64/arm64 --- .github/workflows/publish.yaml | 9 ++++++- justfile | 2 ++ snap/snapcraft.yaml | 47 +++++++++++++++++----------------- snapcraft_template.yaml.jinja2 | 43 +++++++++++++++++++++++-------- 4 files changed, 66 insertions(+), 35 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index a66bffe..1604f5a 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -16,7 +16,13 @@ jobs: matrix: include: - ros_distro: humble + runner: ubuntu-latest - ros_distro: jazzy + runner: ubuntu-latest + - ros_distro: humble + runner: ubuntu-24.04-arm64 + - ros_distro: jazzy + runner: ubuntu-24.04-arm64 steps: @@ -27,7 +33,8 @@ jobs: - name: Render snapcraft.yaml run: | - pip install jinja2 + sudo apt update + sudo apt install python3-jinja2 export ROS_DISTRO=${{ matrix.ros_distro }} ./render_template.py ./snapcraft_template.yaml.jinja2 snap/snapcraft.yaml diff --git a/justfile b/justfile index 3e5cd3e..45cb2e9 100644 --- a/justfile +++ b/justfile @@ -60,7 +60,9 @@ iterate target="humble": fi snapcraft clean + sudo rm -rf snap/snapcraft.yaml ./render_template.py ./snapcraft_template.yaml.jinja2 snap/snapcraft.yaml + chmod 444 snap/snapcraft.yaml snapcraft unsquashfs husarion-depthai*.snap diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 1327268..310b8f8 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -40,7 +40,7 @@ description: | grade: stable confinement: strict -base: core22 +base: core24 contact: https://github.com/husarion/depthai-snap/issues issues: https://github.com/husarion/depthai-snap/issues @@ -50,12 +50,6 @@ slots: shm-slot: interface: shared-memory write: ['*'] # paths are relative to /dev/shm - # c189-slot: - # interface: custom-device - # custom-device: c189 - # files: - # write: - # - /run/udev/data/c189:* plugs: shm-plug: @@ -63,10 +57,6 @@ plugs: shared-memory: shm-slot private: false - # c189-plug: - # interface: custom-device - # custom-device: c189 - apps: daemon: @@ -76,7 +66,7 @@ apps: install-mode: enable plugs: [network, network-bind, shm-plug, raw-usb] slots: [shm-slot] - extensions: [ros2-humble-ros-base] + extensions: [ros2-jazzy-ros-base] husarion-depthai: command: usr/bin/launcher.sh @@ -85,7 +75,7 @@ apps: # plugs: [network, network-bind, shm-plug, raw-usb, system-observe, hardware-observe, network-control, network-observe, camera, browser-support] # block-devices, slots: [shm-slot] - extensions: [ros2-humble-ros-base] + extensions: [ros2-jazzy-ros-base] start: command: usr/bin/start_launcher.sh @@ -99,24 +89,35 @@ apps: parts: husarion-depthai: - plugin: nil - stage-packages: - - ros-humble-depthai-ros - - ros-humble-image-transport - - ros-humble-image-transport-plugins + plugin: colcon + source: https://github.com/luxonis/depthai-ros.git + source-branch: jazzy + build-packages: + - python3-vcstool + stage-packages: + - ros-jazzy-image-transport + - ros-jazzy-image-transport-plugins # https://index.ros.org/p/ffmpeg_image_transport/github-ros-misc-utilities-ffmpeg_image_transport/#humble - - ros-humble-ffmpeg-image-transport + - ros-jazzy-ffmpeg-image-transport - ffmpeg - - ros-humble-cv-bridge + - ros-jazzy-cv-bridge # needed to run ffmpeg without errors: - libpulse-dev - libblas3 - libjpeg-turbo8-dev - override-stage: | + - ros-jazzy-rmw-cyclonedds-cpp + override-pull: | craftctl default - version="$(apt-cache policy ros-humble-depthai-ros-driver | grep Candidate | awk '{print $2}')" + + # Set the snap version from the git tag + # The grade is set to 'stable' if the latest entry in the git history + # is the tag itself, otherwise set to devel + version="$(git describe --always --tags| sed -e 's/^v//;s/-/+git/;y/-/./')" + [ -n "$(echo $version | grep "+git")" ] && grade=devel || grade=stable craftctl set version="$version" - craftctl set grade="stable" + craftctl set grade="$grade" + + local-files: plugin: dump diff --git a/snapcraft_template.yaml.jinja2 b/snapcraft_template.yaml.jinja2 index e5f9f08..06f6dcd 100644 --- a/snapcraft_template.yaml.jinja2 +++ b/snapcraft_template.yaml.jinja2 @@ -50,12 +50,6 @@ slots: shm-slot: interface: shared-memory write: ['*'] # paths are relative to /dev/shm - # c189-slot: - # interface: custom-device - # custom-device: c189 - # files: - # write: - # - /run/udev/data/c189:* plugs: shm-plug: @@ -63,10 +57,6 @@ plugs: shared-memory: shm-slot private: false - # c189-plug: - # interface: custom-device - # custom-device: c189 - apps: daemon: @@ -99,6 +89,37 @@ apps: parts: husarion-depthai: + plugin: colcon + source: https://github.com/luxonis/depthai-ros.git + source-branch: {{ ros_distro }} + build-packages: + - python3-vcstool + stage-packages: + - ros-{{ ros_distro }}-image-transport + - ros-{{ ros_distro }}-image-transport-plugins + # https://index.ros.org/p/ffmpeg_image_transport/github-ros-misc-utilities-ffmpeg_image_transport/#humble + - ros-{{ ros_distro }}-ffmpeg-image-transport + - ffmpeg + - ros-{{ ros_distro }}-cv-bridge + # needed to run ffmpeg without errors: + - libpulse-dev + - libblas3 + - libjpeg-turbo8-dev + - ros-{{ ros_distro }}-rmw-cyclonedds-cpp + override-pull: | + craftctl default + + # Set the snap version from the git tag + # The grade is set to 'stable' if the latest entry in the git history + # is the tag itself, otherwise set to devel + version="$(git describe --always --tags| sed -e 's/^v//;s/-/+git/;y/-/./')" + [ -n "$(echo $version | grep "+git")" ] && grade=devel || grade=stable + craftctl set version="$version" + craftctl set grade="$grade" + + {# + # uncomment when depthai-ros package for jazzy is available here: https://index.ros.org/search/?term=depthai + husarion-depthai: plugin: nil stage-packages: - ros-{{ ros_distro }}-depthai-ros @@ -116,7 +137,7 @@ parts: craftctl default version="$(apt-cache policy ros-{{ ros_distro }}-depthai-ros-driver | grep Candidate | awk '{print $2}')" craftctl set version="$version" - craftctl set grade="stable" + craftctl set grade="stable" #} local-files: plugin: dump