From mboxrd@z Thu Jan 1 00:00:00 1970 From: Roger Pau Monne Subject: Re: [PATCH 2/9] tools/build: fix pygrub linking Date: Tue, 17 Jul 2012 17:34:41 +0100 Message-ID: <50059421.406@citrix.com> References: <1342002232-75531-1-git-send-email-roger.pau@citrix.com> <1342002232-75531-3-git-send-email-roger.pau@citrix.com> <4FFD5CDB.8090409@amd.com> <4FFEFB8B.3040000@citrix.com> <20485.37211.873318.627523@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20485.37211.873318.627523@mariner.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Jackson Cc: Christoph Egger , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org Ian Jackson wrote: > Roger Pau Monne writes ("Re: [PATCH 2/9] tools/build: fix pygrub linking"): >> diff --git a/tools/pygrub/Makefile b/tools/pygrub/Makefile >> index bd22dd4..182afdd 100644 >> --- a/tools/pygrub/Makefile >> +++ b/tools/pygrub/Makefile >> @@ -14,7 +14,9 @@ install: all >> $(PYTHON_PREFIX_ARG) --root="$(DESTDIR)" \ >> --install-scripts=$(PRIVATE_BINDIR) --force >> $(INSTALL_DIR) $(DESTDIR)/var/run/xend/boot >> +ifneq ($(shell readlink -f $(DESTDIR)/$(BINDIR)), $(shell readlink -f >> $(PRIVATE_BINDIR))) >> ln -sf $(PRIVATE_BINDIR)/pygrub $(DESTDIR)/$(BINDIR) >> +endif > > Why are we doing all this work in make with $(shell...) rather than > simply in the command stanza ? > > Also I'm a bit confused. This problem occurs only when DESTDIR="" ? No, this occurs when $(BINDIR) == $(PRIVATE_BINDIR), but we cannot use the "test -e", because we might have previous versions of pygrub installed which should also be overwritten by the link, or the user will keep using the old version. > In which case perhaps the right answer is something like > set -e; if ! test -e $(DESTDIR)/$(BINDIR)/pygrub; then \ > ln -sf $(PRIVATE_BINDIR)/pygrub $(DESTDIR)/$(BINDIR); \ > fi > > Ian.