[libvirt] [PATCH 0/4] configure: Fix init script choice

The changes pushed yesterday have introduced an issue where systemd was turned into systemd+redhat on RHEL systems, which in turn caused RPM building to fail[1]. Patch 1/4 is the actual fix; patch 2/4 changes the code so that breaking it again is hopefully a bit harder. Patches 3/4 and 4/4 clean up a couple of barely related issues in the spec file that I've ran into while investigating this. [1] https://ci.centos.org/view/libvirt-project/job/libvirt-daemon-rpm/systems=li... Andrea Bolognani (4): configure: Change RHEL default from systemd+redhat to systemd configure: Remove nested conditionals in LIBVIRT_CHECK_INIT_SCRIPT spec: Type --with-init-script correctly spec: Rename %{init_scripts} -> %{with_init_script} libvirt.spec.in | 6 +++--- m4/virt-init-script.m4 | 21 ++++++--------------- 2 files changed, 9 insertions(+), 18 deletions(-) -- 2.5.5

We don't want to install legacy init scripts on modern, systemd-native hosts. --- I was under the impression that systemd+redhat was needed to install /etc/sysconfig/libvirtd, but after taking a better look at the code that turned out not to be the case. m4/virt-init-script.m4 | 3 --- 1 file changed, 3 deletions(-) diff --git a/m4/virt-init-script.m4 b/m4/virt-init-script.m4 index 9d0d5c7..d6a52e7 100644 --- a/m4/virt-init-script.m4 +++ b/m4/virt-init-script.m4 @@ -41,9 +41,6 @@ AC_DEFUN([LIBVIRT_CHECK_INIT_SCRIPT],[ fi fi if test -f /etc/redhat-release; then - if test "$with_init_script" = systemd; then - with_init_script=systemd+redhat - fi if test "$with_init_script" = check; then with_init_script=redhat fi -- 2.5.5

We don't need them any longer; moreover, the previous structure made it very easy for bugs to slip in, by having the result of one check influence the following one. By placing the check for "$with_init_script" = check front and center, hopefully this won't happen (as easily) again. --- m4/virt-init-script.m4 | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/m4/virt-init-script.m4 b/m4/virt-init-script.m4 index d6a52e7..c307b0e 100644 --- a/m4/virt-init-script.m4 +++ b/m4/virt-init-script.m4 @@ -30,20 +30,14 @@ AC_DEFUN([LIBVIRT_CHECK_INIT_SCRIPT],[ init_systemd=no init_upstart=no - if test "$with_init_script" = check; then - if test "$cross_compiling" = yes; then - with_init_script=none - fi + if test "$with_init_script" = check && test "$cross_compiling" = yes; then + with_init_script=none fi - if type systemctl >/dev/null 2>&1; then - if test "$with_init_script" = check; then - with_init_script=systemd - fi + if test "$with_init_script" = check && type systemctl >/dev/null 2>&1; then + with_init_script=systemd fi - if test -f /etc/redhat-release; then - if test "$with_init_script" = check; then - with_init_script=redhat - fi + if test "$with_init_script" = check && test -f /etc/redhat-release; then + with_init_script=redhat fi if test "$with_init_script" = check; then with_init_script=none -- 2.5.5

Mixing dashes and underscores in configure options apparently works fine, but it's confusing and just plain ugly. --- lol autoconf libvirt.spec.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 935ca89..4de78c0 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -1475,9 +1475,9 @@ rm -rf .git %define with_packager_version --with-packager-version="%{release}" %if %{with_systemd} - %define init_scripts --with-init_script=systemd + %define init_scripts --with-init-script=systemd %else - %define init_scripts --with-init_script=redhat + %define init_scripts --with-init-script=redhat %endif %if %{with_selinux} -- 2.5.5

The convention used throughout the file is to name variables after the configure option they refer to. --- libvirt.spec.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 4de78c0..f441c51 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -1475,9 +1475,9 @@ rm -rf .git %define with_packager_version --with-packager-version="%{release}" %if %{with_systemd} - %define init_scripts --with-init-script=systemd + %define with_init_script --with-init-script=systemd %else - %define init_scripts --with-init-script=redhat + %define with_init_script --with-init-script=redhat %endif %if %{with_selinux} @@ -1553,7 +1553,7 @@ rm -f po/stamp-po %{?with_loader_nvram} \ %{?enable_werror} \ --enable-expensive-tests \ - %{init_scripts} + %{with_init_script} make %{?_smp_mflags} gzip -9 ChangeLog -- 2.5.5

On Tue, May 03, 2016 at 11:35:35AM +0200, Andrea Bolognani wrote:
The changes pushed yesterday have introduced an issue where systemd was turned into systemd+redhat on RHEL systems, which in turn caused RPM building to fail[1].
Patch 1/4 is the actual fix; patch 2/4 changes the code so that breaking it again is hopefully a bit harder.
Patches 3/4 and 4/4 clean up a couple of barely related issues in the spec file that I've ran into while investigating this.
[1] https://ci.centos.org/view/libvirt-project/job/libvirt-daemon-rpm/systems=li...
Andrea Bolognani (4): configure: Change RHEL default from systemd+redhat to systemd configure: Remove nested conditionals in LIBVIRT_CHECK_INIT_SCRIPT spec: Type --with-init-script correctly spec: Rename %{init_scripts} -> %{with_init_script}
libvirt.spec.in | 6 +++--- m4/virt-init-script.m4 | 21 ++++++--------------- 2 files changed, 9 insertions(+), 18 deletions(-)
ACK series. (Please keep in mind that I was the one who ACKed the series that broke it when pushing it) Jan

On Tue, 2016-05-03 at 16:04 +0200, Ján Tomko wrote:
On Tue, May 03, 2016 at 11:35:35AM +0200, Andrea Bolognani wrote:
The changes pushed yesterday have introduced an issue where systemd was turned into systemd+redhat on RHEL systems, which in turn caused RPM building to fail[1].
Patch 1/4 is the actual fix; patch 2/4 changes the code so that breaking it again is hopefully a bit harder.
Patches 3/4 and 4/4 clean up a couple of barely related issues in the spec file that I've ran into while investigating this.
[1] https://ci.centos.org/view/libvirt-project/job/libvirt-daemon-rpm/systems=li...
Andrea Bolognani (4): configure: Change RHEL default from systemd+redhat to systemd configure: Remove nested conditionals in LIBVIRT_CHECK_INIT_SCRIPT spec: Type --with-init-script correctly spec: Rename %{init_scripts} -> %{with_init_script}
libvirt.spec.in | 6 +++--- m4/virt-init-script.m4 | 21 ++++++--------------- 2 files changed, 9 insertions(+), 18 deletions(-)
ACK series.
(Please keep in mind that I was the one who ACKed the series that broke it when pushing it)
Well, I'm the one who *wrote* that code to begin with, so... ¯\_(ツ)_/¯ Pushed, thanks for the review! -- Andrea Bolognani Software Engineer - Virtualization Team
participants (2)
-
Andrea Bolognani
-
Ján Tomko