Skip to content

Commit 420be53

Browse files
committed
Merge branch 'master' into issue-1754-bcmxcp
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
2 parents 410da30 + 5d3ff46 commit 420be53

File tree

679 files changed

+81700
-17429
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

679 files changed

+81700
-17429
lines changed

.circleci/config.yml

Lines changed: 113 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,17 @@ jobs:
1717
parameters:
1818
XCODE_VER:
1919
type: string
20-
default: "12.5.1"
20+
# https://circleci.com/docs/using-macos/#supported-xcode-versions-silicon
21+
default: "13.4.1"
2122
CC:
2223
type: string
2324
default: "" # e.g. "clang"
2425
CXX:
2526
type: string
2627
default: "" # e.g. "clang++"
28+
CPP:
29+
type: string
30+
default: "" # e.g. "clang -E"
2731
CC_STDVER:
2832
type: string
2933
default: "" # e.g. "-std=gnu17"
@@ -39,15 +43,27 @@ jobs:
3943
BREW_MORE:
4044
type: string
4145
default: "" # e.g. "avahi" for all-driver tests
46+
#HOMEBREW_PREFIX:
47+
# Detected below at run-time
48+
# See https://docs.brew.sh/Installation :
49+
# * /opt/homebrew for Apple Silicon,
50+
# * /usr/local for macOS Intel and
51+
# * /home/linuxbrew/.linuxbrew for Linux
52+
# TODO: Find a way to select one of the values based on the platform?
53+
#type: string
54+
#default: "/opt/homebrew" # since July 2024 CircleCI only serves Apple Silicon instances
55+
#default: "/usr/local" # was when CircleCI builders had x86
4256

4357
environment:
4458
CC: << parameters.CC >>
4559
CXX: << parameters.CXX >>
60+
CPP: << parameters.CPP >>
4661
CC_STDVER: << parameters.CC_STDVER >>
4762
CXX_STDVER: << parameters.CXX_STDVER >>
4863
BUILD_TYPE: << parameters.BUILD_TYPE >>
4964
CI_BUILDDIR: << parameters.CI_BUILDDIR >>
5065
BREW_MORE: << parameters.BREW_MORE >>
66+
#HOMEBREW_PREFIX: << parameters.HOMEBREW_PREFIX >>
5167

5268
# Specify the execution environment. You can specify an image from Dockerhub or use one of our Convenience Images from CircleCI's Developer Hub.
5369
# See: https://circleci.com/docs/2.0/configuration-reference/#docker-machine-macos-windows-executor
@@ -65,25 +81,68 @@ jobs:
6581

6682
# Note: MacOS default /bin/bash 3.x is too old for ci_build.sh
6783
# Brew brings /usr/local/bin/bash 5.x as of this writing
68-
# TODO: Are Binutils needed?
84+
# We also reinstall/relink openssl@3 because asciidoc deps pull
85+
# in openssl@1 and MAYBE they conflict (cause lack of exposed
86+
# symlinks).
6987
- run:
7088
name: "homebrew"
7189
command: |-
7290
HOMEBREW_NO_AUTO_UPDATE=1; export HOMEBREW_NO_AUTO_UPDATE;
73-
brew install ccache bash libtool pkg-config gd libusb neon net-snmp openssl $BREW_MORE #binutils
91+
brew install ccache bash libtool binutils autoconf automake git m4 \
92+
pkg-config aspell asciidoc docbook-xsl cppunit gd \
93+
libusb neon net-snmp \
94+
nss openssl \
95+
libmodbus freeipmi powerman $BREW_MORE
96+
#brew reinstall openssl@3
97+
if ps -ef | grep -v grep | grep sshd ; then
98+
brew install mc
99+
ifconfig -a || true
100+
fi
74101
75-
# - run:
76-
# name: "homebrew-libtool"
77-
# command: |-
78-
# #find /usr /opt /lib* -name '*ltdl*' -ls 2>/dev/null || true
79-
# brew unlink libtool && brew link libtool
80-
# #find /usr /opt /lib* -name '*ltdl*' -ls 2>/dev/null || true
102+
# https://github.com/Homebrew/legacy-homebrew/issues/15488
103+
- run:
104+
name: "homebrew-relink"
105+
command: |-
106+
#find /usr /opt /lib* -name '*ltdl*' -ls 2>/dev/null || true
107+
brew unlink libtool && brew link libtool
108+
#find /usr /opt /lib* -name '*ltdl*' -ls 2>/dev/null || true
109+
brew info openssl
110+
#brew info openssl@3
111+
#brew info openssl@1.1
112+
#command -v pkg-config || true
113+
#pkg-config --list-all || true
114+
#HOMEBREW_PREFIX="`brew config | grep HOMEBREW_PREFIX: | awk '{print $2}'`"
115+
#ls -la "${HOMEBREW_PREFIX}/lib/pkgconfig" || true
116+
#ls -la "${HOMEBREW_PREFIX}/include/openssl" || true
117+
#ls -la "${HOMEBREW_PREFIX}/include/openssl"/* || true
118+
#find "${HOMEBREW_PREFIX}"/Cellar/openssl* -ls || true
119+
pkg-config --libs --cflags nss
120+
pkg-config --libs --cflags openssl || {
121+
brew unlink openssl && brew link --force openssl
122+
pkg-config --libs --cflags openssl ; }
123+
brew unlink net-snmp && brew link --force net-snmp
81124
82125
- restore_cache:
83126
keys:
84127
- ccache-{{ .Branch }}-{{ arch }}-{{ .Environment.CIRCLE_JOB }}
85128
- ccache-master-{{ arch }}-{{ .Environment.CIRCLE_JOB }}
86129

