Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

m4/nut_report_feature.m4: try to report configure invocation args #1709

Merged

Conversation

jimklimov
Copy link
Member

@jimklimov jimklimov commented Nov 16, 2022

...and use them for --enable-inplace-runtime configurations in particular, to facilitate rebuilds over existing deployments.

@jimklimov jimklimov marked this pull request as draft November 21, 2022 22:07
@jimklimov jimklimov added the CI Entries related to continuous integration infrastructure (historically also recipes like Makefiles) label Nov 21, 2022
@jimklimov jimklimov added this to the 2.8.1 milestone Jan 15, 2023
@jimklimov jimklimov marked this pull request as ready for review January 15, 2023 14:19
@jimklimov
Copy link
Member Author

jimklimov commented Jan 15, 2023

Installed a build of this PR, so upsd reports the configure flags:

:; upsd -DV
Network UPS Tools upsd 2.8.0-Windows-436-g285e0065c
   0.000000     [D1] Network UPS Tools version 2.8.0-Windows-436-g285e0065c configured with flags: --with-user=nut --with-group=nut --with-all --with-docs=man --sysconfdir=/etc/nut

Then re-ran just configure --enable-inplace-runtime option, and got this:

:; ./autogen.sh && ./configure --enable-inplace-runtime
...
checking for pkg-config... yes
checking for CONFIG_FLAGS of an already deployed NUT build (if it reports those)... checking /usr/local/ups/sbin/upsd... --with-user=nut --with-group=nut --with-all --with-docs=man --sysconfdir=/etc/nut
configure: Detected CONFIG_FLAGS of an already deployed NUT installation, using them for --inplace-runtime configuration (restarting script)
Network UPS Tools version 2.8.0.1
checking build system type... x86_64-pc-linux-gnu
...

NUT Configuration summary:
==========================

* build serial drivers: yes
* build USB drivers:    yes (libusb-1.0)
* build neon based XML driver:  yes
* enable Avahi support: yes
* build Powerman PDU client driver:     yes
* build Modbus driver:  yes
* build IPMI driver:    yes (FreeIPMI)
* build Mac OS X meta-driver:   no
* build i2c based drivers:      yes
* 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:   yes
* install NUT-Monitor desktop application:      no
* install PyNUT binding module: yes
* use default  Python  interpreter:     /usr/bin/python
* use specific Python2 interpreter:     /usr/bin/python2.7
* use specific Python3 interpreter:     /usr/bin/python3
* build and install documentation:      man
* build specific documentation format(s):       yes  man
* build and install the development files:      yes
* consider basic SMF support:   no
* consider basic systemd support:       yes
* build with tighter systemd support:   yes
* build C++11 codebase (client library, etc.):  yes
* build C++ tests with CPPUNIT: yes
* build SNMP drivers:   yes
* build SNMP drivers with statically linked lib(net)snmp:       no
* User to run as:       nut
* Group of user to run as:      nut

NUT Paths:
----------

* Default installation prefix path:     /usr/local/ups
* State file path:      /var/state/ups
* Unprivileged PID file path:   /var/state/ups
* Privileged PID file path:     /run
* Driver program path:  /usr/local/ups/bin
* CGI program path:     /usr/local/ups/cgi-bin
* HTML file path:       /usr/local/ups/html
* Config file path:     /etc/nut
* Data file path:       /usr/local/ups/share
* Tool program path:    /usr/local/ups/bin
* System program path:  /usr/local/ups/sbin
* System library path:  /usr/local/ups/lib
* System exec-library path:     /usr/local/ups/libexec

NUT Paths for third-party integrations:
---------------------------------------

* Default  Python  interpreter site-packages:   /usr/local/lib/python2.7/dist-packages
* Specific Python2 interpreter site-packages:   /usr/local/lib/python2.7/dist-packages
* Specific Python3 interpreter site-packages:   /usr/local/lib/python3.9/dist-packages
* pkg-config *.pc directory:    ${libdir}/pkgconfig => /usr/local/ups/lib/pkgconfig
* Service units for systemd:    /lib/systemd/system
* Shutdown hooks for systemd:   /lib/systemd/system-shutdown
* Systemd-tmpfiles configs:     /usr/lib/tmpfiles.d
* Augeas lenses directory:      /usr/share/augeas/lenses/dist
* Udev rules directory: /lib/udev

NUT Build/Target system info:
-----------------------------

* host env spec we run on:      x86_64-pc-linux-gnu
* host env spec we built on:    x86_64-pc-linux-gnu
* host env spec we built for:   x86_64-pc-linux-gnu
* host OS short spec we run on: x86_64-linux-gnu
* host OS short spec we built on:       x86_64-linux-gnu
* host OS short spec we built for:      x86_64-linux-gnu

NUT Compiler settings:
----------------------

* CC            : gcc
* CFLAGS        : -isystem /usr/local/include -g -O2 -Wno-reserved-identifier -Wno-unknown-warning-option -std=gnu99 -Wno-system-headers -Wall -Wextra -Wsign-compare -pedantic -Wno-error
* CXX           : g++
* CXXFLAGS      : -isystem /usr/local/include -g -O2 -Wno-reserved-identifier -Wno-unknown-warning-option -std=gnu++11 -Wno-system-headers -Wall -Wextra -Wno-error
* CPP           : gcc -E
* CPPFLAGS      :
* CONFIG_FLAGS  : --with-user=nut --with-group=nut --with-all --with-docs=man --sysconfdir=/etc/nut --enable-inplace-runtime --disable-inplace-runtime

This is a bit messy regarding ... --enable-inplace-runtime --disable-inplace-runtime in the end, may be a point to improve in later PRs. Probably if older build and newer build specified other "conflicting" options like paths involved, we could filter the prepared command line to report only the later variant (but it needs to know somehow what options override and what might concatenate).

For now it is deterministic and (maybe a bit too) visible about what gets applied, and just works :)

On a similar note, configure values that are guessed but not specified in CLI options explicitly (e.g. python version above), may be guessed differently in a later run. Arguably feature, not a bug.

Similarly for environment variables that can impact a build:

:; CFLAGS="..." ./configure ...

#vs.

:; ./configure CFLAGS="..." ...

...in the former case, they are not part of CONFIG_FLAGS saved and reported.

  • TODO: Generate CONFIG_FLAGS with respect for spaces and other special chars in options (not $* but parsed and quoted/escaped $@ stuff)

@jimklimov
Copy link
Member Author

With later additions, CONFIG_FLAGS with tokens that include spaces (maybe Windows paths, etc) should be handled better, e.g.:

* CONFIG_FLAGS  : --with-user=nut --with-group=nut --with-all --with-docs=man --sysconfdir=/etc/nut --with-bogus='word1 word2' --enable-inplace-runtime --disable-inplace-runtime

…ckticks, all doublequoted outside => use $(...)
jimklimov added a commit to jimklimov/nut that referenced this pull request Jan 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Entries related to continuous integration infrastructure (historically also recipes like Makefiles) packaging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant