Skip to contentSkip to conversation

package/nut: bump version

PATCH Superseded Bernd Kuhls 2 participants 2 messages Mar 30, 2021 – Apr 2, 2021

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/nut: bump version

The last release is five years old. To support newer hardware we bump the package to latest git master branch. For upstream discussion see github issue 819.

Removed patches, they were all applied upstream.

NUT_AUTORECONF = YES is broken:

configure.ac:1994: error: required file 'scripts/augeas/nutupsconf.aug.in' not found configure.ac:1994: error: required file 'scripts/devd/nut-usb.conf.in' not found configure.ac:1994: error: required file 'scripts/udev/nut-usbups.rules.in' not found

because upstream autogen.sh creates files using host-perl and host-python:
https://github.com/networkupstools/nut/blob/master/autogen.sh

Configure is not cross-compile friendly:
https://github.com/networkupstools/nut/blob/master/m4/ax_c_pragmas.m4#L574
Add ax_cv__printf_string_null=yes to fix cross build.

---
Build-tested using this defconfig

BR2_PACKAGE_NUT=y
BR2_PACKAGE_NUT_DRIVERS=""

                             andes-nds32 [ 1/45]: SKIPPED
                             arm-aarch64 [ 2/45]: OK
                   bootlin-aarch64-glibc [ 3/45]: OK
               bootlin-arcle-hs38-uclibc [ 4/45]: OK
                    bootlin-armv5-uclibc [ 5/45]: OK
                     bootlin-armv7-glibc [ 6/45]: OK
                   bootlin-armv7m-uclibc [ 7/45]: SKIPPED
                      bootlin-armv7-musl [ 8/45]: OK
                bootlin-m68k-5208-uclibc [ 9/45]: SKIPPED
               bootlin-m68k-68040-uclibc [10/45]: OK
             bootlin-microblazeel-uclibc [11/45]: OK
                bootlin-mipsel32r6-glibc [12/45]: OK
                   bootlin-mipsel-uclibc [13/45]: OK
                     bootlin-nios2-glibc [14/45]: OK
                 bootlin-openrisc-uclibc [15/45]: OK
        bootlin-powerpc64le-power8-glibc [16/45]: OK
           bootlin-powerpc-e500mc-uclibc [17/45]: OK
                   bootlin-riscv32-glibc [18/45]: OK
                   bootlin-riscv64-glibc [19/45]: OK
                    bootlin-riscv64-musl [20/45]: OK
                      bootlin-sh4-uclibc [21/45]: OK
                   bootlin-sparc64-glibc [22/45]: OK
                    bootlin-sparc-uclibc [23/45]: OK
                    bootlin-x86-64-glibc [24/45]: OK
                     bootlin-x86-64-musl [25/45]: OK
                   bootlin-x86-64-uclibc [26/45]: OK
                   bootlin-xtensa-uclibc [27/45]: OK
                            br-arm-basic [28/45]: SKIPPED
                    br-arm-full-nothread [29/45]: OK
                      br-arm-full-static [30/45]: OK
                   br-i386-pentium4-full [31/45]: OK
                br-i386-pentium-mmx-musl [32/45]: OK
                      br-mips64-n64-full [33/45]: OK
                 br-mips64r6-el-hf-glibc [34/45]: OK
               br-powerpc-603e-basic-cpp [35/45]: OK
               br-powerpc64-power7-glibc [36/45]: OK
                       linaro-aarch64-be [37/45]: OK
                          linaro-aarch64 [38/45]: OK
                              linaro-arm [39/45]: OK
                     sourcery-arm-armv4t [40/45]: OK
                            sourcery-arm [41/45]: OK
                     sourcery-arm-thumb2 [42/45]: OK
                         sourcery-mips64 [43/45]: OK
                           sourcery-mips [44/45]: OK
                          sourcery-nios2 [45/45]: OK

