diff --git a/Jenkinsfile-dynamatrix b/Jenkinsfile-dynamatrix index 1f3b651b7c..570483b9fd 100644 --- a/Jenkinsfile-dynamatrix +++ b/Jenkinsfile-dynamatrix @@ -385,7 +385,7 @@ set | sort -n """ //dynamatrixAxesLabels: ['OS_FAMILY', 'OS_DISTRO', '${COMPILER}VER', 'ARCH${ARCH_BITS}'], //dynamatrixAxesLabels: [~/^OS/, '${COMPILER}VER', 'ARCH${ARCH_BITS}'], excludeCombos: dynacfgPipeline.excludeCombos_DEFAULT_STRICT_C - + [[~/OS_DISTRO=netbsd/]] // commented in detail below + + [[~/OS_DISTRO=(macos|netbsd)/]] // commented in detail below + [dynacfgPipeline.axisCombos_WINDOWS_CROSS] ], body) }, // getParStages @@ -432,7 +432,7 @@ set | sort -n """ //dynamatrixAxesLabels: ['OS_FAMILY', 'OS_DISTRO', '${COMPILER}VER', 'ARCH${ARCH_BITS}'], //dynamatrixAxesLabels: [~/^OS/, '${COMPILER}VER', 'ARCH${ARCH_BITS}'], excludeCombos: dynacfgPipeline.excludeCombos_DEFAULT_STRICT_C - + [[~/OS_DISTRO=netbsd/]] // commented in detail below + + [[~/OS_DISTRO=(macos|netbsd)/]] // commented in detail below + [dynacfgPipeline.axisCombos_WINDOWS_CROSS] ], body) }, // getParStages diff --git a/Makefile.am b/Makefile.am index 5d2043504c..9b42b1d84c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -73,6 +73,7 @@ SUBDIRS_ALL_LIBS_LOCAL = \ all-libs-local/clients \ all-libs-local/drivers \ all-libs-local/tests \ + all-libs-local/tools \ all-libs-local/tools/nut-scanner # First target often defines default behavior, and in automake is always at least: @@ -93,19 +94,19 @@ SUBDIR_MAKE_VERBOSE = default all-fanout-maybe: +@if [ x"$(NUT_MAKE_SKIP_FANOUT)" = xtrue ] ; then \ if [ x"$(SUBDIR_MAKE_VERBOSE)" != x0 ] ; then \ - echo " SUBDIR-MAKE $@: skip optimization for parallel make - NUT_MAKE_SKIP_FANOUT is set" ; \ + echo " SUBDIR-MAKE $@: skip optimization for parallel make - NUT_MAKE_SKIP_FANOUT is set" ; \ fi ; \ exit 0 ; \ fi ; \ case "-$(MAKEFLAGS) $(AM_MAKEFLAGS)" in \ *-j|*-j" "*|*-{j,l}{0,1,2,3,4,5,6,7,8,9}*|*-[jl][0123456789]*|*{-l,--jobs,--load-average,--max-load}" "{-,0,1,2,3,4,5,6,7,8,9}*|*--jobserver*|*--jobs" "[0123456789]*|*--load-average" "[0123456789]*|*--max-load" "[0123456789]*) \ if [ x"$(SUBDIR_MAKE_VERBOSE)" != x0 ] ; then \ - echo " SUBDIR-MAKE $@: implement optimization for parallel make as 'make all-fanout-subdirs'" ; \ + echo " SUBDIR-MAKE $@: implement optimization for parallel make as 'make all-fanout-subdirs'" ; \ fi ; \ $(MAKE) $(AM_MAKEFLAGS) all-fanout-subdirs ;; \ *) \ if [ x"$(SUBDIR_MAKE_VERBOSE)" != x0 ] ; then \ - echo " SUBDIR-MAKE $@: skip optimization for parallel make - we seem to run sequentially now, seen MAKEFLAGS='$(MAKEFLAGS)' AM_MAKEFLAGS='$(AM_MAKEFLAGS)'" ; \ + echo " SUBDIR-MAKE $@: skip optimization for parallel make - we seem to run sequentially now, seen MAKEFLAGS='$(MAKEFLAGS)' AM_MAKEFLAGS='$(AM_MAKEFLAGS)'" ; \ fi ;; \ esac @@ -175,12 +176,12 @@ SUBDIR_TGT_RULE = ( \ [ x"$${TGT-}" != x ] || TGT="`echo '$@' | awk -F/ '{print $$1}'`" ; \ [ x"$${DIR-}" != x ] || DIR="`echo '$@' | sed 's,^[^/]*/,,'`" ; \ if [ x"$(SUBDIR_MAKE_VERBOSE)" != x0 ] ; then \ - echo " SUBDIR-MAKE STARTING: 'make $$TGT' in $$DIR ..." ; \ + echo " SUBDIR-MAKE STARTING: 'make $$TGT' in $$DIR ..." ; \ fi ; \ cd "$(abs_builddir)/$${DIR}" && \ - $(MAKE) $(AM_MAKEFLAGS) $${SUBDIR_TGT_MAKEFLAGS-} "$${TGT}" || { RES=$$?; echo " SUBDIR-MAKE FAILURE: 'make $$TGT' in $$DIR" >&2 ; exit $$RES ; } ; \ + $(MAKE) $(AM_MAKEFLAGS) $${SUBDIR_TGT_MAKEFLAGS-} "$${TGT}" || { RES=$$?; echo " SUBDIR-MAKE FAILURE: 'make $$TGT' in $$DIR" >&2 ; exit $$RES ; } ; \ if [ x"$(SUBDIR_MAKE_VERBOSE)" != x0 ] ; then \ - echo " SUBDIR-MAKE SUCCESS: 'make $$TGT' in $$DIR" ; \ + echo " SUBDIR-MAKE SUCCESS: 'make $$TGT' in $$DIR" ; \ fi ; \ ) @@ -229,15 +230,23 @@ all-libs-local/drivers: all-libs-local/common all-libs-local/tests: all-libs-local/common +@$(SUBDIR_TGT_RULE) +### Delivers: generated sources and/or headers for nut-scanner +### No dependencies: actually runs as part of autogen.sh but may be +### re-run during development when USB or SNMP driver sources change. +all-libs-local/tools: + +@$(SUBDIR_TGT_RULE) + ### Delivers: libnutscan.la ### LIB-Requires-ext: drivers/libserial-nutscan.la ### LIB-Requires-ext: common/libnutwincompat.la common/libcommonstr.la ### HDR-Requires-ext: clients/libupsclient-version.h +### HDR-Requires-ext: nut-scanner/nutscan-snmp.h nut-scanner/nutscan-usb.h +### (generated by nut-scanner-deps/tools aliased as all-libs-local/tools) ### Requires-int: libnutscan.la ### Note: indirectly (ltdl) may use installed libupsclient.so ### however does directly use libupsclient-version.h ### for hints to find it at run-time -all-libs-local/tools/nut-scanner: all-libs-local/drivers all-libs-local/common all-libs-local/clients +all-libs-local/tools/nut-scanner: all-libs-local/drivers all-libs-local/common all-libs-local/clients all-libs-local/tools +@$(SUBDIR_TGT_RULE) # Handle all SUBDIRS_ALL_RECURSIVE in a way that dependencies can be specified, @@ -543,7 +552,7 @@ else !HAVE_VALGRIND memcheck distcheck-valgrind: @echo "Starting $@" >&2 @echo "See also scripts/valgrind in NUT sources for a helper tool" - @echo "SKIPPED $@ : valgrind was not detected on this system by configure script" >&2 + @echo " SKIP $@ : valgrind was not detected on this system by configure script" >&2 endif !HAVE_VALGRIND # workaround the dist generated files that are also part of the distribution @@ -594,7 +603,7 @@ maintainer-clean-local: distclean-local: +@for DIR in $(SUBDIRS) ; do \ if test -f "$${DIR}/Makefile" ; then \ - echo " DISTCLEAN in $${DIR}" >&2 ; \ + echo " DISTCLEAN in $${DIR}" >&2 ; \ ( cd "$${DIR}" && $(MAKE) $(AM_MAKEFLAGS) -s distclean ) || exit ; \ fi ; \ done @@ -648,7 +657,7 @@ spellcheck spellcheck-interactive: if [ x"$(NUT_MAKE_SKIP_FANOUT)" = xtrue ] ; then \ RES=0 ; \ if [ x"$(SUBDIR_MAKE_VERBOSE)" != x0 ] ; then \ - echo " SUBDIR-MAKE $@: skip optimization for parallel make - NUT_MAKE_SKIP_FANOUT is set" ; \ + echo " SUBDIR-MAKE $@: skip optimization for parallel make - NUT_MAKE_SKIP_FANOUT is set" ; \ fi ; \ (cd $(builddir)/docs && $(MAKE) $(AM_MAKEFLAGS) -k -s $(abs_top_builddir)/docs/.prep-src-docs) || RES=$$? ; \ (cd $(builddir)/docs/man && $(MAKE) $(AM_MAKEFLAGS) -k -s $(abs_top_builddir)/docs/man/.prep-src-docs) || RES=$$? ; \ @@ -914,26 +923,26 @@ $(abs_top_builddir)/ChangeLog: tools/gitlog2changelog.py dummy-stamp if test -e .git ; then \ NUT_GITDIR=".git" ; if test -r "$${NUT_GITDIR}" -a ! -d "$${NUT_GITDIR}" ; then GD="`grep -E '^gitdir:' "$${NUT_GITDIR}" | sed 's/^gitdir: *//'`" && test -n "$$GD" -a -d "$$GD" && NUT_GITDIR="$$GD" ; fi ; \ if test -s "$@" -a -d "$${NUT_GITDIR}" && test -z "`find "$${NUT_GITDIR}" -newer "$@" 2>/dev/null`" ; then \ - echo " DOC-CHANGELOG-GENERATE $@ : SKIP (keep existing)" ; \ + echo " DOC-CHANGELOG-GENERATE $@ : SKIP (keep existing)" ; \ echo "Using still-valid ChangeLog file generated earlier from same revision of Git source metadata in '$${NUT_GITDIR}'" >&2 ; \ else \ if test -s "$@" ; then \ - echo " DOC-CHANGELOG-GENERATE $@ : RE-GENERATE (older than Git workspace metadata) ..." ; \ + echo " DOC-CHANGELOG-GENERATE $@ : RE-GENERATE (older than Git workspace metadata) ..." ; \ else \ - echo " DOC-CHANGELOG-GENERATE $@ : GENERATE (currently absent) ..." ; \ + echo " DOC-CHANGELOG-GENERATE $@ : GENERATE (currently absent) ..." ; \ fi ; \ CHANGELOG_FILE="$@" $(WITH_PDF_NONASCII_TITLES_ENVVAR) \ CHANGELOG_REQUIRE_GROUP_BY_DATE_AUTHOR="$(CHANGELOG_REQUIRE_GROUP_BY_DATE_AUTHOR_ENVVAR)" \ $(abs_top_builddir)/tools/gitlog2changelog.py $(GITLOG_START_POINT) \ - && { echo " DOC-CHANGELOG-GENERATE $@ : SUCCESS"; } \ + && { echo " DOC-CHANGELOG-GENERATE $@ : SUCCESS"; } \ || { \ - echo " DOC-CHANGELOG-GENERATE $@ : FAILED (non-fatal)" >&2 ; \ + echo " DOC-CHANGELOG-GENERATE $@ : FAILED (non-fatal)" >&2 ; \ printf "gitlog2changelog.py failed to generate the ChangeLog.\n\nNOTE: See https://github.com/networkupstools/nut/commits/master for change history.\n\n" > "$@" ; \ } ; \ fi ; \ else \ if test x"$(abs_top_srcdir)" != x"$(abs_top_builddir)" -a -s ./ChangeLog ; then \ - echo " DOC-CHANGELOG-GENERATE $@ : SKIP (keep existing)" ; \ + echo " DOC-CHANGELOG-GENERATE $@ : SKIP (keep existing)" ; \ if ! diff ./ChangeLog "$@" >/dev/null 2>/dev/null ; then \ echo "Using distributed ChangeLog file from sources (and builddir is not srcdir)" >&2 ; \ rm -f "$@" || true ; \ @@ -943,10 +952,10 @@ $(abs_top_builddir)/ChangeLog: tools/gitlog2changelog.py dummy-stamp fi ; \ else \ if test -s "$@" ; then \ - echo " DOC-CHANGELOG-GENERATE $@ : SKIP (keep existing)" ; \ + echo " DOC-CHANGELOG-GENERATE $@ : SKIP (keep existing)" ; \ echo "Using distributed ChangeLog file from sources (and builddir is srcdir)" >&2 ; \ else \ - echo " DOC-CHANGELOG-GENERATE $@ : FAILED (non-fatal)" >&2 ; \ + echo " DOC-CHANGELOG-GENERATE $@ : FAILED (non-fatal)" >&2 ; \ printf "Failed to generate the ChangeLog.\n\nNOTE: See https://github.com/networkupstools/nut/commits/master for change history.\n\n" > "$@" ; \ fi ; \ fi ; \ @@ -1134,41 +1143,41 @@ install-as-root: exit ; \ fi ; \ fi ; \ - echo " MKDIR $(DESTDIR)/@STATEPATH@ $(DESTDIR)/@STATEPATH@/upssched" >&2 ; \ + echo " MKDIR $(DESTDIR)/@STATEPATH@ $(DESTDIR)/@STATEPATH@/upssched" >&2 ; \ $(MKDIR_P) "$(DESTDIR)/@STATEPATH@/upssched" && \ for D in "@PIDPATH@" "@ALTPIDPATH@" "@ALTSTATEPATH@" "@CONFPATH@" ; do \ case x"$$D" in \ x|x@*) ;; \ - *) echo " MKDIR $(DESTDIR)/$$D" >&2 ; \ + *) echo " MKDIR $(DESTDIR)/$$D" >&2 ; \ $(MKDIR_P) "$(DESTDIR)/$$D" \ || exit ;; \ esac ; \ done ; \ if (command -v chmod) ; then \ - echo " CHMOD(0770) $(DESTDIR)/@STATEPATH@/upssched" >&2 ; \ + echo " CHMOD(0770) $(DESTDIR)/@STATEPATH@/upssched" >&2 ; \ chmod 0770 "$(DESTDIR)/@STATEPATH@/upssched" \ || exit ; \ for D in "@STATEPATH@" "@PIDPATH@" "@ALTPIDPATH@" "@ALTSTATEPATH@" ; do \ case x"$$D" in \ x|x@*|x/run|x/var/run|x/tmp|x/var/tmp|x/dev/shm|x/etc|x/var|x/usr|x/usr/local|x/usr/local/etc|x/usr/etc) ;; \ - *) echo " CHMOD(0770) $(DESTDIR)/$$D" >&2 ; \ + *) echo " CHMOD(0770) $(DESTDIR)/$$D" >&2 ; \ chmod 0770 "$(DESTDIR)/$$D" \ || exit ;; \ esac ; \ done ; \ case x"@CONFPATH@" in \ x|x@*|x/run|x/var/run|x/tmp|x/var/tmp|x/dev/shm|x/etc|x/var|x/usr|x/usr/local|x/usr/local/etc|x/usr/etc) ;; \ - *) echo " CHMOD(0751) $(DESTDIR)/@CONFPATH@" >&2 ; \ + *) echo " CHMOD(0751) $(DESTDIR)/@CONFPATH@" >&2 ; \ chmod 0751 "$(DESTDIR)/@CONFPATH@" \ || exit ;; \ esac ; \ for F in hosts.conf.sample upsstats-single.html.sample upsstats.html.sample upsset.conf.sample ; do \ - echo " CHMOD(0644) CGI: $(DESTDIR)/@CONFPATH@/$$F" >&2 ; \ + echo " CHMOD(0644) CGI: $(DESTDIR)/@CONFPATH@/$$F" >&2 ; \ chmod 0644 "$(DESTDIR)/@CONFPATH@/$$F" \ || { if $(WITH_CGI) ; then exit 1 ; else true ; fi ; } ; \ done ; \ for F in nut.conf.sample ups.conf.sample upsd.conf.sample upsd.users.sample upsmon.conf.sample upssched.conf.sample ; do \ - echo " CHMOD(0640) $(DESTDIR)/@CONFPATH@/$$F" >&2 ; \ + echo " CHMOD(0640) $(DESTDIR)/@CONFPATH@/$$F" >&2 ; \ chmod 0640 "$(DESTDIR)/@CONFPATH@/$$F" \ || exit ; \ done ; \ @@ -1178,30 +1187,30 @@ install-as-root: if (command -v chown) && test 0 -lt "`id -u '@RUN_AS_USER@'`" \ && ( test 0 -lt "`getent group '@RUN_AS_GROUP@' | awk -F: '{print $$3}'`" || test 0 -lt "`id -g '@RUN_AS_GROUP@'`" ) \ ; then \ - echo " CHOWN(@RUN_AS_USER@:@RUN_AS_GROUP@) $(DESTDIR)/@STATEPATH@/upssched" >&2 ; \ + echo " CHOWN(@RUN_AS_USER@:@RUN_AS_GROUP@) $(DESTDIR)/@STATEPATH@/upssched" >&2 ; \ chown "@RUN_AS_USER@:@RUN_AS_GROUP@" "$(DESTDIR)/@STATEPATH@/upssched" \ || exit ; \ for D in "@STATEPATH@" "@PIDPATH@" "@ALTPIDPATH@" "@ALTSTATEPATH@" ; do \ case x"$$D" in \ x|x@*|x/run|x/var/run|x/tmp|x/var/tmp|x/dev/shm|x/etc|x/var|x/usr|x/usr/local|x/usr/local/etc|x/usr/etc) ;; \ - *) echo " CHOWN(@RUN_AS_USER@:@RUN_AS_GROUP@) $(DESTDIR)/$$D" >&2 ; \ + *) echo " CHOWN(@RUN_AS_USER@:@RUN_AS_GROUP@) $(DESTDIR)/$$D" >&2 ; \ chown "@RUN_AS_USER@:@RUN_AS_GROUP@" "$(DESTDIR)/$$D" \ || exit ;; \ esac ; \ done ; \ case x"@CONFPATH@" in \ x|x@*|x/run|x/var/run|x/tmp|x/var/tmp|x/dev/shm|x/etc|x/var|x/usr|x/usr/local|x/usr/local/etc|x/usr/etc) ;; \ - *) echo " CHOWN(root:@RUN_AS_GROUP@) $(DESTDIR)/@CONFPATH@" >&2 ; \ + *) echo " CHOWN(root:@RUN_AS_GROUP@) $(DESTDIR)/@CONFPATH@" >&2 ; \ chown "root:@RUN_AS_GROUP@" "$(DESTDIR)/@CONFPATH@" \ || exit ;; \ esac ; \ for F in hosts.conf.sample upsstats-single.html.sample upsstats.html.sample upsset.conf.sample ; do \ - echo " CHOWN(root:@RUN_AS_GROUP@) CGI: $(DESTDIR)/@CONFPATH@/$$F" >&2 ; \ + echo " CHOWN(root:@RUN_AS_GROUP@) CGI: $(DESTDIR)/@CONFPATH@/$$F" >&2 ; \ chown "root:@RUN_AS_GROUP@" "$(DESTDIR)/@CONFPATH@/$$F" \ || { if $(WITH_CGI) ; then exit 1 ; else true ; fi ; } ; \ done ; \ for F in nut.conf.sample ups.conf.sample upsd.conf.sample upsd.users.sample upsmon.conf.sample upssched.conf.sample ; do \ - echo " CHOWN(root:@RUN_AS_GROUP@) $(DESTDIR)/@CONFPATH@/$$F" >&2 ; \ + echo " CHOWN(root:@RUN_AS_GROUP@) $(DESTDIR)/@CONFPATH@/$$F" >&2 ; \ chown "root:@RUN_AS_GROUP@" "$(DESTDIR)/@CONFPATH@/$$F" \ || exit ; \ done ; \ @@ -1370,10 +1379,10 @@ install-win-bundle-thirdparty: else !HAVE_WINDOWS install-win-bundle: - @echo "SKIP: '$@' not enabled for current build configuration" + @echo " SKIP '$@' : not enabled for current build configuration" install-win-bundle-thirdparty: - @echo "SKIP: '$@' not enabled for current build configuration" + @echo " SKIP '$@' : not enabled for current build configuration" endif !HAVE_WINDOWS print-MAINTAINERCLEANFILES print-REALCLEANFILES: diff --git a/NEWS.adoc b/NEWS.adoc index 79f14404b3..7c37a57c0f 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -151,25 +151,32 @@ This requirement compromises usability of `make distcheck` on platforms without take advantage of these mechanisms to also produce usable dist archives for their relaxed or purpose-specific tests. - - the `upsnotify()` common code introduced in recent NUT releases (integrating - with service management frameworks, etc.) was a bit cryptic when it reported - a *failure to notify* (e.g. when not running as a service currently), fixed - now to report human-friendly text instead of internal enum codes. Follow-up - to [issue #1590, PR #1777, PR #2136] - - - drivers should no longer print warning messages about not-initializing the - notification subsystem because not running as a service when they are either - started explicitly to show the help message, or when their CLI arguments - are fatally wrong (no UPS name, no `port`, invalid trailing keywords...) - - - drivers, `upsd`, `upsmon`: reduce "scary noise" about failure to `fopen()` + - Revised behaviors for the `upsnotify()` common code introduced in recent NUT + releases (integrating with service management frameworks, etc.): + * It was a bit cryptic when it reported a *failure to notify* (e.g. when a + NUT program was not running as a service currently), fixed now to report + human-friendly text instead of internal enum codes. Follow-up to [issue + #1590, PR #1777, PR #2136] + * Drivers should no longer print warning messages about not-initializing + the notification subsystem because not running as a service when they + are either started explicitly to show the help message, or when their + CLI arguments are fatally wrong (no UPS name, no `port`, invalid trailing + keywords...) + * NUT programs generally should default to not "spam" about lack of known + notification technology if our first message to be suppressed is already + about stopping that program. This might help nag distros into getting + a service framework, or integrating theirs with NUT, but is generally + annoying to end-users where there's little they can do about it (other + than suppressing the message with `NUT_QUIET_INIT_UPSNOTIFY` envvar). + + - Drivers, `upsd`, `upsmon`: reduce "scary noise" about failure to `fopen()` the PID file (which most of the time means that no previous instance of the daemon was running to potentially conflict with), especially useless since in recent NUT releases the verdicts from `sendsignal*()` methods are analyzed and lead to layman worded situation reports in these programs. [issue #1782, PR #2384] - - drivers started with the `-FF` command-line option (e.g. wrapped into the + - Drivers started with the `-FF` command-line option (e.g. wrapped into the systemd units to stay "foregrounded" *and* save a PID file anyway) should now also handle an existing PID file to interact with the earlier instance of the driver program, if still running (e.g. started manually). [#2384] @@ -209,49 +216,55 @@ This requirement compromises usability of `make distcheck` on platforms without accommodate for longer device initialization (e.g. due to support of more Megatec Qx dialects by `nutdrv_qx`). [#2885, #2888] - - riello_ser updates: - * added `localcalculation` option to compute `battery.runtime` and + - `riello_ser` updates: + * Added `localcalculation` option to compute `battery.runtime` and `battery.charge` if the device provides bogus values [issue #2390, following in the footsteps of #1692, #1685 done for `riello_usb`] (similar to `runtimecal` in some other drivers, may be refactored to that configuration and logic model in later NUT releases) - - apcsmart updates: + - `apcsmart` updates: * Revised code to use `strncpy()` and avoid potential overflows that are possible with `strcpy()` used before. [PR #2564] * Lost communications led to a logging flood, should not anymore. In fact, the driver should try fully reconnecting upon getting into a prolonged data stale condition. [issue #704, PR #2564] - - nutdrv_qx updates: - * added Visench C1K (using serial port converter with USB ID `1a86:7523`) + - `nutdrv_qx` updates: + * Added Visench C1K (using serial port converter with USB ID `1a86:7523`) as known supported by `nutdrv_qx` (Megatec protocol) since at least NUT v2.7.4 release. [#2395] - * introduced `innovart31` protocol support for Innova RT 3/1 UPSes. [#2712, #2798] - * introduced `q2` and `q6` protocol support; currently also based/tested + * Introduced `innovart31` protocol support for Innova RT 3/1 UPSes. [#2712, #2798] + * Introduced `q2` and `q6` protocol support; currently also based/tested on Innova devices, but other models than RT 3/1. [#2798] - * introduced a `gtec` subdriver and protocol, tested over USB with a + * Introduced a `gtec` subdriver and protocol, tested over USB with a Gtec ZP120N device. [#2818] - * fixed `hunnox_protocol()` to honour the optional `novendor` setting for + * Fixed `hunnox_protocol()` to honour the optional `novendor` setting for devices that are confused by such query, e.g. DEXP LCD EURO 1200VA. [#2839] - * extended Voltronic protocol to support longer numbers as remaining + * Extended Voltronic protocol to support longer numbers as remaining `battery.runtime` value. [#2765] - GPIO drivers: - * extending to support library API of not only libgpiod v1.x releases, + * Extended to support library API of not only libgpiod v1.x releases, but also v2.x; introduced a NUT `WITH_LIBGPIO_VERSION` C macro (in `config.h`) to differentiate the library variants. [issue #2833] - - bicker_ser: added new driver for Bicker 12/24Vdc UPS via RS-232 serial - communication protocol, which supports any UPS shipped with the PSZ-1053 - extension module. [PR #2448] - - - liebert-gxe: added new driver with support for Liebert GXE Series UPS - (serial or USB posing as a serial port). [#2629] - - - nhs_ser: added new driver for numerous NHS Nobreaks, senoidal line -- UPS - models with serial port, made by NHS Sistemas Eletronicos LTDA and popular - in Brazil. Currently this driver only builds on Linux. [#2692] + - New NUT drivers: + * `bicker_ser`: added new driver for Bicker 12/24Vdc UPS via RS-232 serial + communication protocol, which supports any UPS shipped with the PSZ-1053 + extension module. [PR #2448] + * `liebert-gxe`: added new driver with support for Liebert GXE Series UPS + (serial or USB posing as a serial port). [#2629] + * `nhs_ser`: added new driver for numerous NHS Nobreaks, senoidal line -- UPS + models with serial port, made by NHS Sistemas Eletronicos LTDA and popular + in Brazil. Currently this driver only builds on Linux. [#2692] + * `phoenixcontact_modbus` driver: Introduced Phoenix Contact QUINT4-UPS/24DC + management (only new modbus addresses). [#2689, #2716] + + - Added `scripts/external_apis` with an example script integrating a + non-native protocol with NUT (as live-stream input for `dummy-ups` + NUT driver to publish further); that example can be installed using + `configure --enable-extapi-enphase`. [issue #2807, PR #2813] - `usbhid-ups` and `netxml-ups` updated to handle "No battery installed!" alarm also to set the `RB` (Replace Battery) value in `ups.status`. @@ -259,7 +272,7 @@ This requirement compromises usability of `make distcheck` on platforms without and as an important `REPLBATT` status in particular) in `upsmon`, but better safe than sorry. [#415] - - usbhid-ups updates: + - `usbhid-ups` updates: * Support of the `onlinedischarge_log_throttle_hovercharge` in the NUT v2.8.2 release was found to be incomplete. [#2423, follow-up to #2215] * Added support for `interrupt_pipe_no_events_tolerance=N` setting to @@ -293,15 +306,15 @@ This requirement compromises usability of `make distcheck` on platforms without by default: `powercom_sdcmd_byte_order_fallback`. [PR #2480] * `cps-hid` subdriver now supports more variables, as available on e.g. CP1350EPFCLCD model, including temperature. [PRs #2540, #2711] - * loudly suggest to set `pollonly` flag and default a shorter `pollfreq` + * Loudly suggest to set `pollonly` flag and default a shorter `pollfreq` for CPS devices, to try avoiding device-driven timeouts. [#1689] Also adjust default `offdelay` and `ondelay` to reasonable values, and warn the users with CPS devices if their configured values are not multiples of 60. [#432, #1394] - * in `cps-hid` subdriver, `cps_fix_report_desc()` method should now handle + * In `cps-hid` subdriver, `cps_fix_report_desc()` method should now handle mismatched `LogMax` ranges for input and output voltages, whose USB Report Descriptors are wrongly encoded by some firmware versions. [#1512] - * in `cps-hid` subdriver, try to fix frequency scaling based on the values + * In `cps-hid` subdriver, try to fix frequency scaling based on the values we see from the device and/or configuration overrides (low, nominal, high) so `499.0 Hz` reading that comes from some firmware versions gets reported properly as `49.9Hz`. [#2717] @@ -342,15 +355,15 @@ This requirement compromises usability of `make distcheck` on platforms without * ...should now track the fact of `assumed_LogMax` (typically when firmware encoding logic is wrong, and `-1` is resolved by parser). [#1512, #1040] - - snmp-ups updates: - * added support to monitor BayTech RPC3-NC PDUs, with `baytech-rpc3nc-mib` + - `snmp-ups` updates: + * Added support to monitor BayTech RPC3-NC PDUs, with `baytech-rpc3nc-mib` serving same basic data points as were available in `baytech-mib.c`, but checking for a different model OID subtree and different OIDs for the device model information. [#2779] - * fixed `netvision-mib`: sync `netvision_output_info` with currently + * Fixed `netvision-mib`: sync `netvision_output_info` with currently available `SOCOMECUPS-MIB.txt`. [#2803] - - mge-utalk driver will no longer set non-standard status values `COMMFAULT` + - `mge-utalk` driver will no longer set non-standard status values `COMMFAULT` and `ALARM` (for a specific status bit); instead, it will set modern `ups.alarm` with values `COMMFAULT` and/or `DEVICEALARM` (and raise an `ALARM` in `ups.status` for either, as standard alarms go). [#2708] @@ -429,24 +442,24 @@ This requirement compromises usability of `make distcheck` on platforms without so went plaintext even when secure connections were possible. Fixed to at least try being secure, same way as `upsc` does for a long time. [#2847] - - upsmon: - * it was realized that the `POWERDOWNFLAG` must be explicitly set in the + - `upsmon` updates: + * It was realized that the `POWERDOWNFLAG` must be explicitly set in the configuration file, there is no built-in default in the binary program (the settings facilitated by the `configure` script during build "only" impact the `upsmon.conf.sample`, init-scripts and similar files generated from templates). [issue #321, PR #2383] - * added an `OBLBDURATION` (seconds) setting to optionally delay raising + * Added an `OBLBDURATION` (seconds) setting to optionally delay raising the alarm for immediate shutdown in critical situation. [#321] - * optimized `parse_status()` by not checking further strings if we had + * Optimized `parse_status()` by not checking further strings if we had a match; report unexpected tokens in debug log. [#415] - * revised internal `do_notify()` method to support formatting strings + * Revised internal `do_notify()` method to support formatting strings with two `%s` placeholders, to use if certain use-cases pass any extra information (e.g. not just "we have alarms" but their values too). [#415] - * introduced handling for "unknown" `ups.status` tokens, reporting them + * Introduced handling for "unknown" `ups.status` tokens, reporting them as "OTHER" notification type (whenever the set of such tokens appears or changes) or "NOTOTHER" when they disappear. [#415] - - upslog: + - `upslog` updates: * Added support for limiting the loop count. Using in NIT (NUT Integration Test) suite for double profit (checking the tool and fallback in NIT). * If you use the legacy CLI options for single-system logging (`-s ` @@ -494,22 +507,20 @@ This requirement compromises usability of `make distcheck` on platforms without `systemd-udev-settle.service` which is deprecated and causes warnings on some systems. It was shown to benefit NUT use-cases however. [#2638] - - gamatronic driver revised for safer memory operations; this was reported + - `gamatronic` driver revised for safer memory operations; this was reported to have fixed a Segmentation Fault seen in earlier NUT releases with some of the devices supported by this driver. [#2427] - - phoenixcontact_modbus driver: Introduced Phoenix Contact QUINT4-UPS/24DC - management (only new modbus addresses). [#2689, #2716] - - upsd: + - `upsd` updates: * `upsd_cleanup()` is now traced, to more easily see that the daemon is exiting (and/or start-up has aborted due to configuration or run-time issues). Warning about "world readable" files clarified. [#2417] * Failure to `LISTEN` on an invalid host name (e.g. `localhost:3493` or `1.2.3.4/24`) is now logged in a more actionable manner. [#2665] - - nut-scanner: - * the tool relies on dynamic loading of shared objects (library files) + - `nut-scanner` updates: + * The tool relies on dynamic loading of shared objects (library files) orchestrated at run-time rather than pre-compiled, to avoid excessively huge package footprints. This however relies on knowing (or sufficiently safely guessing) the library file names to use, and short `libname.so` @@ -519,10 +530,10 @@ This requirement compromises usability of `make distcheck` on platforms without + NOTE: A different but functionally equivalent trick is done for `libupsclient` during a NUT build. - * fixed support for IPv6 addresses (passed in square brackets) for both + * Fixed support for IPv6 addresses (passed in square brackets) for both `-s` start/`-e` end command-line options, and for `-m cidr/mask` option. [issue #2512, PR #2518] - * newly added support to scan several IP addresses (single or ranges) + * Newly added support to scan several IP addresses (single or ranges) with the same call, by repeating command-line options; also `-m auto{,4,6}` can be specified (once) to select IP (all, IPv4, IPv6) address ranges of configured local network interfaces. @@ -530,15 +541,15 @@ during a NUT build. subnets with too many bits available for the host address part (avoiding millions of scans in the extreme cases). [issue #2244, issue #2511, PR #2509, PR #2513, PR #2517] - * implemented parallel scanning for IPMI bus, otherwise default scan for + * Implemented parallel scanning for IPMI bus, otherwise default scan for all supported buses with `-m auto` takes unbearably long. [#2523] - * bumped version of `libnutscan` to 2.6.0, it now includes a few more + * Bumped version of `libnutscan` to 2.6.0, it now includes a few more methods and symbols from `libcommon`. [issue #2244, PR #2509] - * do not actively suggest `vendor(id)`, `product(id)`, and `serial` options + * Do not actively suggest `vendor(id)`, `product(id)`, and `serial` options for `bcmxcp_usb`, `richcomm_usb` and `nutdrv_atcl_usb` drivers for now [#1763, #1764, #1768, #2580] - - all drivers should now support the optional `sdcommands` setting with + - All drivers should now support the optional `sdcommands` setting with a site-local list of instant commands to handle `upsdrv_shutdown()`, which may be useful in cases when the driver's built-in commands (or their order) do not meet the goals of particular NUT deployment. @@ -556,10 +567,10 @@ INSTCMD such as `shutdown.return`, `shutdown.stayoff` or `load.off`. Default logic that was previously the content of `upsdrv_shutdown()` methods was often relocated into new `shutdown.default` INSTCMD definitions. [#2670] - - common code: + - Common code: * `upscli_splitname()` should now recognize `upsname:port` typos (missing the `@hostname` part) and error out gracefully. - * introduced a `NUT_DEBUG_SYSLOG` environment variable to tweak activation + * Introduced a `NUT_DEBUG_SYSLOG` environment variable to tweak activation of syslog message emission (and related detachment of `stderr` when backgrounding), primarily useful for NIT and perhaps systemd. Most methods relied on logging bits being set, so this change aims to be @@ -569,11 +580,11 @@ relocated into new `shutdown.default` INSTCMD definitions. [#2670] by the `configure` script during build, but can override it with a `NUT_PIDPATH` environment variable in certain use-cases (such as tests). [#2407] - * allow drivers to set `STATEPATH` via `ups.conf` to match `upsd` + * Allow drivers to set `STATEPATH` via `ups.conf` to match `upsd` custom configuration ability; the data server would prefer the value from `ups.conf` over the one in `upsd.conf`, if both are present. Note that `NUT_STATEPATH` environment variable trumps both. [issue #694] - * introduced a check for daemons working with PID files to double-check + * Introduced a check for daemons working with PID files to double-check that if they can resolve the program name of a running process with this identifier, that such name matches the current program (avoid failures to start NUT daemons if PID files are on persistent storage, @@ -585,18 +596,18 @@ relocated into new `shutdown.default` INSTCMD definitions. [#2670] variable support was added to optionally disable this verification. Also the NUT daemons should request to double-check against their run-time process name (if it can be detected). [issue #2463] - * introduced `m4` macros to check during `configure` phase for the + * Introduced `m4` macros to check during `configure` phase for the platform, and a `nut_bool.h` header with `nut_bool_t` type to use during build, to avoid the numerous definitions of Boolean types and values (or macros) in the NUT codebase. [issue #1176, issue #31] - * custom `distcheck-something` targets did not inherit `DISTCHECK_FLAGS` + * Custom `distcheck-something` targets did not inherit `DISTCHECK_FLAGS` properly. [#2541] - * added `status_get()` in NUT driver state API, to check if a status + * Added `status_get()` in NUT driver state API, to check if a status token string had been set recently, and to avoid duplicate settings; fixed `status_set()` for multi-token arguments. [PR #2565, issue #2708] - * local socket/pipe protocol introduced a `LOGOUT` command for cleaner + * Local socket/pipe protocol introduced a `LOGOUT` command for cleaner disconnection handling. [#2572] - * codebase adapted to the liking of `clang-18` and newer revisions of + * Codebase adapted to the liking of `clang-18` and newer revisions of `gcc-13`+ whose static analyzers on NUT CI farm complained about some imperfections after adding newer OS revisions to the population of build agents. [#2585, #2588] @@ -606,116 +617,111 @@ relocated into new `shutdown.default` INSTCMD definitions. [#2670] in others (e.g. flags or notification types do not make sense as signed) and added casting in a few places that remained, because: - `%x` style formatting requires an `unsigned int` variable - - numeric literals and macros are `int` by default - - results of math with unsigned types like `uint16_t`, done in some + - Numeric literals and macros are `int` by default + - Results of math with unsigned types like `uint16_t`, done in some cases, are up-scaled into `int` by default - `char`'s, `unsigned` or not, seem to be also up-scaled into `int` - - updated `docs/nut-names.txt` with items defined by 42ITy NUT fork. [#2339] + - Updated `docs/nut-names.txt` with items defined by 42ITy NUT fork. [#2339] - - various recipe, documentation and source files were revised to address + - Various recipe, documentation and source files were revised to address respective warnings issued by the new generations of analysis tools. [#823, #2437, link:https://github.com/networkupstools/nut-website/issues/52[nut-website issue #52]] - - fixed `configure` script to use default (target-specific) values of + - Fixed `configure` script to use default (target-specific) values of `CFLAGS`, `LIBS` etc. when probing relevant settings for each third-party dependency; as a consequence, on systems that support building for many targets, we check relevant build-ability for that target and not for the building system itself. [issue #2673, PR #2675] - - fixed dynamic linking of Mozilla NSS on systems like Solaris/illumos, + - Fixed dynamic linking of Mozilla NSS on systems like Solaris/illumos, where the shared objects are not packaged into the common RPATH. [issue #2674, PR #2675] - - added `scripts/external_apis` with an example script integrating a - non-native protocol with NUT; that example can be installed using - `configure --enable-extapi-enphase`. [issue #2807, PR #2813] - - - added `scripts/valgrind` with a helper script and suppression file to + - Added `scripts/valgrind` with a helper script and suppression file to ignore common third-party problems. [#2511] - - fixed `configure --with-valgrind=PATH` vs. detection of its usability; + - Fixed `configure --with-valgrind=PATH` vs. detection of its usability; fixed some portability issues with detection of usability per se, tried `--with-valgrind=auto` the default to auto-detect and use the feature (in tests) wherever possible, but too many NUT CI farm agents disagreed; so for now the default is `no`. [#2823] - - when drivers dump collected data (during troubleshooting), flush `stdout` + - When drivers dump collected data (during troubleshooting), flush `stdout` buffer immediately for sane logging (especially on Windows). [PR #2699] - - revised `nut.exe` (the NUT for Windows wrapper for all-in-one service) + - Revised `nut.exe` (the NUT for Windows wrapper for all-in-one service) to be more helpful with command-line use (report that it failed to start as a service, have a help message, pass debug verbosity to launched NUT programs...) and add a man page for it. [issue #2432, PR #2446] - - the `scripts/Windows/build-mingw-nut.sh` helper script was extended to + - The `scripts/Windows/build-mingw-nut.sh` helper script was extended to use `nut_build_${ARCH}` and `nut_install_${ARCH}` directories by default, with the older `nut_build` and `nut_install` short names becoming just a symbolic link to the latest executed build: this should help compare the differences of 32/64-bit builds, without them stepping on each other's toes. - - the `PyNUTClient` module should no longer rely on presence of a `telnetlib` - module in the build or execution environment (deprecated in Python 3.11, - removed since Python 3.13). [issue #2183, PR #2792] - - - the PyPI distribution of the `PyNUTClient` module tarball should now use a - lower-cased file name (and immediate versioned directory name inside) to - match the requirements of link:https://peps.python.org/pep-0625/[PEP-0625]. - The Python module name (and its directory) should remain camel-cased. [#2773] - - - added man page for the `NUT-Monitor` Python UI client. - - - The `NUT-Monitor` Python UI client itself was revised to report the - `PACKAGE_VERSION` and `NUT_WEBSITE_BASE` strings in the "About" dialog - contents; localization support for the dialog and some other resources - was revised to work in Py3Qt5 variant of the script. [#722] - - - enabled installation of built single-file PDF and HTML (including man page - renditions) under the configured `docdir`. It seems previously they were - only built (if requested) but not installed via `make`, unlike the common - man pages which are delivered automatically. [#2445] + - NUT binding for Python and the `NUT-Monitor` Python UI client updates: + * The `PyNUTClient` module should no longer rely on presence of a `telnetlib` + module in the build or execution environment (deprecated in Python 3.11, + removed since Python 3.13). [issue #2183, PR #2792] + * The PyPI distribution of the `PyNUTClient` module tarball should now use a + lower-cased file name (and immediate versioned directory name inside) to + match the requirements of link:https://peps.python.org/pep-0625/[PEP-0625]. + The Python module name (and its directory) should remain camel-cased. [#2773] + * Added man page for the `NUT-Monitor` Python UI client. + * The `NUT-Monitor` Python UI client itself was revised to report the + `PACKAGE_VERSION` and `NUT_WEBSITE_BASE` strings in the "About" dialog + contents; localization support for the dialog and some other resources + was revised to work in Py3Qt5 variant of the script. [#722] + + - Documentation recipe updates: + * Enabled installation of built single-file PDF and HTML (including man + page renditions) under the configured `docdir`. It seems that previously + they were only built (if requested) but not installed via `make`, unlike + the common man pages which are delivered automatically. [#2445] + - NOTE: The `html-chunked` documents are currently still not installed. - - - added support to `./configure --with-doc=man=dist-auto` to use distributed - manual page files if present; only fall back to build them if we can. [#2473] - - - added a `make distcheck-light-man` recipe to require verification that the - manual page files can be built using the prepared "tarball" archive. [#2473] - - - revised the documentation building recipes, with the goal to avoid building - the `ChangeLog` products and their intermediate files more than once (but - still react to `git` metadata changes during development), and to sanity - check the resulting final document (currently only for `html-single` mode). - As part of this, the `CHANGELOG_REQUIRE_GROUP_BY_DATE_AUTHOR` setting was - added (for `make` calls and used by `tools/gitlog2changelog.py.in` script), - and it defaults to `true` allowing for better ordered documents at the cost - of some memory during document generation. [#2510] - - - updated man page generation with `configure` script options to specify that - manual sections on the target platform differ from (Linux-based) defaults - hard-coded into page sources; this should allow to simplify NUT packaging - recipe maintenance in distributions (no more updating patches for changed - or added documentation sources). - - - lines in first section of NUT configuration report (can optionally remain as - `config.nut_report_feature.log` and be installed into shared documentation - of a NUT package) are now better grouped as miscellaneous features and - detection results, then drivers and programs/tools. [#2676] - - - added a `common/Makefile.am` build product for a new internal library +NOTE: The `html-chunked` documents are currently still not installed. + + * Added support to `./configure --with-doc=man=dist-auto` to use the + distributed manual page files if present; only fall back to (re-)building + them if we can. [#2473] + * Added a `make distcheck-light-man` recipe to require verification that + the manual page files can be built using the prepared "tarball" archive. + [#2473] + * Revised the documentation building recipes, with the goal to avoid + building the `ChangeLog` products and their intermediate files more + than once (but still react to `git` metadata changes during development), + and to sanity-check the resulting final document (currently only for + `html-single` mode). ++ +As part of this, the `CHANGELOG_REQUIRE_GROUP_BY_DATE_AUTHOR` setting was + added (for `make` calls and used by `tools/gitlog2changelog.py.in` + script), and it defaults to `true` allowing for better ordered documents + at the cost of some memory during document generation. [#2510] + * Updated man page generation with `configure` script options to specify + that manual section codes on the target platform differ from (Linux-based) + defaults hard-coded into page sources; this should allow to simplify NUT + packaging recipe maintenance in those diverse distributions (no more need + to update patches for changed or added documentation sources). + * Lines in first section of NUT configuration report (which can optionally + remain as `config.nut_report_feature.log` and be installed into shared + documentation of a NUT package) are now better grouped as miscellaneous + features and detection results, then drivers and programs/tools. [#2676] + + - Added a `common/Makefile.am` build product for a new internal library `libcommonstr.la` which allows a smaller selection of helper methods for tools like `nut-scanner` which do not need the full `libcommon.la` nor `libcommonclient.la`. [#2478, #2491] - - added a `drivers/Makefile.am` build product for a new internal library + - Added a `drivers/Makefile.am` build product for a new internal library `libserial-nutscan.la` to simplify `tools/nut-scanner/Makefile.am` recipes. [#2490] - - build of `snmp-ups` and `netxml-ups` drivers now explicitly brings linker + - Build of `snmp-ups` and `netxml-ups` drivers now explicitly brings linker dependency on chosen SSL libraries. [#2479] - - introduced `configure --with-modbus+usb` option to require an USB-capable + - Introduced `configure --with-modbus+usb` option to require an USB-capable libmodbus, and defaulted a couple of specific situations as if this was required (implicitly): `configure --with-modbus --with-usb` and either `--with-drivers=*apc_modbus*` (actually implies `--with-modbus`) @@ -725,11 +731,17 @@ relocated into new `shutdown.default` INSTCMD definitions. [#2670] libmodbus). Also fixed (re-)detection of libmodbus RTU USB support with static libmodbus builds. [#2666] - - brought keyword dictionaries of `nutconf` and `augeas` NUT configuration + - Drivers built with libmodbus (`phoenixcontact_modbus`, `generic_modbus`, + `huawei-ups2000`, `socomec_jbus`, `adelsystem_cbi`, `apc_modbus`) should + now report whether the library is linked dynamically or statically -- this + can help in troubleshooting (especially of `apc_modbus` which may be using + a custom build of the library not delivered by the operating system). [#2897] + + - Brought keyword dictionaries of `nutconf` and `augeas` NUT configuration file parsers up to date; restored automated checks for `augeas` lenses. [issue #657, issue #2294] + - NOTE: Some known issues remain with augeas lens definitions so currently +NOTE: Some known issues remain with augeas lens definitions, so currently they should be able to parse common simple use-cases but not certain types of more complex configurations (e.g. some line patterns that involve too many double-quote characters) which are valid for NUT proper. [#657] diff --git a/UPGRADING.adoc b/UPGRADING.adoc index c2219c1560..4b7715e20a 100644 --- a/UPGRADING.adoc +++ b/UPGRADING.adoc @@ -66,7 +66,7 @@ Changes from 2.8.2 to 2.8.3 (and `make dist-ci`) to fake presence of pre-built man pages with placeholder files, to complete other aspects of `distcheck` validation. [#2842] -- the PyPI distribution of the `PyNUTClient` module tarball should now use a +- The PyPI distribution of the `PyNUTClient` module tarball should now use a lower-cased file name (and immediate versioned directory name inside) to match the requirements of link:https://peps.python.org/pep-0625/[PEP-0625]. The Python module name (and its directory) should remain camel-cased. @@ -174,7 +174,7 @@ Changes from 2.8.2 to 2.8.3 1200VA); it may be remotely possible that some other devices could begin to misbehave due to this fix -- please let us know then. [#2839] -- mge-utalk driver will no longer set non-standard status values `COMMFAULT` +- `mge-utalk` driver will no longer set non-standard status values `COMMFAULT` and `ALARM` (for a specific status bit); instead, it will set modern `ups.alarm` with values `COMMFAULT` and/or `DEVICEALARM` (and raise an `ALARM` in `ups.status` for either, as standard alarms go). If your diff --git a/common/Makefile.am b/common/Makefile.am index bb5d61e4f7..1ef405a735 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -51,7 +51,7 @@ else !BUILDING_IN_TREE @if [ x"$(abs_top_srcdir)" = x"$(abs_top_builddir)" ] || test -s "$@" ; then \ exit 0 ; \ else \ - echo " LN $(top_srcdir)/common/common.c => $@ (relative to `pwd`)" ; \ + echo " LN $(top_srcdir)/common/common.c => $@ (relative to `pwd`)" ; \ ln -s -f "$(top_srcdir)/common/common.c" "$@" ; \ fi endif !BUILDING_IN_TREE diff --git a/common/common.c b/common/common.c index 0c8e4ed201..036b0cd20a 100644 --- a/common/common.c +++ b/common/common.c @@ -2832,12 +2832,34 @@ int upsnotify(upsnotify_state_t state, const char *fmt, ...) #endif ) { if (ret == -127) { - if (!upsnotify_reported_disabled_notech) - upsdebugx(upsnotify_report_verbosity, + if (!upsnotify_reported_disabled_notech) { + int verbosity = upsnotify_report_verbosity; + + if (state == NOTIFY_STATE_STOPPING && upsnotify_report_verbosity == 0) { + /* By default, do not spam even this if our + * first-most message to be suppressed is + * already about stopping (e.g. a failed + * driver) unless explicitly requested to. + */ + char *s = getenv("NUT_QUIET_INIT_UPSNOTIFY"); + + /* FIXME: Make an INVERTED server/conf.c::parse_boolean() reusable */ + if (s && *s && + ( (!strcasecmp(s, "false")) || (!strcasecmp(s, "off")) || (!strcasecmp(s, "no")) || (!strcasecmp(s, "0"))) + ) { + upsdebugx(1, "Caller WANTS to see all these messages: NUT_QUIET_INIT_UPSNOTIFY=%s", NUT_STRARG(s)); + } else { + /* Hide this one by default */ + verbosity = 1; + } + } + + upsdebugx(verbosity, "%s: failed to notify about state %s: " "no notification tech defined, " "will not spam more about it", __func__, str_upsnotify_state(state)); + } upsnotify_reported_disabled_notech = 1; upsnotify_suggest_NUT_QUIET_INIT_UPSNOTIFY_once(); } else { diff --git a/configure.ac b/configure.ac index 1bf87ddf2c..eb89e92a12 100644 --- a/configure.ac +++ b/configure.ac @@ -230,6 +230,7 @@ AM_PROG_CC_C_O AC_PROG_CPP AC_PROG_CXX AC_PROG_CXX_C_O +AC_PATH_PROG([LDD], [ldd]) CFLAGS_AFTER_ACPROG="${CFLAGS-}" CXXFLAGS_AFTER_ACPROG="${CXXFLAGS-}" @@ -536,8 +537,6 @@ AS_IF([test x"$nut_enable_inplace_runtime" = xyes -a x"${NUT_VERSION_DEPLOYED-}" [DEPLOYED_PREFIX="`dirname "${DEPLOYED_BINDIR}"`"])] ) - AC_PATH_PROG([LDD], [ldd]) - AC_MSG_CHECKING([for CONFIG_FLAGS of an already deployed NUT build (if it reports those)]) CONFIG_FLAGS_DEPLOYED="" @@ -3499,6 +3498,24 @@ fi DOCTESTDIR="$(mktemp -d configure-test.docbuild.$$.XXXXXXX)" && \ DOCTESTDIR="$(cd "$DOCTESTDIR" && pwd)" +dnl NOTE: We perform some of these checks/infos also if docs=(man=)skip +dnl so we know in later reports if disted files are still an option +dnl should we want to not just skip them +have_disted_doc_man=no +want_disted_doc_man=no +if test -s "${abs_srcdir}"/docs/man/snmp-ups.8 ; then + dnl Test that groff files exist (building from distributed tarball, not git repo) + if test x"PLACEHOLDER" = x"`cat "${abs_srcdir}"/docs/man/snmp-ups.8`" ; then + dnl REALLY should not happen in real builds, + dnl but may be in distcheck-driven sub-builds + dnl where the external build agreed to use + dnl fake man pages (e.g. for CI recipe checks) + have_disted_doc_man=yes-placeholder + else + have_disted_doc_man=yes + fi +fi + dnl Note: Do not cover ${nut_doc_build_list} in braces or quotes here, dnl to ensure that it is processed as several space-separated tokens for nut_doc_build_target in $nut_doc_build_list; do @@ -3609,20 +3626,6 @@ dnl not fail if we have no tools to generate it (so add to SKIP list). dnl Experimental support for --with-doc=man=dist-auto to prefer pre-disted docs if available, below AC_MSG_CHECKING([if we can build ${nut_doc_build_target_base}]) can_build_doc_man=no - have_disted_doc_man=no - want_disted_doc_man=no - if test -s "${abs_srcdir}"/docs/man/snmp-ups.8 ; then - dnl Test that groff files exist (building from distributed tarball, not git repo) - if test x"PLACEHOLDER" = x"`cat "${abs_srcdir}"/docs/man/snmp-ups.8`" ; then - dnl REALLY should not happen in real builds, - dnl but may be in distcheck-driven sub-builds - dnl where the external build agreed to use - dnl fake man pages - have_disted_doc_man=yes-placeholder - else - have_disted_doc_man=yes - fi - fi if test x"${nut_doc_build_target}" = x"man=dist-auto" || test "${nut_doc_build_target_flag}" = "dist-auto"; then want_disted_doc_man=yes fi @@ -3749,6 +3752,7 @@ AM_CONDITIONAL(SKIP_MANS, test "${SKIP_MANS}" = "yes") AM_CONDITIONAL(KNOWN_UNABLE_MANS, test "${KNOWN_UNABLE_MANS}" = "yes") AM_CONDITIONAL(DOC_INSTALL_DISTED_MANS, test "${DOC_INSTALL_DISTED_MANS}" = "yes") dnl Reporting have_disted_doc_man not DOC_INSTALL_DISTED_MANS because the former has more values +AS_IF([test x"${have_disted_doc_man}" = x], [have_disted_doc_man="did not check"]) NUT_REPORT([can install pre-built documentation (release/dist tarball)], ["${have_disted_doc_man}"]) WITH_HTML_SINGLE=no diff --git a/docs/Makefile.am b/docs/Makefile.am index 1a09ee256c..90d70eee5e 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -341,7 +341,7 @@ ChangeLog.html-contentchecked: fi; \ fi; \ if [ x"$$FAILED" = x ] ; then \ - echo "SKIPPED $@ because input files were not available" >&2 ; \ + echo " SKIP $@ : because input files were not available" >&2 ; \ exit 0 ; \ fi ; \ exit 1 @@ -385,11 +385,11 @@ check-html-chunked: .check-html-chunked # from top-level Makefile, while allowing legacy "cd docs && make" to # still do the right thing by default :) check-man check-man-man all-man man-man all-html html-man: - +@if [ x"$(DOCS_NO_MAN)" = xtrue ] ; then echo " DOC-NOT-MAN SKIP: $@ called in docs/Makefile" ; exit 0 ; fi ; \ + +@if [ x"$(DOCS_NO_MAN)" = xtrue ] ; then echo " DOC-NOT-MAN SKIP: $@ called in docs/Makefile" ; exit 0 ; fi ; \ cd $(abs_top_builddir)/docs/man/ && $(MAKE) $(AM_MAKEFLAGS) -f Makefile $@ man: - +@if [ x"$(DOCS_NO_MAN)" = xtrue ] ; then echo " DOC-NOT-MAN SKIP: $@ called in docs/Makefile" ; exit 0 ; fi ; \ + +@if [ x"$(DOCS_NO_MAN)" = xtrue ] ; then echo " DOC-NOT-MAN SKIP: $@ called in docs/Makefile" ; exit 0 ; fi ; \ cd $(abs_top_builddir)/docs/man/ && $(MAKE) $(AM_MAKEFLAGS) -f Makefile all CLEANFILES = *.xml *.html *.pdf *-spellchecked* *-contentchecked* .check-* docbook-xsl.css docinfo.xml.in.tmp docinfo-since-v*.xml* *-docinfo.xml* @@ -412,14 +412,14 @@ MAINTAINER_ASCIIDOCS_CHANGELOG_DEBUG = no # The $< is okay here, it is used in a suffix rule below .adoc.adoc-parsed: @if [ -s '$@' ] && [ x"`find '$@' -newer '$<'`" != x ] ; then \ - echo " DOC-ASCIIDOC-GITHUB-LINKS SKIP: $@ already exists and is newer than $<" ; \ + echo " DOC-ASCIIDOC-GITHUB-LINKS SKIP: $@ already exists and is newer than $<" ; \ if [ x"$(MAINTAINER_ASCIIDOCS_CHANGELOG_DEBUG)" != xno ] ; then \ ls -lad $@ $< || true ; \ stat $@ $< || true ; \ fi ; \ exit 0 ; \ fi ; \ - echo " DOC-ASCIIDOC-GITHUB-LINKS Parsing GitHub link patterns $< => $@"; \ + echo " DOC-ASCIIDOC-GITHUB-LINKS Parsing GitHub link patterns $< => $@"; \ if [ x"$(MAINTAINER_ASCIIDOCS_CHANGELOG_DEBUG)" != xno ] ; then \ ls -lad $@ $< || true ; \ stat $@ $< || true ; \ @@ -848,8 +848,8 @@ SPELLCHECK_RECIPE_DEBUG_STREAM = /dev/null # and the dictionary was NOT in fact modified, restore the timestamp. $(SPELLCHECK_BUILDDIR)/$(SPELLCHECK_SRC_ONE)-spellchecked: $(SPELLCHECK_SRCDIR)/$(SPELLCHECK_SRC_ONE) $(abs_top_srcdir)/docs/Makefile.am $(abs_srcdir)/$(NUT_SPELL_DICT) @LANG=C; LC_ALL=C; export LANG; export LC_ALL; \ - if test x"$(SPELLCHECK_SRC_ONE)" = x ; then echo "SKIP: Bogus spellcheck call for empty target filename (with make target $@ from `pwd`)" >&2 ; exit 0; fi; \ - case "$@" in *-spellchecked) ;; *) echo "SKIP: Bogus spellcheck call for non '*-spellchecked' target filename (with make target $@ from `pwd`)" >&2 ; exit 0;; esac; \ + if test x"$(SPELLCHECK_SRC_ONE)" = x ; then echo " SKIP Bogus spellcheck call for empty target filename (with make target $@ from `pwd`)" >&2 ; exit 0; fi; \ + case "$@" in *-spellchecked) ;; *) echo " SKIP Bogus spellcheck call for non '*-spellchecked' target filename (with make target $@ from `pwd`)" >&2 ; exit 0;; esac; \ rm -f "$@" || true ; \ $(MKDIR_P) "$(@D)" || exit ; \ REPORT_SRCDIR="$(SPELLCHECK_SRCDIR)"; \ @@ -880,7 +880,7 @@ $(SPELLCHECK_BUILDDIR)/$(SPELLCHECK_SRC_ONE)-spellchecked: $(SPELLCHECK_SRCDIR)/ *) REPORT_SRCDIR="$${REPORT_SRCDIR}/" ;; \ esac ; \ if [ x"$(SPELLCHECK_INTERACTIVE)" = xtrue ] ; then \ - echo " ASPELL Spell checking (interactively) on $${REPORT_PREFIX}$${REPORT_SRCDIR}$${REPORT_SRC_ONE}"; \ + echo " ASPELL Spell checking (interactively) on $${REPORT_PREFIX}$${REPORT_SRCDIR}$${REPORT_SRC_ONE}"; \ LANG=$(ASPELL_ENV_LANG) LC_ALL=$(ASPELL_ENV_LANG) $(ASPELL) check $(ASPELL_NUT_COMMON_ARGS) '$(SPELLCHECK_SRCDIR)/$(SPELLCHECK_SRC_ONE)' || exit ; \ if [ -s $(abs_builddir)/$(NUT_SPELL_DICT).bak-pre-interactive ] && [ -s $(abs_srcdir)/$(NUT_SPELL_DICT) ] && diff $(abs_srcdir)/$(NUT_SPELL_DICT) $(abs_builddir)/$(NUT_SPELL_DICT).bak-pre-interactive >/dev/null ; then \ touch -r $(abs_builddir)/$(NUT_SPELL_DICT).bak-pre-interactive $(abs_srcdir)/$(NUT_SPELL_DICT) ; \ @@ -889,7 +889,7 @@ $(SPELLCHECK_BUILDDIR)/$(SPELLCHECK_SRC_ONE)-spellchecked: $(SPELLCHECK_SRCDIR)/ touch -r $(abs_builddir)/$(NUT_SPELL_DICT).bak-pre-sorting $(abs_srcdir)/$(NUT_SPELL_DICT) ; \ fi ; fi ; \ else \ - echo " ASPELL Spell checking on $${REPORT_PREFIX}$${REPORT_SRCDIR}$${REPORT_SRC_ONE}"; \ + echo " ASPELL Spell checking on $${REPORT_PREFIX}$${REPORT_SRCDIR}$${REPORT_SRC_ONE}"; \ fi ; \ OUT="`(sed 's,^\(.*\)$$, \1,' | $(ASPELL) -a $(ASPELL_NUT_TEXMODE_ARGS) $(ASPELL_NUT_COMMON_ARGS) 2>&1) < '$(SPELLCHECK_SRCDIR)/$(SPELLCHECK_SRC_ONE)'`" \ && { if test -n "$$OUT" ; then OUT="`echo "$$OUT" | $(EGREP) -b -v '$(ASPELL_OUT_NOTERRORS)' `" ; fi; \ @@ -1051,7 +1051,7 @@ spellcheck-interactive: else !HAVE_ASPELL # This rule would probably just fail; normally with no ASPELL there are no callers for it */*-spellchecked *-spellchecked: Makefile.am $(abs_srcdir)/$(NUT_SPELL_DICT) - @echo " SKIP-ASPELL $@ : Documentation spell check not available since 'aspell' was not found (or missing its English dictionary)." >&2 + @echo " SKIP-ASPELL $@ : Documentation spell check not available since 'aspell' was not found (or missing its English dictionary)." >&2 spellcheck: @echo "Documentation spell check not available since 'aspell' was not found (or missing its English dictionary)." spellcheck-interactive: @@ -1171,7 +1171,7 @@ $(abs_top_builddir)/docs/.prep-src-docs: $(PREP_SRC) Makefile D="`dirname "$$F"`" ; \ (cd '$(abs_builddir)' && $(MKDIR_P) "$${linkroot}/$$D") || { rm -f "$@.working" ; exit 1 ; } ; \ if ! test -s "$${linkroot}/$$F" && test -s "$${linksrcroot}/$$F" ; then \ - echo " LN '$${linksrcroot}/$$F' => '$${linkroot}/$$F' (PWD = '`pwd`')" ; \ + echo " LN '$${linksrcroot}/$$F' => '$${linkroot}/$$F' (PWD = '`pwd`')" ; \ ln -fs "$${linksrcroot}/$$F" "$${linkroot}/$$F" || { rm -f "$@.working" ; exit 1 ; } ; \ COUNT="`expr $$COUNT + 1`" ; \ fi ; \ diff --git a/docs/maintainer-guide.txt b/docs/maintainer-guide.txt index c2e9770fc6..0fd9c8184c 100644 --- a/docs/maintainer-guide.txt +++ b/docs/maintainer-guide.txt @@ -99,6 +99,13 @@ artifacts associated with a particular release version/tag, and changing Git tags on public repositories is generally considered as a bad practice. So best to avoid it in the first place. +NOTE: Take time to push release candidates also as one of `fightwarn*` git +branches (maybe with QEMU scenarios too), and maybe post a `FTY` branch +update (while it is not all upstreamed), to gather more insights into code +and recipe quality from scenarios that do not often run. Also revise if +CodeQL or similar tools on GitHub have posted any relevant suggestions +about security or other matters. + * clean up "in-development" bits from files (which we would revert after release), e.g.: ** TODO etc. referring planned future in the `NEWS.adoc` and `UPDATING.adoc` diff --git a/docs/man/Makefile.am b/docs/man/Makefile.am index a370449fe3..18b3995441 100644 --- a/docs/man/Makefile.am +++ b/docs/man/Makefile.am @@ -92,9 +92,9 @@ BUILT_SOURCES = $(abs_top_builddir)/docs/man/.prep-src-docs all-optional # the automake-generated rules in each make implementation we care for. all-optional: $(abs_top_builddir)/docs/man/.prep-src-docs +@case "$(ALL_TGT)" in \ - ""|" "|" "|" ") echo " DOCS_NO_MAN SKIP: $@ called in docs/man/Makefile: No format of man page rendering is enabled" ; exit 0 ;; \ + ""|" "|" "|" ") echo " DOCS_NO_MAN SKIP: $@ called in docs/man/Makefile: No format of man page rendering is enabled" ; exit 0 ;; \ *all-*) \ - if [ x"$(DOCS_NO_MAN)" = xtrue ] ; then echo " DOCS_NO_MAN SKIP: $@ called in docs/man/Makefile: requested to not work in this code path" ; exit 0 ; fi ; \ + if [ x"$(DOCS_NO_MAN)" = xtrue ] ; then echo " DOCS_NO_MAN SKIP: $@ called in docs/man/Makefile: requested to not work in this code path" ; exit 0 ; fi ; \ echo " DOC-FOLLOW-UP Basic 'make $@' in `pwd` is done, following up with 'make $(ALL_TGT)' to ensure complex document types (if enabled)" ; \ $(MAKE) $(AM_MAKEFLAGS) $(ALL_TGT) ; exit ;; \ esac ; exit 0 @@ -1599,7 +1599,7 @@ DOCBUILD_END = { \ ### string resolve meaningfully in the filesystem during docs build. .txt-prepped.html: @A2X_OUTDIR="tmp/man-html.$(@F).$$$$" ; \ - echo " DOC-MAN-HTML Generating $@"; \ + echo " DOC-MAN-HTML Generating $@"; \ $(DOCBUILD_BEGIN) ; RES=0; \ $(ASCIIDOC) --backend=xhtml11 $${A2X_VERBOSE} \ --attribute=localdate="`TZ=UTC date +%Y-%m-%d`" \ @@ -1646,28 +1646,28 @@ if KNOWN_UNABLE_MANS else !KNOWN_UNABLE_MANS .txt-prepped.$(MAN_SECTION_CMD_USR): @A2X_OUTDIR="tmp/man$(MAN_SECTION_CMD_USR).$(@F).$$$$" ; \ - echo " DOC-MAN Generating $@"; \ + echo " DOC-MAN Generating $@"; \ $(DOCBUILD_BEGIN) ; RES=0; \ $(A2X) $(A2X_MANPAGE_OPTS) '$<' || RES=$$? ; \ $(DOCBUILD_END) ; exit $$RES .txt-prepped.$(MAN_SECTION_API): @A2X_OUTDIR="tmp/man$(MAN_SECTION_API).$(@F).$$$$" ; \ - echo " DOC-MAN Generating $@"; \ + echo " DOC-MAN Generating $@"; \ $(DOCBUILD_BEGIN) ; RES=0; \ $(A2X) $(A2X_MANPAGE_OPTS) '$<' || RES=$$? ; \ $(DOCBUILD_END) ; exit $$RES .txt-prepped.$(MAN_SECTION_CFG): @A2X_OUTDIR="tmp/man$(MAN_SECTION_CFG).$(@F).$$$$" ; \ - echo " DOC-MAN Generating $@"; \ + echo " DOC-MAN Generating $@"; \ $(DOCBUILD_BEGIN) ; RES=0; \ $(A2X) $(A2X_MANPAGE_OPTS) '$<' || RES=$$? ; \ $(DOCBUILD_END) ; exit $$RES .txt-prepped.$(MAN_SECTION_CMD_SYS): @A2X_OUTDIR="tmp/man$(MAN_SECTION_CMD_SYS).$(@F).$$$$" ; \ - echo " DOC-MAN Generating $@"; \ + echo " DOC-MAN Generating $@"; \ $(DOCBUILD_BEGIN) ; RES=0; \ $(A2X) $(A2X_MANPAGE_OPTS) '$<' || RES=$$? ; \ $(DOCBUILD_END) ; exit $$RES @@ -1767,9 +1767,9 @@ $(abs_top_builddir)/docs/man/.prep-src-docs: $(PREP_SRC) Makefile @cd "$(@D)" || exit ; \ if [ x"$(DOCS_NO_MAN)" = xtrue ] ; then \ if [ "$(MAINTAINER_DOCS_PREP_MAN_DELAY)" -gt 0 ] 2>/dev/null ; then \ - echo " DOCS_NO_MAN BLOCK: $@ called in docs/man/Makefile : waiting for other thread to complete this target" ; \ + echo " DOCS_NO_MAN BLOCK: $@ called in docs/man/Makefile : waiting for other thread to complete this target" ; \ W=0 ; while [ "$${W}" -lt "$(MAINTAINER_DOCS_PREP_MAN_DELAY)" ] && ( [ \! -e '$@' ] || [ x"`find $(PREP_SRC) \! -newer '$@' 2>/dev/null`" = x ] ) ; do sleep 1 ; W="`expr $$W + 1`"; done ; \ - echo " DOCS_NO_MAN SKIP: $@ called in docs/man/Makefile : waited $$W seconds" ; \ + echo " DOCS_NO_MAN SKIP: $@ called in docs/man/Makefile : waited $$W seconds" ; \ fi ; \ exit 0 ; \ fi ; \ @@ -1835,7 +1835,7 @@ $(abs_top_builddir)/docs/man/.prep-src-docs: $(PREP_SRC) Makefile D="`dirname "$$F"`" ; \ (cd '$(abs_builddir)' && $(MKDIR_P) "$${linkroot}/$$D") || { rm -f "$@.working" ; exit 1 ; } ; \ if ! test -e "$${linkroot}/$$F" && test -s "$${linksrcroot}/$$F" ; then \ - echo " LN '$${linksrcroot}/$$F' => '$${linkroot}/$$F' (PWD = '`pwd`')" >&2 ; \ + echo " LN '$${linksrcroot}/$$F' => '$${linkroot}/$$F' (PWD = '`pwd`')" >&2 ; \ ln -fs "$${linksrcroot}/$$F" "$${linkroot}/$$F" || { rm -f "$@.working" ; exit 1 ; } ; \ COUNT="`expr $$COUNT + 1`" ; \ fi ; \ diff --git a/drivers/adelsystem_cbi.c b/drivers/adelsystem_cbi.c index 40a47bb6b1..9e30f001b7 100644 --- a/drivers/adelsystem_cbi.c +++ b/drivers/adelsystem_cbi.c @@ -29,8 +29,12 @@ #include #include -#define DRIVER_NAME "NUT ADELSYSTEM DC-UPS CB/CBI driver" -#define DRIVER_VERSION "0.04" +#if !(defined NUT_MODBUS_LINKTYPE_STR) +# define NUT_MODBUS_LINKTYPE_STR "unknown" +#endif + +#define DRIVER_NAME "NUT ADELSYSTEM DC-UPS CB/CBI driver (libmodbus link type: " NUT_MODBUS_LINKTYPE_STR ")" +#define DRIVER_VERSION "0.04" /* variables */ static modbus_t *mbctx = NULL; /* modbus memory context */ diff --git a/drivers/apc_modbus.c b/drivers/apc_modbus.c index 65b677afdb..479049db05 100644 --- a/drivers/apc_modbus.c +++ b/drivers/apc_modbus.c @@ -34,11 +34,17 @@ #include #if defined NUT_MODBUS_HAS_USB -# define DRIVER_NAME "NUT APC Modbus driver with USB support" +# define DRIVER_NAME_NUT_MODBUS_HAS_USB_WITH_STR "with" #else -# define DRIVER_NAME "NUT APC Modbus driver without USB support" +# define DRIVER_NAME_NUT_MODBUS_HAS_USB_WITH_STR "without" #endif -#define DRIVER_VERSION "0.12" + +#if !(defined NUT_MODBUS_LINKTYPE_STR) +# define NUT_MODBUS_LINKTYPE_STR "unknown" +#endif + +#define DRIVER_NAME "NUT APC Modbus driver " DRIVER_NAME_NUT_MODBUS_HAS_USB_WITH_STR " USB support (libmodbus link type: " NUT_MODBUS_LINKTYPE_STR ")" +#define DRIVER_VERSION "0.12" #if defined NUT_MODBUS_HAS_USB diff --git a/drivers/generic_modbus.c b/drivers/generic_modbus.c index bb851a1c72..59a0369606 100644 --- a/drivers/generic_modbus.c +++ b/drivers/generic_modbus.c @@ -26,8 +26,12 @@ #include "timehead.h" #include "nut_stdint.h" -#define DRIVER_NAME "NUT Generic Modbus driver" -#define DRIVER_VERSION "0.06" +#if !(defined NUT_MODBUS_LINKTYPE_STR) +# define NUT_MODBUS_LINKTYPE_STR "unknown" +#endif + +#define DRIVER_NAME "NUT Generic Modbus driver (libmodbus link type: " NUT_MODBUS_LINKTYPE_STR ")" +#define DRIVER_VERSION "0.06" /* variables */ static modbus_t *mbctx = NULL; /* modbus memory context */ diff --git a/drivers/huawei-ups2000.c b/drivers/huawei-ups2000.c index bddc5eb86d..70539c0b58 100644 --- a/drivers/huawei-ups2000.c +++ b/drivers/huawei-ups2000.c @@ -50,7 +50,11 @@ #include "nut_stdint.h" #include "timehead.h" /* fallback gmtime_r() variants if needed (e.g. some WIN32) */ -#define DRIVER_NAME "NUT Huawei UPS2000 (1kVA-3kVA) RS-232 Modbus driver" +#if !(defined NUT_MODBUS_LINKTYPE_STR) +# define NUT_MODBUS_LINKTYPE_STR "unknown" +#endif + +#define DRIVER_NAME "NUT Huawei UPS2000 (1kVA-3kVA) RS-232 Modbus driver (libmodbus link type: " NUT_MODBUS_LINKTYPE_STR ")" #define DRIVER_VERSION "0.08" #define CHECK_BIT(var,pos) ((var) & (1<<(pos))) diff --git a/drivers/phoenixcontact_modbus.c b/drivers/phoenixcontact_modbus.c index 47b28917ae..7a82882679 100644 --- a/drivers/phoenixcontact_modbus.c +++ b/drivers/phoenixcontact_modbus.c @@ -25,7 +25,11 @@ #include #include "nut_stdint.h" -#define DRIVER_NAME "NUT PhoenixContact Modbus driver" +#if !(defined NUT_MODBUS_LINKTYPE_STR) +# define NUT_MODBUS_LINKTYPE_STR "unknown" +#endif + +#define DRIVER_NAME "NUT PhoenixContact Modbus driver (libmodbus link type: " NUT_MODBUS_LINKTYPE_STR ")" #define DRIVER_VERSION "0.08" #define CHECK_BIT(var,pos) ((var) & (1<<(pos))) diff --git a/drivers/socomec_jbus.c b/drivers/socomec_jbus.c index 6b5a36d891..2800a56813 100644 --- a/drivers/socomec_jbus.c +++ b/drivers/socomec_jbus.c @@ -30,7 +30,11 @@ #include "main.h" #include -#define DRIVER_NAME "Socomec jbus driver" +#if !(defined NUT_MODBUS_LINKTYPE_STR) +# define NUT_MODBUS_LINKTYPE_STR "unknown" +#endif + +#define DRIVER_NAME "Socomec jbus driver (libmodbus link type: " NUT_MODBUS_LINKTYPE_STR ")" #define DRIVER_VERSION "0.09" #define CHECK_BIT(var,pos) ((var) & (1<<(pos))) diff --git a/m4/nut_check_libmodbus.m4 b/m4/nut_check_libmodbus.m4 index 98f80fa10d..0571fd1450 100644 --- a/m4/nut_check_libmodbus.m4 +++ b/m4/nut_check_libmodbus.m4 @@ -242,12 +242,29 @@ modbus_set_byte_timeout(ctx, to_sec, to_usec);]) AS_IF([test x"${nut_have_libmodbus}" = x"yes"], [LIBMODBUS_CFLAGS="${depCFLAGS}" - LIBMODBUS_LIBS="${depLIBS}"] - ) + LIBMODBUS_LIBS="${depLIBS}" + AS_IF([test x"${nut_have_libmodbus_usb}" = x"yes"], + [AC_DEFINE([NUT_MODBUS_HAS_USB], 1, [Define to use libmodbus USB backend])]) - AS_IF([test x"${nut_have_libmodbus_usb}" = x"yes"], - [AC_DEFINE([NUT_MODBUS_HAS_USB], 1, [Define to use libmodbus USB backend])] - ) + dnl The hack below relies on definition of AC LINK IFELSE macro and (GNUish) LDD! + dnl FIXME: This may be platform-dependent; check e.g. mingw/WIN32 builds via ${top_srcdir}/scripts/Windows/dllldd.sh? + dnl Information ismostly useful for troubleshooting though + dnl (cosmetic/messages), so no big fuss if we do not learn it + LIBMODBUS_LINKTYPE="unknown" + AS_IF([test -n "${LDD}" && test -x "${LDD}"], [ + AC_LINK_IFELSE([AC_LANG_PROGRAM([ +#include +], [modbus_t *ctx = modbus_new_rtu(NULL, 0, 0, 0, 0); +if (ctx) modbus_free(ctx);])], [AS_IF([test -x "conftest$ac_exeext"], [ + AS_IF([test -n "`${LDD} "conftest$ac_exeext" | grep "libmodbus"`" 2>/dev/null], + [LIBMODBUS_LINKTYPE="dynamic"], [LIBMODBUS_LINKTYPE="static"]) + ])]) + dnl If not GNU LDD, try other tools? + ]) + AC_MSG_CHECKING([if libmodbus linking is dynamic or static]) + AC_MSG_RESULT([${LIBMODBUS_LINKTYPE}]) + AC_DEFINE_UNQUOTED([NUT_MODBUS_LINKTYPE_STR], ["${LIBMODBUS_LINKTYPE}"], [Define to let the libmodbus linking type be known for troubleshooting]) + ]) unset depCFLAGS unset depLIBS diff --git a/scripts/Solaris/Makefile.am b/scripts/Solaris/Makefile.am index 9e33fd63e1..e9e7406336 100644 --- a/scripts/Solaris/Makefile.am +++ b/scripts/Solaris/Makefile.am @@ -99,14 +99,14 @@ package-solaris-svr4: $(SOLARIS_PACKAGE_SVR4_HELPERSCRIPTS) $(SOLARIS_PACKAGE_SV # TODO: Define support for IPS packaging (provide p5m files and make rules) package-solaris-ips: - @echo "SKIPPED : Target $@ is not implemented yet" + @echo " SKIP $@ : Target is not implemented yet" check-local: $(SOLARIS_CHECK_TARGETS) check-local-solaris-smf: $(SOLARIS_SMF_MANIFESTS) @[ -x /usr/sbin/svccfg ] || { echo "WARNING : Target $@ skipped due to absent /usr/sbin/svccfg" >&2; return 0; } ; \ RES=0 ; for F in $? ; do \ - echo " SVCCFG-VALIDATE $$F"; \ + echo " SVCCFG-VALIDATE $$F"; \ /usr/sbin/svccfg validate "$$F" || RES=$$? ; \ done; exit $$RES diff --git a/scripts/python/module/Makefile.am b/scripts/python/module/Makefile.am index 5a73a6d312..721f919d95 100644 --- a/scripts/python/module/Makefile.am +++ b/scripts/python/module/Makefile.am @@ -61,15 +61,15 @@ PyNUTClient: .pypi-src # Tagged releases should only have three blocks of digits separated by dots upload publish: - +@echo " PYPI Checking upload type for module version '$(NUT_SOURCE_GITREV_NUMERIC)'" ; \ + +@echo " PYPI Checking upload type for module version '$(NUT_SOURCE_GITREV_NUMERIC)'" ; \ case x"`echo "$(NUT_SOURCE_GITREV_NUMERIC)" | tr -d '[0-9]'`" in \ - x..) echo " PYPI ...release"; $(MAKE) $(AM_MAKEFLAGS) upload-pypi ;; \ - x*) echo " PYPI ...testing"; $(MAKE) $(AM_MAKEFLAGS) upload-testpypi ;; \ + x..) echo " PYPI ...release"; $(MAKE) $(AM_MAKEFLAGS) upload-pypi ;; \ + x*) echo " PYPI ...testing"; $(MAKE) $(AM_MAKEFLAGS) upload-testpypi ;; \ esac # README.txt is also a part of module standard expectations .pypi-src: test_nutclient.py.in PyNUT.py.in setup.py.in README.adoc Makefile $(top_srcdir)/LICENSE-GPL3 - @echo " PYPI Generate PyPI module source" + @echo " PYPI Generate PyPI module source" @rm -rf $(GENERATED_SRC) "$@" @mkdir -p PyNUTClient @for S in "$(srcdir)"/*.py.in ; do \ @@ -93,29 +93,29 @@ upload publish: @touch "$@" .pypi-tools-python: - @echo " PYPI Checking that PYTHON variable is defined and usable: $(PYTHON)" + @echo " PYPI Checking that PYTHON variable is defined and usable: $(PYTHON)" @test -n "$(PYTHON)" && command -v $(PYTHON) @touch "$@" .pypi-tools-dist-wheel: .pypi-tools-python - @echo " PYPI Prepare PyPI tools to generate a distribution (wheel)" + @echo " PYPI Prepare PyPI tools to generate a distribution (wheel)" @$(PYTHON) -m pip install wheel @touch "$@" .pypi-tools-dist-build: .pypi-tools-python - @echo " PYPI Prepare PyPI tools to generate a distribution (build)" + @echo " PYPI Prepare PyPI tools to generate a distribution (build)" @$(PYTHON) -m pip install build @touch "$@" .pypi-tools-tox: .pypi-tools-python - @echo " PYPI Prepare Python multi-environment testing tools (tox)" + @echo " PYPI Prepare Python multi-environment testing tools (tox)" @$(PYTHON) -m pip install tox @touch "$@" # Install via OS packaging or pip? # https://twine.readthedocs.io/en/stable/ .pypi-tools-upload: .pypi-tools-python - @echo " PYPI Prepare PyPI tools and resources to upload a distribution (twine)" + @echo " PYPI Prepare PyPI tools and resources to upload a distribution (twine)" @$(PYTHON) -m pip install twine @command -v twine @test -s $(HOME)/.pypirc @@ -130,7 +130,7 @@ upload publish: # The most modern approach as of 2023 .pypi-dist-pip-build: .pypi-tools-dist-build .pypi-src - @echo " PYPI Generate PyPI module distribution (using 'build' module)" + @echo " PYPI Generate PyPI module distribution (using 'build' module)" @rm -rf $(GENERATED_DIST) "$@" @$(PYTHON) -m build --skip-dependency-check --no-isolation @touch "$@" @@ -140,13 +140,13 @@ upload publish: # it "knows what it's doing" and goes quietly about its work :) # Does not support "sdis" though. Oh well. .pypi-dist-pip-wheel: .pypi-tools-dist-wheel .pypi-src - @echo " PYPI Generate PyPI module distribution (using 'pip wheel')" + @echo " PYPI Generate PyPI module distribution (using 'pip wheel')" @rm -rf $(GENERATED_DIST) "$@" @$(PYTHON) -m pip wheel --no-deps -w dist . @touch "$@" .pypi-dist-obsolete: .pypi-tools-dist-wheel .pypi-src - @echo " PYPI Generate PyPI module distribution (using setup.py directly)" + @echo " PYPI Generate PyPI module distribution (using setup.py directly)" @rm -rf $(GENERATED_DIST) "$@" @$(PYTHON) setup.py sdist bdist_wheel @touch "$@" @@ -155,9 +155,9 @@ upload publish: # https://pypi.org/manage/account/ and https://test.pypi.org/manage/account/ # TODO: .asc/.sig files for releases? upload-pypi: .pypi-dist .pypi-tools-upload - @echo " PYPI Upload PyPI module distribution to production/release PyPI repository" + @echo " PYPI Upload PyPI module distribution to production/release PyPI repository" @twine upload dist/* upload-testpypi: .pypi-dist .pypi-tools-upload - @echo " PYPI Upload PyPI module distribution to testing/staging PyPI repository" + @echo " PYPI Upload PyPI module distribution to testing/staging PyPI repository" @twine upload -r testpypi dist/* diff --git a/tests/Makefile.am b/tests/Makefile.am index 5b2df1a1ce..508f081cd6 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -183,7 +183,7 @@ else !HAVE_CPPUNIT EXTRA_DIST += $(CPPUNITTESTSRC) $(CPPCLIENTTESTSRC) $(CPPUNITTESTERSRC) $(CPPUNITTESTSRC_NUTCONF) cppnit: - @echo "SKIP: $@ not implemented without C++11 and CPPUNIT enabled" >&2 ; exit 1 + @echo " SKIP $@ : not implemented without C++11 and CPPUNIT enabled" >&2 ; exit 1 endif !HAVE_CPPUNIT @@ -193,7 +193,7 @@ else !HAVE_CXX11 EXTRA_DIST += $(CPPUNITTESTSRC) $(CPPCLIENTTESTSRC) $(CPPUNITTESTERSRC) $(CPPUNITTESTSRC_NUTCONF) cppnit: - @echo "SKIP: $@ not implemented without C++11 and CPPUNIT enabled" >&2 ; exit 1 + @echo " SKIP $@ : not implemented without C++11 and CPPUNIT enabled" >&2 ; exit 1 endif !HAVE_CXX11 @@ -206,7 +206,7 @@ memcheck: $(check_PROGRAMS) case "$$P" in \ cppnit|cppnit$(EXEEXT)) \ if [ "$${NUT_PORT-}" -gt 0 ] 2>/dev/null ; then : ; else \ - echo "SKIPPED: $(VALGRIND) ./$$P : NUT_PORT not prepared" ; \ + echo " SKIP $@ : $(VALGRIND) ./$$P : NUT_PORT not prepared" ; \ continue ; \ fi ;; \ esac ; \ @@ -220,7 +220,7 @@ memcheck: $(check_PROGRAMS) exit $$RES else !HAVE_VALGRIND memcheck: - @echo "SKIPPED $@ : valgrind was not detected on this system by configure script" >&2 + @echo " SKIP $@ : valgrind was not detected on this system by configure script" >&2 endif !HAVE_VALGRIND if WITH_VALGRIND diff --git a/tools/Makefile.am b/tools/Makefile.am index 1321c3cf6a..cb649e1d2f 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -172,3 +172,6 @@ DISTCLEANFILES = gitlog2changelog.py DISTCLEANFILES += nut-snmpinfo.py .PHONY: nut-scanner-deps nut-scanner-snmp-deps nut-scanner-usb-deps + +# Helper for only the enabled libs to get built: +all-libs-local: nut-scanner-deps diff --git a/tools/nut-usbinfo.pl b/tools/nut-usbinfo.pl index ae26951941..5292585c9b 100755 --- a/tools/nut-usbinfo.pl +++ b/tools/nut-usbinfo.pl @@ -292,6 +292,8 @@ sub find_usbdevs # take care to NOT prune (avoid recursion into) the "." one: return $File::Find::prune = 1 if ($_ eq '.svn') || ($_ =~ /^\.#/) || ($_ =~ /\.(orig|o|la|lo|exe)$/) || ($_ eq '.libs') || ($_ eq '.deps') || ($_ eq '..'); return $File::Find::prune = 0 if ($_ eq '.'); + # FIXME: Skip libtool wrappers or binary builds of drivers without extension + # Maybe ONLY walk *.c and *.h files (and subdirs)?.. if (-d $_) { # FIXME: in current NUT vanilla code we do not support subdirs