130+
# Help SEMVER look right (optionally)
131+
- run:
132+
name: "fetch git tags"
133+
command: git fetch --tags || true
134+
135+
# Fail fast if we had a problem with prerequisites - this
136+
# situation would likely impact all build branches anyway.
137+
# Requires a Personal API token in the building account:
138+
# https://support.circleci.com/hc/en-us/articles/360052058811-Exit-Build-Early-if-Any-Test-Fails
139+
- run:
140+
name: Fail Fast
141+
when: on_fail
142+
command: |-
143+
echo "Canceling workflow as a step resulted in failure"
144+
curl -X POST --header "Content-Type: application/json" "https://circleci.com/api/v2/workflow/${CIRCLE_WORKFLOW_ID}/cancel?circle-token=${CIRCLE_TOKEN}"
145+
87146
# - run:
88147
# name: "check shell"
89148
# command: /usr/bin/env bash --version || true; command -v bash || true
@@ -99,14 +158,16 @@ jobs:
99158
# uses of sem_init() and sem_destroy() in nut-scanner.c)
100159
# NOTE: CANBUILD_NIT_TESTS=yes to check if single-executor environments
101160
# do not have a problem with it.
161+
# NOTE: python3.11 is available but broken on some of the workers
162+
# (no homebrew dirs in search path)
102163
- run:
103164
name: "ci_build"
104165
command: |-
105-
CI_CCACHE_SYMLINKDIR="/usr/local/opt/ccache/libexec" \
166+
HOMEBREW_PREFIX="`brew config | grep HOMEBREW_PREFIX: | awk '{print $2}'`" \
106167
CANBUILD_NIT_TESTS=yes \
107-
CFLAGS="$CC_STDVER -Wno-poison-system-directories -Wno-deprecated-declarations" \
108-
CXXFLAGS="$CXX_STDVER -Wno-poison-system-directories" \
109-
LDFLAGS="-L/usr/local/lib" \
168+
CFLAGS="$CC_STDVER" \
169+
CXXFLAGS="$CXX_STDVER" \
170+
PYTHON=python3.11 \
110171
./ci_build.sh
111172
112173
- run:
@@ -125,53 +186,81 @@ jobs:
125186
- ~/.ccache
126187
key: ccache-{{ .Branch }}-{{ arch }}-{{ .Environment.CIRCLE_JOB }}
127188

189+
- store_artifacts:
190+
path: config.log
191+
192+
- store_artifacts:
193+
path: config.nut_report_feature.log
194+
195+
128196
# Invoke jobs via workflows
129197
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
130198
workflows:
131199
xcode-workflow:
132200
jobs:
133201
# Note: while "ccache" lists hordes of symlinks to gcc-XXX versions,
134202
# in practice these toolkits are not installed (by default)
203+
# or actually identify as clang
135204

136205
### This scenario is a subset of fightwarn-all below (modulo C standard),
137206
### so disabled to not waste time from free CircleCI allowance limit:
138207
# - osx-xcode:
139-
# name: "gnu17-clang-xcode12_5_1-default-all-errors"
140-
# XCODE_VER: "12.5.1"
208+
# name: "gnu17-clang-xcode13_4_1-default-all-errors"
209+
# XCODE_VER: "13.4.1"
141210
# CC: "clang"
142211
# CXX: "clang++"
143212
# CC_STDVER: "-std=gnu17"
144213
# CXX_STDVER: "-std=gnu++17"
145214

215+
# - osx-xcode:
216+
# name: "gnu11-gcc-xcode13_4_1-out-of-tree"
217+
# CC: "gcc"
218+
# CXX: "g++"
219+
# CC_STDVER: "-std=gnu11"
220+
# CXX_STDVER: "-std=gnu++11"
221+
# # Try an out-of-tree build:
222+
# CI_BUILDDIR: "obj"
223+
224+
# - osx-xcode:
225+
# name: "c99-cxx11-gcc-xcode13_4_1-default-distcheck"
226+
# CC: "gcc"
227+
# CXX: "g++"
228+
# CC_STDVER: "-std=c99"
229+
# CXX_STDVER: "-std=c++11"
230+
# # Try usual and distchecked build:
231+
# BUILD_TYPE: "default"
232+
146233
- osx-xcode:
147-
name: "gnu11-gcc-xcode12_5_1-out-of-tree"
148-
CC: "gcc"
149-
CXX: "g++"
234+
name: "gnu11-clang-xcode13_4_1-out-of-tree"
235+
CC: "clang"
236+
CXX: "clang++"
237+
CPP: "clang -E"
150238
CC_STDVER: "-std=gnu11"
151239
CXX_STDVER: "-std=gnu++11"
152240
# Try an out-of-tree build:
153241
CI_BUILDDIR: "obj"
154242

155243
- osx-xcode:
156-
name: "c99-cxx11-gcc-xcode12_5_1-default-distcheck"
157-
CC: "gcc"
158-
CXX: "g++"
244+
name: "c99-cxx11-clang-xcode13_4_1-default-distcheck"
245+
CC: "clang"
246+
CXX: "clang++"
247+
CPP: "clang -E"
159248
CC_STDVER: "-std=c99"
160249
CXX_STDVER: "-std=c++11"
161250
# Try usual and distchecked build:
162251
BUILD_TYPE: "default"
163252

164253
- osx-xcode:
165-
name: "stdDefault-xcode12_5_1-fightwarn-all"
254+
name: "stdDefault-xcode13_4_1-fightwarn-all"
166255
# Run "default-all-errors" with both compiler families,
167256
# using their default C/C++ standard for current release:
168257
BUILD_TYPE: "fightwarn-all"
169258

170259
### This does not work due to missing dependencies built for MacOS in homebrew:
171260
### TODO? Evaluate other packagers (MacPorts, fink...)?
172261
# - osx-xcode:
173-
# name: "c17-clang-xcode12_5_1-alldrv"
174-
# XCODE_VER: "12.5.1"
262+
# name: "c17-clang-xcode13_4_1-alldrv"
263+
# XCODE_VER: "13.4.1"
175264
# CC: "clang"
176265
# CXX: "clang++"
177266
# CC_STDVER: "-std=c17"

.github/codeql/codeql-config.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# For interpreted languages:
2+
paths:
3+
- scripts/python/module
4+
- scripts/python/app

.github/workflows/PyNUTClient.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ jobs:
2727
with:
2828
fetch-depth: 0
2929
fetch-tags: true
30-
- name: Set up Python 3.10
30+
- name: Set up Python 3.13
3131
uses: actions/setup-python@v3
3232
with:
33-
python-version: '3.10'
33+
python-version: '3.13'
3434
- name: Extract python interpreter path name
3535
id: pythoncmd
3636
run: >-
@@ -47,7 +47,7 @@ jobs:
4747
{ TAG_NAME="$(git describe --tags --match 'v[0-9]*.[0-9]*.[0-9]' --exclude '*-signed' --exclude '*rc*' --exclude '*alpha*' --exclude '*beta*')" \
4848
|| TAG_NAME="$(git describe --tags --exclude '*rc*' --exclude '*alpha*' --exclude '*beta*' --exclude '*Windows*' --exclude '*IPM*')" ; } \
4949
&& test -n "${TAG_NAME}" \
50-
|| TAG_NAME="2.8.1-`TZ=UTC date +%s`" ;
50+
|| TAG_NAME="2.8.3-`TZ=UTC date +%s`" ;
5151
fi >&2 ;
5252
TAG_NAME="$(echo "$TAG_NAME" | sed -e 's/^v\([0-9]\)/\1/' -e 's,^.*/,,' -e 's/^v//' -e 's/-g.*$//' -e 's/-/./g')" ;
5353
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_OUTPUT

.github/workflows/codeql.yml

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ name: "CodeQL"
1313

1414
on:
1515
push:
16-
branches: [ "master" ]
16+
branches: [ "master", "FTY", "fightwarn" ]
1717
pull_request:
1818
# The branches below must be a subset of the branches above
19-
branches: [ "master" ]
19+
branches: [ "master", "FTY", "fightwarn" ]
2020
schedule:
2121
- cron: '32 12 * * 0'
2222

