[systemd-devel] [PATCH] build: don't install busname units and target if kdbus support is disabled

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Wed Sep 3 21:16:32 PDT 2014


On Wed, Sep 03, 2014 at 11:51:58PM +0200, Michael Biebl wrote:
> If kbus support is disabled we already do omit the installation of
> org.freedesktop.systemd1.busname
> 
> Be consistent and do that that for all busname units and the
> busnames.target unit, since installing them is rather useless without
> kdbus support.
> 
> 
> Fix install-target-wants-hook while at it.
> 
> 
> 
> Cheers,
> Michael
> 
> -- 
> Why is it that all of the instruments seeking intelligent life in the
> universe are pointed away from Earth?

> From aac915d0c81dca230826ca71516d7cfa8ab4b6c5 Mon Sep 17 00:00:00 2001
> From: Michael Biebl <biebl at debian.org>
> Date: Wed, 3 Sep 2014 23:34:29 +0200
> Subject: [PATCH] build: don't install busname units and target if kdbus
>  support is disabled
> 
> When creating the wants symlinks, we also need to check if the string
> contains any non-space characters, simply testing for a string with
> length zero is not sufficient. This is due to how automake composes the
> variables.
> 
> E.g. the generated Makefile looks something like this for
> BUSNAMES_TARGET_WANTS:
> 
> BUSNAMES_TARGET_WANTS = $(am__append_195) $(am__append_200) \
>         $(am__append_208) $(am__append_220) $(am__append_243) \
>         $(am__append_254) $(am__append_286)
> 
> If kdbus support is disabled, the $what variable in
> install-target-wants-hook is set to "       ".
> ---
>  Makefile.am | 46 +++++++++++++++++++++++++++++++++++++++++-----
>  1 file changed, 41 insertions(+), 5 deletions(-)
> 
> diff --git a/Makefile.am b/Makefile.am
> index 1991fd0..9167add 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -270,7 +270,7 @@ install-target-wants-hook:
>  	what="$(USER_BUSNAMES_TARGET_WANTS)" && wants=busnames.target && dir=$(userunitdir) && $(add-wants)
>  
>  define add-wants
> -	[ -z "$$what" ] || ( \
> +	[ -z "$$what" ] || ! echo $$what | grep -q '[^[:space:]]' || ( \
Maybe we could use something simpler like
        [[ $what =~ ^[[:space:]]*$ ]] || ( \

>  	  dir=$(DESTDIR)$$dir/$$wants.wants && \
>  	  $(MKDIR_P) -m 0755 $$dir && \
>  	  cd $$dir && \
> @@ -466,7 +466,6 @@ dist_systemunit_DATA = \
>  	units/sigpwr.target \
>  	units/sleep.target \
>  	units/sockets.target \
> -	units/busnames.target \
>  	units/timers.target \
>  	units/paths.target \
>  	units/suspend.target \
> @@ -494,6 +493,11 @@ dist_systemunit_DATA = \
>  	units/system-update.target \
>  	units/initrd-switch-root.target
>  
> +if ENABLE_KDBUS
> +dist_systemunit_DATA += \
> +	units/busnames.target
> +endif
This is quite intrusive. Maybe another layer of indirection would help:

"""
dist_systemdunit_DATA = \
       $(dist_systemdunit_DATA_busnames)

...

dist_systemdunit_DATA_busnames += \
        units/busnames.target
"""

>  nodist_systemunit_DATA = \
>  	units/getty at .service \
>  	units/serial-getty at .service \
> @@ -4474,8 +4478,10 @@ rootlibexec_PROGRAMS += \
>  nodist_systemunit_DATA += \
>  	units/systemd-hostnamed.service
>  
> +if ENABLE_KDBUS
>  dist_systemunit_DATA += \
>  	units/org.freedesktop.hostname1.busname
> +endif
>  
>  dist_dbuspolicy_DATA += \
>  	src/hostname/org.freedesktop.hostname1.conf
> @@ -4489,8 +4495,10 @@ polkitpolicy_files += \
>  SYSTEM_UNIT_ALIASES += \
>  	systemd-hostnamed.service dbus-org.freedesktop.hostname1.service
>  
> +if ENABLE_KDBUS
>  BUSNAMES_TARGET_WANTS += \
>  	org.freedesktop.hostname1.busname
> +endif
And similarly with this one: if the line in add-wants using
$(BUSNAMES_TARGET_WANTS) could be made conditional, it would be
the only place to modify.

Zbyszek


More information about the systemd-devel mailing list