From 52284188107ca96f16598d793b8a8f9dfc22d328 Mon Sep 17 00:00:00 2001 From: Thomas Dallmair Date: Sun, 8 Dec 2024 23:57:24 +0100 Subject: [PATCH 1/8] Update bootstrap.sh in `main` as well Updated this in commit 7787816d993161056afea42e0c7809ae88c0d5cd in the `debian` branch already, because I forgot this also affects `main`. --- bootstrap.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap.sh b/bootstrap.sh index fd3eca7a..365058a7 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -13,7 +13,7 @@ esac # on Debian systems we need pkg-config if which dpkg >/dev/null && ! which pkg-config >/dev/null ; then - echo "Package 'pkg-config' missing." + echo "Tool 'pkg-config' missing. Install package 'pkgconf' or older 'pkg-config'." exit 2 fi From bb5c7670e198b44e9bd915a9f8d33ea3727ff225 Mon Sep 17 00:00:00 2001 From: Thomas Dallmair Date: Wed, 18 Dec 2024 20:28:23 +0100 Subject: [PATCH 2/8] Introduce GitHub Actions --- .github/workflows/ci.yml | 111 +++++++++++++++++++++++++++++++++++++++ README.md | 2 +- 2 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..f4b00b1f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,111 @@ +name: CI + +on: + push: + branches: "*" + pull_request: + branches: "*" + +permissions: {} + +jobs: + # On Ubuntu, because that is the standard OS of GitHub Actions. + build_ubuntu: + + runs-on: ubuntu-latest + + steps: + - name: Install build dependencies + run: | + sudo apt-get update + sudo apt-get dist-upgrade -y + sudo apt-get install -y --no-install-recommends libusb-1.0-0-dev libsystemd-dev libev-dev libfmt-dev libinih-dev + + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Full history to be able to determine version number + + - name: Bootstrap + run: sh bootstrap.sh + + - name: Configure + run: ./configure + + - name: Build + run: make -j$(nproc) + + - name: Test + run: make -j1 test + + - name: Install + run: sudo make -j1 install + + # On Alpine, because it's a tiny distro heavily used in containers. + build_alpine: + + runs-on: ubuntu-latest + container: alpine + + steps: + - name: Install build dependencies + run: | + apk update + apk upgrade + apk add git build-base autoconf automake libtool argp-standalone linux-headers libusb-dev libev-dev fmt-dev inih-dev + + - name: Configure git in container + run: | + git config --global --add safe.directory "$GITHUB_WORKSPACE" + + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Full history to be able to determine version number + + - name: Bootstrap + run: sh bootstrap.sh + + - name: Configure + run: ./configure --disable-systemd + + - name: Build + run: make -j$(nproc) + + - name: Test + run: make -j1 test + + - name: Install + run: make -j1 install + + # Debian packaging; May break when code changes require updates to the Debian package. + # Merges the pushed/proposed code changes to the `debian` branch and builds that then. + package_debian: + + strategy: + fail-fast: false + matrix: + suite: [testing, stable, oldstable] + runs-on: ubuntu-latest + container: debian:${{ matrix.suite }}-slim + + steps: + - name: Install dependencies + run: | + apt-get update + apt-get dist-upgrade -y + apt-get install -y --no-install-recommends ca-certificates git sudo + + - name: Configure git in container + run: | + git config --global --add safe.directory "$GITHUB_WORKSPACE" + git config --global user.name "Your Name" + git config --global user.email "you@example.com" + + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Full history to be able to determine version number + + - name: Merge into debian branch + run: git checkout debian && git merge "$GITHUB_REF" + + - name: Build and install + run: sh install-debian.sh diff --git a/README.md b/README.md index 930e1904..fdbdfc7d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -knxd [![Build Status](https://travis-ci.org/knxd/knxd.svg)](https://travis-ci.org/knxd/knxd) +knxd [![CI](https://github.com/knxd/knxd/actions/workflows/ci.yml/badge.svg)](https://github.com/knxd/knxd/actions/workflows/ci.yml) ==== KNX is a very common building automation protocol which runs on dedicated 9600-baud wire as well as IP multicast. From a402748a5099be474e55da0323a07013ea048582 Mon Sep 17 00:00:00 2001 From: Thomas Dallmair Date: Sat, 28 Dec 2024 19:53:34 +0100 Subject: [PATCH 3/8] Document multi-processor build for shorter build times --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fdbdfc7d..5df1bf74 100644 --- a/README.md +++ b/README.md @@ -216,7 +216,7 @@ This part covers "manual" installation. sh bootstrap.sh ./configure --help ./configure --your-chosen-options - make + make -j$(nproc) make install cd .. From 17c1a485f42ef0f40f98bd47000ccfdca4ec6a20 Mon Sep 17 00:00:00 2001 From: Thomas Dallmair Date: Wed, 18 Dec 2024 20:29:19 +0100 Subject: [PATCH 4/8] Back to autoconf 2.69, use m4_esyscmd_s --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index d06f7ba8..e0469c01 100644 --- a/configure.ac +++ b/configure.ac @@ -23,10 +23,10 @@ dnl ## OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF dnl ## SUCH DAMAGE. -AC_PREREQ([2.72]) +AC_PREREQ([2.69]) LT_PREREQ([2.2.0]) -AC_INIT([knxd],m4_esyscmd(sh -c "./tools/version.sh | tr -d '\n'")) +AC_INIT([knxd],m4_esyscmd_s([./tools/version.sh])) AC_CONFIG_SRCDIR([src/server/knxd.cpp]) AM_INIT_AUTOMAKE LT_INIT From 57b59bf961a2812613cebbb953bd22dbeedd36e9 Mon Sep 17 00:00:00 2001 From: Thomas Dallmair Date: Sun, 29 Dec 2024 01:28:01 +0100 Subject: [PATCH 5/8] Also check for existence of `dpkg-parsechangelog` Now that every push to GitHub triggers a workflow, even pushes to `debian` (or any newly created branches from it) do build on all distributions. Therefore, merely checking existence of the file is not sufficient to determine whether to use this or that approach for detecting the version. --- tools/version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/version.sh b/tools/version.sh index 2ebf70fa..ff6ba34a 100755 --- a/tools/version.sh +++ b/tools/version.sh @@ -2,7 +2,7 @@ # Sorry about the Debian nonsense in here but the build system doesn't # patch the file early enough and overriding it is a PITA -if test -s debian/changelog ; then +if test -s debian/changelog && which dpkg-parsechangelog >/dev/null ; then dpkg-parsechangelog -SVersion | sed -e 's/.*://' -e 's/-.*//' exit fi From aeefb806bd3d1efb518e605f29b9644135cb6f4a Mon Sep 17 00:00:00 2001 From: Thomas Dallmair Date: Sat, 28 Dec 2024 13:11:29 +0100 Subject: [PATCH 6/8] Fix warning "redirecting incorrect #include to " This warning occurs on Alpine with musl: ``` In file included from usb.cpp:22: /usr/include/sys/poll.h:1:2: warning: #warning redirecting incorrect #include to [-Wcpp] 1 | #warning redirecting incorrect #include to | ^~~~~~~ ``` --- src/usb/usb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/usb/usb.cpp b/src/usb/usb.cpp index 5a1fbe9d..feaef78a 100644 --- a/src/usb/usb.cpp +++ b/src/usb/usb.cpp @@ -19,7 +19,7 @@ #include #include -#include +#include #include "usb.h" #include "types.h" From 0dcd8d9f7af8e6116be693250ecb8a73a46acf7a Mon Sep 17 00:00:00 2001 From: Thomas Dallmair Date: Mon, 30 Dec 2024 11:37:08 +0100 Subject: [PATCH 7/8] test_inih is not built, so do not try to run it --- Makefile.am | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index e66b4b2a..76dee0fb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -37,4 +37,3 @@ config.h: configure test: all sh tools/test.sh - tools/test_inih tools/test.ini tools/bad*.ini From 2a73cd8c4c1553476daee9269058367f1e3922e5 Mon Sep 17 00:00:00 2001 From: Thomas Dallmair Date: Mon, 30 Dec 2024 11:52:09 +0100 Subject: [PATCH 8/8] Fix WARNING: tempfile is deprecated; consider using mktemp instead. --- tools/test.sh | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/tools/test.sh b/tools/test.sh index 254a62af..de2c6d64 100755 --- a/tools/test.sh +++ b/tools/test.sh @@ -7,7 +7,7 @@ export LD_LIBRARY_PATH=src/client/c/.libs${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH set -ex export PATH="$(pwd)/src/tools/.libs:$(pwd)/src/tools:$(pwd)/src/server/.libs:$(pwd)/src/server:$(pwd)/src/server:$PATH" -EF=$(tempfile) +EF=$(mktemp) # first test argument handling if knxd -e 1.2.3 --stop-right-now >$EF 2>&1; then @@ -52,19 +52,19 @@ if ! knxd -e 1.2.3 --stop-right-now -c -b dummy: -b dummy: >$EF 2>&1; then exit 0 fi -S1=$(tempfile); rm $S1 -S2=$(tempfile); rm $S2 -S3=$(tempfile); rm $S3 -L1=$(tempfile) -L2=$(tempfile) -L3=$(tempfile) -L4=$(tempfile) -L5=$(tempfile) -E1=$(tempfile) -E2=$(tempfile) -E3=$(tempfile) -E4=$(tempfile) -E5=$(tempfile) +S1=$(mktemp); rm $S1 +S2=$(mktemp); rm $S2 +S3=$(mktemp); rm $S3 +L1=$(mktemp) +L2=$(mktemp) +L3=$(mktemp) +L4=$(mktemp) +L5=$(mktemp) +E1=$(mktemp) +E2=$(mktemp) +E3=$(mktemp) +E4=$(mktemp) +E5=$(mktemp) PORT=$((9999 + $$)) PORT2=$((9998 + $$))