[libvirt] [PATCH 0/4] build: Fix symbolic links usage

This series fixes the build failures currently affecting FreeBSD on ci.centos.org[1] and also gets rid of some behavior deemed dangerous by the autoconf manual[2]. Tested on Fedora 23 and FreeBSD 10.3-RELEASE. [1] https://ci.centos.org/view/libvirt-project/job/libvirt-freebsd/617/console [2] https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Particu... Andrea Bolognani (4): build: Always use $(LN_S) and $(MKDIR_P) build: Add AC_PROG_LN_S to configure build: Overwrite existing symbolic links build: Use $(LN_S) safely Makefile.am | 2 +- configure.ac | 1 + src/Makefile.am | 5 ++--- tools/Makefile.am | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) -- 2.5.5

autotools provide those for our convenience, so let's use them everywhere instead of mixing in native command invocation. --- Makefile.am | 2 +- src/Makefile.am | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 9298082..d6f09ba 100644 --- a/Makefile.am +++ b/Makefile.am @@ -68,7 +68,7 @@ rpm: clean check-local: all tests cov: clean-cov - mkdir $(top_builddir)/coverage + $(MKDIR_P) $(top_builddir)/coverage $(LCOV) -c -o $(top_builddir)/coverage/libvirt.info.tmp \ -d $(top_builddir)/src -d $(top_builddir)/daemon \ -d $(top_builddir)/tests diff --git a/src/Makefile.am b/src/Makefile.am index ad1c0c3..0380695 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3079,7 +3079,7 @@ if WITH_NETWORK $(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) ../default.xml \ $(DESTDIR)$(confdir)/qemu/networks/autostart/default.xml endif WITH_NETWORK -- 2.5.5

We use $(LN_S) for creating symbolic links, but the appropriate autoconf macro was not included among the checks for external programs. --- configure.ac | 1 + 1 file changed, 1 insertion(+) diff --git a/configure.ac b/configure.ac index 3c6a55f..de5f430 100644 --- a/configure.ac +++ b/configure.ac @@ -428,6 +428,7 @@ AC_PATH_PROG([XMLCATALOG], [xmlcatalog], [/usr/bin/xmlcatalog]) AC_PATH_PROG([XSLTPROC], [xsltproc], [/usr/bin/xsltproc]) AC_PATH_PROG([AUGPARSE], [augparse], [/usr/bin/augparse]) AC_PROG_MKDIR_P +AC_PROG_LN_S dnl External programs that we can use if they are available. dnl We will hard-code paths to these programs unless we cannot -- 2.5.5

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

The autoconf documentation recommends to always use this construct when creating symbolic links with $(LN_S) to avoid unexpected behavior. --- src/Makefile.am | 4 ++-- tools/Makefile.am | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 0168177..c639e37 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3078,8 +3078,8 @@ 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; } - $(LN_S) -f ../default.xml \ - $(DESTDIR)$(confdir)/qemu/networks/autostart/default.xml + ( cd $(DESTDIR)$(confdir)/qemu/networks/autostart && \ + $(LN_S) -f ../default.xml default.xml ) endif WITH_NETWORK uninstall-local:: uninstall-init uninstall-systemd diff --git a/tools/Makefile.am b/tools/Makefile.am index 7f2c0fc..e963b91 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -423,8 +423,8 @@ LIBVIRT_NSS_SYMBOL_FILE = \ 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) + ( cd $(DESTDIR)$(libdir) && \ + $(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

On 04/20/2016 02:00 PM, Andrea Bolognani wrote:
This series fixes the build failures currently affecting FreeBSD on ci.centos.org[1] and also gets rid of some behavior deemed dangerous by the autoconf manual[2].
Tested on Fedora 23 and FreeBSD 10.3-RELEASE.
[1] https://ci.centos.org/view/libvirt-project/job/libvirt-freebsd/617/console [2] https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Particu...
Andrea Bolognani (4): build: Always use $(LN_S) and $(MKDIR_P) build: Add AC_PROG_LN_S to configure build: Overwrite existing symbolic links build: Use $(LN_S) safely
Makefile.am | 2 +- configure.ac | 1 + src/Makefile.am | 5 ++--- tools/Makefile.am | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-)
ACK series - Cole

On Wed, 2016-04-20 at 14:51 -0400, Cole Robinson wrote:
Andrea Bolognani (4): build: Always use $(LN_S) and $(MKDIR_P) build: Add AC_PROG_LN_S to configure build: Overwrite existing symbolic links build: Use $(LN_S) safely
Makefile.am | 2 +- configure.ac | 1 + src/Makefile.am | 5 ++--- tools/Makefile.am | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-)
ACK series
Pushed, thanks :) -- Andrea Bolognani Software Engineer - Virtualization Team
participants (2)
-
Andrea Bolognani
-
Cole Robinson