Skip to content

Commit

Permalink
Merge pull request #112 from basler/feature/debian_packaging
Browse files Browse the repository at this point in the history
Feature/debian packaging
  • Loading branch information
thiesmoeller authored Jul 30, 2024
2 parents f9dc08c + 2eb2136 commit ee8922d
Show file tree
Hide file tree
Showing 23 changed files with 458 additions and 31 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/build_config.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
{
"linux-x86_64": {
"targets": ["ubuntu-20.04", "ubuntu-22.04", "ubuntu-24.04"],
"pylon_sdks": ["7.4.0.14900", "7.5.0.15658"]
"pylon_sdks": ["7.4.0.14900", "7.5.0.15658"],
"pylon_sdk_packaging": "7.5.0.15658"
},
"linux-aarch64": {
"targets": ["ubuntu18.04", "ubuntu20.04", "ubuntu22.04"],
"pylon_sdks": ["6.2.0.21487", "7.4.0.14900", "7.5.0.15658"]
"pylon_sdks": ["6.2.0.21487", "7.4.0.14900", "7.5.0.15658"],
"pylon_sdk_packaging": "7.5.0.15658"
},
"windows": {
"targets": ["windows-2019", "windows-2022"],
"pylon_sdks": ["7.4.0.14900", "7.5.0.15658"]
"pylon_sdks": ["7.4.0.14900", "7.5.0.15658"],
"pylon_sdk_packaging": "7.5.0.15658"
},
"macos": {
"targets": ["macos-12", "macos-13", "macos-14"],
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ jobs:
setup:
runs-on: ubuntu-latest
steps:
- uses: jfrog/setup-jfrog-cli@v3
- uses: jfrog/setup-jfrog-cli@v4
env:
JF_URL: ${{ secrets.SDK_URL }}
JF_ACCESS_TOKEN: ${{ secrets.SDK_TOKEN }}

- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

# login
- run: |
Expand Down Expand Up @@ -107,7 +107,7 @@ jobs:
runs-on: ${{ matrix.os }}
name: Build gstreamer for ${{ matrix.pylon_sdk }} on ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: Windows_Pylon
Expand Down Expand Up @@ -181,7 +181,7 @@ jobs:
runs-on: ubuntu-latest
name: Build pylon ${{ matrix.pylon_sdk }} on ${{ matrix.os }}-aarch64
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: Linux_aarch64_Pylon
Expand Down Expand Up @@ -265,7 +265,7 @@ jobs:
runs-on: ${{ matrix.os }}
name: Build pylon ${{ matrix.pylon_sdk }} on ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/download-artifact@v4
with:
Expand Down
134 changes: 134 additions & 0 deletions .github/workflows/deb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: Build Debian Packages
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
setup:
runs-on: ubuntu-latest
steps:
- uses: jfrog/setup-jfrog-cli@v4
env:
JF_URL: ${{ secrets.SDK_URL }}
JF_ACCESS_TOKEN: ${{ secrets.SDK_TOKEN }}

- name: Checkout repository
uses: actions/checkout@v4

# login
- run: |
jf c add --url=$JF_URL --access-token=$JF_ACCESS_TOKEN --interactive=false
# download·
- name: Download files from Artifactory
id: get_matrix
run: |
set +x
set -e
build_config=$(cat .github/workflows/build_config.json)
for os in $(echo $build_config | jq -r 'keys[]'); do
for pylon_sdk in $(echo $build_config | jq -r --arg os "$os" '.[$os].pylon_sdk_packaging'); do
if [[ $os == "linux-x86_64" ]]; then
jf rt dl --flat --props "pylon_architecture=x86_64;pylon_os=linux;pylon_version=$pylon_sdk;pylon_packaging=deb" "pylon-sdks-generic/*" ./linux_x86_64_sdk/
elif [[ $os == "linux-aarch64" ]]; then
jf rt dl --flat --props "pylon_architecture=aarch64;pylon_os=linux;pylon_version=$pylon_sdk;pylon_packaging=deb" "pylon-sdks-generic/*" ./linux_aarch64_sdk/
fi
done
done
- name: Upload Pylon SDK for Linux aarch64
uses: actions/upload-artifact@v4
with:
name: Linux_aarch64_packaging_Pylon
path: linux_aarch64_sdk

- name: Upload Pylon SDK for Linux x86_64
uses: actions/upload-artifact@v4
with:
name: Linux_x86_64_packaging_Pylon
path: linux_x86_64_sdk

build_deb:
runs-on: ubuntu-latest
needs: setup
strategy:
fail-fast: false
matrix:
os:
- ubuntu:24.04
- ubuntu:22.04
- ubuntu:20.04
- debian:bookworm
- debian:bullseye
arch: ["arm64", "amd64"]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Download x86_64
if: matrix.arch == 'amd64'
uses: actions/download-artifact@v4
with:
name: Linux_x86_64_packaging_Pylon
path: pylon-installer

- name: Download aarch64
if: matrix.arch == 'arm64'
uses: actions/download-artifact@v4
with:
name: Linux_aarch64_packaging_Pylon
path: pylon-installer

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/amd64, linux/arm64

- name: Set sanitized OS name
id: sanitize_os
run: |
SANITIZED_OS=$(echo ${{ matrix.os }} | sed 's/:/./g')
echo "SANITIZED_OS=$SANITIZED_OS" >> $GITHUB_ENV
- name: Build Debian Package
uses: jtdor/build-deb-action@v1
env:
DEB_BUILD_OPTIONS: noautodbgsym
with:
setup-hook: |
ln -sfn packaging/debian
apt-get update
(cd /pylon-installer && tar -xvf *.tar.gz && apt-get install -y ./*.deb)
# patch version to contain platform info
tools/patch_deb_changelog.sh
docker-image: ${{ matrix.arch == 'arm64' && format('arm64v8/{0}', matrix.os) || format('{0}', matrix.os) }}
extra-docker-args: -v ${{ github.workspace }}/pylon-installer:/pylon-installer -e PYLON_ROOT=/opt/pylon
buildpackage-opts: --build=binary --no-sign

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: debian-packages-${{ env.SANITIZED_OS }}-${{ matrix.arch }}
path: debian/artifacts/



cleanup:
if: always()
needs: [
setup,
build_deb
]
runs-on: ubuntu-latest
steps:
- uses: geekyeggo/delete-artifact@v5
continue-on-error: true
with:
name: |
Linux_x86_64_packaging_Pylon
Linux_aarch64_packaging_Pylon
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ __pycache__

# subprojects
subprojects/packagecache
subprojects/pybind11-2.10.3
subprojects/pybind11-*
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
# Changelog
All notable changes to this project will be documented in this file.

## [0.7.2] - 2024-07-12
### Changed
- add debian packaging
* CI builds for std x86/aarch64 ubuntu and debian targets
* Building deb packates for NVIDIA Jetson is documented in the README

### Fixed
- workaround for failed tests for Ubuntu 22.04
* fixes #111
- fix nvmm error if no camera connected
* fixes #88

## [0.7.1] - 2024-06-06
### Changed
- check for cuda version >= 11 to enable nvmm code
Expand Down
61 changes: 58 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,8 @@ Installing Basler pylon SDK will also install the Basler pylon viewer. You shoul
The differences in the build steps for [Linux](#Linux), [Windows](#Windows) and [macos](#macOS) are described in the next sections.
Building debian packages locally is described in the sections [Debian/Ubuntu](#debian-packaging) and [Nvidia Jetson](#debian-nvidia-packaging)
## Linux
Make sure the dependencies are properly installed. In Debian-based
systems you can run the following commands:
Expand Down Expand Up @@ -410,6 +412,59 @@ Finally, test for proper installation:
gst-inspect-1.0 pylonsrc
```
## Linux package building
### Debian Packaging
Install the pylon and codemeter debian packages. They will install into `/opt/pylon`
Install the platform dependencies:
```
sudo apt-get install cmake meson ninja-build debhelper dh-python \
libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-python3-plugin-loader \
python3 python3-dev python3-pip python3-setuptools pybind11-dev
```
Prepare the build setup ( from main project folder ):
```
ln -sfn packaging/debian
tools/patch_deb_changelog.sh
```
Build the debian packages
```
PYLON_ROOT=/opt/pylon dpkg-buildpackage -us -uc -rfakeroot
```
### Debian NVIDIA Packaging
Install the pylon and codemeter debian packages. They will install into `/opt/pylon`
Install the platform dependencies:
```
sudo apt-get install cmake meson ninja-build debhelper dh-python \
libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-python3-plugin-loader \
python3 python3-dev python3-pip python3-setuptools pybind11-dev \
deepstream-6.3 # depending on platform deepstream-6.4 or deepstream-7.0
```
Prepare the build setup ( from main project folder ):
```
ln -sfn packaging/debian
tools/patch_deb_changelog.sh
```
Build the debian packages using the nvidia profile
```
DEB_BUILD_PROFILES=nvidia PYLON_ROOT=/opt/pylon dpkg-buildpackage -us -uc -rfakeroot
```
### Integrating with GStreamer monorepo
The monorepo is a top-level repository that integrates and builds all
Expand Down Expand Up @@ -464,15 +519,15 @@ meson setup builddir --prefix /usr/ --werror --buildtype=debug -Dgobject-cast-ch
```
### Cross compilation for linux targets
#### NVIDIA Jetson Jetpack
TBD
#### YOCTO recipe
A reference yocto recipe for honister is available in the [meta-basler-tools](https://github.com/basler/meta-basler-tools/tree/honister/recipes-multimedia/gstreamer)
on github. This recipe still needs a backport patch due to the version of meson tool in honister.
on github.
Builds on yocto kirkstone and later work without the patch.
( This recipe still needs a backport patch due to the version of meson tool in honister. )
## Windows
Install the dependencies:
Expand Down
1 change: 1 addition & 0 deletions bindings/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ incdir = include_directories('include')
pymeta = py3.extension_module('pygstpylon',
pygstpylon_sources,
install : true,
install_rpath : pylon_rpath,
cpp_args: ['-DHAVE_CONFIG_H=1'],
include_directories : [configinc, incdir],
gnu_symbol_visibility: 'inlineshidden',
Expand Down
11 changes: 7 additions & 4 deletions ext/pylon/gstpylonsrc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -782,10 +782,13 @@ static gboolean gst_pylon_src_start(GstBaseSrc *src) {
self->device_serial_number, self->device_index,
self->enable_correction, &error);
#ifdef NVMM_ENABLED
gst_pylon_set_nvsurface_layout(
self->pylon,
static_cast<GstPylonNvsurfaceLayoutEnum>(self->nvsurface_layout));
gst_pylon_set_gpu_id(self->pylon, self->gpu_id);
/* setup nvbufsurface if a new device has been created */
if(self->pylon){
gst_pylon_set_nvsurface_layout(
self->pylon,
static_cast<GstPylonNvsurfaceLayoutEnum>(self->nvsurface_layout));
gst_pylon_set_gpu_id(self->pylon, self->gpu_id);
}
#endif
GST_OBJECT_UNLOCK(self);

Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
project('gst-plugin-pylon', 'c', 'cpp',
version : '0.7.0',
version : '0.7.2',
meson_version : '>= 0.61',
default_options : [ 'warning_level=1',
'buildtype=debugoptimized' ])
Expand Down
5 changes: 5 additions & 0 deletions packaging/debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
gst-plugin-pylon (0.7.2) unstable; urgency=medium

* Refer to Package Release Notes for details: https://github.com/basler/gst-plugin-pylon/blob/main/CHANGELOG.md

-- Basler AG <[email protected]> Tue, 09 Jul 2024 12:00:00 +0000
37 changes: 37 additions & 0 deletions packaging/debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Source: gst-plugin-pylon
Section: video
Priority: optional
Maintainer: Basler AG <[email protected]>
Build-Depends: debhelper-compat (= 11),
dh-python, cmake,
python3-pip,
python3-setuptools,
pybind11-dev,
python3-dev,
libgstreamer1.0-dev,
libgstreamer-plugins-base1.0-dev,
pylon (= 7.5.0.15658-deb0),
deepstream-6.3 <nvidia> | deepstream-6.4 <nvidia> | deepstream-7.0 <nvidia>
Standards-Version: 4.5.0
Homepage: https://github.com/basler/gst-plugin-pylon

Package: gst-plugin-pylon
Architecture: any
Depends: libc6, pylon (= 7.5.0.15658-deb0), ${misc:Depends}, gstreamer1.0-plugins-base, deepstream-6.3 <nvidia> | deepstream-6.4 <nvidia> | deepstream-7.0 <nvidia>
Description: GStreamer plugin for Basler cameras
This plugin allows the use of any Basler 2D camera (supported by Basler pylon
Camera Software Suite) as a source element in a GStreamer pipeline.

Package: gst-plugin-pylon-dev
Architecture: any
Depends: pylon (= 7.5.0.15658-deb0), ${misc:Depends}, gst-plugin-pylon
Description: Development files for GStreamer plugin for Basler cameras
This package contains the development files for the GStreamer plugin for
Basler cameras.

Package: python3-pygstpylon
Architecture: any
Depends: libc6, python3, pylon (= 7.5.0.15658-deb0), ${misc:Depends}, gst-plugin-pylon, deepstream-6.3 <nvidia> | deepstream-6.4 <nvidia> | deepstream-7.0 <nvidia>
Description: Python module to access pylon specific gstreamer metadata.
The python module pygstpylon allows to extract pylon specific metadata
from a buffer.
Loading

0 comments on commit ee8922d

Please sign in to comment.