45 builds, 4 skipped, 0 build failed, 0 legal-info failed

 ...ze-path-to-gdlib-config-and-net-snmp.patch | 153 ------------------
 .../0002-client-ups-add-missing-include.patch |  29 ----
 ...Add-compatibility-with-openssl-1.1.0.patch |  76 ---------
 ...m4-try-to-find-gd-through-pkg-config.patch | 120 --------------
 package/nut/nut.hash                          |   3 +-
 package/nut/nut.mk                            |  26 ++-
 6 files changed, 22 insertions(+), 385 deletions(-)
 delete mode 100644 package/nut/0001-Allow-to-customize-path-to-gdlib-config-and-net-snmp.patch
 delete mode 100644 package/nut/0002-client-ups-add-missing-include.patch
 delete mode 100644 package/nut/0003-Add-compatibility-with-openssl-1.1.0.patch
 delete mode 100644 package/nut/0004-nut_check_libgd.m4-try-to-find-gd-through-pkg-config.patch
package/nut/0001-Allow-to-customize-path-to-gdlib-config-and-net-snmp.patch deleted +0 -153
deleted file mode 100644
index 308dbb1aa2..0000000000
@@ -1,153 +0,0 @@
-From 086b5fa8fe4ba74404e92b5f838263dfcf9f173d Mon Sep 17 00:00:00 2001
-From: Jim Klimov <[email protected]>
-Date: Thu, 7 Apr 2016 03:56:51 +0200
-Subject: [PATCH] Allow to customize path to gdlib-config and net-snmp-config
- programs
-
-[yann.morin.1998 at free.fr: backport]
-Signed-off-by: "Yann E. MORIN" <[email protected]>
-
----
-Backported from upstream commit 086b5fa8fe4ba74404e92b5f838263dfcf9f173d
----
- docs/configure.txt         | 14 ++++++++++++++
- m4/nut_check_libgd.m4      | 29 +++++++++++++++++++++++------
- m4/nut_check_libnetsnmp.m4 | 25 +++++++++++++++++++++----
- 3 files changed, 58 insertions(+), 10 deletions(-)
-
-diff --git a/docs/configure.txt b/docs/configure.txt
-index aff82c1..b3b542a 100644
---- a/docs/configure.txt
-+++ b/docs/configure.txt
-@@ -23,6 +23,13 @@ Note that you need to install the libusb development package or files.
- Build and install the SNMP drivers (default: auto-detect)
- Note that you need to install libsnmp development package or files.
- 
-+	--with-net-snmp-config
-+
-+In addition to the `--with-snmp` option above, this one allows to provide
-+a custom program name (in `PATH`) or complete pathname to `net-snmp-config`.
-+This may be needed on build systems which support multiple architectures,
-+or in cases where your distribution names this program differently.
-+
- 	--with-neon
- 
- Build and install the XML drivers (default: auto-detect)
-@@ -335,6 +342,13 @@ NOTE: the --with-gd switches are not necessary if you have gd 2.0.8
- or higher installed properly.  The gdlib-config script will be 
- detected and used by default in that situation.
- 
-+	--with-gdlib-config
-+
-+This option allows to provide a custom program name (in `PATH`) or
-+a complete pathname to `gdlib-config`. This may be needed on build
-+systems which support multiple architectures, or in cases where your
-+distribution names this program differently.
-+
- 	--with-ssl-includes, --with-usb-includes, --with-snmp-includes,
- 	--with-neon-includes, --with-libltdl-includes,
- 	--with-powerman-includes="-I/foo/bar"
-diff --git a/m4/nut_check_libgd.m4 b/m4/nut_check_libgd.m4
-index 01cc882..73f4da7 100644
---- a/m4/nut_check_libgd.m4
-+++ b/m4/nut_check_libgd.m4
-@@ -19,8 +19,25 @@ if test -z "${nut_have_libgd_seen}"; then
- 	LDFLAGS="-L/usr/X11R6/lib"
- 	LIBS="-lgd -lpng -lz -ljpeg -lfreetype -lm -lXpm -lX11"
- 
--	AC_MSG_CHECKING(for gd version via gdlib-config)
--	GD_VERSION=`gdlib-config --version 2>/dev/null`
-+	dnl By default seek in PATH
-+	GDLIB_CONFIG=gdlib-config
-+	AC_ARG_WITH(gdlib-config,
-+		AS_HELP_STRING([@<:@--with-gdlib-config=/path/to/gdlib-config@:>@],
-+			[path to program that reports GDLIB configuration]),
-+	[
-+		case "${withval}" in
-+		"") ;;
-+		yes|no)
-+			AC_MSG_ERROR(invalid option --with(out)-gdlib-config - see docs/configure.txt)
-+			;;
-+		*)
-+			GDLIB_CONFIG="${withval}"
-+			;;
-+		esac
-+	])
-+
-+	AC_MSG_CHECKING(for gd version via ${GDLIB_CONFIG})
-+	GD_VERSION=`${GDLIB_CONFIG} --version 2>/dev/null`
- 	if test "$?" != "0" -o -z "${GD_VERSION}"; then
- 		GD_VERSION="none"
- 	fi
-@@ -30,13 +47,13 @@ if test -z "${nut_have_libgd_seen}"; then
- 	none)
- 		;;
- 	2.0.5 | 2.0.6 | 2.0.7)
--		AC_MSG_WARN([[gd ${GD_VERSION} detected, unable to use gdlib-config script]])
-+		AC_MSG_WARN([[gd ${GD_VERSION} detected, unable to use ${GDLIB_CONFIG} script]])
- 		AC_MSG_WARN([[If gd detection fails, upgrade gd or use --with-gd-includes and --with-gd-libs]])
- 		;;
- 	*)
--		CFLAGS="`gdlib-config --includes 2>/dev/null`"
--		LDFLAGS="`gdlib-config --ldflags 2>/dev/null`"
--		LIBS="`gdlib-config --libs 2>/dev/null`"
-+		CFLAGS="`${GDLIB_CONFIG} --includes 2>/dev/null`"
-+		LDFLAGS="`${GDLIB_CONFIG} --ldflags 2>/dev/null`"
-+		LIBS="`${GDLIB_CONFIG} --libs 2>/dev/null`"
- 		;;
- 	esac
- 
-diff --git a/m4/nut_check_libnetsnmp.m4 b/m4/nut_check_libnetsnmp.m4
-index e1c1426..83b2633 100644
---- a/m4/nut_check_libnetsnmp.m4
-+++ b/m4/nut_check_libnetsnmp.m4
-@@ -13,9 +13,26 @@ if test -z "${nut_have_libnetsnmp_seen}"; then
- 	CFLAGS_ORIG="${CFLAGS}"
- 	LIBS_ORIG="${LIBS}"
- 
-+	dnl By default seek in PATH
-+	NET_SNMP_CONFIG=net-snmp-config
-+	AC_ARG_WITH(net-snmp-config,
-+		AS_HELP_STRING([@<:@--with-net-snmp-config=/path/to/net-snmp-config@:>@],
-+			[path to program that reports Net-SNMP configuration]),
-+	[
-+		case "${withval}" in
-+		"") ;;
-+		yes|no)
-+			AC_MSG_ERROR(invalid option --with(out)-net-snmp-config - see docs/configure.txt)
-+			;;
-+		*)
-+			NET_SNMP_CONFIG="${withval}"
-+			;;
-+		esac
-+	])
-+
- 	dnl See which version of the Net-SNMP library (if any) is installed
--	AC_MSG_CHECKING(for Net-SNMP version via net-snmp-config)
--	SNMP_VERSION=`net-snmp-config --version 2>/dev/null`
-+	AC_MSG_CHECKING(for Net-SNMP version via ${NET_SNMP_CONFIG})
-+	SNMP_VERSION=`${NET_SNMP_CONFIG} --version 2>/dev/null`
- 	if test "$?" != "0" -o -z "${SNMP_VERSION}"; then
- 		SNMP_VERSION="none"
- 	fi
-@@ -33,7 +50,7 @@ if test -z "${nut_have_libnetsnmp_seen}"; then
- 			CFLAGS="${withval}"
- 			;;
- 		esac
--	], [CFLAGS="`net-snmp-config --base-cflags 2>/dev/null`"])
-+	], [CFLAGS="`${NET_SNMP_CONFIG} --base-cflags 2>/dev/null`"])
- 	AC_MSG_RESULT([${CFLAGS}])
- 
- 	AC_MSG_CHECKING(for Net-SNMP libs)
-@@ -48,7 +65,7 @@ if test -z "${nut_have_libnetsnmp_seen}"; then
- 			LIBS="${withval}"
- 			;;
- 		esac
--	], [LIBS="`net-snmp-config --libs 2>/dev/null`"])
-+	], [LIBS="`${NET_SNMP_CONFIG} --libs 2>/dev/null`"])
- 	AC_MSG_RESULT([${LIBS}])
- 
- 	dnl Check if the Net-SNMP library is usable
--- 
-2.7.4
-
package/nut/0002-client-ups-add-missing-include.patch deleted +0 -29
deleted file mode 100644
index 63fdcdcbb4..0000000000
@@ -1,29 +0,0 @@
-From da0969b26ad4bb839bcb88362c8f41aaf0eb8363 Mon Sep 17 00:00:00 2001
-From: "Yann E. MORIN" <[email protected]>
-Date: Tue, 11 Oct 2016 12:05:36 +0200
-Subject: [PATCH] client/ups: add missing include
-
-struct timeval is declared in sys/time.h, so we need to #include it.
-
-Signed-off-by: "Yann E. MORIN" <[email protected]>
----
-Backported from upstream commit da0969b26ad4bb839bcb88362c8f41aaf0eb8363
----
- clients/upsclient.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/clients/upsclient.c b/clients/upsclient.c
-index 43c0e79..dfadd0d 100644
---- a/clients/upsclient.c
-+++ b/clients/upsclient.c
-@@ -37,6 +37,7 @@
- #include <netinet/in.h>
- #include <arpa/inet.h>
- #include <fcntl.h>
-+#include <sys/time.h>
- 
- #include "upsclient.h"
- #include "common.h"
--- 
-2.7.4
-
package/nut/0003-Add-compatibility-with-openssl-1.1.0.patch deleted +0 -76

76 lines not on this page · raw message

package/nut/0004-nut_check_libgd.m4-try-to-find-gd-through-pkg-config.patch deleted +0 -120

120 lines not on this page · raw message

package/nut/nut.hash +1 -2
index 0a677bc058..a4e84244b5 100644
@@ -1,6 +1,5 @@
-# From http://www.networkupstools.org/source/2.7/nut-2.7.2.tar.gz.sha256
-sha256  980e82918c52d364605c0703a5dcf01f74ad2ef06e3d365949e43b7d406d25a7  nut-2.7.4.tar.gz
 # Locally computed
+sha256  7129b2df45f9a9df3943f4d09f2b95b5a63d66ca4913431352570206968ca97b  nut-03c3bbe8df9a2caf3c09c120ae7045d35af99b76.tar.gz
 sha256  9f562d0e6be5108a06684dd249686d378abe1653df14b1944e971e084f6751f0  COPYING
 sha256  ab15fd526bd8dd18a9e77ebc139656bf4d33e97fc7238cd11bf60e2b9b8666c6  LICENSE-GPL2
 sha256  fc82ca8b6fdb18d4e3e85cfd8ab58d1bcd3f1b29abe782895abd91d64763f8e7  LICENSE-GPL3
package/nut/nut.mk +21 -5
index ad575310f5..47593c5fbf 100644
@@ -4,16 +4,30 @@
 #
 ################################################################################
 
