[libvirt] [PATCH] dist: ln(1) is not guaranteed to have a '-f' option

Roman Bogorodskiy bogorodskiy at gmail.com
Wed May 4 04:24:28 UTC 2016


  Andrea Bolognani wrote:

> According to the autoconf manual, using '$(LN_S) -f' is not
> portable; remove the target explicitly beforehand to work around
> this limitation.
> 
> Adjust some slightly awkward indentation while at it.
> ---
>  src/Makefile.am   | 3 ++-
>  tools/Makefile.am | 3 ++-
>  2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/src/Makefile.am b/src/Makefile.am
> index c639e37..b71e694 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -3079,7 +3079,8 @@ if WITH_NETWORK
>  	      $(DESTDIR)$(confdir)/qemu/networks/default.xml && \
>  	    rm $(DESTDIR)$(confdir)/qemu/networks/default.xml.t; }
>  	( cd $(DESTDIR)$(confdir)/qemu/networks/autostart && \
> -	    $(LN_S) -f ../default.xml default.xml )
> +	  rm -f default.xml && \
> +	  $(LN_S) ../default.xml default.xml )
>  endif WITH_NETWORK

Looking at this, I recall that there's a thing I want to discuss.

Specifically, creating a symlink like this brings some difficulties for
packaging, at least in FreeBSD case. Specifically, for user
configuration files the policy is to install them with .sample extension
and then cp .sample to the original file if it does not exist. Later,
when uninstalling, .sample is removed, but the original configuration
file left untouched unless it's not equal to the .sample one.

This, however, cannot be applied to symlinks, i.e. there's no clean way
(as I see it) to figure out if libvirt was previously installed and user
disabled autostart for the default network or just libvirt was never
installed on the host.

To avoid having default network set to autostart across reinstalls, I
just patched out this bit in the FreeBSD port and added a quick
instruction how to enable it if a user wants. 

Finally, coming to the actual question: would it make sense to add a
configure knob like e.g. --disable-network-default-autostart (yeah,
length of this option compared to how little it does is a bit
ridiculous) or this case is very FreeBSD packaging specific?  

>  uninstall-local:: uninstall-init uninstall-systemd
> diff --git a/tools/Makefile.am b/tools/Makefile.am
> index e963b91..c5a6a0d 100644
> --- a/tools/Makefile.am
> +++ b/tools/Makefile.am
> @@ -424,7 +424,8 @@ NSS_SO_VER = 1
>  
>  install-exec-hook:
>  	( cd $(DESTDIR)$(libdir) && \
> -	  $(LN_S) -f libnss_libvirt.so.$(NSS_SO_VER) nss_libvirt.so.$(NSS_SO_VER) )
> +	  rm -f nss_libvirt.so.$(NSS_SO_VER) && \
> +	  $(LN_S) libnss_libvirt.so.$(NSS_SO_VER) nss_libvirt.so.$(NSS_SO_VER) )
>  
>  uninstall-local:
>  	-rm -f $(DESTDIR)$(libdir)/nss_libvirt.so.$(NSS_SO_VER)
> -- 
> 2.5.5
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list

Roman Bogorodskiy




More information about the libvir-list mailing list