[libvirt] [PATCH 3/4] build: Overwrite existing symbolic links

Andrea Bolognani abologna at redhat.com
Wed Apr 20 18:00:29 UTC 2016


The current rule fails if the target already exists:

  cd /home/jenkins/build/libvirt/lib && \
    ln -s libnss_libvirt.so.1 nss_libvirt.so.1
  ln: nss_libvirt.so.1: File exists
  Makefile:3357: recipe for target 'install-exec-hook' failed

However, all other rules concerned with installation are
idempotent and will happily overwrite an existing target,
so this one should as well.
---
 src/Makefile.am   | 3 +--
 tools/Makefile.am | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index 0380695..0168177 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3078,8 +3078,7 @@ if WITH_NETWORK
 	    cp $(DESTDIR)$(confdir)/qemu/networks/default.xml.t \
 	      $(DESTDIR)$(confdir)/qemu/networks/default.xml && \
 	    rm $(DESTDIR)$(confdir)/qemu/networks/default.xml.t; }
-	test -e $(DESTDIR)$(confdir)/qemu/networks/autostart/default.xml || \
-	   $(LN_S) ../default.xml \
+	$(LN_S) -f ../default.xml \
 	    $(DESTDIR)$(confdir)/qemu/networks/autostart/default.xml
 endif WITH_NETWORK
 
diff --git a/tools/Makefile.am b/tools/Makefile.am
index c474d75..7f2c0fc 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -424,7 +424,7 @@ NSS_SO_VER = 1
 
 install-exec-hook:
 	cd $(DESTDIR)$(libdir) && \
-	  $(LN_S) libnss_libvirt.so.$(NSS_SO_VER) nss_libvirt.so.$(NSS_SO_VER)
+	  $(LN_S) -f 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




More information about the libvir-list mailing list