Skip to content

Commit

Permalink
Merge branch 'master' into invt_modbus
Browse files Browse the repository at this point in the history
  • Loading branch information
jimklimov authored Feb 27, 2024
2 parents 3e0b66a + d14e31c commit 29c02d8
Show file tree
Hide file tree
Showing 363 changed files with 33,903 additions and 9,259 deletions.
2 changes: 2 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
of "real" changes in the other commits. Similarly for typo fixes in
comments or text documents.

- [ ] Please star NUT on GitHub, this helps with sponsorships! ;)

## Frequent "underwater rocks" for driver addition/update PRs

- [ ] Revised existing driver families and added a sub-driver if applicable
Expand Down
78 changes: 78 additions & 0 deletions .github/workflows/PyNUTClient.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: 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/

# NOTE: We may need to split this workflow into two files to do only
# paths for master branch, and run always for (release) tags?
on:
push:
paths:
- 'scripts/python/module/*'
- '.github/workflows/PyNUTClient.yml'
tags:
- '*'
branches:
- 'master'

permissions:
id-token: write

jobs:
build-n-publish:
if: github.repository_owner == 'networkupstools'
name: Build and publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
fetch-depth: 0
fetch-tags: true
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: Extract python interpreter path name
id: pythoncmd
run: >-
set -x ;
echo "PYTHON=$(command -v python)" >> $GITHUB_OUTPUT
- name: Extract tag name
id: tag
# Note: this is all a single shell line in the end,
# so we need semicolons between commands!
run: >-
set -x ;
TAG_NAME="$(echo $GITHUB_REF | cut -d / -f 3)" ;
if [ x"$TAG_NAME" = xmaster ]; then
{ TAG_NAME="$(git describe --tags --match 'v[0-9]*.[0-9]*.[0-9]' --exclude '*-signed' --exclude '*rc*' --exclude '*alpha*' --exclude '*beta*')" \
|| TAG_NAME="$(git describe --tags --exclude '*rc*' --exclude '*alpha*' --exclude '*beta*' --exclude '*Windows*' --exclude '*IPM*')" ; } \
&& test -n "${TAG_NAME}" \
|| TAG_NAME="2.8.1-`TZ=UTC date +%s`" ;
fi >&2 ;
TAG_NAME="$(echo "$TAG_NAME" | sed -e 's/^v\([0-9]\)/\1/' -e 's,^.*/,,' -e 's/^v//' -e 's/-g.*$//' -e 's/-/./g')" ;
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_OUTPUT
- name: Install pypa/setuptools
run: >-
${{ steps.pythoncmd.outputs.PYTHON }} -m
pip install wheel build
- name: Prepare source layout and Build a binary wheel
run: >-
set -e ;
cd scripts/python/module ;
cp -f Makefile.am Makefile ;
make -f Makefile.am clean-local dist NUT_SOURCE_GITREV_NUMERIC="${{ steps.tag.outputs.TAG_NAME }}" PYTHON="${{ steps.pythoncmd.outputs.PYTHON }}" top_srcdir="../../.." srcdir="." builddir="." ;
find . -ls
- name: Publish master distribution 📦 to Test PyPI
# https://github.com/pypa/gh-action-pypi-publish
if: ${{ !startsWith(github.ref, 'refs/tags') }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: scripts/python/module/dist
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
- name: Publish tagged release distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: scripts/python/module/dist
password: ${{ secrets.PYPI_API_TOKEN }}
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -57,7 +57,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
Expand All @@ -70,6 +70,6 @@ jobs:
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Makefile.in
/missing
/test-driver
*-spellchecked
*-prepped
*.adoc-parsed
*.adoc*.tmp
*.txt*.tmp
Expand Down
6 changes: 3 additions & 3 deletions INSTALL.nut.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -633,8 +633,8 @@ It should currently be possible to build the codebase in native Windows
with MSYS2/MinGW and cross-building from Linux with mingw (preferably
in a Debian/Ubuntu container). Refer to
link:config-prereqs.txt[Prerequisites for building NUT on different OSes]
and link:scripts/Windows/README[scripts/Windows/README file] for respective
build environment preparation instructions.
and link:scripts/Windows/README.adoc[scripts/Windows/README.adoc file]
for respective build environment preparation instructions.
Note that to use NUT for Windows, non-system dependency DLL files must
be located in same directory as each EXE file that uses them. This can be
Expand Down Expand Up @@ -679,7 +679,7 @@ Building for Windows

For suggestions about setting up the NUT build environment variants
for Windows, please see link:docs/config-prereqs.txt and/or
link:scripts/Windows/README files. Note this is rather experimental
link:scripts/Windows/README.adoc files. Note this is rather experimental
at this point.


Expand Down
22 changes: 20 additions & 2 deletions Jenkinsfile-dynamatrix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ def buildCommit = '86a32237c7df45c5aba640746f7afc4de09505a1'

// See https://github.com/networkupstools/jenkins-dynamatrix/ for the lib
// Agent setup evolves at https://ci.networkupstools.org/computer/
@Library('jenkins-dynamatrix') _
// NOTE: The "${BRANCH_NAME}" below IS NOT A VARIABLE!
// Special notation per custom plugin build including changes from
// https://github.com/jenkinsci/pipeline-groovy-lib-plugin/pull/19/
@Library('jenkins-dynamatrix@${BRANCH_NAME}') _
import org.nut.dynamatrix.dynamatrixGlobalState;
import org.nut.dynamatrix.*;

Expand All @@ -27,6 +30,13 @@ import org.nut.dynamatrix.*;
dynacfgPipeline.disableSlowBuildCIBuild = false
dynacfgPipeline.disableSlowBuildCIBuildExperimental = false

// NOTE: Disabled by default because with -std=c* the compiler and linker
// (at least on environments NUT CI farm has) do not "see" many things,
// and do not even define WIN32, and this is unrelated to NUT codebase.
// This toggle aims to only disable 'c' builds in the scenario; but the
//'gnu' ones should still happen if it is enabled overall.
dynacfgPipeline.disableStrictCIBuild_CrossWindows = true

// At this time, GCC succeeds building C89/GNU89 mode for NUT
// while CLANG complains about things we can't fix easily.
dynacfgPipeline.axisCombos_COMPILER_GCC = [~/COMPILER=GCC/]
Expand Down Expand Up @@ -1218,7 +1228,7 @@ set | sort -n """
dynamatrixAxesVirtualLabelsMap: [
'BITS': [64, 32],
'CSTDVERSION_${KEY}': [ ['c': '99', 'cxx': '11'] ],
'CSTDVARIANT': ['c', 'gnu'],
'CSTDVARIANT': ['gnu'] + (dynacfgPipeline.disableStrictCIBuild_CrossWindows ? [] : ['c']),
],
dynamatrixAxesCommonEnv: [
['LANG=C','LC_ALL=C','TZ=UTC',
Expand Down Expand Up @@ -1285,6 +1295,14 @@ if ( env?.BRANCH_NAME ==~ /.*verbose.*/ )
dynamatrixGlobalState.enableDebugErrors = true
dynamatrixGlobalState.enableDebugMilestones = true
dynamatrixGlobalState.enableDebugMilestonesDetails = true
dynamatrixGlobalState.enableDebugTraceGithubStatusHighlights = true
}

//if (true) // <<< (Un-)comment away in select runs/branches
//if (false) // <<< (Un-)comment away in select runs/branches
if ( env?.BRANCH_NAME ==~ /.*fightwarn.*/ )
{
dynamatrixGlobalState.enableDebugTraceGithubStatusHighlights = true
}

dynamatrixPipeline(dynacfgBase, dynacfgPipeline)
95 changes: 65 additions & 30 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# top-level Makefile for NUT

# Export certain values for ccache which NUT ci_build.sh can customize,
# to facilitate developer iteration re-runs of "make" later.
# At least GNU and BSD make implementations are okay with this syntax.
@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_NAMESPACE=@CCACHE_NAMESPACE@
@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_BASEDIR=@CCACHE_BASEDIR@
@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_DIR=@CCACHE_DIR@
@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_PATH=@CCACHE_PATH@
@NUT_AM_MAKE_CAN_EXPORT@export PATH=@PATH_DURING_CONFIGURE@

# include directory for aclocal
ACLOCAL_AMFLAGS = -I m4

Expand Down Expand Up @@ -65,11 +74,11 @@ DISTCHECK_CONFIGURE_FLAGS = ${DISTCHECK_FLAGS} \
--with-pynut=app --with-nut_monitor=force

distcheck-light:
$(MAKE) $(AM_MAKEFLAGS) DISTCHECK_FLAGS="$(DISTCHECK_LIGHT_FLAGS)" distcheck
+$(MAKE) $(AM_MAKEFLAGS) DISTCHECK_FLAGS="$(DISTCHECK_LIGHT_FLAGS)" distcheck

# Make a distcheck (and check in particular) with enabled valgrind and debug info
memcheck distcheck-valgrind:
$(MAKE) $(AM_MAKEFLAGS) DISTCHECK_FLAGS="$(DISTCHECK_VALGRIND_FLAGS)" distcheck
+$(MAKE) $(AM_MAKEFLAGS) DISTCHECK_FLAGS="$(DISTCHECK_VALGRIND_FLAGS)" distcheck

# workaround the dist generated files that are also part of the distribution
# Note that distcleancheck is disabled for now, while waiting for a proper
Expand Down Expand Up @@ -117,23 +126,38 @@ maintainer-clean-local:
# should be available during their clean-up). Just in case, we make sure
# here that their sub-distcleans complete first.
distclean-local:
@for DIR in $(SUBDIRS) ; do \
+@for DIR in $(SUBDIRS) ; do \
if test -f "$${DIR}/Makefile" ; then \
echo " DISTCLEAN in $${DIR}" >&2 ; \
( cd "$${DIR}" && $(MAKE) -s distclean ) || exit ; \
( cd "$${DIR}" && $(MAKE) $(AM_MAKEFLAGS) -s distclean ) || exit ; \
fi ; \
done
$(AM_V_at)rm -rf .inst tmp autom4te.cache
$(AM_V_at)find "$(builddir)" -type d -name '.deps' | while read DIR ; do rm -rf "$${DIR}" ; done

# Hook the documentation building and validating recipes
# Note: these are optionally available (as determined during configure runs)
# Maint: grep -l 'SPELLCHECK_' `git grep -lw spellcheck '*.am'`
spellcheck spellcheck-interactive:
@RES=0; \
(cd $(builddir)/docs && $(MAKE) -s $@) || RES=$$? ; \
(cd $(builddir)/docs/man && $(MAKE) -s $@) || RES=$$? ; \
(cd $(builddir)/conf && $(MAKE) -s $@) || RES=$$? ; \
(cd $(builddir)/data && $(MAKE) -s $@) || RES=$$? ; \
+@RES=0; \
(cd $(builddir)/docs && $(MAKE) $(AM_MAKEFLAGS) -s $(abs_top_builddir)/docs/.prep-src-docs) || RES=$$? ; \
(cd $(builddir)/docs/man && $(MAKE) $(AM_MAKEFLAGS) -s $(abs_top_builddir)/docs/.prep-src-docs) || RES=$$? ; \
(cd $(builddir)/docs && $(MAKE) $(AM_MAKEFLAGS) -s $@) || RES=$$? ; \
(cd $(builddir)/docs/man && $(MAKE) $(AM_MAKEFLAGS) -s $@) || RES=$$? ; \
(cd $(builddir)/conf && $(MAKE) $(AM_MAKEFLAGS) -s $@) || RES=$$? ; \
(cd $(builddir)/data && $(MAKE) $(AM_MAKEFLAGS) -s $@) || RES=$$? ; \
(cd $(builddir)/data/html && $(MAKE) $(AM_MAKEFLAGS) -s $@) || RES=$$? ; \
(cd $(builddir)/scripts && $(MAKE) $(AM_MAKEFLAGS) -s $@) || RES=$$? ; \
(cd $(builddir)/scripts/Solaris && $(MAKE) $(AM_MAKEFLAGS) -s $@) || RES=$$? ; \
(cd $(builddir)/scripts/Windows && $(MAKE) $(AM_MAKEFLAGS) -s $@) || RES=$$? ; \
(cd $(builddir)/scripts/devd && $(MAKE) $(AM_MAKEFLAGS) -s $@) || RES=$$? ; \
(cd $(builddir)/scripts/hotplug && $(MAKE) $(AM_MAKEFLAGS) -s $@) || RES=$$? ; \
(cd $(builddir)/scripts/installer && $(MAKE) $(AM_MAKEFLAGS) -s $@) || RES=$$? ; \
(cd $(builddir)/scripts/python && $(MAKE) $(AM_MAKEFLAGS) -s $@) || RES=$$? ; \
(cd $(builddir)/scripts/systemd && $(MAKE) $(AM_MAKEFLAGS) -s $@) || RES=$$? ; \
(cd $(builddir)/scripts/udev && $(MAKE) $(AM_MAKEFLAGS) -s $@) || RES=$$? ; \
(cd $(builddir)/scripts/upsdrvsvcctl && $(MAKE) $(AM_MAKEFLAGS) -s $@) || RES=$$? ; \
(cd $(builddir)/tests/NIT && $(MAKE) $(AM_MAKEFLAGS) -s $@) || RES=$$? ; \
exit $$RES

# Note: the "all-docs" and "check-docs" targets may require tools not
Expand All @@ -144,10 +168,10 @@ spellcheck spellcheck-interactive:
doc spellcheck-sortdict \
all-docs check-docs \
man all-man man-man check-man man-html all-html:
cd $(builddir)/docs && $(MAKE) $@
+cd $(builddir)/docs && $(MAKE) $(AM_MAKEFLAGS) $@

INSTALL.nut UPGRADING NEWS README:
cd $(builddir)/docs && $(MAKE) ../$(@F).adoc-parsed && cp -f ../$(@F).adoc-parsed ../$(@F)
+cd $(builddir)/docs && $(MAKE) $(AM_MAKEFLAGS) ../$(@F).adoc-parsed && cp -f ../$(@F).adoc-parsed ../$(@F)

# Workarounds for https://github.com/github/markup/issues/1095
# require direct definition of our attributes in each source
Expand Down Expand Up @@ -203,7 +227,7 @@ maintainer-asciidocs:
)

check-NIT check-NIT-devel:
cd $(builddir)/tests/NIT && $(MAKE) $@
+cd $(builddir)/tests/NIT && $(MAKE) $(AM_MAKEFLAGS) $@

# This target adds syntax-checking for committed shell script files,
# to avoid surprises and delays in finding fatal typos after packaging
Expand Down Expand Up @@ -277,7 +301,7 @@ cppcheck:
endif !HAVE_CPPCHECK

sockdebug:
cd $(builddir)/server && $(MAKE) $(AM_MAKEFLAGS) sockdebug$(EXEEXT)
+cd $(builddir)/server && $(MAKE) $(AM_MAKEFLAGS) sockdebug$(EXEEXT)

# ----------------------------------------------------------------------
# Automatically generate the ChangeLog from Git logs:
Expand All @@ -293,18 +317,29 @@ GITLOG_START_POINT=v2.6.0

# Force ChangeLog regeneration upon make dist (due to nonexistant 'dummy-stamp'),
# in case it has already been generated previously
# Note that the script is hard-coded to generate "ChangeLog" in the current dir
# Note that the script is hard-coded to inspect Git workspace which contains
# the current dir, and defaults to generate a "ChangeLog" in the current dir.
# The script itself is generated from a template, so resides in builddir.
dummy-stamp:
ChangeLog: tools/gitlog2changelog.py dummy-stamp
cd $(top_builddir) && \
./tools/gitlog2changelog.py $(GITLOG_START_POINT) || \
{ echo "gitlog2changelog.py failed to generate the ChangeLog. See https://github.com/networkupstools/nut/commits/master" > $@ ; }
cd $(abs_top_srcdir) && \
if test -e .git ; then \
CHANGELOG_FILE="$@" $(abs_top_builddir)/tools/gitlog2changelog.py $(GITLOG_START_POINT) || \
{ printf "gitlog2changelog.py failed to generate the ChangeLog.\n\nNOTE: See https://github.com/networkupstools/nut/commits/master for change history.\n\n" > "$@" ; } ; \
else \
if ! test -s "$@" ; then \
printf "Failed to generate the ChangeLog.\n\nNOTE: See https://github.com/networkupstools/nut/commits/master for change history.\n\n" > "$@" ; \
fi ; \
fi

ChangeLog.adoc: ChangeLog
+cd $(abs_top_builddir)/docs && $(MAKE) $(AM_MAKEFLAGS) ../ChangeLog.adoc

nut_version.h include/nut_version.h:
cd $(abs_top_builddir)/include && $(MAKE) nut_version.h
+cd $(abs_top_builddir)/include && $(MAKE) $(AM_MAKEFLAGS) nut_version.h

tools/gitlog2changelog.py: tools/gitlog2changelog.py.in
cd $(@D) && $(MAKE) -s $(@F)
+cd $(@D) && $(MAKE) $(AM_MAKEFLAGS) -s $(@F)

# ----------------------------------------------------------------------
# Maintainers targets: distribution signature and hashes
Expand All @@ -330,35 +365,35 @@ build:
@echo $(WARN)
@echo "Warning: 'make build' is deprecated. Use 'make all' instead."
@echo $(WARN)
$(MAKE) $(AM_MAKEFLAGS) all
+$(MAKE) $(AM_MAKEFLAGS) all
install-bin:
@echo $(WARN)
@echo "Warning: 'make install-bin' is deprecated."
@echo "Use 'make install-exec' instead for a similar effect."
@echo $(WARN)
cd common; $(MAKE) $(AM_MAKEFLAGS) install
cd drivers; $(MAKE) $(AM_MAKEFLAGS) install
cd server; $(MAKE) $(AM_MAKEFLAGS) install
cd clients; $(MAKE) $(AM_MAKEFLAGS) install
+cd common; $(MAKE) $(AM_MAKEFLAGS) install
+cd drivers; $(MAKE) $(AM_MAKEFLAGS) install
+cd server; $(MAKE) $(AM_MAKEFLAGS) install
+cd clients; $(MAKE) $(AM_MAKEFLAGS) install
install-man: install-data-recursive
@echo $(WARN)
@echo "Warning: 'make install-man' is deprecated."
@echo "Use 'cd man; make install' instead."
@echo $(WARN)
cd man; $(MAKE) $(AM_MAKEFLAGS) install
+cd man; $(MAKE) $(AM_MAKEFLAGS) install
install-conf:
@echo $(WARN)
@echo "Warning: 'make install-conf' is deprecated."
@echo "Use 'cd conf; make install' instead."
@echo $(WARN)
cd conf; $(MAKE) $(AM_MAKEFLAGS) install
+cd conf; $(MAKE) $(AM_MAKEFLAGS) install
# The target install-data already has a standardized meaning under automake
install-dirs:
@echo $(WARN)
@echo "Warning: 'make install-dirs' is deprecated."
@echo "Use 'make installdirs' instead."
@echo $(WARN)
$(MAKE) installdirs
+$(MAKE) installdirs
cgi build-cgi install-cgi install-cgi-dir install-cgi-bin \
install-cgi-man install-cgi-conf install-cgi-html:
@echo "Error: 'make $@' no longer exists."
Expand Down Expand Up @@ -393,7 +428,7 @@ MAINTAINERCLEANFILES += $(MAINTAINERCLEANFILES_DISTBALL)
MAINTAINERCLEANFILES += $(MAINTAINERCLEANFILES_PACKAGES)

package: dist
DESTDIR="$(abs_builddir)/_install_pkgprotodir" ; export DESTDIR; \
+DESTDIR="$(abs_builddir)/_install_pkgprotodir" ; export DESTDIR; \
rm -rf "$$DESTDIR"; \
case "`uname -s`" in \
"HP-UX") \
Expand Down Expand Up @@ -433,8 +468,8 @@ if HAVE_WINDOWS
# anything.
install-win-bundle: all
@if test -z "$(DESTDIR)" ; then echo "ERROR: '$@': Bundle may only be installed to some DESTDIR prototype area'" >&2 ; exit 1; fi
$(MAKE) $(AM_MAKEFLAGS) DESTDIR='$(DESTDIR)' install
$(MAKE) $(AM_MAKEFLAGS) DESTDIR='$(DESTDIR)' install-win-bundle-thirdparty
+$(MAKE) $(AM_MAKEFLAGS) DESTDIR='$(DESTDIR)' install
+$(MAKE) $(AM_MAKEFLAGS) DESTDIR='$(DESTDIR)' install-win-bundle-thirdparty

install-win-bundle-thirdparty:
@if test -z "$(DESTDIR)" ; then echo "ERROR: '$@': Bundle may only be installed to some DESTDIR prototype area'" >&2 ; exit 1; fi
Expand Down
Loading

0 comments on commit 29c02d8

Please sign in to comment.