Hilko Bengen
2014-Oct-31 19:03 UTC
[Libguestfs] [PATCH] Fix, simplify out-of-tree build/install for bash completions
--- bash/Makefile.am | 54 +++++++++++++++--------------------------------------- 1 file changed, 15 insertions(+), 39 deletions(-) diff --git a/bash/Makefile.am b/bash/Makefile.am index 10f0861..780da64 100644 --- a/bash/Makefile.am +++ b/bash/Makefile.am @@ -21,6 +21,10 @@ scripts = \ guestfish \ guestmount \ virt-alignment-scan \ + virt-rescue \ + virt-resize + +symlinks = \ virt-builder \ virt-cat \ virt-df \ @@ -30,53 +34,21 @@ scripts = \ virt-inspector \ virt-log \ virt-ls \ - virt-rescue \ - virt-resize \ virt-sparsify \ virt-sysprep # Note: Don't distribute the symbolic links, only the real files. EXTRA_DIST = \ README \ - guestfish \ - guestmount \ - virt-alignment-scan \ - virt-rescue \ - virt-resize + $(scripts) # Some of the scripts are simply symbolic links. -virt-cat: - rm -f $@ - $(LN_S) virt-alignment-scan $@ -virt-df: - rm -f $@ - $(LN_S) virt-alignment-scan $@ -virt-edit: - rm -f $@ - $(LN_S) virt-alignment-scan $@ -virt-filesystems: - rm -f $@ - $(LN_S) virt-alignment-scan $@ -virt-format: - rm -f $@ - $(LN_S) virt-alignment-scan $@ -virt-inspector: - rm -f $@ - $(LN_S) virt-alignment-scan $@ -virt-log: - rm -f $@ - $(LN_S) virt-alignment-scan $@ -virt-ls: - rm -f $@ - $(LN_S) virt-alignment-scan $@ -virt-sysprep: +virt-cat virt-df virt-edit virt-filesystems virt-format virt-inspector \ +virt-log virt-ls virt-sysprep: rm -f $@ $(LN_S) virt-alignment-scan $@ -virt-builder: - rm -f $@ - $(LN_S) virt-resize $@ -virt-sparsify: +virt-builder virt-sparsify: rm -f $@ $(LN_S) virt-resize $@ @@ -87,10 +59,14 @@ if HAVE_BASH_COMPLETION bashcompletiondir = $(BASH_COMPLETIONS_DIR) #bashcompletion_DATA = $(scripts) -all-local: $(scripts) +all-local: $(scripts) $(symlinks) + test $(srcdir) != $(builddir) && cd $(srcdir) && cp $(scripts) $(abs_builddir)/ -install-data-local: $(scripts) +install-data-local: $(mkdir_p) $(DESTDIR)$(bashcompletiondir) - cp -d $(scripts) $(DESTDIR)$(bashcompletiondir) + cp -d $(scripts) $(symlinks) $(DESTDIR)$(bashcompletiondir) + +clean-local: + test $(srcdir) != $(builddir) && rm -f $(symlinks) $(scripts) endif -- 2.1.1
Richard W.M. Jones
2014-Nov-04 09:41 UTC
Re: [Libguestfs] [PATCH] Fix, simplify out-of-tree build/install for bash completions
On Fri, Oct 31, 2014 at 08:03:22PM +0100, Hilko Bengen wrote:> --- > bash/Makefile.am | 54 +++++++++++++++--------------------------------------- > 1 file changed, 15 insertions(+), 39 deletions(-) > > diff --git a/bash/Makefile.am b/bash/Makefile.am > index 10f0861..780da64 100644 > --- a/bash/Makefile.am > +++ b/bash/Makefile.am > @@ -21,6 +21,10 @@ scripts = \ > guestfish \ > guestmount \ > virt-alignment-scan \ > + virt-rescue \ > + virt-resize > + > +symlinks = \ > virt-builder \ > virt-cat \ > virt-df \ > @@ -30,53 +34,21 @@ scripts = \ > virt-inspector \ > virt-log \ > virt-ls \ > - virt-rescue \ > - virt-resize \ > virt-sparsify \ > virt-sysprep > > # Note: Don't distribute the symbolic links, only the real files. > EXTRA_DIST = \ > README \ > - guestfish \ > - guestmount \ > - virt-alignment-scan \ > - virt-rescue \ > - virt-resize > + $(scripts) > > # Some of the scripts are simply symbolic links. > -virt-cat: > - rm -f $@ > - $(LN_S) virt-alignment-scan $@ > -virt-df: > - rm -f $@ > - $(LN_S) virt-alignment-scan $@ > -virt-edit: > - rm -f $@ > - $(LN_S) virt-alignment-scan $@ > -virt-filesystems: > - rm -f $@ > - $(LN_S) virt-alignment-scan $@ > -virt-format: > - rm -f $@ > - $(LN_S) virt-alignment-scan $@ > -virt-inspector: > - rm -f $@ > - $(LN_S) virt-alignment-scan $@ > -virt-log: > - rm -f $@ > - $(LN_S) virt-alignment-scan $@ > -virt-ls: > - rm -f $@ > - $(LN_S) virt-alignment-scan $@ > -virt-sysprep: > +virt-cat virt-df virt-edit virt-filesystems virt-format virt-inspector \ > +virt-log virt-ls virt-sysprep: > rm -f $@ > $(LN_S) virt-alignment-scan $@ > > -virt-builder: > - rm -f $@ > - $(LN_S) virt-resize $@ > -virt-sparsify: > +virt-builder virt-sparsify: > rm -f $@ > $(LN_S) virt-resize $@ > > @@ -87,10 +59,14 @@ if HAVE_BASH_COMPLETION > bashcompletiondir = $(BASH_COMPLETIONS_DIR) > #bashcompletion_DATA = $(scripts) > > -all-local: $(scripts) > +all-local: $(scripts) $(symlinks) > + test $(srcdir) != $(builddir) && cd $(srcdir) && cp $(scripts) $(abs_builddir)/ > > -install-data-local: $(scripts) > +install-data-local: > $(mkdir_p) $(DESTDIR)$(bashcompletiondir) > - cp -d $(scripts) $(DESTDIR)$(bashcompletiondir) > + cp -d $(scripts) $(symlinks) $(DESTDIR)$(bashcompletiondir) > + > +clean-local: > + test $(srcdir) != $(builddir) && rm -f $(symlinks) $(scripts) > > endifACKed and pushed, thanks. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
Pino Toscano
2014-Nov-04 09:52 UTC
Re: [Libguestfs] [PATCH] Fix, simplify out-of-tree build/install for bash completions
On Friday 31 October 2014 20:03:22 Hilko Bengen wrote:> @@ -87,10 +59,14 @@ if HAVE_BASH_COMPLETION > bashcompletiondir = $(BASH_COMPLETIONS_DIR) > #bashcompletion_DATA = $(scripts) > > -all-local: $(scripts) > +all-local: $(scripts) $(symlinks) > + test $(srcdir) != $(builddir) && cd $(srcdir) && cp $(scripts) > $(abs_builddir)/ > > -install-data-local: $(scripts) > +install-data-local: > $(mkdir_p) $(DESTDIR)$(bashcompletiondir) > - cp -d $(scripts) $(DESTDIR)$(bashcompletiondir) > + cp -d $(scripts) $(symlinks) $(DESTDIR)$(bashcompletiondir) > + > +clean-local: > + test $(srcdir) != $(builddir) && rm -f $(symlinks) $(scripts)This however breaks when srcdir==builddir. I'm sending a followup to hopefully fix this. Maybe just creating the symlinks only in the installation directory would not have been a bad idea... -- Pino Toscano
Pino Toscano
2014-Nov-04 09:55 UTC
[Libguestfs] [PATCH] bash: fix build/clean when srcdir==builddir
Use CLEANFILES to remove the generated symlinks, and just ignore the errors when copying the scripts in srcdir!=builddir situations. Followup of commit 40ac54829d4e71b1bac76343872a2674a40c7ac0. --- bash/Makefile.am | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bash/Makefile.am b/bash/Makefile.am index 780da64..ee9c10c 100644 --- a/bash/Makefile.am +++ b/bash/Makefile.am @@ -42,6 +42,9 @@ EXTRA_DIST = \ README \ $(scripts) +CLEANFILES = \ + $(symlinks) + # Some of the scripts are simply symbolic links. virt-cat virt-df virt-edit virt-filesystems virt-format virt-inspector \ virt-log virt-ls virt-sysprep: @@ -60,13 +63,13 @@ bashcompletiondir = $(BASH_COMPLETIONS_DIR) #bashcompletion_DATA = $(scripts) all-local: $(scripts) $(symlinks) - test $(srcdir) != $(builddir) && cd $(srcdir) && cp $(scripts) $(abs_builddir)/ + -test $(srcdir) != $(builddir) && cd $(srcdir) && cp $(scripts) $(abs_builddir)/ install-data-local: $(mkdir_p) $(DESTDIR)$(bashcompletiondir) cp -d $(scripts) $(symlinks) $(DESTDIR)$(bashcompletiondir) clean-local: - test $(srcdir) != $(builddir) && rm -f $(symlinks) $(scripts) + -test $(srcdir) != $(builddir) && rm -f $(scripts) endif -- 1.9.3
Reasonably Related Threads
- [PATCH] Fix, simplify out-of-tree build/install for bash completions
- [PATCH 0/2] bash-completion: Install symbolic links instead of copies of files (RHBZ#1156298).
- Re: [PATCH] Fix, simplify out-of-tree build/install for bash completions
- [p2v PATCH] Add bash completion scripts
- [PATCH] Fix determining release date for builddir != srcdir