-NUT_VERSION_MAJOR = 2.7
-NUT_VERSION = $(NUT_VERSION_MAJOR).4
-NUT_SITE = http://www.networkupstools.org/source/$(NUT_VERSION_MAJOR)
+NUT_VERSION = 03c3bbe8df9a2caf3c09c120ae7045d35af99b76
+NUT_SITE = $(call github,networkupstools,nut,$(NUT_VERSION))
 NUT_LICENSE = GPL-2.0+, GPL-3.0+ (python scripts), GPL/Artistic (perl client)
 NUT_LICENSE_FILES = COPYING LICENSE-GPL2 LICENSE-GPL3
 NUT_INSTALL_STAGING = YES
 NUT_DEPENDENCIES = host-pkgconf
 
-# Our patch changes m4 macros, so we need to autoreconf
-NUT_AUTORECONF = YES
+# libtool needs to be patched after autogen.sh
+NUT_LIBTOOL_PATCH = NO
+
+# configure is missing and autogen.sh generates more files than our
+# autoreconf, run libtool patch hook after autogen.sh
+define NUT_RUN_AUTOGEN
+	cd $(@D) && PATH=$(BR_PATH) ./autogen.sh
+endef
+NUT_POST_PATCH_HOOKS += NUT_RUN_AUTOGEN
+NUT_POST_PATCH_HOOKS += LIBTOOL_PATCH_HOOK
+
+NUT_DEPENDENCIES += \
+	host-autoconf \
+	host-automake \
+	host-libtool \
+	host-perl \
+	$(if $(BR2_PACKAGE_PYTHON),host-python,host-python3)
 
 # Race condition in tools generation
 NUT_MAKE = $(MAKE1)
@@ -25,6 +39,8 @@ NUT_CONF_OPTS = \
 	--with-dev \
 	--without-hal
 
+NUT_CONF_ENV = ax_cv__printf_string_null=yes
+
 # For uClibc-based toolchains, nut forgets to link with -lm
 ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
 NUT_CONF_ENV += LDFLAGS="$(TARGET_LDFLAGS) -lm"
Signature · 1 line
2.29.2
#1 lore raw

PATCH 1/1 package/nut: bump version

Bernd, All,

On 2021-03-30 23:04 +0200, Bernd Kuhls spake thusly:

Quoted 6 lines

The last release is five years old. To support newer hardware we bump the package to latest git master branch. For upstream discussion see github issue 819.

Removed patches, they were all applied upstream.

Quoted 8 lines

NUT_AUTORECONF = YES is broken:

configure.ac:1994: error: required file 'scripts/augeas/nutupsconf.aug.in' not found configure.ac:1994: error: required file 'scripts/devd/nut-usb.conf.in' not found configure.ac:1994: error: required file 'scripts/udev/nut-usbups.rules.in' not found

because upstream autogen.sh creates files using host-perl and host-python:
https://github.com/networkupstools/nut/blob/master/autogen.sh

The python stuff is need to create scripts/augeas/nutupsconf.aug.in, and this is needed for the Augeas configuration framework, which we do not have in Buildroot. And in anycase, the support for which is anyway broken for cross-compilation:

    [https://github.com/networkupstools/nut/blob/master/configure.ac#L87]
    auglensdir='/usr/share/augeas/lenses/dist'
    if test ! -d "${auglensdir}"; then
       auglensdir='/usr/share/augeas/lenses'
       if test ! -d "${auglensdir}"; then
          auglensdir=''
       fi
    fi
    [https://github.com/networkupstools/nut/blob/master/configure.ac#L1561]
    AC_ARG_WITH(augeas-lenses-dir,
        AS_HELP_STRING([--with-augeas-lenses-dir=PATH], [where to install Augeas configuration-management lenses (/usr/share/augeas/lenses{/dist,/})]),
    [
        case "${withval}" in
        yes)
            if test -z "${auglensdir}"; then
                AC_MSG_RESULT(no)
                AC_MSG_ERROR([augeas lenses directory requested but not found in default location])
            fi
            ;;
        auto)
            ;;
        no)
            auglensdir=""
            ;;
        *)
            auglensdir="${withval}"
            ;;
        esac
    ], [])

So, if the host has Augeas installed or, the current situation, where we do not pass any of --with-augeas-lenses-dir=XXXXX, will depend on the host setting, not the target.

