[Buildroot] [PATCH 1/1] package/nut: bump version

Yann E. MORIN yann.morin.1998 at free.fr
Fri Apr 2 21:07:05 UTC 2021


Bernd, All,

On 2021-03-30 23:04 +0200, Bernd Kuhls spake thusly:
> 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

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

> 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/

> Signed-off-by: Bernd Kuhls <bernd.kuhls at t-online.de>
> ---
[--SNIP--]
> diff --git a/package/nut/nut.mk b/package/nut/nut.mk
> index ad575310f5..47593c5fbf 100644
> --- a/package/nut/nut.mk
> +++ b/package/nut/nut.mk
> @@ -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 += \

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

> +	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.

-- 
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'


More information about the buildroot mailing list