2323
jobs:
2424
analyze:
2525
name: Analyze
26-
runs-on: ubuntu-latest
26+
runs-on: ${{ matrix.os }}
2727
permissions:
2828
actions: read
2929
contents: read
@@ -32,18 +32,30 @@ jobs:
3232
strategy:
3333
fail-fast: false
3434
matrix:
35+
# https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs
3536
language: [ 'cpp' ]
3637
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
3738
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
38-
# TODO: Want to find Python sources to test like with LGTM, see https://github.com/networkupstools/nut/issues/1726
39+
os: ['ubuntu-latest']
40+
# TOTHINK: windows-latest, macos-latest
41+
compiler: ['CC=gcc CXX=g++', 'CC=clang CXX=clang++']
42+
NUT_SSL_VARIANTS: ['no', 'nss', 'openssl']
43+
NUT_USB_VARIANTS: ['no', 'libusb-1.0', 'libusb-0.1']
44+
include:
45+
# Add cell(s) to the matrix, beside the combinatorics made above
46+
- language: 'python'
47+
os: 'ubuntu-latest'
48+
compiler: 'PYTHON=python3'
49+
NUT_SSL_VARIANTS: 'no'
50+
NUT_USB_VARIANTS: 'no'
3951

4052
steps:
4153
- name: Checkout repository
4254
uses: actions/checkout@v3
4355

4456
# Initializes the CodeQL tools for scanning.
4557
- name: Initialize CodeQL
46-
uses: github/codeql-action/init@v2
58+
uses: github/codeql-action/init@v3
4759
with:
4860
languages: ${{ matrix.language }}
4961
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -52,12 +64,40 @@ jobs:
5264

5365
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
5466
# queries: security-extended,security-and-quality
67+
config-file: ./.github/codeql/codeql-config.yml
5568

69+
# https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
70+
- if: matrix.language == 'cpp' && matrix.os == 'ubuntu-latest'
71+
name: NUT CI Prerequisite packages (Ubuntu)
72+
run: |
73+
sudo apt update
74+
case x"${{matrix.compiler}}" in x*clang*) sudo apt install clang ;; x*) sudo apt install gcc g++ ;; esac
75+
sudo apt install libltdl-dev libtool libtool-bin cppcheck ccache libgd-dev libcppunit-dev libsystemd-dev libssl-dev libnss3-dev augeas-tools libaugeas-dev augeas-lenses libusb-dev libusb-1.0-0-dev libmodbus-dev libsnmp-dev libpowerman0-dev libfreeipmi-dev libipmimonitoring-dev libavahi-common-dev libavahi-core-dev libavahi-client-dev libgpiod-dev libneon27-dev libi2c-dev i2c-tools lm-sensors
5676
5777
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
5878
# If this step fails, then you should remove it and run the build manually (see below)
59-
- name: Autobuild
60-
uses: github/codeql-action/autobuild@v2
79+
#- name: Autobuild
80+
# uses: github/codeql-action/autobuild@v3
81+
82+
#- if: matrix.language == 'cpp'
83+
# name: NUT CI Build (default-all-errors matrix)
84+
# run: |
85+
# BUILD_TYPE=default-all-errors BUILD_SSL_ONCE=true DO_DISTCHECK=no CI_SKIP_CHECK=true CANBUILD_DOCS_ALL=no ${{ matrix.compiler }} NUT_SSL_VARIANTS=${{ matrix.NUT_SSL_VARIANTS }} NUT_USB_VARIANTS=${{ matrix.NUT_USB_VARIANTS }} ./ci_build.sh
86+
87+
#- if: matrix.language == 'cpp'
88+
# name: NUT CI Build (fightwarn-all)
89+
# run: |
90+
# BUILD_TYPE=fightwarn-all ./ci_build.sh
91+
92+
# TOTHINK: Can we prepare the working area once (apt, autogen => containers?)
93+
# and then spread it out for builds and analyses?
94+
# Can ccache be used across builds?
95+
- if: matrix.language == 'cpp'
96+
name: NUT CI Build
97+
run: |
98+
./autogen.sh
99+
./configure --enable-warnings --enable-Werror --enable-Wcolor --with-all=auto --with-dev --without-docs ${{matrix.compiler}} --with-ssl=${{matrix.NUT_SSL_VARIANTS}} --with-usb=${{matrix.NUT_USB_VARIANTS}}
100+
make -s -j 8
61101
62102
# ℹ️ Command-line programs to run using the OS shell.
63103
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -70,6 +110,6 @@ jobs:
70110
# ./location_of_script_within_repo/buildscript.sh
71111

72112
- name: Perform CodeQL Analysis
73-
uses: github/codeql-action/analyze@v2
113+
uses: github/codeql-action/analyze@v3
74114
with:
75115
category: "/language:${{matrix.language}}"

0 commit comments

Comments
 (0)