Augeas support is limited to installing a few configuration files:

    [https://github.com/networkupstools/nut/blob/master/scripts/augeas/Makefile.am#L27]
    if WITH_AUGLENS
    [--SNIP--]
     auglens_DATA = \
        nuthostsconf.aug  nutupsconf.aug   nutupsdusers.aug   nutupsschedconf.aug \
        nutnutconf.aug    nutupsdconf.aug  nutupsmonconf.aug  nutupssetconf.aug
    endif

So I think we could very well leave without Augeas support installed, as it currently is de-facto, and touch a fake scripts/augeas/nutupsconf.aug.in file with a pre-configure hook...

The perl part is more problematic, because it is about udev rules, for which we do have support; not having it would be seriously crippling, so we can't do the fake-dance like suggested above for Augeas.

But the autogensh script is pretty trivial, in fact: it is just callign those two scripts, and we could very well do it ourselves, which would allow us to use our full autoreconf machinery...

    NUT_DEPENDENCIES = \
        host-pkgconf \
        host-perl \
        $(BR2_PYTHON3_HOST_DEPENDENCY)

    # From git:
    NUT_AUTORECONF = YES

    # Generate files otherwise generated by autogen.sh
    define NUT_PREGEN
        cd $(@D)/scripts/augeas && PATH=$(BR_PATH) ./gen-nutupsconf-aug.py
        cd $(@D)/tools && PATH=$(BR_PATH) ./nut-usbinfo.pl
    endef
    NUT_PRE_CONFIGURE_HOOKS += NUT_PREGEN
Quoted 3 lines

Configure is not cross-compile friendly:
https://github.com/networkupstools/nut/blob/master/m4/ax_c_pragmas.m4#L574
Add ax_cv__printf_string_null=yes to fix cross build.

That's indeed the case for the three C libraries we support.

Care to look into the above sugestions, please/

Quoted 2 lines

---

[--SNIP--]

Quoted 22 lines
package/nut/nut.mk +4 -5
index ad575310f5..47593c5fbf 100644
@@ -4,16 +4,30 @@
 #
 ################################################################################
 
-NUT_VERSION_MAJOR = 2.7
-NUT_VERSION = $(NUT_VERSION_MAJOR).4
-NUT_SITE = http://www.networkupstools.org/source/$(NUT_VERSION_MAJOR)
+NUT_VERSION = 03c3bbe8df9a2caf3c09c120ae7045d35af99b76
+NUT_SITE = $(call github,networkupstools,nut,$(NUT_VERSION))
 NUT_LICENSE = GPL-2.0+, GPL-3.0+ (python scripts), GPL/Artistic (perl client)
 NUT_LICENSE_FILES = COPYING LICENSE-GPL2 LICENSE-GPL3
 NUT_INSTALL_STAGING = YES
 NUT_DEPENDENCIES = host-pkgconf
 
-# Our patch changes m4 macros, so we need to autoreconf
-NUT_AUTORECONF = YES
+# libtool needs to be patched after autogen.sh
+NUT_LIBTOOL_PATCH = NO

package/nut/nut.mk line 25

Quoted 10 lines
package/nut/nut.mk +10 -0
+
+# configure is missing and autogen.sh generates more files than our
+# autoreconf, run libtool patch hook after autogen.sh
+define NUT_RUN_AUTOGEN
+	cd $(@D) && PATH=$(BR_PATH) ./autogen.sh
+endef
+NUT_POST_PATCH_HOOKS += NUT_RUN_AUTOGEN
+NUT_POST_PATCH_HOOKS += LIBTOOL_PATCH_HOOK
+
+NUT_DEPENDENCIES += \

When the dependencies are not conditional, assign them in a single assignment (see above).

package/nut/nut.mk line 28

Quoted 3 lines
package/nut/nut.mk +3 -0
+	host-autoconf \
+	host-automake \
+	host-libtool \

Those three are not necessary if we use our autoreconf infra, as suggested above, I hope...

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'