Skip to content

Commit

Permalink
FEATURE: Bulk of Debian packaging
Browse files Browse the repository at this point in the history
Implementation of the main set of Debian packages for executables, libraries, development files, modules and test-suites for Machinekit-HAL via the CPack.

This does not implement the Python related parts.
  • Loading branch information
cerna committed Dec 22, 2021
1 parent 984c237 commit c79e75c
Show file tree
Hide file tree
Showing 658 changed files with 5,052 additions and 14,273 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/debian-builder-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,49 @@ jobs:
name: machinekit-hal-${{ env.distribution_normalized }}-${{ matrix.architecture }}-${{ matrix.osVersionNumber }}-${{ github.sha }}-${{ needs.prepareState.outputs.Timestamp }}
path: machinekit-hal-${{ env.distribution_normalized }}
- name: >
Prepare base Docker image for installation of packages
of Machinekit-HAL on ${{ matrix.osDistribution }}
${{ matrix.osVersionCodename}}
if: matrix.architecture == 'amd64'
run: |
debian/buildcontainerimage.py -d ${IMAGE_NAME_PREFIX} \
${DISTRIBUTION} \
${VERSION} \
${ARCHITECTURE} \
-t ${BUILD_TARGET} \
${IMAGE_NAME}
env:
IMAGE_NAME_PREFIX: 'docker.pkg.github.com/${{ github.repository }}'
DISTRIBUTION: ${{ matrix.osDistribution}}
VERSION: ${{ matrix.osVersionCodename}}
ARCHITECTURE: ${{ matrix.architecture}}
BUILD_TARGET: 'machinekit-hal_base'
IMAGE_NAME: 'machinekit-hal-runner'
working-directory: ./build/machinekit-hal
- name: >
Install Machinekit-HAL ${{ matrix.osDistribution }} package for
${{ matrix.osVersionCodename}}, ${{ matrix.architecture }} and
run Runtests
if: matrix.architecture == 'amd64'
run: |
docker run --tty --rm -u "$(id -u):$(id -g)" \
-v "$(pwd):/home/machinekit/machinekit-hal" \
-w "/home/machinekit/machinekit-hal" \
${DOCKER_IMAGE} \
/bin/bash -c "
#!/bin/bash -e
sudo apt-get install -y \
/home/machinekit/machinekit-hal/*.deb
echo "ANNOUNCE_IPV4=0" | sudo tee -a /etc/machinekit/hal/machinekit.ini
echo "ANNOUNCE_IPV6=0" | sudo tee -a /etc/machinekit/hal/machinekit.ini
run_runtests
"
env:
DOCKER_IMAGE: 'docker.pkg.github.com/${{ github.repository }}/machinekit-hal-runner:latest'
working-directory: './machinekit-hal-${{ env.distribution_normalized }}'
testMachinekitHALBuild:
name: >
Test on ${{ matrix.osDistribution }} ${{ matrix.osVersionCodename }},
Expand Down
18 changes: 15 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
# #####################################################################
# ~~~

cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.21)

set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
set(CMAKE_EXPORT_LINK_COMMANDS TRUE)

project(
Machinekit-HAL
VERSION 0.4 # TODO: Get the right version from VERSION file and git
VERSION 0.5 # TODO: Get the right version from VERSION file and git
DESCRIPTION "Universal framework for machine control."
HOMEPAGE_URL "https://machinekit.io"
LANGUAGES C CXX)
Expand Down Expand Up @@ -59,13 +59,17 @@ set(MACHINEKIT_HAL_LIBRARY_DIRECTORY "${CMAKE_INSTALL_LIBDIR}")
set(MACHINEKIT_HAL_MANAGED_MODULE_DIRECTORY
"${CMAKE_INSTALL_LIBDIR}/${MACHINEKIT_HAL_PACKAGE_PREFIX_PATH}/module/managed"
)
set(MACHINEKIT_HAL_UNMANAGED_MODULE_DIRECTORY
"${MACHINEKIT_HAL_EXECUTABLE_DIRECTORY}")
set(MACHINEKIT_HAL_INTERNAL_EXECUTABLE_DIRECTORY
"${CMAKE_INSTALL_LIBEXECDIR}/${MACHINEKIT_HAL_PACKAGE_PREFIX_PATH}")
set(MACHINEKIT_HAL_INTERFACE_DIRECTORY "${CMAKE_INSTALL_INCLUDEDIR}")
set(MACHINEKIT_HAL_SYSTEM_CONFIG_DIRECTORY
"${CMAKE_INSTALL_SYSCONFDIR}/${MACHINEKIT_HAL_PACKAGE_PREFIX_PATH}")
set(MACHINEKIT_HAL_LOCAL_STATE_DIRECTORY "${CMAKE_INSTALL_LOCALSTATEDIR}")
set(MACHINEKIT_HAL_TEST_DIRECTORY "test")
set(MACHINEKIT_HAL_TEST_DIRECTORY
"${CMAKE_INSTALL_DATAROOTDIR}/${MACHINEKIT_HAL_PACKAGE_PREFIX_PATH}/testsuite"
)

list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/support/cmake/tools")

Expand Down Expand Up @@ -94,6 +98,14 @@ define_property(
add_subdirectory(src)

# Main package CPack groups
cpack_add_component_group(MachinekitHAL_Package_Base_Executables)
cpack_add_component_group(MachinekitHAL_Package_Base_Libraries)
cpack_add_component_group(MachinekitHAL_Package_Base_Libraries_Development)
cpack_add_component_group(MachinekitHAL_Package_Base_Managed_Modules_Components)
cpack_add_component_group(MachinekitHAL_Package_Base_Managed_Modules_Drivers)
cpack_add_component_group(
MachinekitHAL_Package_Base_Managed_Modules_Drivers_Development)
cpack_add_component_group(
MachinekitHAL_Package_Base_Unmanaged_Modules_Components)
cpack_add_component_group(MachinekitHAL_Package_Base_Unmanaged_Modules_Drivers)
cpack_add_component_group(MachinekitHAL_Package_Base_Tests_Runtests)
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.4
0.5
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions debian/buildsystem/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ RUN printf "%s;\n%s;\n" \
'APT::Install-Suggests "0"' \
> /etc/apt/apt.conf.d/01norecommend

# Ubuntu Focal needs debconf settings in addition
# to setting 'DEBIAN_FRONTEND=noninteractive'
RUN apt-get update && \
apt-get install -y \
apt-utils && \
apt-get clean && \
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections

# Add Machinekit Dependencies repository
RUN apt-get update && \
apt-get install -y \
Expand Down
16 changes: 16 additions & 0 deletions debian/buildsystem/debian-distro-settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
"osVersionNumber": 10,
"architecture": "i386"
},
{
"osVersionNumber": 11,
"architecture": "i386"
},
{
"osVersionNumber": 18.04,
"architecture": "amd64"
Expand All @@ -48,6 +52,10 @@
"osVersionNumber": 10,
"architecture": "amd64"
},
{
"osVersionNumber": 11,
"architecture": "amd64"
},
{
"osVersionNumber": 20.04,
"architecture": "amd64"
Expand All @@ -64,6 +72,10 @@
"osVersionNumber": 10,
"architecture": "armhf"
},
{
"osVersionNumber": 11,
"architecture": "armhf"
},
{
"osVersionNumber": 20.04,
"architecture": "armhf"
Expand All @@ -80,6 +92,10 @@
"osVersionNumber": 10,
"architecture": "arm64"
},
{
"osVersionNumber": 11,
"architecture": "arm64"
},
{
"osVersionNumber": 20.04,
"architecture": "arm64"
Expand Down
121 changes: 71 additions & 50 deletions debian/control.in
Original file line number Diff line number Diff line change
Expand Up @@ -65,70 +65,91 @@ Package: libmachinekit-hal
Architecture: any
Multi-Arch: same
Depends: ${shlibs:Depends}, ${misc:Depends}, ${cpack:Depends}
Description: dh-cmake example - libraries
Description: Machinekit-HAL's libraries
This package contains the shared libraries for the Machinekit-HAL project.

Package: libmachinekit-hal-dev
Architecture: any
Multi-Arch: same
Depends: ${shlibs:Depends}, ${misc:Depends}, ${cpack:Depends}
Description: dh-cmake example - libraries
Description: Machinekit-HAL's libraries - development files
This package contains the development files for libraries of the Machinekit-HAL project.

Package: modmachinekit-hal-components
Architecture: any
Multi-Arch: same
Depends: ${shlibs:Depends}, ${misc:Depends}, ${cpack:Depends}
Description: dh-cmake example - libraries
Description: Machinekit-HAL's managed modules - components
This package contains the managed modules - components for the Machinekit-HAL project.

#Package: modmachinekit-hal-drivers
#Architecture: any
#Multi-Arch: same
#Depends: ${shlibs:Depends}, ${misc:Depends}
#Description: dh-cmake example - libraries
# This package contains the managed modules - drivers for the Machinekit-HAL project.
#
#Package: machinekit-hal-unmanaged-modules
#Architecture: any
#Multi-Arch: same
#Depends: ${shlibs:Depends}, ${misc:Depends}
#Description: dh-cmake example - libraries
# This package contains the unmanaged modules for the Machinekit-HAL project.
#
#Package: machinekit-hal
#Conflicts: machinekit
#Architecture: any
#Depends:
# ${shlibs:Depends},
# ${python3:Depends},
# ${misc:Depends},
# python3-numpy,
# libmodbus-dev (>= 3.0),
# python3-xlib,
# python3-configobj,
# python3-zmq,
# python3-protobuf (>= 2.4.1),
# python3-avahi,
# python3-simplejson,
# python3-pyftpdlib,
# python3-pydot,
# xdot,
# bc,
# procps,
# psmisc,
# cgroup-tools,
# python3-pil,
# python3-gst-1.0,
# uuid-runtime,
# python3-setproctitle,
# @RUNTIME_DEPENDENCIES@,
#Description: Universal framework for machine control based on Hardware Abstraction Layer principle
# .
# Machinekit is the next-generation Machine Controller. It provides
# motion and other control for atomation, robot and CNC machine tool
# applications.
#
Package: modmachinekit-hal-drivers
Architecture: any
Multi-Arch: same
Depends: ${shlibs:Depends}, ${misc:Depends}, ${cpack:Depends}
Description: Machinekit-HAL's managed modules - drivers
This package contains the managed modules - drivers for the Machinekit-HAL project.

Package: modmachinekit-hal-drivers-dev
Architecture: any
Multi-Arch: same
Depends: ${shlibs:Depends}, ${misc:Depends}, ${cpack:Depends}
Description: Machinekit-HAL's managed modules - drivers, development files
This package contains the development files for managed modules - drivers for the Machinekit-HAL project.

Package: machinekit-hal-unmanaged-components
Architecture: any
Multi-Arch: same
Depends: ${shlibs:Depends}, ${misc:Depends}, ${cpack:Depends}
Description: Machinekit-HAL's unmanaged modules - components
This package contains the unmanaged modules - components for the Machinekit-HAL project.

Package: machinekit-hal-unmanaged-drivers
Architecture: any
Multi-Arch: same
Depends: ${shlibs:Depends}, ${misc:Depends}, ${cpack:Depends}
Description: Machinekit-HAL's unmanaged modules - drivers
This package contains the unmanaged modules - drivers for the Machinekit-HAL project.

Package: machinekit-hal-testsuite-runtests
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, ${cpack:Depends}
Description: Machinekit-HAL's runtests (acceptance tests)
This package contains the unmanaged modules - drivers for the Machinekit-HAL project.

Package: machinekit-hal
Conflicts: machinekit
Architecture: any
Depends:
${shlibs:Depends},
${python3:Depends},
${misc:Depends},
${cpack:Depends},
python3-numpy,
libmodbus-dev (>= 3.0),
python3-xlib,
python3-configobj,
python3-zmq,
python3-protobuf (>= 2.4.1),
python3-avahi,
python3-simplejson,
python3-pyftpdlib,
python3-pydot,
xdot,
bc,
procps,
psmisc,
cgroup-tools,
python3-pil,
python3-gst-1.0,
uuid-runtime,
python3-setproctitle,
@RUNTIME_DEPENDENCIES@,
Description: Universal framework for machine control based on Hardware Abstraction Layer principle
.
Machinekit is the next-generation Machine Controller. It provides
motion and other control for atomation, robot and CNC machine tool
applications.

#Package: machinekit-hal-dev
#Architecture: any
#Depends:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MachinekitHAL_Package_Base_Tests_Runtests
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MachinekitHAL_Package_Base_Unmanaged_Modules_Components
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MachinekitHAL_Package_Base_Unmanaged_Modules_Drivers
Empty file.
1 change: 1 addition & 0 deletions debian/machinekit-hal.cpack-component-groups
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MachinekitHAL_Package_Base_Executables
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MachinekitHAL_Package_Base_Managed_Modules_Drivers_Development
1 change: 1 addition & 0 deletions debian/modmachinekit-hal-drivers.cpack-component-groups
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MachinekitHAL_Package_Base_Managed_Modules_Drivers
Empty file.
3 changes: 2 additions & 1 deletion debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@

override_dh_auto_configure:
dh_auto_configure -- \
--toolchain $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))/debianMultiarchToolchain.cmake
--toolchain $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))/debianMultiarchToolchain.cmake \
-DCMAKE_BUILD_TYPE:STRING=DebWithRelInfo

override_dh_auto_test:
# Only run tests (CTest) when not cross-compiling
Expand Down
22 changes: 7 additions & 15 deletions debian/runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,30 +128,22 @@ def _envrc_path(self, config: str) -> pathlib.Path:
else:
return self.build_directory / ".envrc"

def _prepare_run_runtests_executable(self, new_path: pathlib.Path) -> pathlib.Path:
run_runtests = self.source_directory / "tests" / "run_runtests"
new_run_runtests = new_path / "run_runtests"
shutil.copyfile(run_runtests, new_run_runtests)
new_run_runtests.chmod(stat.S_IWUSR | stat.S_IRUSR | stat.S_IXUSR)
return new_run_runtests

def run_runtests(self, test_path: pathlib.Path = None) -> None:
if test_path is None:
test_path = self.source_directory / "tests" / "runtests"
else:
if test_path:
test_path = test_path if isinstance(
test_path, pathlib.Path) else pathlib.Path(test_path)
for config in self.configs:
config_test_path = self.build_directory / config if self.generator == "Ninja Multi-Config" else "." / \
"share" / "machinekit" / "hal" / "testsuite" / \
"runtests" if test_path is None else test_path
test_directory = pathlib.Path(tempfile.mkdtemp(suffix=config))
destination = test_directory / "runtests"
print(
f"--->Tests for config {config} are run in directory {destination}.<---"
"\n====================================")
shutil.copytree(test_path, destination, ignore=shutil.ignore_patterns(
shutil.copytree(config_test_path, destination, ignore=shutil.ignore_patterns(
'pipe-*', 'result', 'strerr'))
run_runtests = self._prepare_run_runtests_executable(
test_directory)
bash_command_string = f". {self._envrc_path(config)}; {run_runtests} {destination}"
bash_command_string = f". {self._envrc_path(config)}; run_runtests {destination}"
sh.bash("-c", bash_command_string,
_out=sys.stdout.buffer, _err=sys.stderr.buffer)

Expand Down Expand Up @@ -279,7 +271,7 @@ def main(args):
if exception:
print("Machinekit-HAL test suite FAILED!")
sys.exit(1)

print("Machinekit-HAL test suite ran successfully!")


Expand Down
2 changes: 1 addition & 1 deletion lefthook.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# EXAMPLE USAGE
# Refer for explanation to following link:
# https://github.com/Arkweid/lefthook/blob/master/docs/full_guide.md
# https://github.com/evilmartians/lefthook/blob/master/docs/full_guide.md
#
# pre-push:
# commands:
Expand Down
Loading

0 comments on commit c79e75c

Please sign in to comment.