Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 836776

Summary: sys-power/nut-2.8.0 version bump
Product: Gentoo Linux Reporter: Ronny Boesger <ronny+bugsgentoo>
Component: Current packagesAssignee: Robin Johnson <robbat2>
Status: RESOLVED FIXED    
Severity: enhancement CC: aliaksei.urbanski, colton.reeder, dan, hyedad, jstein, luke-jr+gentoobugs, matoro_bugzilla_gentoo, polynomial-c, prometheanfire, web
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: nut-2.8.0.ebuild proposal
The patch needed by the proposed ebuild
Second revision

Description Ronny Boesger 2022-04-04 19:55:39 UTC
There is finally, after years a new version available for the nut tools: 

https://github.com/networkupstools/nut/releases/tag/v2.8.0-rc1
Comment 1 Ronny Boesger 2022-04-11 05:25:55 UTC
RC2 is available:
https://github.com/networkupstools/nut/releases/tag/v2.8.0-rc2
Comment 2 Ronny Boesger 2022-04-24 19:01:53 UTC
RC3 (and probably the last) ist available:
https://github.com/networkupstools/nut/releases/tag/v2.8.0-rc3
Comment 3 Ronny Boesger 2022-04-27 17:12:14 UTC
And finally the 2.8.0 is released:
https://github.com/networkupstools/nut/releases/tag/v2.8.0
Comment 4 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2022-05-24 11:29:08 UTC
I get the following error when trying to compile nut-2.8.0:

  DOC-MAN  Generating nutupsdrv.8
a2x: ERROR: "xmllint" --nonet --noout --valid "/var/tmp/portage/sys-power/nut-2.8.0_pre/work/nut-2.8.0/docs/man/tmp/man8.nutupsdrv.8.2077/nutupsdrv.xml" returned non-zero exit status 4

mv: cannot stat './tmp/man8.nutupsdrv.8.2077/nutupsdrv.8': No such file or directory
make[2]: *** [Makefile:1646: nutupsdrv.8] Error 1
Comment 5 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2022-06-23 05:38:48 UTC
*** Bug 853829 has been marked as a duplicate of this bug. ***
Comment 6 Tom Li 2022-07-03 15:28:27 UTC
Also, NUT v2.8.0 added drivers for several new UPS models, including generic_modbus, phoenixcontact_modbus, huawei-ups2000, socomec_jbus, and adelsystem_cbi. However, the use of these drivers requires an external library libmodbus installed and the build option --with-modbus switched on when building NUT. The ebuild should be updated with support of building Modbus drivers.
Comment 7 Timo Kokkonen 2022-07-11 18:11:26 UTC
Created attachment 791084 [details]
nut-2.8.0.ebuild proposal

-2.7.4 version as used as a starting point

-modbus use flag is added due to some new drivers requiring libmodbus to compile

-Driver list is updated to match the available drivers

-All old patches that did not apply are just dropped

-QA issues regarding udev and tmpfiles silenced

-One new patch (nut-2.8.0-fix-man-page-generation.patch) is needed to fix man page generation when only some of the drivers are built
Comment 8 Timo Kokkonen 2022-07-11 18:12:36 UTC
Created attachment 791087 [details, diff]
The patch needed by the proposed ebuild
Comment 9 Ronny Boesger 2022-07-11 19:56:10 UTC
Hello Timo,

many thanks, looks good for me, tried it on my own overlay, compiled fine.
Only in the post section there was 1 error, do not know whats the cause:

 * Running udev control --reload for reloading rules and databases ...   [ ok ]
Failed to open 'nut-common.tmpfiles': No such file or directory
 * The tmpfiles processor exited with a non-zero exit code

Beside that, it runs actually and the upgrade went fine. Will leave it on my server :)

Ronny
Comment 10 Timo Kokkonen 2022-07-12 05:37:50 UTC
Thanks for testing Ronny!

