All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] multipath-tools: Build: properly parse systemd's version
@ 2019-03-07 14:54 Martin Wilck
  2019-03-07 18:22 ` Xose Vazquez Perez
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Wilck @ 2019-03-07 14:54 UTC (permalink / raw)
  To: Christophe Varoqui; +Cc: Dominique Leuenberger, dm-devel, Martin Wilck

From: Dominique Leuenberger <dimstar@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.

Signed-off-by: Martin Wilck <mwilck@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
 
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] multipath-tools: Build: properly parse systemd's version
  2019-03-07 14:54 [PATCH] multipath-tools: Build: properly parse systemd's version Martin Wilck
@ 2019-03-07 18:22 ` Xose Vazquez Perez
  2019-03-07 19:20   ` Martin Wilck
  0 siblings, 1 reply; 4+ messages in thread
From: Xose Vazquez Perez @ 2019-03-07 18:22 UTC (permalink / raw)
  To: Martin Wilck, Dominique Leuenberger, Igor Gnatenko, Benjamin Marzinski
  Cc: device-mapper development

On 3/7/19 3:54 PM, Martin Wilck wrote:
> From: Dominique Leuenberger <dimstar@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@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@fedoraproject.org>
Date: Mon, 18 Feb 2019 00:09:17 +0100
Subject: [PATCH] Fix systemd version detection

Signed-off-by: Igor Gnatenko <ignatenkobrain@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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] multipath-tools: Build: properly parse systemd's version
  2019-03-07 18:22 ` Xose Vazquez Perez
@ 2019-03-07 19:20   ` Martin Wilck
  2019-03-16 22:48     ` Xose Vazquez Perez
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Wilck @ 2019-03-07 19:20 UTC (permalink / raw)
  To: Xose Vazquez Perez, Igor Gnatenko, Dominique Leuenberger,
	Benjamin Marzinski, mwilck+gmail
  Cc: development, device-mapper

On Thu, 2019-03-07 at 19:22 +0100, Xose Vazquez Perez wrote:
> On 3/7/19 3:54 PM, Martin Wilck wrote:
> > From: Dominique Leuenberger <dimstar@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.

Which is equivalent to the "else" clause of my patch, thanks for
pointing it out.

But pkg-config should be the way to go in the future, so why not
use it if we can?

Martin


> 
> > Signed-off-by: Martin Wilck <mwilck@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@fedoraproject.org>
> Date: Mon, 18 Feb 2019 00:09:17 +0100
> Subject: [PATCH] Fix systemd version detection
> 
> Signed-off-by: Igor Gnatenko <ignatenkobrain@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
> 

-- 
Dr. Martin Wilck <mwilck@suse.com>, Tel. +49 (0)911 74053 2107
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)


--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] multipath-tools: Build: properly parse systemd's version
  2019-03-07 19:20   ` Martin Wilck
@ 2019-03-16 22:48     ` Xose Vazquez Perez
  0 siblings, 0 replies; 4+ messages in thread
From: Xose Vazquez Perez @ 2019-03-16 22:48 UTC (permalink / raw)
  To: Martin Wilck, Igor Gnatenko, Dominique Leuenberger,
	Benjamin Marzinski, mwilck+gmail
  Cc: device-mapper development

On 3/7/19 8:20 PM, Martin Wilck wrote:

> On Thu, 2019-03-07 at 19:22 +0100, Xose Vazquez Perez wrote:
>> On 3/7/19 3:54 PM, Martin Wilck wrote:
>>> From: Dominique Leuenberger <dimstar@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.
> 
> Which is equivalent to the "else" clause of my patch, thanks for
> pointing it out.
> 
> But pkg-config should be the way to go in the future, so why not
> use it if we can?

I agree.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-03-16 22:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-07 14:54 [PATCH] multipath-tools: Build: properly parse systemd's version Martin Wilck
2019-03-07 18:22 ` Xose Vazquez Perez
2019-03-07 19:20   ` Martin Wilck
2019-03-16 22:48     ` Xose Vazquez Perez

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.