Add support for .deb packages for ubuntu-noble-amd64 (#32)

Fix GH-35

---------

Co-authored-by: otegami <otegami@clear-code.com>
Co-authored-by: Sutou Kouhei <kou@clear-code.com>
This commit is contained in:
Daijiro Fukuda 2025-09-26 14:56:28 +09:00 committed by GitHub
parent 4fe19f1f34
commit d3f52afe2f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 547 additions and 4 deletions

148
.github/workflows/package.yaml vendored Normal file
View File

@ -0,0 +1,148 @@
# Copyright 2025 Enactic, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Package
on:
push:
branches:
- '**'
- '!dependabot/**'
tags:
- '**'
pull_request:
concurrency:
group: ${{ github.head_ref || github.sha }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
source:
name: Source
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v5
- name: Create source archive
run: |
rake dist
- uses: actions/upload-artifact@v4
with:
name: source
path: |
openarm-can-*.tar.gz
build:
name: Build
needs: source
strategy:
fail-fast: false
matrix:
id:
- ubuntu-noble-amd64
env:
APACHE_ARROW_REPOSITORY: ${{ github.workspace }}/apache-arrow
# condition && true-case || false-case
# ==
# condition ? true-case : false-case
runs-on: >-
${{ (contains(matrix.id, 'arm64') ||
contains(matrix.id, 'aarch64')) && 'ubuntu-24.04-arm' ||
'ubuntu-latest' }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v5
with:
submodules: recursive
- uses: actions/checkout@v5
with:
path: apache-arrow
repository: apache/arrow
- name: Prepare environment variables
run: |
id=${{ matrix.id }}
# ubuntu-noble-amd64 -> ubuntu-noble
os_version=${id%-*}
# ubuntu-noble -> ubuntu
os=${os_version%-*}
# ubuntu-noble -> noble
version=${os_version##*-}
# ubuntu-noble-amd64 -> amd64
architecture=${id##*-}
if [ "${os}" = "debian" ] || [ "${os}" = "ubuntu" ]; then
TASK_NAMESPACE=apt
if [ "${architecture}" = "amd64" ]; then
echo "APT_TARGETS=${os_version}" >> "${GITHUB_ENV}"
TEST_DOCKER_IMAGE="${os}:${version}"
else
echo "APT_TARGETS=${id}" >> "${GITHUB_ENV}"
TEST_DOCKER_IMAGE="arm64v8/${os}:${version}"
fi
else
TASK_NAMESPACE=yum
# amazon-linux -> amazonlinux
docker_os=${os/-/}
if [ "${architecture}" = "x86_64" ]; then
echo "YUM_TARGETS=${os_version}" >> "${GITHUB_ENV}"
TEST_DOCKER_IMAGE="${docker_os}:${version}"
else
echo "YUM_TARGETS=${id}" >> "${GITHUB_ENV}"
TEST_DOCKER_IMAGE="arm64v8/${docker_os}:${version}"
fi
fi
echo "ARCHITECTURE=${architecture}" >> ${GITHUB_ENV}
echo "TASK_NAMESPACE=${TASK_NAMESPACE}" >> ${GITHUB_ENV}
echo "TEST_DOCKER_IMAGE=${TEST_DOCKER_IMAGE}" >> ${GITHUB_ENV}
- name: Install dependencies
run: |
sudo apt update -o="APT::Acquire::Retries=3"
sudo apt install -y -V -o="APT::Acquire::Retries=3" \
devscripts \
ruby
- uses: actions/download-artifact@v5
with:
name: source
- name: Update version
if: github.ref_type != 'tag'
run: |
cd packages
rake version:update
- name: Login to GitHub Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build with docker
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd packages
rake docker:pull || :
rake ${TASK_NAMESPACE}:build BUILD_DIR=build
if [ "${TASK_NAMESPACE}" = "yum" ] && [ "${ARCHITECTURE}" != "x86_64" ]; then
# Remove SRPMs from non x86_64 artifacts
rm -rf ${TASK_NAMESPACE}/repositories/*/*/source
fi
- name: Push the built Docker image
continue-on-error: true
run: |
cd packages
rake docker:push
# Test
- name: Test
run: |
docker run \
--rm \
--volume ${PWD}:/host:ro \
${TEST_DOCKER_IMAGE} \
/host/packages/${TASK_NAMESPACE}/test.sh

View File

@ -29,9 +29,7 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Create source archive - name: Create source archive
run: | run: |
git archive ${GITHUB_REF_NAME} \ rake dist VERSION=${GITHUB_REF_NAME}
--prefix openarm-can-${GITHUB_REF_NAME}/ \
--output openarm-can-${GITHUB_REF_NAME}.tar.gz
sha256sum \ sha256sum \
openarm-can-${GITHUB_REF_NAME}.tar.gz > \ openarm-can-${GITHUB_REF_NAME}.tar.gz > \
openarm-can-${GITHUB_REF_NAME}.tar.gz.sha256 openarm-can-${GITHUB_REF_NAME}.tar.gz.sha256

14
.gitignore vendored
View File

@ -13,4 +13,16 @@
# limitations under the License. # limitations under the License.
/.vscode /.vscode
/build /build
/openarm-can-*.tar.gz
/packages/apt/build.sh
/packages/apt/build/
/packages/apt/env.sh
/packages/apt/repositories/
/packages/apt/tmp/
/packages/openarm-can-*.tar.gz
/packages/yum/build.sh
/packages/yum/build/
/packages/yum/env.sh
/packages/yum/repositories/
/packages/yum/tmp/

28
Rakefile Normal file
View File

@ -0,0 +1,28 @@
# Copyright 2025 Enactic, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
require_relative "helper"
version = ENV["VERSION"] || Helper.detect_version
archive_base_name = "openarm-can-#{version}"
archive_tar_gz = "#{archive_base_name}.tar.gz"
file archive_tar_gz do
sh("git", "archive", "HEAD",
"--prefix", "#{archive_base_name}/",
"--output", archive_tar_gz)
end
desc "Create #{archive_tar_gz}"
task :dist => archive_tar_gz

21
helper.rb Normal file
View File

@ -0,0 +1,21 @@
# Copyright 2025 Enactic, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
module Helper
module_function
def detect_version
cmakelists = File.join(__dir__, "CMakeLists.txt")
File.read(cmakelists)[/^project\(.+ VERSION (.+?)\)/, 1]
end
end

71
packages/Rakefile Normal file
View File

@ -0,0 +1,71 @@
# Copyright 2025 Enactic, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
require "time"
apache_arrow_repository = ENV["APACHE_ARROW_REPOSITORY"]
if apache_arrow_repository.nil?
raise "Specify APACHE_ARROW_REPOSITORY environment variable"
end
require "#{apache_arrow_repository}/dev/tasks/linux-packages/package-task"
require_relative "../helper"
class OpenArmCANPackageTask < PackageTask
def initialize
super("openarm-can", detect_version, detect_release_time)
end
private
def detect_version
Helper.detect_version
end
def detect_release_time
release_time_env = ENV["RELEASE_TIME"]
if release_time_env
Time.parse(release_time_env).utc
else
Time.now.utc
end
end
def enable_yum?
false
end
def define_archive_task
file @archive_name do
if File.exist?("../#{@archive_name}")
ln_s("../#{@archive_name}",
@archive_name)
else
download("https://github.com/#{github_repository}/" +
"releases/download/#{@version}/#{@archive_name}",
@archive_name)
end
end
end
def github_repository
"enactic/openarm_can"
end
def docker_image(os, architecture)
"ghcr.io/#{github_repository.gsub(/"_"/, "-")}-package:#{super}"
end
end
task = OpenArmCANPackageTask.new
task.define

28
packages/apt/test.sh Executable file
View File

@ -0,0 +1,28 @@
#!/bin/bash
#
# Copyright 2025 Enactic, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -exu
apt update
apt install -V -y curl lsb-release
distribution=$(lsb_release --short --id | tr '[:upper:]' '[:lower:]')
code_name=$(lsb_release --codename --short)
architecture=$(dpkg --print-architecture)
repositories_dir=/host/packages/apt/repositories
apt install -V -y \
"${repositories_dir}"/"${distribution}"/pool/"${code_name}"/*/*/*/*_"${architecture}".deb

View File

@ -0,0 +1,33 @@
# Copyright 2025 Enactic, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM ubuntu:noble
RUN \
echo "debconf debconf/frontend select Noninteractive" | \
debconf-set-selections
ARG DEBUG
RUN \
quiet=$([ "${DEBUG}" = "yes" ] || echo "-qq") && \
apt update ${quiet} && \
apt install -y -V ${quiet} \
build-essential \
ccache \
cmake \
debhelper \
devscripts \
ninja-build && \
apt clean

View File

67
packages/debian/control Normal file
View File

@ -0,0 +1,67 @@
# Copyright 2025 Enactic, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
Source: openarm-can
Section: libs
Priority: optional
Maintainer: "Enactic, Inc." <openarm@enactic.ai>
Rules-Requires-Root: no
Build-Depends:
cmake,
debhelper-compat (= 13),
Standards-Version: 4.6.0
Homepage: https://docs.openarm.dev/
Vcs-Browser: https://github.com/enactic/openarm_can
Vcs-Git: https://github.com/enactic/openarm_can.git
Package: libopenarm-can-dev
Section: libdevel
Architecture: any
Multi-Arch: same
Depends:
${misc:Depends},
libopenarm-can1 (= ${binary:Version}),
Description: Development files to use OpenArm CAN as a library
OpenArm CAN Library is a communication bridge between high-level
OpenArm control applications and low-level motor protocols.
It abstracts CAN bus communication via SocketCAN interface.
.
This package provides header files to use OpenArm CAN as a library.
Package: libopenarm-can1
Architecture: any
Multi-Arch: same
Depends:
${misc:Depends},
${shlibs:Depends},
Description: CAN communication library for OpenArm robotic hardware
OpenArm CAN Library is a communication bridge between high-level
OpenArm control applications and low-level motor protocols.
It abstracts CAN bus communication via SocketCAN interface.
Package: openarm-can-utils
Architecture: any
Depends:
${misc:Depends},
${shlibs:Depends},
can-utils,
iproute2,
python3,
Description: Utility tools for OpenArm CAN configuration
OpenArm CAN Library is a communication bridge between high-level
OpenArm control applications and low-level motor protocols.
It abstracts CAN bus communication via Linux SocketCAN interface.
.
This package provides utility scripts for CAN interface setup,
motor diagnostics, and configuration tools.

41
packages/debian/copyright Normal file
View File

@ -0,0 +1,41 @@
# Copyright 2025 Enactic, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Source: https://github.com/enactic/openarm_can/releases
Upstream-Name: OpenArm CAN
Upstream-Contact: "Enactic, Inc." <openarm@enactic.ai>
Files:
*
Copyright:
2025 Enactic, Inc. <openarm@enactic.ai>
License: Apache-2.0
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
.
http://www.apache.org/licenses/LICENSE-2.0
.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
.
On Debian systems, the full text of the Apache Software License version 2 can
be found in the file `/usr/share/common-licenses/Apache-2.0'.

View File

@ -0,0 +1,18 @@
# Copyright 2025 Enactic, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
usr/include/*
usr/lib/*/lib*.so
usr/lib/*/pkgconfig/*
usr/lib/*/cmake/OpenArmCAN/*

View File

@ -0,0 +1,15 @@
# Copyright 2025 Enactic, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
usr/lib/*/lib*.so.*

View File

@ -0,0 +1,17 @@
# Copyright 2025 Enactic, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
setup/configure_socketcan.sh usr/libexec/openarm-can
setup/set_zero.sh usr/libexec/openarm-can
setup/change_baudrate.py usr/libexec/openarm-can

27
packages/debian/rules Executable file
View File

@ -0,0 +1,27 @@
#!/usr/bin/make -f
#
# Copyright 2025 Enactic, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
%:
dh $@
override_dh_auto_configure:
dh_auto_configure \
--buildsystem=cmake+ninja \
-- \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=RelWithDebInfo

View File

@ -0,0 +1 @@
3.0 (quilt)

View File

@ -0,0 +1,18 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
Bug-Database: https://github.com/enactic/openarm_can/issues
Bug-Submit: https://github.com/enactic/openarm_can/issues/new
Changelog: https://github.com/enactic/openarm_can/blob/main/packages/debian/changelog
Documentation: https://docs.openarm.dev/software/can/
Repository-Browse: https://github.com/enactic/openarm_can
Repository: https://github.com/enactic/openarm_can.git