Do you happen to be using systemd on your system? It seem if I git grep tmpfiles in the nut source tree, everything seems to be related systemd. Maybe it should be run only if systemd use flag is in place...?

I did open a ticket upstream about the man page generation issue:

https://github.com/networkupstools/nut/issues/1467

Let's hope we don't need to patch it in upcoming versions.
Comment 11 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-07-12 05:40:42 UTC
tmpfiles should probably be installed unconditionally (as this ebuild tries to do).

This line dying:
>tmpfiles_process nut-common.tmpfiles
... implies that the issue is it isn't actually being installed.
Comment 12 Ronny Boesger 2022-07-12 07:23:19 UTC
Hi Timo, 

i do not use SystemD (i use OpenRC).
Comment 13 Timo Kokkonen 2022-07-12 17:15:20 UTC
I can see that the tmpfiles generation is tied to systemd in the configure script. It doesn't get generated at all unless you have systemd installed. Which is bit odd as the file appears to be there for clearing up state files (it seems).

So, I think the only approach is to handle the tmpfiles on systems where systemd is enabled. I'm not sure how we should detect this in ebuild. Do we need to add a use flag for systemd? I don't think that would be a good idea. Can we see it some other way already?
Comment 14 Timo Kokkonen 2022-07-13 13:51:12 UTC
Created attachment 791318 [details]
Second revision

There is now systemd use flag in the ebuild, which probably should solve the issue that tmpfiles_process fails on systems where systemd is not found. We just don't do the processing if systemd use flag is not present. I think this probably should be fine.

This made me think that there might be similar issue with udev rule processing. Are there anyone who might be not using udev and might want to not do udev rule reloading?

Ronny, if you could try now does this solve the issue you were having with tmpfiles processing on your system? Thanks.
Comment 15 Ronny Boesger 2022-07-14 18:56:23 UTC
Hi Timo,

compiles fine, no more warnings for the systemd tmpfiles, good work :)

From my PoV this can now be commited to portage in testing.

Many Thanks,
Ronny
Comment 16 Timo Kokkonen 2022-07-15 05:38:06 UTC
Thanks for testing Ronny!

The upstream devs are acknowledging the issue I reported and it looks like they will either take my patch as is or in some other form at least. Thus, we should be able to drop the patch once a new upstream version is released.

I'll look forward to hear from Gentoo devs whether we still need anything to this ebuild or is it good enough now.
Comment 17 Luke-Jr 2022-08-15 02:41:40 UTC
Note the NUT-Monitor client was dropped previously due to requiring Python 2 and GTK 2.

I use and like the client, so I ported it to Python 3 and Qt 5. This was included in NUT 2.8.0.

There is, however, a bug in icon handling, which needs patching: https://github.com/networkupstools/nut/issues/1567

My overlay has an older pre-release of the port in sys-power/nut-monitor-2.0_pre20220220 - I suggest keeping it in a separate package (no benefit to bundling it?) and just updating it to the official release.
Comment 18 Karl Hakimian 2022-10-28 17:45:21 UTC
The attached ebuild, while mostly working, does not support USB scanning with nut-scanner.

if you enter:

nut-scanner -U

You get

Cannot load USB library (/usr/lib64/libusb-1.0.so) : file not found. USB search disabled.
Comment 19 Ronny Boesger 2023-06-07 17:27:57 UTC
The usb-scanner thing seems to be caused by nut selft, not because of the ebuild, it seems this would fix it 
https://github.com/networkupstools/nut/issues/233

So the next release should *hopefully* cover this then. 


=== 
For me this is also the case with the nut-scanner for usb:

 # nut-scanner -D -D -D
   0.000000     [D2] Looking for lib libusb-1.0.so in directory #0 : /usr/lib64
   0.000633     [D2] Candidate path for lib libusb-1.0.so is /usr/lib64/libusb-1.0.so (realpath /usr/lib64/libusb-1.0.so)
   0.000660     [D1] Looking for lib libusb-1.0.so, found /usr/lib64/libusb-1.0.so
Cannot load USB library (/usr/lib64/libusb-1.0.so) : file not found. USB search disabled.


Maybe we could go one here ? or is the nut-scanner USB a blocker ?
Comment 20 INODE64 Sistemas 2023-06-16 16:50:45 UTC
I have created a commit improving and simplifying the ebuild

https://github.com/gentoo/gentoo/pull/31486
Comment 21 Larry the Git Cow gentoo-dev 2023-06-17 03:15:23 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aea0f99f970c391e3daf4f98d0b6a2dc58fc039b

commit aea0f99f970c391e3daf4f98d0b6a2dc58fc039b
Author:     Francisco Javier FĂ©lix <web@inode64.com>
AuthorDate: 2023-06-16 16:14:55 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-06-17 03:13:49 +0000

    sys-power/nut: add 2.8.0, various enhancements
    
    I've recently made a comprehensive update to the ebuild of sys-power/nut:
    The way drivers are activated has been altered - instead of using a driver list, which
    can be hard to maintain when new ones are added, we now activate them based on the
    connection type (serial, USB, XML, IPMI, Modbus, etc).
    
    This simplification not only streamlines the installation process but also resolves
    dependency issues associated with activating a driver and its corresponding unactivated connection.
    
    The updates align with the latest Gentoo specifications and are summarized below:
    
    Improvements:
    *    Removed unused libnsl
    *    Removed outdated hotplug
    *    Utilized EAPI=8
    *    Default use of libusb-1
    *    Added connections for GPIO, i2c, and Modbus
    *    Configuration parameters required per connection type
    *    Fixed the creation of PID in /run/nut
    *    Removed configurations no longer necessary for nut-2.8.0 or newer
    *    Creation of man pages
    *    Added a flag for documentation
    *    Utilized tmpfile for creating temporary directories
    *    Added Q5t5 monitor (nut-9999)
    *    Disabled Python2
    *    Added Python3 library
    *    Message for the optional function of sys-apps/util-linux[logger, tty-helpers]
    *    Added configuration for Avahi
    *    Added a flag for systemd (nut-9999)
    
    TODO: (in next version)
    *    nut-scanner is not working
    *    /etc/init.d/upslog requires parameters of SAI and log file
    
    Please note that I have tested different SAI drivers, but only with USB and SNMP connections.
    
    Any feedback or further testing on these updates would be highly appreciated.
    
    Closes: https://bugs.gentoo.org/836776
    Closes: https://bugs.gentoo.org/736804
    Closes: https://bugs.gentoo.org/598619
    Closes: https://bugs.gentoo.org/636402
    Closes: https://bugs.gentoo.org/862543
    Closes: https://bugs.gentoo.org/852287
    Closes: https://bugs.gentoo.org/676598
    Closes: https://bugs.gentoo.org/808675
    Closes: https://bugs.gentoo.org/771291
    Closes: https://bugs.gentoo.org/714930
    Closes: https://bugs.gentoo.org/695148
    Closes: https://bugs.gentoo.org/641144
    Closes: https://bugs.gentoo.org/670132
    Closes: https://bugs.gentoo.org/642618
    Closes: https://bugs.gentoo.org/544250
    Closes: https://bugs.gentoo.org/526328
    Package-Manager: Portage-3.0.45.3, pkgcheck-0.10.24
    Signed-off-by: Fco Javier Felix <ffelix@inode64.com>
    Closes: https://github.com/gentoo/gentoo/pull/31486
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-power/nut/Manifest                             |   1 +
 sys-power/nut/files/nut-2.6.5-init.d-upsmon        |   2 +-
 .../files/nut-2.8.0-fix-man-page-generation.patch  |  64 +++++
 sys-power/nut/files/nut-2.8.0-init.d-upsd          |  37 +++
 sys-power/nut/files/nut.powerfail.initd            |   1 -
 sys-power/nut/files/systemd_notify.path            |  50 ++++
 sys-power/nut/metadata.xml                         |  14 +-
 sys-power/nut/nut-2.8.0.ebuild                     | 222 +++++++++++++++++
 sys-power/nut/nut-9999.ebuild                      | 266 +++++++++++++++++++++
 9 files changed, 654 insertions(+), 3 deletions(-)
Comment 22 Ronny Boesger 2023-06-17 08:48:00 UTC
Many thanks INODE64 Sistemas

one issue with the new ebuild, the cgi use does not work.

 * Package:    sys-power/nut-2.8.0-r1:0
 * Repository: gentoo
 * Maintainer: robbat2@gentoo.org prometheanfire@gentoo.org,web@inode64.com,proxy-maint@gentoo.org
 * Upstream:   https://github.com/networkupstools/nut/issues
 * USE:        abi_x86_64 amd64 cgi elibc_glibc kernel_linux man snmp split-usr ssl tcpd usb xml
 * FEATURES:   network-sandbox preserve-libs sandbox userpriv usersandbox

[...]

./configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --datarootdir=/usr/share --disable-dependency-tracking --disable-silent-rules --disable-static --docdir=/usr/share/doc/nut-2.8.0-r1 --htmldir=/usr/share/doc/nut-2.8.0-r1/html --with-sysroot=/ --libdir=/usr/lib64 --datadir=/usr/share/nut --datarootdir=/usr/share/nut --disable-static --disable-strip --disable-Werror --sysconfdir=/etc/nut --with-dev --with-drvpath=/lib64/nut --with-group=nut --with-htmlpath=/usr/share/nut/html --with-logfacility=LOG_DAEMON --with-statepath=/var/lib/nut --with-systemdsystemunitdir=/lib/systemd/system --with-systemdtmpfilesdir=/usr/lib/tmpfiles.d --with-udev-dir=/lib/udev --with-user=nut --without-powerman --without-python --without-python2 --without-python3 --with-altpidpath=/run/nut --with-pidpath=/run/nut --disable-cppunit --without-linux_i2c --without-freeipmi --without-ipmi --without-serial --with-snmp --with-ssl --with-wrap --with-usb --with-neon --without-avahi --with-cgipath=/usr/share/nut/cgi --with-doc=man

[...]

checking cgi path... /usr/share/nut/cgi
checking html path... /usr/share/nut/html

[...]

Configuration summary:
======================
build serial drivers: no
build USB drivers: yes (libusb-1.0)
build neon based XML driver: yes
enable Avahi support: no
build Powerman PDU client driver: no
build Modbus driver: no
build IPMI driver: no
build Mac OS X meta-driver: no
build i2c based drivers: no
enable SSL support: yes (OpenSSL)
enable libwrap (tcp-wrappers) support: yes
enable libltdl (Libtool dlopen abstraction) support: yes
build nut-scanner: yes
build CGI programs: no
build and install documentation: man
build specific documentation format(s): yes  man
build and install the development files: yes
build SNMP drivers: yes


So it seems, only the "--with-cgi" configure flag is missing.

Many Thanks,
Ronny
Comment 23 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-06-17 12:38:03 UTC
Could you file a new bug for that? Thanks!
Comment 24 Ronny Boesger 2023-06-17 15:46:51 UTC
Done in: https://bugs.gentoo.org/836776
Comment 25 Ronny Boesger 2023-06-17 15:47:50 UTC
Sorry, wrong bugig, right is https://bugs.gentoo.org/908689
Comment 26 matoro archtester 2023-06-18 01:10:36 UTC
The usb scanner thing does not appear to be anything related to the development files.  Rather it is because our libusb-1.0.so is a linker script instead of an actual library.  So the usb-scanner tool does not actually work with this release.