[dm-devel] [PATCH] multipath-tools: Build: properly parse systemd's version

Xose Vazquez Perez xose.vazquez at gmail.com
Thu Mar 7 18:22:58 UTC 2019


On 3/7/19 3:54 PM, Martin Wilck wrote:
> From: Dominique Leuenberger <dimstar at opensuse.org>
> 
> Since systemd 241, systemctl --version no longer 'just' prints out the
> version, but gives more information like git commit ref and whatnot. In
> it's shortest form, it gives something like "systemd 241 (241)", which when
> passed as parameter "-DUSE_SYSTEMD=241 (241)" results in shell errors.
> 
> Try to retrieve the version from pkg-config instead, and if that fails,
> discard anything after the first number in "systemctl --version" output.

There is a simpler patch in Fedora, see below.

> Signed-off-by: Martin Wilck <mwilck at suse.com>
> ---
>  Makefile.inc | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/Makefile.inc b/Makefile.inc
> index fc728ca9..56c3eda0 100644
> --- a/Makefile.inc
> +++ b/Makefile.inc
> @@ -36,8 +36,13 @@ ifndef RUN
>  endif
>  
>  ifndef SYSTEMD
> -	ifeq ($(shell systemctl --version > /dev/null 2>&1 && echo 1), 1)
> -		SYSTEMD = $(shell systemctl --version 2> /dev/null |  sed -n 's/systemd \([0-9]*\)/\1/p')
> +	ifeq ($(shell pkg-config --modversion libsystemd >/dev/null 2>&1 && echo 1), 1)
> +		SYSTEMD = $(shell pkg-config --modversion libsystemd)
> +	else
> +		ifeq ($(shell systemctl --version >/dev/null 2>&1 && echo 1), 1)
> +			SYSTEMD = $(shell systemctl --version 2> /dev/null | \
> +				sed -n 's/systemd \([0-9]*\).*/\1/p')
> +		endif
>  	endif
>  endif
>  
> 

>From a4dbf985b2440f8bb0210b90aaf549030e274b4f Mon Sep 17 00:00:00 2001
From: Igor Gnatenko <ignatenkobrain at fedoraproject.org>
Date: Mon, 18 Feb 2019 00:09:17 +0100
Subject: [PATCH] Fix systemd version detection

Signed-off-by: Igor Gnatenko <ignatenkobrain at fedoraproject.org>
---
 Makefile.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.inc b/Makefile.inc
index fc728ca..5b2f6d4 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -37,7 +37,7 @@ endif

 ifndef SYSTEMD
 	ifeq ($(shell systemctl --version > /dev/null 2>&1 && echo 1), 1)
-		SYSTEMD = $(shell systemctl --version 2> /dev/null |  sed -n 's/systemd \([0-9]*\)/\1/p')
+		SYSTEMD = $(shell systemctl --version 2> /dev/null |  sed -n 's/systemd \([0-9]*\).*/\1/p')
 	endif
 endif

-- 
2.20.1




More information about the dm-devel mailing list