From 87d0eceddf98084ae22bcc0ccd433ee461f5943b Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 6 Nov 2025 11:57:56 +0100 Subject: [PATCH 01/51] .github/workflows/codeql.yml: fix typo for ccache key name Signed-off-by: Jim Klimov --- .github/workflows/codeql.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 3ef64b68bc..c0e866f6fe 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -96,7 +96,7 @@ jobs: id: cache-ccache uses: actions/cache@v4 env: - cache-name: cache-ccache-${{ matrix.compiler }}-${{ matrix.NUT_SSL_VARIANTS }}-${{ matrix.NUT_SSL_VARIANTS }} + cache-name: cache-ccache-${{ matrix.compiler }}-${{ matrix.NUT_SSL_VARIANTS }}-${{ matrix.NUT_USB_VARIANTS }} with: path: | ~/.ccache From ae6fc292dd22c02b43c90c7462f589e945e34e65 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 6 Nov 2025 12:40:48 +0100 Subject: [PATCH 02/51] Makefile.am: dist-hook: report if DISTing VERSION_FORCED* files Signed-off-by: Jim Klimov --- Makefile.am | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile.am b/Makefile.am index 8fc1436077..c6d7dfaaf0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -823,10 +823,13 @@ EXTRA_DIST += VERSION_DEFAULT # Best-effort delivery for (overly?) customized distros, e.g. via # echo NUT_VERSION_FORCED_SEMVER=1.1.1 > VERSION_FORCED_SEMVER +# ONLY populated into dist tarball if present in the build area! +# (Note we do tarball the VERSION_DEFAULT generated just above) dist-hook: for D in "$(abs_top_srcdir)" "$(abs_top_builddir)" ; do \ for F in VERSION_FORCED VERSION_FORCED_SEMVER ; do \ if [ -s "$$D/$$F" ] ; then \ + echo " DIST $$D/$$F => $(top_distdir)/$$F"; \ cat "$$D/$$F" > "$(top_distdir)/$$F" || true ; \ fi ; \ done ; \ From c5fc7e0bee956046b5219456ef70495afbc75bea Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 6 Nov 2025 13:14:37 +0100 Subject: [PATCH 03/51] Makefile.am, NEWS.adoc, docs/maintainer-guide.txt: introduce `make dist-docs` [#1400] Signed-off-by: Jim Klimov --- Makefile.am | 48 +++++++++++++++++++++++++++++++++++++++ NEWS.adoc | 4 ++++ docs/maintainer-guide.txt | 2 ++ 3 files changed, 54 insertions(+) diff --git a/Makefile.am b/Makefile.am index c6d7dfaaf0..760782cb09 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1022,6 +1022,9 @@ nut-@PACKAGE_VERSION@.tar.gz: dist nut-@PACKAGE_VERSION@.tar.gz.sig: dist-sig nut-@PACKAGE_VERSION@.tar.gz.md5 nut-@PACKAGE_VERSION@.tar.gz.sha256: dist-hash +# Bonus feature, results depend on configure script options and available tools +nut-@PACKAGE_VERSION@-docs.tar.gz: dist-docs + dist-sig: nut-@PACKAGE_VERSION@.tar.gz rm -f nut-@PACKAGE_VERSION@.tar.gz.sig gpg --detach-sign nut-@PACKAGE_VERSION@.tar.gz @@ -1030,6 +1033,51 @@ dist-hash: nut-@PACKAGE_VERSION@.tar.gz md5sum nut-@PACKAGE_VERSION@.tar.gz > nut-@PACKAGE_VERSION@.tar.gz.md5 sha256sum nut-@PACKAGE_VERSION@.tar.gz > nut-@PACKAGE_VERSION@.tar.gz.sha256 +# Helper to have all built docs (config-dependent) neatly aligned +# NOT part of standard tarball, though +EXTRA_DIST_DOCS = VERSION_* *.adoc-parsed + +if WITH_CHANGELOG_TEXT +EXTRA_DIST_DOCS += ChangeLog +endif WITH_CHANGELOG_TEXT + +if WITH_CHANGELOG_ADOC +EXTRA_DIST_DOCS += ChangeLog.adoc +endif WITH_CHANGELOG_ADOC + +if KEEP_NUT_REPORT +EXTRA_DIST_DOCS += config.nut_report_feature.log +endif KEEP_NUT_REPORT + +if WITH_HTML_SINGLE +EXTRA_DIST_DOCS += docs/man/*.html docs/*.html +endif WITH_HTML_SINGLE + +if WITH_HTML_CHUNKED +EXTRA_DIST_DOCS += docs/*.chunked +endif WITH_HTML_CHUNKED + +if WITH_PDFS +EXTRA_DIST_DOCS += docs/*.pdf +endif WITH_PDFS + +if WITH_MANS +if !KNOWN_UNABLE_MANS +EXTRA_DIST_DOCS += \ + docs/man/*.@MAN_SECTION_API_BASE@ \ + docs/man/*.@MAN_SECTION_CFG_BASE@ \ + docs/man/*.@MAN_SECTION_CMD_SYS_BASE@ \ + docs/man/*.@MAN_SECTION_CMD_USR_BASE@ \ + docs/man/*.@MAN_SECTION_MISC_BASE@ +endif !KNOWN_UNABLE_MANS +endif WITH_MANS + +# Modeled after automake generated mesh of rules for "distdir" handling with "am__tar" +dist-docs: all-docs + $${TAR-tar} cf - $(EXTRA_DIST_DOCS) | eval GZIP= gzip $(GZIP_ENV) -c > $(distdir)-docs.tar.gz + ls -la $(distdir)-docs.tar.gz + $${TAR-tar} tzvf $(distdir)-docs.tar.gz || true + # ---------------------------------------------------------------------- # targets from old build system (pre-automake). # supported for a period of time for backward "compatibility". diff --git a/NEWS.adoc b/NEWS.adoc index 4c96d6e935..5f52a82523 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -256,6 +256,10 @@ several `FSD` notifications into one executed action. [PR #3097] - Updated `docs/*.txt`: add asciidoc comments with links to nut-website rendered contents of most interesting pages. [#3095] + - Added a `make dist-docs` goal to generate, collect and tarball all document + types (man, html-single, html-chunked, pdf) that we may have enabled for the + current build configuration and available tooling. [#1400] + - Source directory `data/html` was renamed to `data/htmlcgi` in order to better reflect its contents and purpose, compared to documentation-oriented `html*` directories (and recipe variable names). This may impact some diff --git a/docs/maintainer-guide.txt b/docs/maintainer-guide.txt index 1e4f0b0b91..e059fbfe95 100644 --- a/docs/maintainer-guide.txt +++ b/docs/maintainer-guide.txt @@ -272,6 +272,8 @@ VERSION_FORCED_SEMVER:NUT_VERSION_FORCED_SEMVER='2.8.3' * `make dist-files` (especially if you did not `make distcheck` above, or had some changes since then) to store the source tarball, checksum and signature files +** Bonus feature: `make dist-docs` (if on a system configured to build all + documentation types) * post-release update of the "in-development" codebase: ** start a feature branch to return the master branch into development state From a27e826ea900711d0f82dac85e46b4192fcf4bb5 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 6 Nov 2025 14:08:49 +0100 Subject: [PATCH 04/51] .github/workflows: re-number the jobs to hopefully impact processing order on GHA farm [#1400] Signed-off-by: Jim Klimov --- .github/workflows/{codeql.yml => 05-codeql.yml} | 2 +- .github/workflows/{PyNUTClient.yml => 08-PyNUTClient.yml} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename .github/workflows/{codeql.yml => 05-codeql.yml} (99%) rename .github/workflows/{PyNUTClient.yml => 08-PyNUTClient.yml} (97%) diff --git a/.github/workflows/codeql.yml b/.github/workflows/05-codeql.yml similarity index 99% rename from .github/workflows/codeql.yml rename to .github/workflows/05-codeql.yml index c0e866f6fe..1bcb5d5f78 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/05-codeql.yml @@ -9,7 +9,7 @@ # the `language` matrix defined below to confirm you have the correct set of # supported CodeQL languages. # -name: "CodeQL" +name: "GHA-05: CodeQL" on: push: diff --git a/.github/workflows/PyNUTClient.yml b/.github/workflows/08-PyNUTClient.yml similarity index 97% rename from .github/workflows/PyNUTClient.yml rename to .github/workflows/08-PyNUTClient.yml index d6298efaf4..353394e9bd 100644 --- a/.github/workflows/PyNUTClient.yml +++ b/.github/workflows/08-PyNUTClient.yml @@ -1,4 +1,4 @@ -name: Publish PyNUT client bindings for NUT 🐍 distributions 📦 to PyPI +name: "GHA-08: Publish PyNUT client bindings for NUT 🐍 distributions 📦 to PyPI" # based on https://medium.com/@VersuS_/automate-pypi-releases-with-github-actions-4c5a9cfe947d # and https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ From f64ec1a4004c93765eb0465e37ab052eaf0f73be Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 6 Nov 2025 13:31:00 +0100 Subject: [PATCH 05/51] .github/workflows/01-make-dist.yml, NEWS.adoc: introduce a CI job to maintain `dist` tarballs of recent iterations [#1400, #2829] Signed-off-by: Jim Klimov --- .github/workflows/01-make-dist.yml | 187 +++++++++++++++++++++++++++++ NEWS.adoc | 5 + 2 files changed, 192 insertions(+) create mode 100644 .github/workflows/01-make-dist.yml diff --git a/.github/workflows/01-make-dist.yml b/.github/workflows/01-make-dist.yml new file mode 100644 index 0000000000..a03d91d6e9 --- /dev/null +++ b/.github/workflows/01-make-dist.yml @@ -0,0 +1,187 @@ +# Adapted from NUT codeql.yml with inspiration taken from +# https://javahelps.com/manage-github-artifact-storage-quota +# regarding uploads of artifacts and clearing the way for them. +# See also: +# https://github.com/actions/upload-artifact +# https://docs.github.com/en/actions/reference/workflows-and-actions/variables +name: "GHA-01: Make dist and docs tarballs" + +on: + push: + branches: [ "master", "FTY", "fightwarn" ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ "master", "FTY", "fightwarn" ] + schedule: + - cron: '15 12 * * 0' + workflow_dispatch: + # Allow manually running the action, e.g. if disabled after some quietness in the source + +jobs: + make-dist-tarballs: + name: Make Dist and Docs Tarballs + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Using hints from https://askubuntu.com/questions/272248/processing-triggers-for-man-db + # and our own docs/config-prereqs.txt + # NOTE: Currently installing the MAX prerequisite footprint, + # which for building just the docs may be a bit of an overkill. + - name: NUT CI Prerequisite packages (Ubuntu, GCC) + run: | + echo "set man-db/auto-update false" | sudo debconf-communicate + sudo dpkg-reconfigure man-db + sudo apt update + sudo apt install \ + gcc g++ clang \ + ccache time \ + git perl curl \ + make autoconf automake libltdl-dev libtool binutils \ + valgrind \ + cppcheck \ + pkg-config \ + libtool-bin \ + python3 gettext python3-pyqt6 pyqt6-dev-tools \ + aspell aspell-en \ + asciidoc source-highlight python3-pygments dblatex \ + libgd-dev \ + systemd-dev \ + libsystemd-dev \ + libcppunit-dev \ + libssl-dev libnss3-dev \ + augeas-tools libaugeas-dev augeas-lenses \ + libusb-dev libusb-1.0-0-dev \ + libi2c-dev \ + libmodbus-dev \ + libsnmp-dev \ + libpowerman0-dev \ + libfreeipmi-dev libipmimonitoring-dev \ + libavahi-common-dev libavahi-core-dev libavahi-client-dev \ + libgpiod-dev \ + bash dash ksh busybox \ + libneon27-gnutls-dev \ + build-essential git-core libi2c-dev i2c-tools lm-sensors \ + || exit + date > .timestamp-init + + - name: Prepare ccache + # Based on https://docs.github.com/en/actions/reference/workflows-and-actions/dependency-caching#example-using-the-cache-action example + id: cache-ccache + uses: actions/cache@v4 + env: + compiler: 'CC=gcc CXX=g++' + cache-name: cache-ccache-${{ env.compiler }} + with: + path: | + ~/.ccache + ~/.cache/ccache + ~/.config/ccache/ccache.conf + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/.timestamp-init') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: CCache stats before build + run: | + ccache -sv || ccache -s || echo "FAILED to read ccache info, oh well" + rm -f .timestamp-init + + # Make build identification more useful (no fallbacks) + - name: Try to get more Git metadata + run: | + git remote -v || true + git branch -a || true + for R in `git remote` ; do git fetch $R master ; done || true + git fetch --tags + + - name: Debug gitlog2version processing + run: bash -x ./tools/gitlog2version.sh || true + + - name: NUT CI Build Configuration + env: + compiler: 'CC=gcc CXX=g++' + run: | + PATH="/usr/lib/ccache:$PATH" ; export PATH + CCACHE_COMPRESS=true; export CCACHE_COMPRESS + ccache --version || true + ( ${{env.compiler}} ; echo "=== CC: $CC => `command -v $CC` =>" ; $CC --version ; echo "=== CXX: $CXX => `command -v $CXX` =>" ; $CXX --version ) || true + ./autogen.sh && \ + ./configure --enable-warnings --enable-Werror --enable-Wcolor --with-all --with-dev --with-docs --enable-docs-changelog ${{env.compiler}} + + # NOTE: In this scenario we do not build actually NUT in the main + # checkout directory, at least not explicitly (recipe may generate + # some files like man pages to fulfill the "dist" requirements; + # for now this may generate some libs to figure out their IDs). + # We may `make docs` to provide them as a separate tarball just + # in case, later. + - name: NUT CI Build to create "dist" tarball and related files + env: + compiler: 'CC=gcc CXX=g++' + run: | + PATH="/usr/lib/ccache:$PATH" ; export PATH + CCACHE_COMPRESS=true; export CCACHE_COMPRESS + ccache --version || true + ( ${{env.compiler}} ; echo "=== CC: $CC => `command -v $CC` =>" ; $CC --version ; echo "=== CXX: $CXX => `command -v $CXX` =>" ; $CXX --version ) || true + make -s -j 8 dist-files + + - name: NUT CI Build to verify "dist" tarball build + env: + compiler: 'CC=gcc CXX=g++' + run: | + PATH="/usr/lib/ccache:$PATH" ; export PATH + CCACHE_COMPRESS=true; export CCACHE_COMPRESS + ccache --version || true + ( ${{env.compiler}} ; echo "=== CC: $CC => `command -v $CC` =>" ; $CC --version ; echo "=== CXX: $CXX => `command -v $CXX` =>" ; $CXX --version ) || true + make -s -j 8 distcheck + + - name: CCache stats after distcheck + run: ccache -sv || ccache -s || echo "FAILED to read ccache info, oh well" + + - name: NUT CI Build to package complex docs (not part of dist tarball) + run: | + make -s -j 8 dist-docs + + # Inspired by https://javahelps.com/manage-github-artifact-storage-quota + # Note that the code below wipes everything matched by the filter! + # We may want another script block (after this cleanup of obsolete data) + # to iterate clearing the way build by build until there's X MB available. + - if: env.GITHUB_REF_TYPE != 'tag' && env.GITHUB_HEAD_REF != 'master' + name: Delete Old Artifacts for this feature branch/PR + uses: actions/github-script@v6 + id: artifact + with: + script: | + const res = await github.rest.actions.listArtifactsForRepo({ + owner: context.repo.owner, + repo: context.repo.repo, + }) + + res.data.artifacts + .filter(({ name }) => name === 'tarballs-{{ env.GITHUB_HEAD_REF }}') + .forEach(({ id }) => { + github.rest.actions.deleteArtifact({ + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: id, + }) + }) + + - name: Upload tarball and its checksum artifacts + uses: actions/upload-artifact@v4 + with: + name: tarballs-{{ env.GITHUB_HEAD_REF }} + path: | + nut-*.tar* + compression-level: 0 + overwrite: true diff --git a/NEWS.adoc b/NEWS.adoc index 5f52a82523..12de06cfeb 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -260,6 +260,11 @@ several `FSD` notifications into one executed action. [PR #3097] types (man, html-single, html-chunked, pdf) that we may have enabled for the current build configuration and available tooling. [#1400] + - Added a GitHub Actions CI job to generate, upload and recycle `make dist` + and `make dist-docs` tarballs so they are easier to obtain for people and + other CI systems (which might not want to follow a Git repository). [#1400, + #2829] + - Source directory `data/html` was renamed to `data/htmlcgi` in order to better reflect its contents and purpose, compared to documentation-oriented `html*` directories (and recipe variable names). This may impact some From 30425ed9d8cb263d21679195708b651ac2a428c7 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 6 Nov 2025 14:39:47 +0100 Subject: [PATCH 06/51] .github/workflows/01-make-dist.yml: do not `make dist-sig` (via `dist-files`) in the CI job [#1400] Signed-off-by: Jim Klimov --- .github/workflows/01-make-dist.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/01-make-dist.yml b/.github/workflows/01-make-dist.yml index a03d91d6e9..827ffbab6f 100644 --- a/.github/workflows/01-make-dist.yml +++ b/.github/workflows/01-make-dist.yml @@ -123,8 +123,10 @@ jobs: # checkout directory, at least not explicitly (recipe may generate # some files like man pages to fulfill the "dist" requirements; # for now this may generate some libs to figure out their IDs). - # We may `make docs` to provide them as a separate tarball just + # We do `make docs` to provide them as a separate tarball just # in case, later. + # DO NOT `make dist-files` here as it includes `dist-sig` and + # needs a GPG keychain with maintainers' secrets deployed locally. - name: NUT CI Build to create "dist" tarball and related files env: compiler: 'CC=gcc CXX=g++' @@ -133,7 +135,7 @@ jobs: CCACHE_COMPRESS=true; export CCACHE_COMPRESS ccache --version || true ( ${{env.compiler}} ; echo "=== CC: $CC => `command -v $CC` =>" ; $CC --version ; echo "=== CXX: $CXX => `command -v $CXX` =>" ; $CXX --version ) || true - make -s -j 8 dist-files + make -s -j 8 dist dist-hash - name: NUT CI Build to verify "dist" tarball build env: From d78fa4be0e4e185a3d3cba0b0fc841a47c6a0259 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 6 Nov 2025 14:52:27 +0100 Subject: [PATCH 07/51] .github/workflows/01-make-dist.yml: more debugging of git workspace [#1400] Signed-off-by: Jim Klimov --- .github/workflows/01-make-dist.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/01-make-dist.yml b/.github/workflows/01-make-dist.yml index 827ffbab6f..4780db1a80 100644 --- a/.github/workflows/01-make-dist.yml +++ b/.github/workflows/01-make-dist.yml @@ -104,6 +104,10 @@ jobs: git branch -a || true for R in `git remote` ; do git fetch $R master ; done || true git fetch --tags + pwd ; ls -la + git log -2 || true + git tag || true + git describe || true - name: Debug gitlog2version processing run: bash -x ./tools/gitlog2version.sh || true From e9806d34a64f90519da5fa95e0296f709f12f3d2 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 6 Nov 2025 14:59:28 +0100 Subject: [PATCH 08/51] .github/workflows/01-make-dist.yml: fix GHA scripting syntax; update comments [#1400] Signed-off-by: Jim Klimov --- .github/workflows/01-make-dist.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/01-make-dist.yml b/.github/workflows/01-make-dist.yml index 4780db1a80..29219e242c 100644 --- a/.github/workflows/01-make-dist.yml +++ b/.github/workflows/01-make-dist.yml @@ -20,6 +20,8 @@ on: jobs: make-dist-tarballs: name: Make Dist and Docs Tarballs + # FIXME: Prepare/maintain a container image with pre-installed + # NUT build/tooling prereqs (save about 3 minutes per run!) runs-on: ubuntu-latest permissions: actions: read @@ -161,7 +163,8 @@ jobs: # Inspired by https://javahelps.com/manage-github-artifact-storage-quota # Note that the code below wipes everything matched by the filter! # We may want another script block (after this cleanup of obsolete data) - # to iterate clearing the way build by build until there's X MB available. + # to iterate clearing the way build by build until there's X MB available + # (at least 12MB as of Nov 2025). - if: env.GITHUB_REF_TYPE != 'tag' && env.GITHUB_HEAD_REF != 'master' name: Delete Old Artifacts for this feature branch/PR uses: actions/github-script@v6 @@ -174,7 +177,7 @@ jobs: }) res.data.artifacts - .filter(({ name }) => name === 'tarballs-{{ env.GITHUB_HEAD_REF }}') + .filter(({ name }) => name === 'tarballs-${{ env.GITHUB_HEAD_REF }}') .forEach(({ id }) => { github.rest.actions.deleteArtifact({ owner: context.repo.owner, @@ -186,7 +189,7 @@ jobs: - name: Upload tarball and its checksum artifacts uses: actions/upload-artifact@v4 with: - name: tarballs-{{ env.GITHUB_HEAD_REF }} + name: tarballs-${{ env.GITHUB_HEAD_REF }} path: | nut-*.tar* compression-level: 0 From 30d5eaaceaaf5c5b66ef3775fbb727ffdb0085f3 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 6 Nov 2025 15:29:17 +0100 Subject: [PATCH 09/51] .github/workflows/01-make-dist.yml: try to post a link to tarballs on build page [#1400] Signed-off-by: Jim Klimov --- .github/workflows/01-make-dist.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/01-make-dist.yml b/.github/workflows/01-make-dist.yml index 29219e242c..7da41a0456 100644 --- a/.github/workflows/01-make-dist.yml +++ b/.github/workflows/01-make-dist.yml @@ -194,3 +194,14 @@ jobs: nut-*.tar* compression-level: 0 overwrite: true + + # Abusing https://github.com/marketplace/actions/publish-test-report + # to post a GHA check result with an URL + - name: "GHA-01: Make dist and docs tarballs - download URL" + uses: turing85/publish-report@v2 + if: ${{ always() }} + with: + comment-header: Dist and Docs for NUT build of ${{ env.GITHUB_HEAD_REF }} + comment-message-success: Dist and Docs [tarballs-${{ env.GITHUB_HEAD_REF }}](${{ steps.upload_artifact.outputs.artifact-url }}) are available + comment-message-failure: Dist and Docs tarballs were not archived for this build + report-fail-on-error: true From 4461767f3f0afe66e3be9744aa6be525f239a4e0 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 6 Nov 2025 15:31:18 +0100 Subject: [PATCH 10/51] .github/workflows/01-make-dist.yml: pull whole repo if `git describe` fails [#1400] Signed-off-by: Jim Klimov --- .github/workflows/01-make-dist.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/01-make-dist.yml b/.github/workflows/01-make-dist.yml index 7da41a0456..98e3e8b368 100644 --- a/.github/workflows/01-make-dist.yml +++ b/.github/workflows/01-make-dist.yml @@ -109,6 +109,7 @@ jobs: pwd ; ls -la git log -2 || true git tag || true + git describe || git fetch --all git describe || true - name: Debug gitlog2version processing From 11b115392da705fedc1ae658bde28a0f28c49711 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 6 Nov 2025 16:16:18 +0100 Subject: [PATCH 11/51] .github/workflows/01-make-dist.yml: act on tags too [#1400] Signed-off-by: Jim Klimov --- .github/workflows/01-make-dist.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/01-make-dist.yml b/.github/workflows/01-make-dist.yml index 98e3e8b368..e0f963ba9d 100644 --- a/.github/workflows/01-make-dist.yml +++ b/.github/workflows/01-make-dist.yml @@ -9,6 +9,8 @@ name: "GHA-01: Make dist and docs tarballs" on: push: branches: [ "master", "FTY", "fightwarn" ] + tags: + - v* pull_request: # The branches below must be a subset of the branches above branches: [ "master", "FTY", "fightwarn" ] From 50e824af9f9795f004cbe1839696b9406ebcf434 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 6 Nov 2025 16:16:57 +0100 Subject: [PATCH 12/51] .github/workflows/01-make-dist.yml: there is no env.GITHUB_HEAD_REF [#1400] Signed-off-by: Jim Klimov --- .github/workflows/01-make-dist.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/01-make-dist.yml b/.github/workflows/01-make-dist.yml index e0f963ba9d..aad4fe22a5 100644 --- a/.github/workflows/01-make-dist.yml +++ b/.github/workflows/01-make-dist.yml @@ -37,6 +37,14 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 + # https://github.com/marketplace/actions/substitute-string + - uses: bluwy/substitute-string-action@v3 + id: subst-github-ref-name + with: + _input-text: "${{ github.ref_name }}" + " ": _ + "/": _ + # Using hints from https://askubuntu.com/questions/272248/processing-triggers-for-man-db # and our own docs/config-prereqs.txt # NOTE: Currently installing the MAX prerequisite footprint, @@ -168,7 +176,7 @@ jobs: # We may want another script block (after this cleanup of obsolete data) # to iterate clearing the way build by build until there's X MB available # (at least 12MB as of Nov 2025). - - if: env.GITHUB_REF_TYPE != 'tag' && env.GITHUB_HEAD_REF != 'master' + - if: env.GITHUB_REF_TYPE != 'tag' && steps.subst-github-ref.outputs.result != 'master' name: Delete Old Artifacts for this feature branch/PR uses: actions/github-script@v6 id: artifact @@ -180,7 +188,7 @@ jobs: }) res.data.artifacts - .filter(({ name }) => name === 'tarballs-${{ env.GITHUB_HEAD_REF }}') + .filter(({ name }) => name === 'tarballs-${{ steps.subst-github-ref.outputs.result }}') .forEach(({ id }) => { github.rest.actions.deleteArtifact({ owner: context.repo.owner, @@ -192,7 +200,7 @@ jobs: - name: Upload tarball and its checksum artifacts uses: actions/upload-artifact@v4 with: - name: tarballs-${{ env.GITHUB_HEAD_REF }} + name: tarballs-${{ steps.subst-github-ref.outputs.result }} path: | nut-*.tar* compression-level: 0 From 9217baaad9180e206137470055bb35667651563c Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 6 Nov 2025 16:17:23 +0100 Subject: [PATCH 13/51] .github/workflows/01-make-dist.yml: try to post a link to tarballs on build page - v2 (message/comment in PRs) [#1400] Signed-off-by: Jim Klimov --- .github/workflows/01-make-dist.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/01-make-dist.yml b/.github/workflows/01-make-dist.yml index aad4fe22a5..6161ad5cfe 100644 --- a/.github/workflows/01-make-dist.yml +++ b/.github/workflows/01-make-dist.yml @@ -206,13 +206,13 @@ jobs: compression-level: 0 overwrite: true - # Abusing https://github.com/marketplace/actions/publish-test-report - # to post a GHA check result with an URL - - name: "GHA-01: Make dist and docs tarballs - download URL" - uses: turing85/publish-report@v2 - if: ${{ always() }} + # https://github.com/thollander/actions-comment-pull-request + # FIXME: Something that adds/updates Github Checks would be better + # as it would be seen in the list attached to a status icon of any + # build (e.g. history of master branch) + - name: "GHA-01: Make dist and docs tarballs - report download URL" + uses: thollander/actions-comment-pull-request@v3 + if: startsWith(github.ref, 'refs/pull/') with: - comment-header: Dist and Docs for NUT build of ${{ env.GITHUB_HEAD_REF }} - comment-message-success: Dist and Docs [tarballs-${{ env.GITHUB_HEAD_REF }}](${{ steps.upload_artifact.outputs.artifact-url }}) are available - comment-message-failure: Dist and Docs tarballs were not archived for this build - report-fail-on-error: true + comment-tag: latest-tarball + message: Dist and Docs [tarballs-${{ steps.subst-github-ref.outputs.result }}.zip}](${{ steps.upload_artifact.outputs.artifact-url }}) are available for commit ${{ github.workflow_sha }} From 16f8ce426ebb863c30cce9672404f8d77969985f Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 6 Nov 2025 16:49:32 +0100 Subject: [PATCH 14/51] .github/workflows/01-make-dist.yml: debug subst-github-ref-name [#1400] Signed-off-by: Jim Klimov --- .github/workflows/01-make-dist.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/01-make-dist.yml b/.github/workflows/01-make-dist.yml index 6161ad5cfe..4742b80ef7 100644 --- a/.github/workflows/01-make-dist.yml +++ b/.github/workflows/01-make-dist.yml @@ -44,6 +44,7 @@ jobs: _input-text: "${{ github.ref_name }}" " ": _ "/": _ + - run: echo "${{ steps.subst-github-ref-name.outputs.result }}" # Using hints from https://askubuntu.com/questions/272248/processing-triggers-for-man-db # and our own docs/config-prereqs.txt From e040f483187124267b79f516093db73d97b7697e Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 6 Nov 2025 16:49:58 +0100 Subject: [PATCH 15/51] .github/workflows/01-make-dist.yml: more trickery to make git-describe work [#1400] Signed-off-by: Jim Klimov --- .github/workflows/01-make-dist.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/01-make-dist.yml b/.github/workflows/01-make-dist.yml index 4742b80ef7..86f925b735 100644 --- a/.github/workflows/01-make-dist.yml +++ b/.github/workflows/01-make-dist.yml @@ -110,7 +110,7 @@ jobs: ccache -sv || ccache -s || echo "FAILED to read ccache info, oh well" rm -f .timestamp-init - # Make build identification more useful (no fallbacks) + # Make build identification more useful (so we use no fallbacks in script) - name: Try to get more Git metadata run: | git remote -v || true @@ -118,9 +118,15 @@ jobs: for R in `git remote` ; do git fetch $R master ; done || true git fetch --tags pwd ; ls -la + echo "=== Known commits in history:" + git log --oneline | wc -l + echo "=== Recent commits in history:" git log -2 || true + echo "=== Known tags:" git tag || true - git describe || git fetch --all + echo "=== Try to ensure 'git describe' works:" + git describe || { git fetch --all && for R in `git remote` ; do for T in `git tag` ; do git fetch $R $T ; done ; done; } + git describe || { TEST_REF="`git rev-parse --abbrev-ref HEAD`" && [ -n "${TEST_REF}" ] && git checkout master && git pull --all && git checkout "${TEST_REF}" ; } git describe || true - name: Debug gitlog2version processing From 000c49d72135c53279dc5949832db5dfbff00e8b Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 6 Nov 2025 16:53:51 +0100 Subject: [PATCH 16/51] .github/workflows/01-make-dist.yml: different var for built SHA [#1400] Signed-off-by: Jim Klimov --- .github/workflows/01-make-dist.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/01-make-dist.yml b/.github/workflows/01-make-dist.yml index 86f925b735..9a7c51e1e7 100644 --- a/.github/workflows/01-make-dist.yml +++ b/.github/workflows/01-make-dist.yml @@ -222,4 +222,4 @@ jobs: if: startsWith(github.ref, 'refs/pull/') with: comment-tag: latest-tarball - message: Dist and Docs [tarballs-${{ steps.subst-github-ref.outputs.result }}.zip}](${{ steps.upload_artifact.outputs.artifact-url }}) are available for commit ${{ github.workflow_sha }} + message: Dist and Docs [tarballs-${{ steps.subst-github-ref.outputs.result }}.zip}](${{ steps.upload_artifact.outputs.artifact-url }}) are available for commit ${{ github.sha }} From 9390b3ad8504570b8116813f983f785b9675d032 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 6 Nov 2025 16:58:00 +0100 Subject: [PATCH 17/51] .github/workflows/01-make-dist.yml: flip TEST_REF for branches and commits (prNNNN/merge) alike [#1400] Signed-off-by: Jim Klimov --- .github/workflows/01-make-dist.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/01-make-dist.yml b/.github/workflows/01-make-dist.yml index 9a7c51e1e7..b183bb32f4 100644 --- a/.github/workflows/01-make-dist.yml +++ b/.github/workflows/01-make-dist.yml @@ -126,7 +126,7 @@ jobs: git tag || true echo "=== Try to ensure 'git describe' works:" git describe || { git fetch --all && for R in `git remote` ; do for T in `git tag` ; do git fetch $R $T ; done ; done; } - git describe || { TEST_REF="`git rev-parse --abbrev-ref HEAD`" && [ -n "${TEST_REF}" ] && git checkout master && git pull --all && git checkout "${TEST_REF}" ; } + git describe || { TEST_REF="`git symbolic-ref --short HEAD 2>/dev/null || cat .git/HEAD`" && [ -n "${TEST_REF}" ] && git checkout master && git pull --all && git checkout "${TEST_REF}" ; } git describe || true - name: Debug gitlog2version processing From 1637b713ffed5cf7bcac44ec3bc2e401c8310b15 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 6 Nov 2025 17:00:07 +0100 Subject: [PATCH 18/51] .github/workflows/01-make-dist.yml: typo fix (renamed subst-github-ref-name step) [#1400] Signed-off-by: Jim Klimov --- .github/workflows/01-make-dist.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/01-make-dist.yml b/.github/workflows/01-make-dist.yml index b183bb32f4..09bf6e6582 100644 --- a/.github/workflows/01-make-dist.yml +++ b/.github/workflows/01-make-dist.yml @@ -183,7 +183,7 @@ jobs: # We may want another script block (after this cleanup of obsolete data) # to iterate clearing the way build by build until there's X MB available # (at least 12MB as of Nov 2025). - - if: env.GITHUB_REF_TYPE != 'tag' && steps.subst-github-ref.outputs.result != 'master' + - if: env.GITHUB_REF_TYPE != 'tag' && steps.subst-github-ref-name.outputs.result != 'master' name: Delete Old Artifacts for this feature branch/PR uses: actions/github-script@v6 id: artifact @@ -195,7 +195,7 @@ jobs: }) res.data.artifacts - .filter(({ name }) => name === 'tarballs-${{ steps.subst-github-ref.outputs.result }}') + .filter(({ name }) => name === 'tarballs-${{ steps.subst-github-ref-name.outputs.result }}') .forEach(({ id }) => { github.rest.actions.deleteArtifact({ owner: context.repo.owner, @@ -207,7 +207,7 @@ jobs: - name: Upload tarball and its checksum artifacts uses: actions/upload-artifact@v4 with: - name: tarballs-${{ steps.subst-github-ref.outputs.result }} + name: tarballs-${{ steps.subst-github-ref-name.outputs.result }} path: | nut-*.tar* compression-level: 0 @@ -222,4 +222,4 @@ jobs: if: startsWith(github.ref, 'refs/pull/') with: comment-tag: latest-tarball - message: Dist and Docs [tarballs-${{ steps.subst-github-ref.outputs.result }}.zip}](${{ steps.upload_artifact.outputs.artifact-url }}) are available for commit ${{ github.sha }} + message: Dist and Docs [tarballs-${{ steps.subst-github-ref-name.outputs.result }}.zip}](${{ steps.upload_artifact.outputs.artifact-url }}) are available for commit ${{ github.sha }} From c7f92c630369feea1c1087cbe1da49988097b62d Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 6 Nov 2025 17:01:21 +0100 Subject: [PATCH 19/51] .github/workflows/01-make-dist.yml: "Try to get more Git metadata" earlier so we can debug it better [#1400] Signed-off-by: Jim Klimov --- .github/workflows/01-make-dist.yml | 38 +++++++++++++++--------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/01-make-dist.yml b/.github/workflows/01-make-dist.yml index 09bf6e6582..6c1d34fc6a 100644 --- a/.github/workflows/01-make-dist.yml +++ b/.github/workflows/01-make-dist.yml @@ -46,6 +46,25 @@ jobs: "/": _ - run: echo "${{ steps.subst-github-ref-name.outputs.result }}" + # Make build identification more useful (so we use no fallbacks in script) + - name: Try to get more Git metadata + run: | + git remote -v || true + git branch -a || true + for R in `git remote` ; do git fetch $R master ; done || true + git fetch --tags + pwd ; ls -la + echo "=== Known commits in history:" + git log --oneline | wc -l + echo "=== Recent commits in history:" + git log -2 || true + echo "=== Known tags:" + git tag || true + echo "=== Try to ensure 'git describe' works:" + git describe || { git fetch --all && for R in `git remote` ; do for T in `git tag` ; do git fetch $R $T ; done ; done; } + git describe || { TEST_REF="`git symbolic-ref --short HEAD 2>/dev/null || cat .git/HEAD`" && [ -n "${TEST_REF}" ] && git checkout master && git pull --all && git checkout "${TEST_REF}" ; } + git describe || true + # Using hints from https://askubuntu.com/questions/272248/processing-triggers-for-man-db # and our own docs/config-prereqs.txt # NOTE: Currently installing the MAX prerequisite footprint, @@ -110,25 +129,6 @@ jobs: ccache -sv || ccache -s || echo "FAILED to read ccache info, oh well" rm -f .timestamp-init - # Make build identification more useful (so we use no fallbacks in script) - - name: Try to get more Git metadata - run: | - git remote -v || true - git branch -a || true - for R in `git remote` ; do git fetch $R master ; done || true - git fetch --tags - pwd ; ls -la - echo "=== Known commits in history:" - git log --oneline | wc -l - echo "=== Recent commits in history:" - git log -2 || true - echo "=== Known tags:" - git tag || true - echo "=== Try to ensure 'git describe' works:" - git describe || { git fetch --all && for R in `git remote` ; do for T in `git tag` ; do git fetch $R $T ; done ; done; } - git describe || { TEST_REF="`git symbolic-ref --short HEAD 2>/dev/null || cat .git/HEAD`" && [ -n "${TEST_REF}" ] && git checkout master && git pull --all && git checkout "${TEST_REF}" ; } - git describe || true - - name: Debug gitlog2version processing run: bash -x ./tools/gitlog2version.sh || true From 31ec3a3e11c7cbe4f96ff4a661c6cdf02b917376 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 6 Nov 2025 17:06:39 +0100 Subject: [PATCH 20/51] .github/workflows/01-make-dist.yml: tell actions/checkout to fetch more git history right away [#1400] Signed-off-by: Jim Klimov --- .github/workflows/01-make-dist.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/01-make-dist.yml b/.github/workflows/01-make-dist.yml index 6c1d34fc6a..60ea337e43 100644 --- a/.github/workflows/01-make-dist.yml +++ b/.github/workflows/01-make-dist.yml @@ -35,7 +35,10 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v5 + with: + fetch-depth: 0 + fetch-tags: true # https://github.com/marketplace/actions/substitute-string - uses: bluwy/substitute-string-action@v3 From 420242e4989de2c279551a2df12a3ea893e670c1 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 6 Nov 2025 17:07:00 +0100 Subject: [PATCH 21/51] .github/workflows/01-make-dist.yml: "Try to get more Git metadata" only if "git describe" is initially useless [#1400] Signed-off-by: Jim Klimov --- .github/workflows/01-make-dist.yml | 36 +++++++++++++++++------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/.github/workflows/01-make-dist.yml b/.github/workflows/01-make-dist.yml index 60ea337e43..2301afd37a 100644 --- a/.github/workflows/01-make-dist.yml +++ b/.github/workflows/01-make-dist.yml @@ -52,21 +52,27 @@ jobs: # Make build identification more useful (so we use no fallbacks in script) - name: Try to get more Git metadata run: | - git remote -v || true - git branch -a || true - for R in `git remote` ; do git fetch $R master ; done || true - git fetch --tags - pwd ; ls -la - echo "=== Known commits in history:" - git log --oneline | wc -l - echo "=== Recent commits in history:" - git log -2 || true - echo "=== Known tags:" - git tag || true - echo "=== Try to ensure 'git describe' works:" - git describe || { git fetch --all && for R in `git remote` ; do for T in `git tag` ; do git fetch $R $T ; done ; done; } - git describe || { TEST_REF="`git symbolic-ref --short HEAD 2>/dev/null || cat .git/HEAD`" && [ -n "${TEST_REF}" ] && git checkout master && git pull --all && git checkout "${TEST_REF}" ; } - git describe || true + git describe || { + git remote -v || true + git branch -a || true + for R in `git remote` ; do git fetch $R master ; done || true + git fetch --tags + pwd ; ls -la + echo "=== Known commits in history:" + git log --oneline | wc -l + echo "=== Recent commits in history:" + git log -2 || true + echo "=== Known tags:" + git tag || true + echo "=== Try to ensure 'git describe' works:" + git describe || { + git fetch --all && for R in `git remote` ; do for T in `git tag` ; do git fetch $R $T ; done ; done + git describe || { + TEST_REF="`git symbolic-ref --short HEAD 2>/dev/null || cat .git/HEAD`" && [ -n "${TEST_REF}" ] && git checkout master && git pull --all && git checkout "${TEST_REF}" + git describe || true + } + } + } # Using hints from https://askubuntu.com/questions/272248/processing-triggers-for-man-db # and our own docs/config-prereqs.txt From 358d93d0c8523bfad5fee55089910c00d7b8ecec Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 6 Nov 2025 17:19:01 +0100 Subject: [PATCH 22/51] .github/workflows/01-make-dist.yml: fix step IDs [#1400] Signed-off-by: Jim Klimov --- .github/workflows/01-make-dist.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/01-make-dist.yml b/.github/workflows/01-make-dist.yml index 2301afd37a..42b1d693cc 100644 --- a/.github/workflows/01-make-dist.yml +++ b/.github/workflows/01-make-dist.yml @@ -195,7 +195,7 @@ jobs: - if: env.GITHUB_REF_TYPE != 'tag' && steps.subst-github-ref-name.outputs.result != 'master' name: Delete Old Artifacts for this feature branch/PR uses: actions/github-script@v6 - id: artifact + id: delete_old_artifact_for_pr with: script: | const res = await github.rest.actions.listArtifactsForRepo({ @@ -215,6 +215,7 @@ jobs: - name: Upload tarball and its checksum artifacts uses: actions/upload-artifact@v4 + id: upload_artifact with: name: tarballs-${{ steps.subst-github-ref-name.outputs.result }} path: | From a638faf402b3adad9d4d959d7bf98b6381608cd5 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 6 Nov 2025 17:21:30 +0100 Subject: [PATCH 23/51] .github/workflows/01-make-dist.yml: try to fix permissions for PR commenter [#1400] Signed-off-by: Jim Klimov --- .github/workflows/01-make-dist.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/01-make-dist.yml b/.github/workflows/01-make-dist.yml index 42b1d693cc..7f96814d94 100644 --- a/.github/workflows/01-make-dist.yml +++ b/.github/workflows/01-make-dist.yml @@ -11,7 +11,7 @@ on: branches: [ "master", "FTY", "fightwarn" ] tags: - v* - pull_request: + pull_request_target: # The branches below must be a subset of the branches above branches: [ "master", "FTY", "fightwarn" ] schedule: @@ -19,6 +19,9 @@ on: workflow_dispatch: # Allow manually running the action, e.g. if disabled after some quietness in the source +permissions: + pull-requests: write + jobs: make-dist-tarballs: name: Make Dist and Docs Tarballs From e75ff50d639df45230fa90736d41a5d06553d60d Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 6 Nov 2025 17:27:59 +0100 Subject: [PATCH 24/51] .github/workflows/01-make-dist.yml: allow to fire on more branches [#1400] Signed-off-by: Jim Klimov --- .github/workflows/01-make-dist.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/01-make-dist.yml b/.github/workflows/01-make-dist.yml index 7f96814d94..ad4ef7d73c 100644 --- a/.github/workflows/01-make-dist.yml +++ b/.github/workflows/01-make-dist.yml @@ -8,12 +8,12 @@ name: "GHA-01: Make dist and docs tarballs" on: push: - branches: [ "master", "FTY", "fightwarn" ] + branches: [ "master", "FTY", "fightwarn", "FTY-obs" ] tags: - v* pull_request_target: # The branches below must be a subset of the branches above - branches: [ "master", "FTY", "fightwarn" ] + branches: [ "master", "FTY", "fightwarn", "FTY-obs" ] schedule: - cron: '15 12 * * 0' workflow_dispatch: From c24235152bdd8cb31744353df301e651ce8de2f0 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 6 Nov 2025 17:49:57 +0100 Subject: [PATCH 25/51] .github/workflows/01-make-dist.yml: after all use pull_request not pull_request_target so there is an attached PR to comment into [#1400] Signed-off-by: Jim Klimov --- .github/workflows/01-make-dist.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/01-make-dist.yml b/.github/workflows/01-make-dist.yml index ad4ef7d73c..8f7137e41f 100644 --- a/.github/workflows/01-make-dist.yml +++ b/.github/workflows/01-make-dist.yml @@ -11,7 +11,7 @@ on: branches: [ "master", "FTY", "fightwarn", "FTY-obs" ] tags: - v* - pull_request_target: + pull_request: # The branches below must be a subset of the branches above branches: [ "master", "FTY", "fightwarn", "FTY-obs" ] schedule: From 140b5c187899dedc6be5f0f543472741cc2957b7 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 6 Nov 2025 18:17:16 +0100 Subject: [PATCH 26/51] .github/workflows/01-make-dist.yml: do not immediately fail the CI job if we can not post actions-comment-pull-request (e.g. in a NUT fork build) [#1400] Signed-off-by: Jim Klimov --- .github/workflows/01-make-dist.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/01-make-dist.yml b/.github/workflows/01-make-dist.yml index 8f7137e41f..3b9ca4785f 100644 --- a/.github/workflows/01-make-dist.yml +++ b/.github/workflows/01-make-dist.yml @@ -207,7 +207,7 @@ jobs: }) res.data.artifacts - .filter(({ name }) => name === 'tarballs-${{ steps.subst-github-ref-name.outputs.result }}') + .filter(({ name }) => name === 'NUT-tarballs-${{ steps.subst-github-ref-name.outputs.result }}') .forEach(({ id }) => { github.rest.actions.deleteArtifact({ owner: context.repo.owner, @@ -220,7 +220,7 @@ jobs: uses: actions/upload-artifact@v4 id: upload_artifact with: - name: tarballs-${{ steps.subst-github-ref-name.outputs.result }} + name: NUT-tarballs-${{ steps.subst-github-ref-name.outputs.result }} path: | nut-*.tar* compression-level: 0 @@ -233,6 +233,7 @@ jobs: - name: "GHA-01: Make dist and docs tarballs - report download URL" uses: thollander/actions-comment-pull-request@v3 if: startsWith(github.ref, 'refs/pull/') + continue-on-error: true with: comment-tag: latest-tarball - message: Dist and Docs [tarballs-${{ steps.subst-github-ref-name.outputs.result }}.zip}](${{ steps.upload_artifact.outputs.artifact-url }}) are available for commit ${{ github.sha }} + message: Dist and Docs [NUT-tarballs-${{ steps.subst-github-ref-name.outputs.result }}.zip}](${{ steps.upload_artifact.outputs.artifact-url }}) are available for commit ${{ github.sha }} From 10ef85ff81ff00b167804349ea99283564c09974 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 6 Nov 2025 21:56:34 +0100 Subject: [PATCH 27/51] .github/workflows/01-make-dist.yml: try to use GITHUB_TOKEN when posting a PR comment [#1400] Signed-off-by: Jim Klimov --- .github/workflows/01-make-dist.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/01-make-dist.yml b/.github/workflows/01-make-dist.yml index 3b9ca4785f..55df3fa006 100644 --- a/.github/workflows/01-make-dist.yml +++ b/.github/workflows/01-make-dist.yml @@ -237,3 +237,4 @@ jobs: with: comment-tag: latest-tarball message: Dist and Docs [NUT-tarballs-${{ steps.subst-github-ref-name.outputs.result }}.zip}](${{ steps.upload_artifact.outputs.artifact-url }}) are available for commit ${{ github.sha }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 32a3798b37012524206820247ea9b3718bea6a07 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 6 Nov 2025 22:08:38 +0100 Subject: [PATCH 28/51] .github/workflows/01-make-dist.yml: no fatal problem if we can not delete an older tarball [#1400] Signed-off-by: Jim Klimov --- .github/workflows/01-make-dist.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/01-make-dist.yml b/.github/workflows/01-make-dist.yml index 55df3fa006..b98637a203 100644 --- a/.github/workflows/01-make-dist.yml +++ b/.github/workflows/01-make-dist.yml @@ -199,6 +199,7 @@ jobs: name: Delete Old Artifacts for this feature branch/PR uses: actions/github-script@v6 id: delete_old_artifact_for_pr + continue-on-error: true with: script: | const res = await github.rest.actions.listArtifactsForRepo({ From ddd2af616c1cb21f8a44af5f08cacb8b0881735a Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 6 Nov 2025 23:06:11 +0100 Subject: [PATCH 29/51] .github/workflows/01-make-dist.yml: define permissions for auto-generated GITHUB_TOKEN differently [#1400] Signed-off-by: Jim Klimov --- .github/workflows/01-make-dist.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/01-make-dist.yml b/.github/workflows/01-make-dist.yml index b98637a203..38197ab18d 100644 --- a/.github/workflows/01-make-dist.yml +++ b/.github/workflows/01-make-dist.yml @@ -19,8 +19,6 @@ on: workflow_dispatch: # Allow manually running the action, e.g. if disabled after some quietness in the source -permissions: - pull-requests: write jobs: make-dist-tarballs: @@ -31,7 +29,10 @@ jobs: permissions: actions: read contents: read + #contents: write + #repository-projects: write security-events: write + pull-requests: write strategy: fail-fast: false From 8805e50cbfb419cb33f9b628f96575fffd818ce9 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 6 Nov 2025 23:16:54 +0100 Subject: [PATCH 30/51] .github/workflows/01-make-dist.yml: try to use GITHUB_TOKEN when posting a PR comment - v2 [#1400] Signed-off-by: Jim Klimov --- .github/workflows/01-make-dist.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/01-make-dist.yml b/.github/workflows/01-make-dist.yml index 38197ab18d..00132300a9 100644 --- a/.github/workflows/01-make-dist.yml +++ b/.github/workflows/01-make-dist.yml @@ -239,4 +239,4 @@ jobs: with: comment-tag: latest-tarball message: Dist and Docs [NUT-tarballs-${{ steps.subst-github-ref-name.outputs.result }}.zip}](${{ steps.upload_artifact.outputs.artifact-url }}) are available for commit ${{ github.sha }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + github-token: ${{ secrets.GITHUB_TOKEN }} From f20dac7da34b0e8eb6a07787172727fa2858145a Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 7 Nov 2025 10:26:36 +0100 Subject: [PATCH 31/51] .github/workflows/01-make-dist.yml: try more ways to post a PR comment [#1400] Signed-off-by: Jim Klimov --- .github/workflows/01-make-dist.yml | 49 +++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/.github/workflows/01-make-dist.yml b/.github/workflows/01-make-dist.yml index 00132300a9..a02259c5ee 100644 --- a/.github/workflows/01-make-dist.yml +++ b/.github/workflows/01-make-dist.yml @@ -19,6 +19,9 @@ on: workflow_dispatch: # Allow manually running the action, e.g. if disabled after some quietness in the source +permissions: + contents: read + pull-requests: write jobs: make-dist-tarballs: @@ -27,10 +30,11 @@ jobs: # NUT build/tooling prereqs (save about 3 minutes per run!) runs-on: ubuntu-latest permissions: - actions: read - contents: read - #contents: write - #repository-projects: write + #actions: read + actions: write + #contents: read + contents: write + repository-projects: write security-events: write pull-requests: write @@ -38,6 +42,27 @@ jobs: fail-fast: false steps: + # Post early so this would be about the top comment in the PR trail + # (easy to see, contents replaced later) + - name: "GHA-01: Make dist and docs tarballs - report download URL - t1" + uses: thollander/actions-comment-pull-request@v3 + # if: startsWith(github.ref, 'refs/pull/') + continue-on-error: true + with: + comment-tag: latest-tarball + message: Dist and Docs will be linked here after the "make dist" job completes. + #github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: "GHA-01: Make dist and docs tarballs - report download URL - s1" + uses: marocchino/sticky-pull-request-comment@v2 + # if: startsWith(github.ref, 'refs/pull/') + continue-on-error: true + with: + header: latest-tarball-sticky + only_create: true + message: Dist and Docs will be linked here after the "make dist" job completes. + #github-token: ${{ secrets.GITHUB_TOKEN }} + - name: Checkout repository uses: actions/checkout@v5 with: @@ -232,11 +257,21 @@ jobs: # FIXME: Something that adds/updates Github Checks would be better # as it would be seen in the list attached to a status icon of any # build (e.g. history of master branch) - - name: "GHA-01: Make dist and docs tarballs - report download URL" + - name: "GHA-01: Make dist and docs tarballs - report download URL - t2" uses: thollander/actions-comment-pull-request@v3 - if: startsWith(github.ref, 'refs/pull/') + # if: startsWith(github.ref, 'refs/pull/') continue-on-error: true with: comment-tag: latest-tarball message: Dist and Docs [NUT-tarballs-${{ steps.subst-github-ref-name.outputs.result }}.zip}](${{ steps.upload_artifact.outputs.artifact-url }}) are available for commit ${{ github.sha }} - github-token: ${{ secrets.GITHUB_TOKEN }} + #github-token: ${{ secrets.GITHUB_TOKEN }} + + # https://github.com/marocchino/sticky-pull-request-comment + - name: "GHA-01: Make dist and docs tarballs - report download URL - s2" + uses: marocchino/sticky-pull-request-comment@v2 + # if: startsWith(github.ref, 'refs/pull/') + continue-on-error: true + with: + header: latest-tarball-sticky + only_create: true + message: Dist and Docs [NUT-tarballs-${{ steps.subst-github-ref-name.outputs.result }}.zip}](${{ steps.upload_artifact.outputs.artifact-url }}) are available for commit ${{ github.sha }} From 374dd0cbd2d986108db46c8f15e4538299da843e Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 7 Nov 2025 11:28:15 +0100 Subject: [PATCH 32/51] .github/workflows/01-make-dist.yml: try "issues: write" into permissions [#1400] Signed-off-by: Jim Klimov --- .github/workflows/01-make-dist.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/01-make-dist.yml b/.github/workflows/01-make-dist.yml index a02259c5ee..aa25253b2f 100644 --- a/.github/workflows/01-make-dist.yml +++ b/.github/workflows/01-make-dist.yml @@ -21,6 +21,7 @@ on: permissions: contents: read + issues: write pull-requests: write jobs: @@ -37,6 +38,7 @@ jobs: repository-projects: write security-events: write pull-requests: write + issues: write strategy: fail-fast: false From b6a8b96360d5c3c6b96ff82d15aa4f6c25f08130 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 7 Nov 2025 11:28:36 +0100 Subject: [PATCH 33/51] .github/workflows/01-make-dist.yml: comment about substitute-string-action [#1400] Signed-off-by: Jim Klimov --- .github/workflows/01-make-dist.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/01-make-dist.yml b/.github/workflows/01-make-dist.yml index aa25253b2f..0e6c46e09e 100644 --- a/.github/workflows/01-make-dist.yml +++ b/.github/workflows/01-make-dist.yml @@ -72,12 +72,15 @@ jobs: fetch-tags: true # https://github.com/marketplace/actions/substitute-string + # Note it warns about "unexpected input(s)" with replacement tokens below, + # as they are by design not predefined, as far as actions API is concened. + # They still work for substitutions though. - uses: bluwy/substitute-string-action@v3 id: subst-github-ref-name with: - _input-text: "${{ github.ref_name }}" - " ": _ - "/": _ + _input-text: "${{ github.ref_name }}" + " ": _ + "/": _ - run: echo "${{ steps.subst-github-ref-name.outputs.result }}" # Make build identification more useful (so we use no fallbacks in script) From 5f190c6f5a735b6318806c82e61a1f50c084d512 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 7 Nov 2025 11:40:27 +0100 Subject: [PATCH 34/51] scripts/obs/nut.spec: turn package availability/requirement for NUTPKG_WITH_* upside down [#1209] Signed-off-by: Jim Klimov --- scripts/obs/nut.spec | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/scripts/obs/nut.spec b/scripts/obs/nut.spec index 9d718e3d11..9c6c3d9034 100644 --- a/scripts/obs/nut.spec +++ b/scripts/obs/nut.spec @@ -51,6 +51,7 @@ %define MODELPATH %{LIBEXECPATH}/driver %define STATEPATH %{_localstatedir}/lib/ups +### Note: this is /etc/nut in Debian version %define CONFPATH %{_sysconfdir}/ups # RPM on OpenSUSE goes: # DOCDIR=/home/abuild/rpmbuild/BUILD/nut-2.8.4.428-build/BUILDROOT/usr/share/doc/packages/nut @@ -66,7 +67,6 @@ # This directory is for user files, use /usr/share/bash-completion/completions/ %define BASHCOMPLETIONPATH %(test -d /usr/share/bash-completion/completions && echo /usr/share/bash-completion/completions || echo "%{_sysconfdir}/bash_completion.d") -### Note: this is /etc/nut in Debian version %define NUT_USER upsd %define NUT_GROUP daemon %define LBRACE ( @@ -94,14 +94,16 @@ # Does this NUT branch have DMF feature code? %define NUTPKG_WITH_DMF %( test -d scripts/DMF && echo 1 || echo 0 ) -# Not all distros have it -# FIXME: No use searching remote repos; can use rpm queries based on whatever -# did get installed according to Requires lines below, to decide whether we -# deliver certain sub-packages though. -%define NUTPKG_WITH_FREEIPMI %( (yum search freeipmi-devel | grep -E '^(lib)?freeipmi-devel\.' && exit ; dnf search freeipmi-devel | grep -E '^(lib)?freeipmi-devel\.' && exit ; zypper search -s freeipmi-devel | grep -E '(lib)?freeipmi-devel' && exit ; urpmq --sources freeipmi-devel && exit ; pkcon search name freeipmi-devel | grep -E '(Available|Installed).*freeipmi-devel' && exit;) >&2 && echo 1 || echo 0) -%define NUTPKG_WITH_POWERMAN %( (yum search powerman-devel | grep -E '^(lib)?powerman-devel\.' && exit ; dnf search powerman-devel | grep -E '^(lib)?powerman-devel\.' && exit ; zypper search -s powerman-devel | grep -E '(lib)?powerman-devel' && exit ; urpmq --sources powerman-devel && exit ; pkcon search name powerman-devel | grep -E '(Available|Installed).*powerman-devel' && exit;) >&2 && echo 1 || echo 0) -%define NUTPKG_WITH_AVAHI %( (yum search avahi-devel | grep -E '^(lib)?avahi-devel\.' && exit ; dnf search avahi-devel | grep -E '^(lib)?avahi-devel\.' && exit ; zypper search -s avahi-devel | grep -E '(lib)?avahi-devel' && exit ; urpmq --sources avahi-devel && exit ; pkcon search name avahi-devel | grep -E '(Available|Installed).*avahi-devel' && exit;) >&2 && echo 1 || echo 0) -%define NUTPKG_WITH_TCPWRAP %( (yum search tcp_wrappers-devel | grep -E '^(lib)?tcp_wrappers-devel\.' && exit ; dnf search tcp_wrappers-devel | grep -E '^(lib)?tcp_wrappers-devel\.' && exit ; zypper search -s tcp_wrappers-devel | grep -E '(lib)?tcp_wrappers-devel' && exit ; urpmq --sources tcp_wrappers-devel && exit ; pkcon search name tcp_wrappers-devel | grep -E '(Available|Installed).*tcp_wrappers-devel' && exit;) >&2 && echo 1 || echo 0) +# Not all distros have these packages (or their equivalents/aliases) +# NONE: No use searching remote repos for what might be or not be available +# there; we have to use rpm queries based on whatever did get installed +# according to Requires lines below (in turn according to our declaration +# of what is shipped by this or that distro/release), to decide whether we +# deliver certain sub-packages. +%define NUTPKG_WITH_FREEIPMI %( (rpm -qa | grep -E '^(lib)?freeipmi-devel\.' && exit ; urpmq --sources freeipmi-devel && exit ; pkcon search name freeipmi-devel | grep -E 'Installed.*freeipmi-devel' && exit;) >&2 && echo 1 || echo 0) +%define NUTPKG_WITH_POWERMAN %( (rpm -qa | grep -E '^(lib)?powerman-devel\.' && exit ; urpmq --sources powerman-devel && exit ; pkcon search name powerman-devel | grep -E 'Installed.*powerman-devel' && exit;) >&2 && echo 1 || echo 0) +%define NUTPKG_WITH_AVAHI %( (rpm -qa | grep -E '^(lib)?avahi-devel\.' && exit ; urpmq --sources avahi-devel && exit ; pkcon search name avahi-devel | grep -E 'Installed.*avahi-devel' && exit;) >&2 && echo 1 || echo 0) +%define NUTPKG_WITH_TCPWRAP %( (rpm -qa | grep -E '^(lib)?tcp_wrappers-devel\.' && exit ; urpmq --sources tcp_wrappers-devel && exit ; pkcon search name tcp_wrappers-devel | grep -E 'Installed.*tcp_wrappers-devel' && exit;) >&2 && echo 1 || echo 0) # FIXME: Find a smarter way to set those from main codebase recipes... # Something like `git grep 'version-info' '*.am'` ? @@ -156,13 +158,13 @@ BuildRequires: dos2unix # https://en.opensuse.org/openSUSE:Packaging_Conventions_RPM_Macros#fdupes BuildRequires: fdupes -%if 0%{?NUTPKG_WITH_AVAHI} +#%if 0%{?rhel_version}>=8 || ! 0%{?rhel_version} BuildRequires: avahi-devel -%endif +#%endif -%if 0%{?NUTPKG_WITH_FREEIPMI} +#%if 0%{?rhel_version}>=8 || ! 0%{?rhel_version} BuildRequires: (libfreeipmi-devel or freeipmi-devel) -%endif +#%endif BuildRequires: gcc-c++ BuildRequires: gd-devel @@ -204,9 +206,10 @@ BuildRequires: (libcppunit-devel or cppunit-devel) %endif # Obsoleted/away in newer distros -%if 0%{?NUTPKG_WITH_TCPWRAP} +#%if 0%{?rhel_version}>=8 || ! 0%{?rhel_version} +#%if 0%{?NUTPKG_WITH_TCPWRAP} BuildRequires: (tcpd-devel or tcp_wrappers-devel) -%endif +#%endif # May be plain "neon" and "libusb" in RHEL7 or older? # OBS: This may need `osc meta prjconf` to `Prefer:` one @@ -216,9 +219,10 @@ BuildRequires: (libneon-devel or neon-devel or neon) BuildRequires: (libopenssl-devel or openssl-devel or openssl) #!Prefer: (libopenssl-devel or openssl-devel) -%if 0%{?NUTPKG_WITH_POWERMAN} +#%if 0%{?rhel_version}>=8 || ! 0%{?rhel_version} +#%if 0%{?NUTPKG_WITH_POWERMAN} BuildRequires: powerman-devel -%endif +#%endif %if 0%{?suse_version} BuildRequires: systemd-rpm-macros From 48b0cab7f8f92de5c3919f3caab41a3d1f5faa62 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 7 Nov 2025 11:56:34 +0100 Subject: [PATCH 35/51] scripts/obs/nut.spec: define NUTPKG_WITH_ when we requre the deps or not, based on distro/release [#1209] Signed-off-by: Jim Klimov --- scripts/obs/nut.spec | 58 +++++++++++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 20 deletions(-) diff --git a/scripts/obs/nut.spec b/scripts/obs/nut.spec index 9c6c3d9034..5479967fdf 100644 --- a/scripts/obs/nut.spec +++ b/scripts/obs/nut.spec @@ -91,19 +91,15 @@ %define NUT_SYSTEMD_UNITS_PRESET %(cd scripts/systemd && ls -1 *.preset{,.in} | sed 's,.in$,,' | sort | uniq) -# Does this NUT branch have DMF feature code? -%define NUTPKG_WITH_DMF %( test -d scripts/DMF && echo 1 || echo 0 ) - -# Not all distros have these packages (or their equivalents/aliases) -# NONE: No use searching remote repos for what might be or not be available +# Not all distros have certain packages (or their equivalents/aliases), +# NOTE: No use searching remote repos for what might be or not be available # there; we have to use rpm queries based on whatever did get installed # according to Requires lines below (in turn according to our declaration # of what is shipped by this or that distro/release), to decide whether we -# deliver certain sub-packages. -%define NUTPKG_WITH_FREEIPMI %( (rpm -qa | grep -E '^(lib)?freeipmi-devel\.' && exit ; urpmq --sources freeipmi-devel && exit ; pkcon search name freeipmi-devel | grep -E 'Installed.*freeipmi-devel' && exit;) >&2 && echo 1 || echo 0) -%define NUTPKG_WITH_POWERMAN %( (rpm -qa | grep -E '^(lib)?powerman-devel\.' && exit ; urpmq --sources powerman-devel && exit ; pkcon search name powerman-devel | grep -E 'Installed.*powerman-devel' && exit;) >&2 && echo 1 || echo 0) -%define NUTPKG_WITH_AVAHI %( (rpm -qa | grep -E '^(lib)?avahi-devel\.' && exit ; urpmq --sources avahi-devel && exit ; pkcon search name avahi-devel | grep -E 'Installed.*avahi-devel' && exit;) >&2 && echo 1 || echo 0) -%define NUTPKG_WITH_TCPWRAP %( (rpm -qa | grep -E '^(lib)?tcp_wrappers-devel\.' && exit ; urpmq --sources tcp_wrappers-devel && exit ; pkcon search name tcp_wrappers-devel | grep -E 'Installed.*tcp_wrappers-devel' && exit;) >&2 && echo 1 || echo 0) +# deliver certain sub-packages - and set NUTPKG_WITH_ at that time. + +# Does this NUT branch have DMF feature code? +%define NUTPKG_WITH_DMF %( test -d scripts/DMF && echo 1 || echo 0 ) # FIXME: Find a smarter way to set those from main codebase recipes... # Something like `git grep 'version-info' '*.am'` ? @@ -154,17 +150,25 @@ Recommends: logrotate # To fix end-of-line encoding: BuildRequires: dos2unix +%if ! 0%{?rhel_version} # For man page aliases # https://en.opensuse.org/openSUSE:Packaging_Conventions_RPM_Macros#fdupes BuildRequires: fdupes +%endif -#%if 0%{?rhel_version}>=8 || ! 0%{?rhel_version} +%if 0%{?rhel_version}>=8 || ! 0%{?rhel_version} +%define NUTPKG_WITH_AVAHI 1 BuildRequires: avahi-devel -#%endif +%else +%define NUTPKG_WITH_AVAHI 0 +%endif -#%if 0%{?rhel_version}>=8 || ! 0%{?rhel_version} +%if ( 0%{?rhel_version}>=8 || ! 0%{?rhel_version} ) || ( 0%{?suse_version}>12 || ! 0%{?suse_version} ) +%define NUTPKG_WITH_FREEIPMI 1 BuildRequires: (libfreeipmi-devel or freeipmi-devel) -#%endif +%else +%define NUTPKG_WITH_FREEIPMI 0 +%endif BuildRequires: gcc-c++ BuildRequires: gd-devel @@ -180,6 +184,7 @@ BuildRequires: pkg-config BuildRequires: (python >= 2.6 or python3 or python2) %if 0%{?NUTPKG_WITH_DMF} +# Toggle decided above based on variant of NUT source codebase # LUA 5.1 or 5.2 is known ok for us, both are modern in current distros (201609xx) BuildRequires: lua-devel @@ -198,7 +203,12 @@ BuildRequires: lua-devel # % if 0 % {?rhel_version}>=7 # and whatnot +%if ( (0%{?rhel_version}>0 && 0%{?rhel_version}<=7) || ! 0%{?rhel_version} ) +# Strange that this is not present in RHEL (even with Fedora EPEL repos attached) +# We only need this to learn paths from apxs tool, so no NUTPKG_WITH_* toggle BuildRequires: (httpd-devel or apache2-devel) +%endif + BuildRequires: (dbus-1-glib-devel or dbus-glib-devel) %if 0%{?rhel_version}>=8 || ! 0%{?rhel_version} @@ -206,10 +216,12 @@ BuildRequires: (libcppunit-devel or cppunit-devel) %endif # Obsoleted/away in newer distros -#%if 0%{?rhel_version}>=8 || ! 0%{?rhel_version} -#%if 0%{?NUTPKG_WITH_TCPWRAP} +%if ( (0%{?rhel_version}>0 && 0%{?rhel_version}<=7) || ! 0%{?rhel_version} ) && ( (0%{?centos_version}>0 && 0%{?centos_version}<=7) || ! 0%{?centos_version} ) && ( (0%{?fedora_version}>0 && 0%{?fedora_version}<=27) || ! 0%{?fedora_version} ) +%define NUTPKG_WITH_TCPWRAP 1 BuildRequires: (tcpd-devel or tcp_wrappers-devel) -#%endif +%else +%define NUTPKG_WITH_TCPWRAP 0 +%endif # May be plain "neon" and "libusb" in RHEL7 or older? # OBS: This may need `osc meta prjconf` to `Prefer:` one @@ -219,10 +231,16 @@ BuildRequires: (libneon-devel or neon-devel or neon) BuildRequires: (libopenssl-devel or openssl-devel or openssl) #!Prefer: (libopenssl-devel or openssl-devel) -#%if 0%{?rhel_version}>=8 || ! 0%{?rhel_version} -#%if 0%{?NUTPKG_WITH_POWERMAN} +%if ( ! 0%{?rhel_version} ) && ( (0%{?centos_version}>0 && 0%{?centos_version}<=9) || ! 0%{?centos_version} ) && ( (0%{?fedora_version}>0 && 0%{?fedora_version}<99) || ! 0%{?fedora_version} ) +# Strange that this is not present in RHEL (even with Fedora EPEL repos attached) +# NOTE: fedora_version=99 seems to be rawhide; currently it says this package +# is not known (so likely a post-42 release would be more specific later), +# CentOS10 also does not like the name. +%define NUTPKG_WITH_POWERMAN 1 BuildRequires: powerman-devel -#%endif +%else +%define NUTPKG_WITH_POWERMAN 0 +%endif %if 0%{?suse_version} BuildRequires: systemd-rpm-macros From e1ce3f39880a4e6475985d2a777d8e0156987edf Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 7 Nov 2025 13:43:14 +0100 Subject: [PATCH 36/51] scripts/obs/_config: CentOS 10 depends on "either of" util-linux(-core), so we must pick one [#1209] Signed-off-by: Jim Klimov --- scripts/obs/_config | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/obs/_config b/scripts/obs/_config index c53e0ce56c..bec91ec4f2 100644 --- a/scripts/obs/_config +++ b/scripts/obs/_config @@ -5,6 +5,7 @@ Prefer: libusbx-devel Prefer: libusb-1.0-dev Prefer: neon-devel +Prefer: util-linux %if "x%{_repository}" == "xRaspbian_11" %else From cb8c7f19d2dbeedc24e45883f610342ad6e4e921 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 7 Nov 2025 14:43:36 +0100 Subject: [PATCH 37/51] scripts/obs/_config: no ccache in RHEL_7 it seems [#1209] Signed-off-by: Jim Klimov --- scripts/obs/_config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/obs/_config b/scripts/obs/_config index bec91ec4f2..139af5ab1d 100644 --- a/scripts/obs/_config +++ b/scripts/obs/_config @@ -7,7 +7,7 @@ Prefer: libusb-1.0-dev Prefer: neon-devel Prefer: util-linux -%if "x%{_repository}" == "xRaspbian_11" +%if "x%{_repository}" == "xRaspbian_11" || "x%{_repository}" == "xRHEL_7" %else # Use ccache or sccache (let OBS pick its preference) for faster (re-)builds: BuildFlags: useccache:nut From e80b6fadb299db5f4cc839c6999f8cadfae2dcdf Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 7 Nov 2025 13:30:19 +0100 Subject: [PATCH 38/51] scripts/obs/nut.spec: fix "distro_version" numbers (some have extra digits for sub-releases) [#1209] Signed-off-by: Jim Klimov --- scripts/obs/nut.spec | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/scripts/obs/nut.spec b/scripts/obs/nut.spec index 5479967fdf..38eb4fc90f 100644 --- a/scripts/obs/nut.spec +++ b/scripts/obs/nut.spec @@ -97,6 +97,9 @@ # according to Requires lines below (in turn according to our declaration # of what is shipped by this or that distro/release), to decide whether we # deliver certain sub-packages - and set NUTPKG_WITH_ at that time. +# For version-specific checks note that some are directly digited, others +# are off by two or four digits (e.g. 0810 = a "8.10" release), see +# https://en.opensuse.org/openSUSE:Build_Service_cross_distribution_howto # Does this NUT branch have DMF feature code? %define NUTPKG_WITH_DMF %( test -d scripts/DMF && echo 1 || echo 0 ) @@ -136,9 +139,9 @@ Requires: %{_bindir}/pgrep Requires: %{_bindir}/pkill Requires: %{_bindir}/readlink Requires: usbutils -%if 0%{?suse_version} +#%if 0 % {?suse_version} Requires(post): udev -%endif +#%endif #Requires(post): group(% {NUT_GROUP}) #Requires(post): user(% {NUT_USER}) Requires(postun): %{_bindir}/sh @@ -156,14 +159,15 @@ BuildRequires: dos2unix BuildRequires: fdupes %endif -%if 0%{?rhel_version}>=8 || ! 0%{?rhel_version} +%if ( 0%{?rhel_version}>=800 || ! 0%{?rhel_version} ) && ( 0%{?rhel}>=8 || ! 0%{?rhel} ) +# Not sure why claimed absent in RHEL7 (even with Fedora/EPEL repo layer added) %define NUTPKG_WITH_AVAHI 1 BuildRequires: avahi-devel %else %define NUTPKG_WITH_AVAHI 0 %endif -%if ( 0%{?rhel_version}>=8 || ! 0%{?rhel_version} ) || ( 0%{?suse_version}>12 || ! 0%{?suse_version} ) +%if ( 0%{?rhel_version}>=800 || ! 0%{?rhel_version} ) && ( 0%{?rhel}>=8 || ! 0%{?rhel} ) && ( 0%{?sle_version}>=150000 || ! 0%{?sle_version} ) && ( 0%{?suse_version}>=1300 || ! 0%{?suse_version} ) %define NUTPKG_WITH_FREEIPMI 1 BuildRequires: (libfreeipmi-devel or freeipmi-devel) %else @@ -200,23 +204,27 @@ BuildRequires: lua-devel # For some platforms we may have to fiddle with distro-named macros like # % if 0 % {?centos_version} # % if 0 % {?suse_version} -# % if 0 % {?rhel_version}>=7 +# % if 0 % {?rhel_version}>=700 # and whatnot -%if ( (0%{?rhel_version}>0 && 0%{?rhel_version}<=7) || ! 0%{?rhel_version} ) +%if ( (0%{?rhel_version}>0 && 0%{?rhel_version}<800) || ! 0%{?rhel_version} ) && ( (0%{?centos_version}>0 && 0%{?centos_version}!=800) || ! 0%{?centos_version} ) # Strange that this is not present in RHEL (even with Fedora EPEL repos attached) +# and that it is resolvable in CentOS 7, 9, 10 but not 8... # We only need this to learn paths from apxs tool, so no NUTPKG_WITH_* toggle BuildRequires: (httpd-devel or apache2-devel) %endif BuildRequires: (dbus-1-glib-devel or dbus-glib-devel) -%if 0%{?rhel_version}>=8 || ! 0%{?rhel_version} +%if ( 0%{?rhel_version}>=800 || ! 0%{?rhel_version} ) && ( 0%{?rhel}>=8 || ! 0%{?rhel} ) BuildRequires: (libcppunit-devel or cppunit-devel) %endif # Obsoleted/away in newer distros -%if ( (0%{?rhel_version}>0 && 0%{?rhel_version}<=7) || ! 0%{?rhel_version} ) && ( (0%{?centos_version}>0 && 0%{?centos_version}<=7) || ! 0%{?centos_version} ) && ( (0%{?fedora_version}>0 && 0%{?fedora_version}<=27) || ! 0%{?fedora_version} ) +%if ( (0%{?rhel_version}>0 && 0%{?rhel_version}<800) || ! 0%{?rhel_version} ) && ( (0%{?centos_version}>0 && 0%{?centos_version}<800) || ! 0%{?centos_version} ) && ( (0%{?fedora_version}>0 && 0%{?fedora_version}<=27) || ! 0%{?fedora_version} ) +# Note that per https://en.opensuse.org/openSUSE:Build_Service_cross_distribution_howto +# there was "fedora_version" until some time before 36, when the macro became "fedora"; +# similarly for "rhel_version <= 700" vs. "rhel == 8"... %define NUTPKG_WITH_TCPWRAP 1 BuildRequires: (tcpd-devel or tcp_wrappers-devel) %else @@ -231,7 +239,7 @@ BuildRequires: (libneon-devel or neon-devel or neon) BuildRequires: (libopenssl-devel or openssl-devel or openssl) #!Prefer: (libopenssl-devel or openssl-devel) -%if ( ! 0%{?rhel_version} ) && ( (0%{?centos_version}>0 && 0%{?centos_version}<=9) || ! 0%{?centos_version} ) && ( (0%{?fedora_version}>0 && 0%{?fedora_version}<99) || ! 0%{?fedora_version} ) +%if ( ! 0%{?rhel_version} ) && ( ! 0%{?rhel} ) && ( (0%{?centos_version}>0 && 0%{?centos_version}<1000) || ! 0%{?centos_version} ) && ( (0%{?fedora_version}>0 && 0%{?fedora_version}<4200) || ! 0%{?fedora_version} ) && ( (0%{?fedora}>0 && 0%{?fedora}<42) || ! 0%{?fedora} ) # Strange that this is not present in RHEL (even with Fedora EPEL repos attached) # NOTE: fedora_version=99 seems to be rawhide; currently it says this package # is not known (so likely a post-42 release would be more specific later), @@ -242,16 +250,19 @@ BuildRequires: powerman-devel %define NUTPKG_WITH_POWERMAN 0 %endif -%if 0%{?suse_version} +%if ( 0%{?suse_version}>0 || ! %{?suse_version} ) && (0%{?centos_version}>=800) || ! 0%{?centos_version} ) && ( ! 0%{?rhel_version} ) && ( ! 0%{?rhel} ) +# Strange that this is not present in RHEL (even with Fedora EPEL repos attached) +# But it also complains about epel-rpm-macros when this is added though. BuildRequires: systemd-rpm-macros +%endif + # Only needed for PDF generation, we do not package that now #BuildRequires: dblatex -%endif BuildRequires: (libxslt-tools or libxslt) BuildRequires: asciidoc -%if %{defined opensuse_version} +%if 0%{?opensuse_version} # Package provides driver for USB HID UPSes, but people can live with hal addon: Enhances: %{USBHIDDRIVERS} # Package provides the only avalailable driver for other USB UPSes: From b828fcbb3621deafcbd27039a08a0ebdcd9b04f3 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 7 Nov 2025 14:29:02 +0100 Subject: [PATCH 39/51] scripts/obs/nut.spec: libltdl-devel (nut-scanner and consumers) and libgd-devel (cgi) are not ubiquitous [#1209] Signed-off-by: Jim Klimov --- scripts/obs/nut.spec | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/scripts/obs/nut.spec b/scripts/obs/nut.spec index 38eb4fc90f..b40fa63170 100644 --- a/scripts/obs/nut.spec +++ b/scripts/obs/nut.spec @@ -174,10 +174,25 @@ BuildRequires: (libfreeipmi-devel or freeipmi-devel) %define NUTPKG_WITH_FREEIPMI 0 %endif -BuildRequires: gcc-c++ +%if ( 0%{?rhel_version}>=800 || ! 0%{?rhel_version} ) && ( 0%{?rhel}>=8 || ! 0%{?rhel} ) +# Not in RHEL7 +%define NUTPKG_WITH_LIBGD 1 BuildRequires: gd-devel +%else +%define NUTPKG_WITH_LIBGD 0 +%endif + +BuildRequires: gcc-c++ BuildRequires: libtool + +%if ( 0%{?rhel_version}>=800 || ! 0%{?rhel_version} ) && ( 0%{?rhel}>=8 || ! 0%{?rhel} ) +# Not in RHEL7 +%define NUTPKG_WITH_LTDL 1 BuildRequires: libtool-ltdl-devel +%else +%define NUTPKG_WITH_LTDL 0 +%endif + # libusb-0.1 or libusb-1.0: BuildRequires: (libusb-devel or libusbx-devel) #!Prefer: libusbx-devel @@ -334,6 +349,7 @@ interface for monitoring and administering UPS hardware. Detailed information about supported hardware can be found in %{_docdir}/nut. +%if 0%{?NUTPKG_WITH_LTDL} %package -n libnutscan%{SO_MAJOR_LIBNUTSCAN} Summary: Network UPS Tools Library (Uninterruptible Power Supply Monitoring) Group: System/Libraries @@ -364,7 +380,9 @@ interface for monitoring and administering UPS hardware. Detailed information about supported hardware can be found in %{_docdir}/nut. %endif +%endif +%if 0%{?NUTPKG_WITH_LIBGD} %package cgi Summary: Network UPS Tools Web Server Support (UPS Status Pages) Group: Hardware/UPS @@ -380,6 +398,7 @@ interface for monitoring and administering UPS hardware. Detailed information about supported hardware can be found in %{_docdir}/nut. +%endif %package monitor Summary: Network UPS Tools Web Server Support (GUI client) @@ -582,6 +601,7 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %postun -n libnutclientstub%{SO_MAJOR_LIBNUTCLIENTSTUB} -p /sbin/ldconfig +%if 0%{?NUTPKG_WITH_LTDL} > 0 %post -n libnutscan%{SO_MAJOR_LIBNUTSCAN} -p /sbin/ldconfig %postun -n libnutscan%{SO_MAJOR_LIBNUTSCAN} -p /sbin/ldconfig @@ -590,7 +610,7 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %post -n libnutconf%{SO_MAJOR_LIBNUTCONF} -p /sbin/ldconfig %postun -n libnutconf%{SO_MAJOR_LIBNUTCONF} -p /sbin/ldconfig - +%endif %endif %files @@ -754,6 +774,7 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %defattr(-,root,root) %{_libdir}/libnutclientstub.so.* +%if 0%{?NUTPKG_WITH_LTDL} %files -n libnutscan%{SO_MAJOR_LIBNUTSCAN} %defattr(-,root,root) %{_libdir}/libnutscan.so.* @@ -763,7 +784,9 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %defattr(-,root,root) %{_libdir}/libnutconf.so.* %endif +%endif +%if 0%{?NUTPKG_WITH_LIBGD} %files cgi %defattr(-,root,root) %dir %{CGIPATH} @@ -772,6 +795,7 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro %{HTMLPATH}/* %config(noreplace) %{CONFPATH}/upsstats-single.html %config(noreplace) %{CONFPATH}/upsstats.html +%endif %files monitor %defattr(-,root,root) From 51f8b979db0020207e9913d6fb309307803b0a29 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 7 Nov 2025 14:38:25 +0100 Subject: [PATCH 40/51] scripts/obs/nut.spec: more constraints about what is available in what distro versions [#1209] Signed-off-by: Jim Klimov --- scripts/obs/nut.spec | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/obs/nut.spec b/scripts/obs/nut.spec index b40fa63170..37f8212b82 100644 --- a/scripts/obs/nut.spec +++ b/scripts/obs/nut.spec @@ -159,7 +159,7 @@ BuildRequires: dos2unix BuildRequires: fdupes %endif -%if ( 0%{?rhel_version}>=800 || ! 0%{?rhel_version} ) && ( 0%{?rhel}>=8 || ! 0%{?rhel} ) +%if ( ! 0%{?rhel_version} ) && ( ! 0%{?rhel} ) # Not sure why claimed absent in RHEL7 (even with Fedora/EPEL repo layer added) %define NUTPKG_WITH_AVAHI 1 BuildRequires: avahi-devel @@ -167,7 +167,8 @@ BuildRequires: avahi-devel %define NUTPKG_WITH_AVAHI 0 %endif -%if ( 0%{?rhel_version}>=800 || ! 0%{?rhel_version} ) && ( 0%{?rhel}>=8 || ! 0%{?rhel} ) && ( 0%{?sle_version}>=150000 || ! 0%{?sle_version} ) && ( 0%{?suse_version}>=1300 || ! 0%{?suse_version} ) +%if ( ! 0%{?rhel_version} ) && ( ! 0%{?rhel} ) && ( 0%{?sle_version}>=150000 || ! 0%{?sle_version} ) && ( 0%{?suse_version}>=1300 || ! 0%{?suse_version} ) +# Not sure why claimed absent in RHEL (even with Fedora/EPEL repo layer added) %define NUTPKG_WITH_FREEIPMI 1 BuildRequires: (libfreeipmi-devel or freeipmi-devel) %else @@ -231,7 +232,8 @@ BuildRequires: (httpd-devel or apache2-devel) BuildRequires: (dbus-1-glib-devel or dbus-glib-devel) -%if ( 0%{?rhel_version}>=800 || ! 0%{?rhel_version} ) && ( 0%{?rhel}>=8 || ! 0%{?rhel} ) +%if ( ! 0%{?rhel_version} ) && ( ! 0%{?rhel} ) +# Strange that this is not present in RHEL (even with Fedora EPEL repos attached) BuildRequires: (libcppunit-devel or cppunit-devel) %endif @@ -265,17 +267,19 @@ BuildRequires: powerman-devel %define NUTPKG_WITH_POWERMAN 0 %endif -%if ( 0%{?suse_version}>0 || ! %{?suse_version} ) && (0%{?centos_version}>=800) || ! 0%{?centos_version} ) && ( ! 0%{?rhel_version} ) && ( ! 0%{?rhel} ) +%if ( 0%{?suse_version}>0 || ! 0%{?suse_version} ) && (0%{?centos_version}>=800 || ! 0%{?centos_version} ) && ( ! 0%{?rhel_version} ) && ( ! 0%{?rhel} ) # Strange that this is not present in RHEL (even with Fedora EPEL repos attached) # But it also complains about epel-rpm-macros when this is added though. BuildRequires: systemd-rpm-macros %endif +%if ( 0%{?rhel_version}>=800 || ! 0%{?rhel_version} ) && ( 0%{?rhel}>=8 || ! 0%{?rhel} ) # Only needed for PDF generation, we do not package that now #BuildRequires: dblatex BuildRequires: (libxslt-tools or libxslt) BuildRequires: asciidoc +%endif %if 0%{?opensuse_version} # Package provides driver for USB HID UPSes, but people can live with hal addon: From 21e5d7a79d8e3432c6382252c667eae3fb9e6223 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 7 Nov 2025 15:04:51 +0100 Subject: [PATCH 41/51] scripts/obs/debian.control: dumb down the libmodbus requirement [#1209] Do not constrain the versions so it can build on Debian 9 and 10; Note that for USB support we would need our fork anyway (until it gets merged to upstream, which may take years at their pace). Signed-off-by: Jim Klimov --- scripts/obs/debian.control | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/obs/debian.control b/scripts/obs/debian.control index e14a9b93a3..21bbcb4aed 100644 --- a/scripts/obs/debian.control +++ b/scripts/obs/debian.control @@ -19,13 +19,14 @@ Build-Depends: debhelper (>= 8.1.3), python2 | python3, dh-python | dh-python2 | dh-python3 | dh-pypy, libfreeipmi-dev (>= 0.8.5) [!hurd-i386], libipmimonitoring-dev (>= 1.1.5-2) [!hurd-i386], - libmodbus-dev (>= 3.1.6), + libmodbus-dev, libi2c-dev (>= 4.0), libnss3-dev, libtool, libltdl-dev, liblua5.1-0-dev, lua5.1, pkg-config #python (>= 2.6.6-3~) | python-is-python2 | python-is-python3, +#libmodbus-dev (>= 3.1.6), Build-Depends-Indep: asciidoc (>= 8.6.3), docbook-xsl, dblatex (>= 0.2.5), @@ -150,7 +151,8 @@ Description: network UPS tools - IPMI driver Package: nut-modbus Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, nut-server (= ${binary:Version}), libmodbus5 (>= 3.1.6) +Depends: ${shlibs:Depends}, ${misc:Depends}, nut-server (= ${binary:Version}), libmodbus5 +# (>= 3.1.6) Description: network UPS tools - Modbus drivers Network UPS Tools (NUT) is a client/server monitoring system that allows computers to share uninterruptible power supply (UPS) and From 313e13e8fcae4f59d74ed20da7709d286dee14b7 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 7 Nov 2025 15:12:30 +0100 Subject: [PATCH 42/51] scripts/obs/debian.control: dumb down the libi2c requirement [#1209] Signed-off-by: Jim Klimov --- scripts/obs/debian.control | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/obs/debian.control b/scripts/obs/debian.control index 21bbcb4aed..6628969537 100644 --- a/scripts/obs/debian.control +++ b/scripts/obs/debian.control @@ -20,13 +20,14 @@ Build-Depends: debhelper (>= 8.1.3), libfreeipmi-dev (>= 0.8.5) [!hurd-i386], libipmimonitoring-dev (>= 1.1.5-2) [!hurd-i386], libmodbus-dev, - libi2c-dev (>= 4.0), + libi2c-dev, libnss3-dev, libtool, libltdl-dev, liblua5.1-0-dev, lua5.1, pkg-config #python (>= 2.6.6-3~) | python-is-python2 | python-is-python3, #libmodbus-dev (>= 3.1.6), +#libi2c-dev (>= 4.0), Build-Depends-Indep: asciidoc (>= 8.6.3), docbook-xsl, dblatex (>= 0.2.5), @@ -165,7 +166,8 @@ Description: network UPS tools - Modbus drivers Package: nut-linux-i2c Architecture: linux-any -Depends: ${shlibs:Depends}, ${misc:Depends}, nut-server (= ${binary:Version}), libi2c0 (>= 4.0) +Depends: ${shlibs:Depends}, ${misc:Depends}, nut-server (= ${binary:Version}), libi2c0 +# (>= 4.0) Description: network UPS tools - Linux I2C drivers Network UPS Tools (NUT) is a client/server monitoring system that allows computers to share uninterruptible power supply (UPS) and From 2b1a596f364ab172d80bacdba17616c942503077 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 7 Nov 2025 15:14:10 +0100 Subject: [PATCH 43/51] scripts/obs/nut.spec: try to constrain udev to non-RHEL [#1209] Signed-off-by: Jim Klimov --- scripts/obs/nut.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/obs/nut.spec b/scripts/obs/nut.spec index 37f8212b82..5ac2887428 100644 --- a/scripts/obs/nut.spec +++ b/scripts/obs/nut.spec @@ -140,8 +140,9 @@ Requires: %{_bindir}/pkill Requires: %{_bindir}/readlink Requires: usbutils #%if 0 % {?suse_version} +%if ! 0%{?rhel_version} Requires(post): udev -#%endif +%endif #Requires(post): group(% {NUT_GROUP}) #Requires(post): user(% {NUT_USER}) Requires(postun): %{_bindir}/sh From 1ce8f8e638e0ccd1828d38ea318786885215ce92 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 7 Nov 2025 15:26:07 +0100 Subject: [PATCH 44/51] Revert "scripts/obs/nut.spec: try to constrain udev to non-RHEL [#1209]" This reverts commit 2b1a596f364ab172d80bacdba17616c942503077. Dropped NUT CI OBS support for platforms it still refuses to build instead. Signed-off-by: Jim Klimov --- scripts/obs/nut.spec | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/obs/nut.spec b/scripts/obs/nut.spec index 5ac2887428..37f8212b82 100644 --- a/scripts/obs/nut.spec +++ b/scripts/obs/nut.spec @@ -140,9 +140,8 @@ Requires: %{_bindir}/pkill Requires: %{_bindir}/readlink Requires: usbutils #%if 0 % {?suse_version} -%if ! 0%{?rhel_version} Requires(post): udev -%endif +#%endif #Requires(post): group(% {NUT_GROUP}) #Requires(post): user(% {NUT_USER}) Requires(postun): %{_bindir}/sh From 67e3fd6ae1d7f4934be18942160a8c5755ad58db Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 7 Nov 2025 15:26:46 +0100 Subject: [PATCH 45/51] Revert "scripts/obs/debian.control: dumb down the libi2c requirement [#1209]" This reverts commit 313e13e8fcae4f59d74ed20da7709d286dee14b7. Dropped NUT CI OBS support for platforms it still refuses to build instead. Signed-off-by: Jim Klimov --- scripts/obs/debian.control | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/obs/debian.control b/scripts/obs/debian.control index 6628969537..21bbcb4aed 100644 --- a/scripts/obs/debian.control +++ b/scripts/obs/debian.control @@ -20,14 +20,13 @@ Build-Depends: debhelper (>= 8.1.3), libfreeipmi-dev (>= 0.8.5) [!hurd-i386], libipmimonitoring-dev (>= 1.1.5-2) [!hurd-i386], libmodbus-dev, - libi2c-dev, + libi2c-dev (>= 4.0), libnss3-dev, libtool, libltdl-dev, liblua5.1-0-dev, lua5.1, pkg-config #python (>= 2.6.6-3~) | python-is-python2 | python-is-python3, #libmodbus-dev (>= 3.1.6), -#libi2c-dev (>= 4.0), Build-Depends-Indep: asciidoc (>= 8.6.3), docbook-xsl, dblatex (>= 0.2.5), @@ -166,8 +165,7 @@ Description: network UPS tools - Modbus drivers Package: nut-linux-i2c Architecture: linux-any -Depends: ${shlibs:Depends}, ${misc:Depends}, nut-server (= ${binary:Version}), libi2c0 -# (>= 4.0) +Depends: ${shlibs:Depends}, ${misc:Depends}, nut-server (= ${binary:Version}), libi2c0 (>= 4.0) Description: network UPS tools - Linux I2C drivers Network UPS Tools (NUT) is a client/server monitoring system that allows computers to share uninterruptible power supply (UPS) and From e48986486c8367e4057798ee05a78427c196da47 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 7 Nov 2025 15:26:50 +0100 Subject: [PATCH 46/51] Revert "scripts/obs/debian.control: dumb down the libmodbus requirement [#1209]" This reverts commit 21e5d7a79d8e3432c6382252c667eae3fb9e6223. Dropped NUT CI OBS support for platforms it still refuses to build instead. Signed-off-by: Jim Klimov --- scripts/obs/debian.control | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/obs/debian.control b/scripts/obs/debian.control index 21bbcb4aed..e14a9b93a3 100644 --- a/scripts/obs/debian.control +++ b/scripts/obs/debian.control @@ -19,14 +19,13 @@ Build-Depends: debhelper (>= 8.1.3), python2 | python3, dh-python | dh-python2 | dh-python3 | dh-pypy, libfreeipmi-dev (>= 0.8.5) [!hurd-i386], libipmimonitoring-dev (>= 1.1.5-2) [!hurd-i386], - libmodbus-dev, + libmodbus-dev (>= 3.1.6), libi2c-dev (>= 4.0), libnss3-dev, libtool, libltdl-dev, liblua5.1-0-dev, lua5.1, pkg-config #python (>= 2.6.6-3~) | python-is-python2 | python-is-python3, -#libmodbus-dev (>= 3.1.6), Build-Depends-Indep: asciidoc (>= 8.6.3), docbook-xsl, dblatex (>= 0.2.5), @@ -151,8 +150,7 @@ Description: network UPS tools - IPMI driver Package: nut-modbus Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, nut-server (= ${binary:Version}), libmodbus5 -# (>= 3.1.6) +Depends: ${shlibs:Depends}, ${misc:Depends}, nut-server (= ${binary:Version}), libmodbus5 (>= 3.1.6) Description: network UPS tools - Modbus drivers Network UPS Tools (NUT) is a client/server monitoring system that allows computers to share uninterruptible power supply (UPS) and From 621e0e71aed71da21521ecf7784ece4b892720d0 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 7 Nov 2025 15:48:21 +0100 Subject: [PATCH 47/51] .github/workflows/01-make-dist.yml: add permissions for delete artifact [#1400] Signed-off-by: Jim Klimov --- .github/workflows/01-make-dist.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/01-make-dist.yml b/.github/workflows/01-make-dist.yml index 0e6c46e09e..5aeace48e8 100644 --- a/.github/workflows/01-make-dist.yml +++ b/.github/workflows/01-make-dist.yml @@ -20,6 +20,7 @@ on: # Allow manually running the action, e.g. if disabled after some quietness in the source permissions: + repo: write contents: read issues: write pull-requests: write @@ -31,6 +32,7 @@ jobs: # NUT build/tooling prereqs (save about 3 minutes per run!) runs-on: ubuntu-latest permissions: + repo: write #actions: read actions: write #contents: read From 6c5a25add60a5c2d40728600afd39050c0852ea5 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 7 Nov 2025 16:04:22 +0100 Subject: [PATCH 48/51] .github/workflows/01-make-dist.yml: try using a custom MAKE_DIST_TOKEN [#1400] Signed-off-by: Jim Klimov --- .github/workflows/01-make-dist.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/01-make-dist.yml b/.github/workflows/01-make-dist.yml index 5aeace48e8..61f3f51ff7 100644 --- a/.github/workflows/01-make-dist.yml +++ b/.github/workflows/01-make-dist.yml @@ -19,6 +19,9 @@ on: workflow_dispatch: # Allow manually running the action, e.g. if disabled after some quietness in the source +# NOTE: These seem to not work for standard GITHUB_TOKEN generated +# for each run, so a MAKE_DIST_TOKEN was made with equivalent list +# of "fine-grained" rules. permissions: repo: write contents: read @@ -55,7 +58,7 @@ jobs: with: comment-tag: latest-tarball message: Dist and Docs will be linked here after the "make dist" job completes. - #github-token: ${{ secrets.GITHUB_TOKEN }} + github-token: ${{ secrets.MAKE_DIST_TOKEN }} - name: "GHA-01: Make dist and docs tarballs - report download URL - s1" uses: marocchino/sticky-pull-request-comment@v2 @@ -65,7 +68,8 @@ jobs: header: latest-tarball-sticky only_create: true message: Dist and Docs will be linked here after the "make dist" job completes. - #github-token: ${{ secrets.GITHUB_TOKEN }} + github-token: ${{ secrets.MAKE_DIST_TOKEN }} + GITHUB_TOKEN: ${{ secrets.MAKE_DIST_TOKEN }} - name: Checkout repository uses: actions/checkout@v5 @@ -249,6 +253,7 @@ jobs: artifact_id: id, }) }) + github-token: ${{ secrets.MAKE_DIST_TOKEN }} - name: Upload tarball and its checksum artifacts uses: actions/upload-artifact@v4 @@ -271,7 +276,7 @@ jobs: with: comment-tag: latest-tarball message: Dist and Docs [NUT-tarballs-${{ steps.subst-github-ref-name.outputs.result }}.zip}](${{ steps.upload_artifact.outputs.artifact-url }}) are available for commit ${{ github.sha }} - #github-token: ${{ secrets.GITHUB_TOKEN }} + github-token: ${{ secrets.MAKE_DIST_TOKEN }} # https://github.com/marocchino/sticky-pull-request-comment - name: "GHA-01: Make dist and docs tarballs - report download URL - s2" @@ -282,3 +287,5 @@ jobs: header: latest-tarball-sticky only_create: true message: Dist and Docs [NUT-tarballs-${{ steps.subst-github-ref-name.outputs.result }}.zip}](${{ steps.upload_artifact.outputs.artifact-url }}) are available for commit ${{ github.sha }} + github-token: ${{ secrets.MAKE_DIST_TOKEN }} + GITHUB_TOKEN: ${{ secrets.MAKE_DIST_TOKEN }} From 267230de49d71fbac2baec4ae9bee42be13a5225 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 7 Nov 2025 16:04:47 +0100 Subject: [PATCH 49/51] Revert ".github/workflows/01-make-dist.yml: add permissions for delete artifact [#1400]" This reverts commit 621e0e71aed71da21521ecf7784ece4b892720d0. Signed-off-by: Jim Klimov --- .github/workflows/01-make-dist.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/01-make-dist.yml b/.github/workflows/01-make-dist.yml index 61f3f51ff7..c5c156a646 100644 --- a/.github/workflows/01-make-dist.yml +++ b/.github/workflows/01-make-dist.yml @@ -23,7 +23,6 @@ on: # for each run, so a MAKE_DIST_TOKEN was made with equivalent list # of "fine-grained" rules. permissions: - repo: write contents: read issues: write pull-requests: write @@ -35,7 +34,6 @@ jobs: # NUT build/tooling prereqs (save about 3 minutes per run!) runs-on: ubuntu-latest permissions: - repo: write #actions: read actions: write #contents: read From 3707ddf446e10142cc212acb0445ec88e18b1b3e Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 7 Nov 2025 17:57:25 +0100 Subject: [PATCH 50/51] .github/workflows/01-make-dist.yml: try pull_request_target again, to use context of the main repo for actions [#1400] Signed-off-by: Jim Klimov --- .github/workflows/01-make-dist.yml | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/workflows/01-make-dist.yml b/.github/workflows/01-make-dist.yml index c5c156a646..afcca1bb20 100644 --- a/.github/workflows/01-make-dist.yml +++ b/.github/workflows/01-make-dist.yml @@ -11,7 +11,7 @@ on: branches: [ "master", "FTY", "fightwarn", "FTY-obs" ] tags: - v* - pull_request: + pull_request_target: # The branches below must be a subset of the branches above branches: [ "master", "FTY", "fightwarn", "FTY-obs" ] schedule: @@ -19,9 +19,6 @@ on: workflow_dispatch: # Allow manually running the action, e.g. if disabled after some quietness in the source -# NOTE: These seem to not work for standard GITHUB_TOKEN generated -# for each run, so a MAKE_DIST_TOKEN was made with equivalent list -# of "fine-grained" rules. permissions: contents: read issues: write @@ -56,7 +53,7 @@ jobs: with: comment-tag: latest-tarball message: Dist and Docs will be linked here after the "make dist" job completes. - github-token: ${{ secrets.MAKE_DIST_TOKEN }} + #github-token: ${{ secrets.MAKE_DIST_TOKEN }} - name: "GHA-01: Make dist and docs tarballs - report download URL - s1" uses: marocchino/sticky-pull-request-comment@v2 @@ -66,8 +63,8 @@ jobs: header: latest-tarball-sticky only_create: true message: Dist and Docs will be linked here after the "make dist" job completes. - github-token: ${{ secrets.MAKE_DIST_TOKEN }} - GITHUB_TOKEN: ${{ secrets.MAKE_DIST_TOKEN }} + #github-token: ${{ secrets.MAKE_DIST_TOKEN }} + #GITHUB_TOKEN: ${{ secrets.MAKE_DIST_TOKEN }} - name: Checkout repository uses: actions/checkout@v5 @@ -251,7 +248,7 @@ jobs: artifact_id: id, }) }) - github-token: ${{ secrets.MAKE_DIST_TOKEN }} + #github-token: ${{ secrets.MAKE_DIST_TOKEN }} - name: Upload tarball and its checksum artifacts uses: actions/upload-artifact@v4 @@ -274,7 +271,7 @@ jobs: with: comment-tag: latest-tarball message: Dist and Docs [NUT-tarballs-${{ steps.subst-github-ref-name.outputs.result }}.zip}](${{ steps.upload_artifact.outputs.artifact-url }}) are available for commit ${{ github.sha }} - github-token: ${{ secrets.MAKE_DIST_TOKEN }} + #github-token: ${{ secrets.MAKE_DIST_TOKEN }} # https://github.com/marocchino/sticky-pull-request-comment - name: "GHA-01: Make dist and docs tarballs - report download URL - s2" @@ -285,5 +282,5 @@ jobs: header: latest-tarball-sticky only_create: true message: Dist and Docs [NUT-tarballs-${{ steps.subst-github-ref-name.outputs.result }}.zip}](${{ steps.upload_artifact.outputs.artifact-url }}) are available for commit ${{ github.sha }} - github-token: ${{ secrets.MAKE_DIST_TOKEN }} - GITHUB_TOKEN: ${{ secrets.MAKE_DIST_TOKEN }} + #github-token: ${{ secrets.MAKE_DIST_TOKEN }} + #GITHUB_TOKEN: ${{ secrets.MAKE_DIST_TOKEN }} From 8c5f6c7bb1fa750955b818034fed4b6048318a82 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 7 Nov 2025 18:09:20 +0100 Subject: [PATCH 51/51] .github/workflows/01-make-dist.yml: refer to links from GH checks entry title [#1400] We have hit some snags about changing the artifact history or adding PR comments, at least before initially merging the first PR that adds this workflow (so `pull_request_target` has something to run from the master branch at all). Even if this turns out to be the end of the road, at least this way we can let people know where to find those generated tarballs :) Signed-off-by: Jim Klimov --- .github/workflows/01-make-dist.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/01-make-dist.yml b/.github/workflows/01-make-dist.yml index afcca1bb20..5993f3e6b5 100644 --- a/.github/workflows/01-make-dist.yml +++ b/.github/workflows/01-make-dist.yml @@ -4,7 +4,7 @@ # See also: # https://github.com/actions/upload-artifact # https://docs.github.com/en/actions/reference/workflows-and-actions/variables -name: "GHA-01: Make dist and docs tarballs" +name: "GHA-01: Make dist and docs tarballs, see workflow page for links" on: push: