GNU bug report logs - #44258
Add Network UPS Tools

Previous Next

Package: guix-patches;

Reported by: Nicolò Balzarotti <anothersms <at> gmail.com>

Date: Tue, 27 Oct 2020 16:13:01 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 44258 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#44258; Package guix-patches. (Tue, 27 Oct 2020 16:13:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Nicolò Balzarotti <anothersms <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Tue, 27 Oct 2020 16:13:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Nicolò Balzarotti <anothersms <at> gmail.com>
To: guix-patches <at> gnu.org
Subject: Add Network UPS Tools
Date: Tue, 27 Oct 2020 17:12:26 +0100
[Message part 1 (text/plain, inline)]
Hi guix!
This patch adds Network UPS Tools (nut).

I could test that binaries run, but could not connect to a real UPS (I
need to replace my UPSs as they are currently dead).

Let me know if any of you can try!

Thanks, Nicolò

[0001-gnu-Add-nut.patch (text/x-patch, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#44258; Package guix-patches. (Tue, 10 Nov 2020 19:56:01 GMT) Full text and rfc822 format available.

Message #8 received at 44258 <at> debbugs.gnu.org (full text, mbox):

From: Marius Bakke <marius <at> gnu.org>
To: Nicolò Balzarotti <anothersms <at> gmail.com>,
 44258 <at> debbugs.gnu.org
Subject: Re: [bug#44258] Add Network UPS Tools
Date: Tue, 10 Nov 2020 20:55:39 +0100
[Message part 1 (text/plain, inline)]
Nicolò Balzarotti <anothersms <at> gmail.com> writes:

> Hi guix!
> This patch adds Network UPS Tools (nut).

Cool!

[...]

>>From 0e3a16eb19bc481d38edbe36c241ec4631cbdd33 Mon Sep 17 00:00:00 2001
> From: nixo <nicolo <at> nixo.xyz>
> Date: Tue, 27 Oct 2020 10:56:35 +0100
> Subject: [PATCH] gnu: Add nut.
>
> * gnu/packages/admin.scm (nut): New variable.

[...]
  
> +(define-public nut
> +  (package
> +    (name "nut")
> +    (version "2.7.4")
> +    (source
> +     (origin
> +       (method url-fetch)
> +       (uri "https://networkupstools.org/source/2.7/nut-2.7.4.tar.gz")

Avoid hard-coding versions in URLs.  You can use the version-major+minor
procedure to create that "2.7" URL component.

> +       (patches
> +        (list
> +         ;; OpenSSL 1.1 support
> +         (origin
> +           (method url-fetch)
> +           (uri (string-append "https://patch-diff.githubusercontent.com/raw/"
> +                               "networkupstools/nut/pull/504.patch"))
> +           (sha256
> +            (base32 "1dabbzlmb886qy39xjx6nxlfrzfkm99n48la1ip32zm3baal6qph"))
> +           (file-name (string-append name "-openssl1.1")))))))

This got merged in 2017, and still not released!

Looking at the pull request[0], this URL is a squashed version of 7
commits.  While convenient, this trick has failed before due to subtle
changes in GitHub machinery, eventually leading to a hash mismatch[1].

Taking 7 patches directly is no fun either, so I wonder if we can just
stick with OpenSSL 1.0 for now?

[0] https://github.com/networkupstools/nut/pull/504
[1] commit 7670efefe4fb4aca12cb19ea5d89ff37c48e3ea6

> +    (build-system gnu-build-system)
> +    (arguments
> +     `(#:configure-flags '("--with-all"
> +                           "--with-openssl"
> +                           ;; powerman is required (where is it hosted?)
> +                           "--without-powerman"

Can you elaborate on powerman being required?  Is the package not usable
without it?

> +                           ;; cgi requires libgd
> +                           "--without-cgi")

We do have libgd (in the 'gd' package).

> +       #:phases
> +       (modify-phases %standard-phases
> +         (add-before 'configure 'update-configure
> +           ;; required to apply the patch to the ./configure script
> +           (lambda _
> +             (invoke "autoconf"))))))

This may not be necessary due to the 'bootstrap' phase (but I haven't
verified).

> +    (native-inputs `(("autoconf" ,autoconf)
> +                     ("cppunit" ,cppunit)
> +                     ("pkg-config" ,pkg-config)))
> +    (inputs `(("avahi" ,avahi)
> +              ("libusb" ,libusb-compat)
> +              ("libltdl" ,libltdl)
> +              ("freeipmi" ,freeipmi)
> +              ("neon" ,neon)
> +              ("openssl" ,openssl)
> +              ("net-snmp" ,net-snmp)))

The indentation of these are a bit weird.  :-)

> +    (home-page "https://networkupstools.org")
> +    (license
> +     (list
> +      ;; - most files under gpl2+
> +      license:gpl2+
> +      ;; - scripts/python/ under gpl3+
> +      license:gpl3+
> +      ;; - scripts/perl/Nut.pm same as perl (either gpl1+ or artistic)
> +      license:gpl1+ license:artistic2.0))

Great job at listing licenses!

> +    (synopsis "Collection of programs for monitoring and administering UPS")
> +    (description "Network UPS Tools is a collection of programs which provide
> +a common interface for monitoring and administering UPS, PDU and SCD hardware.
> +It uses a layered approach to connect all of the parts.  Drivers are provided
> +for a wide assortment of equipment.")))

Maybe add @acronym{UPS, Uninterruptible Power Supply},
@acronym{PDU, ...} etc, but no strong opinion.

Can you send an updated patch?
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#44258; Package guix-patches. (Sat, 14 Nov 2020 16:46:01 GMT) Full text and rfc822 format available.

Message #11 received at 44258 <at> debbugs.gnu.org (full text, mbox):

From: Nicolò Balzarotti <anothersms <at> gmail.com>
To: Marius Bakke <marius <at> gnu.org>, 44258 <at> debbugs.gnu.org
Subject: Re: [bug#44258] Add Network UPS Tools
Date: Sat, 14 Nov 2020 17:45:11 +0100
[Message part 1 (text/plain, inline)]
Hi, thanks for the reply.

Marius Bakke <marius <at> gnu.org> writes:

>
> Avoid hard-coding versions in URLs.  You can use the version-major+minor
> procedure to create that "2.7" URL component.

Done!

> This got merged in 2017, and still not released!
>
> Looking at the pull request[0], this URL is a squashed version of 7
> commits.  While convenient, this trick has failed before due to subtle
> changes in GitHub machinery, eventually leading to a hash mismatch[1].
>
> Taking 7 patches directly is no fun either, so I wonder if we can just
> stick with OpenSSL 1.0 for now?
>
Fine! Using openssl-1.0 now.

>> +                           ;; powerman is required (where is it hosted?)
>> +                           "--without-powerman"
>
> Can you elaborate on powerman being required?  Is the package not usable
> without it?
>
Expanded a bit, following nut readme.

>> +                           ;; cgi requires libgd
>> +                           "--without-cgi")
>
> We do have libgd (in the 'gd' package).
>
Oh, I don't know how I missed it.  Added!  Now cgi is working (output is
in folder /cgi-bin, is this correct for guix?)

Since nut release is really old, it used to use gdlib-config.  It has 
been removed and replaced by pkg-config.  However, the patch [1] does
not apply.  So I had to do the "terrible" fix of calling pkg-config
myself (in the new "fix-ligdb-check" phase).  Terrible because I wanted
to call it in guile and save the output to the file, but the only way I
know of is with popen (and I could not find another package doing this
(while some package like python-libmpsse are just inserting the call
like I did here).

>> +       #:phases
>> +       (modify-phases %standard-phases
>> +         (add-before 'configure 'update-configure
>> +           ;; required to apply the patch to the ./configure script
>> +           (lambda _
>> +             (invoke "autoconf"))))))
>
> This may not be necessary due to the 'bootstrap' phase (but I haven't
> verified).
>
Well, now that I switched to openssl-1.0 it sure is not needed anymore.
But previously I remember without the autoreconf call, it was not working.

>> +    (native-inputs `(("autoconf" ,autoconf)n
>> +                     ("cppunit" ,cppunit)
>> +                     ("pkg-config" ,pkg-config)))
>> +    (inputs `(("avahi" ,avahi)
>> +              ("libusb" ,libusb-compat)
>> +              ("libltdl" ,libltdl)
>> +              ("freeipmi" ,freeipmi)
>> +              ("neon" ,neon)
>> +              ("openssl" ,openssl)
>> +              ("net-snmp" ,net-snmp)))
>
> The indentation of these are a bit weird.  :-)
>
ops :)

>> +    (home-page "https://networkupstools.org")
>> +    (license
>> +     (list
>> +      ;; - most files under gpl2+
>> +      license:gpl2+
>> +      ;; - scripts/python/ under gpl3+
>> +      license:gpl3+
>> +      ;; - scripts/perl/Nut.pm same as perl (either gpl1+ or artistic)
>> +      license:gpl1+ license:artistic2.0))
>
> Great job at listing licenses!
>
>> +    (synopsis "Collection of programs for monitoring and administering UPS")
>> +    (description "Network UPS Tools is a collection of programs which provide
>> +a common interface for monitoring and administering UPS, PDU and SCD hardware.
>> +It uses a layered approach to connect all of the parts.  Drivers are provided
>> +for a wide assortment of equipment.")))
>
> Maybe add @acronym{UPS, Uninterruptible Power Supply},
> @acronym{PDU, ...} etc, but no strong opinion.
>
Sure!

> Can you send an updated patch?

I also added the phase "fix-search-paths" which fixes nut-scanner.
nut scanner now finds my ups device (but I still could not get it to
work, not sure if the problem is in my config or in this package.  I'd
wait to merge this until someone can try.

Thanks again,
Nicolò

[v2-0001-gnu-Add-nut.patch (text/x-patch, attachment)]
[Message part 3 (text/plain, inline)]

[1] https://github.com/networkupstools/nut/pull/809/commits/cb507c44d26d8ae04a0cc3d1c24e79e3bf33ba23

Added tag(s) patch. Request was from Bruno Victal <mirai <at> makinata.eu> to control <at> debbugs.gnu.org. (Thu, 30 Mar 2023 23:01:03 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 77 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.