[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 11/11] build: Don't assume that mkbuildtree is executable



On Tue, Apr 11, 2006 at 10:23:39AM +0100, Keir Fraser wrote:
> 
> On 11 Apr 2006, at 09:50, Horms wrote:
> 
> >>I think all the scripts currently specify /bin/bash. You could define
> >>SHELL or SH in Config.mk, default to /bin/bash, and use that variable
> >>in place of 'sh'.
> >
> >Understood, if they are indeed all using /bin/bash at the moment.  It
> >seems as well to just specify bash. It can be made more flexible if the
> >need arises. Here is an updated patch.
> 
> Let's not risk any regressions: it should be /bin/bash, and apart from 
> the configurability argument it's also cleaner imo to define a wrapper 
> variable for /bin/bash in Config.mk.

Understood

-- 
Horms

build: Don't assume that mkbuildtree is executable

In some cases, say for instance for some bizarre reason the tree was
checked out of CVS, which doesn't necessarily store file permissions,
mkbuildtree may not be executable.

I had trouble deciding between chmoding mkbuildtree, which changes the
tree, and running sh mkbuildtree, which assumes its a shell script. I
settled on the latter.

As all the scripts currently specify /bin/bash, it is used, rather than sh
which was in the original version of this patch. This can be overridden by
setting MKBUILD_SHELL in the environment.

MKBUILD_SHELL was chosen over SHELL as the latter has special significance
within make.

Signed-Off-By: Horms <horms@xxxxxxxxxxxx>

 Config.mk                        |    2 ++
 Makefile                         |    3 +++
 buildconfigs/Rules.mk            |    8 ++++++--
 buildconfigs/mk.linux-2.6-xen    |    4 ++--
 linux-2.6-xen-sparse/mkbuildtree |   10 ++++++----
 tools/debugger/gdb/gdbbuild      |    3 ++-
 tools/misc/xen-clone             |    5 ++++-
 7 files changed, 25 insertions(+), 10 deletions(-)

--- x/Config.mk
+++ x/Config.mk
@@ -92,4 +92,6 @@ XENSTAT_XENTOP ?= y
 
 VTPM_TOOLS ?= n
 
+MKBUILD_SHELL ?= /bin/bash
+
 -include $(XEN_ROOT)/.config
--- x/Makefile
+++ x/Makefile
@@ -172,6 +172,9 @@ help:
        @echo '                     install into prefix/lib/python<VERSION>'
        @echo '                     instead of <PREFIX>/lib/python'
        @echo '                     true if set to non-empty value, false 
otherwise'
+       @echo '  MKBUILD_SHELL'
+       @echo '                   - shell used to invoke various mkbuild 
scripts'
+       @echo '                     default is /bin/bash'
 
 # Use this target with extreme care!
 .PHONY: uninstall
--- x/buildconfigs/Rules.mk
+++ x/buildconfigs/Rules.mk
@@ -99,14 +99,18 @@ endif
 linux-2.6-xen.patch: ref-linux-$(LINUX_VER)/.valid-ref
        rm -rf tmp-$@
        cp -al $(<D) tmp-$@
-       ( cd linux-2.6-xen-sparse && ./mkbuildtree ../tmp-$@ )  
+       ( cd linux-2.6-xen-sparse && \
+               MKBUILD_SHELL="$(MKBUILD_SHELL)" $(MKBUILD_SHELL) \
+               ./mkbuildtree ../tmp-$@ )       
        diff -Nurp $(patsubst ref%,pristine%,$(<D)) tmp-$@ > $@ || true
        rm -rf tmp-$@
 
 %-xen.patch: ref-%/.valid-ref
        rm -rf tmp-$@
        cp -al $(<D) tmp-$@
-       ( cd $*-xen-sparse && ./mkbuildtree ../tmp-$@ ) 
+       ( cd $*-xen-sparse && \
+               MKBUILD_SHELL="$(MKBUILD_SHELL)" $(MKBUILD_SHELL) \
+               ./mkbuildtree ../tmp-$@ )       
        diff -Nurp $(patsubst ref%,pristine%,$(<D)) tmp-$@ > $@ || true
        rm -rf tmp-$@
 
--- x/buildconfigs/mk.linux-2.6-xen
+++ x/buildconfigs/mk.linux-2.6-xen
@@ -22,8 +22,8 @@ $(LINUX_DIR)/include/linux/autoconf.h: r
        rm -rf $(LINUX_DIR)
        cp -al $(<D) $(LINUX_DIR)
        # Apply arch-xen patches
-       ( cd linux-$(LINUX_SERIES)-xen-sparse ; \
-          LINUX_ARCH=$(LINUX_ARCH) ./mkbuildtree ../$(LINUX_DIR) )
+       ( cd linux-$(LINUX_SERIES)-xen-sparse && \
+          LINUX_ARCH=$(LINUX_ARCH) bash ./mkbuildtree ../$(LINUX_DIR) )
        # Re-use config from install dir if one exits else use default config
        CONFIG_VERSION=$$(sed -ne 's/^EXTRAVERSION = //p' 
$(LINUX_DIR)/Makefile); \
        [ -r 
$(DESTDIR)/boot/config-$(LINUX_VER)$$CONFIG_VERSION-$(EXTRAVERSION) ] && \
バイナリー・ファイル/dev/nullとto-work/linux-2.6-xen-sparse/.mkbuildtree.swpは違います
--- x/linux-2.6-xen-sparse/mkbuildtree
+++ x/linux-2.6-xen-sparse/mkbuildtree
@@ -90,8 +90,9 @@ abs_to_rel ${AD} ${AS}
 RS=$DESTPATH
 
 # Arch-specific pre-processing
-if [ -x arch/${LINUX_ARCH}/xen-mkbuildtree-pre ]; then
-       arch/${LINUX_ARCH}/xen-mkbuildtree-pre
+if [ -e arch/${LINUX_ARCH}/xen-mkbuildtree-pre ]; then
+       MKBUILD_SHELL="$MKBUILD_SHELL" $MKBUILD_SHELL \
+               arch/${LINUX_ARCH}/xen-mkbuildtree-pre
 fi
 
 # Remove old copies of files and directories at the destination
@@ -115,6 +116,7 @@ relative_lndir ../../../${RS}/../xen/inc
 
 # Arch-specific post-processing
 cd ${AD}
-if [ -x arch/${LINUX_ARCH}/xen-mkbuildtree-post ]; then
-       arch/${LINUX_ARCH}/xen-mkbuildtree-post
+if [ -e arch/${LINUX_ARCH}/xen-mkbuildtree-post ]; then
+       MKBUILD_SHELL="$MKBUILD_SHELL" $MKBUILD_SHELL \
+               arch/${LINUX_ARCH}/xen-mkbuildtree-post
 fi
--- x/tools/debugger/gdb/gdbbuild
+++ x/tools/debugger/gdb/gdbbuild
@@ -1,5 +1,6 @@
 #!/bin/sh
 
+[ "$MKBUILD_SHELL" ] || MKBUILD_SHELL="/bin/bash"
 [ "$GDB_MIRROR" ] || GDB_MIRROR="ftp://ftp.gnu.org/gnu/gdb/";
 
 rm -rf gdb-6.2.1 gdb-6.2.1-linux-i386-xen
@@ -7,7 +8,7 @@ rm -rf gdb-6.2.1 gdb-6.2.1-linux-i386-xe
 tar xjf gdb-6.2.1.tar.bz2
 
 cd gdb-6.2.1-xen-sparse
-./mkbuildtree ../gdb-6.2.1
+MKBUILD_SHELL="$MKBUILD_SHELL" $MKBUILD_SHELL ./mkbuildtree ../gdb-6.2.1
 
 cd ..
 mkdir gdb-6.2.1-linux-i386-xen
--- x/tools/misc/xen-clone
+++ x/tools/misc/xen-clone
@@ -5,6 +5,8 @@
 # this script contains some CL site specific details, but can easily be adapted
 #
 
+MKBUILD_SHELL=${MKBUILD_SHELL:-/bin/bash}
+
 # test which site we're on
 [ -d /usr/groups/xeno/ -a -d /usr/groups/srgboot ] && SITE=UCCL
 
@@ -113,7 +115,8 @@ else
 
  # Turn linux into xenolinux then build it
  cd xenolinux-${LINUX_VER}-sparse
- ./mkbuildtree ../../linux-${LINUX_VER}
+ MKBUILD_SHELL="$MKBUILD_SHELL" $MKBUILD_SHELL \
+       ./mkbuildtree ../../linux-${LINUX_VER}
  cd ../..
  mv linux-${LINUX_VER} xenolinux-${LINUX_VER}
  cd xenolinux-${LINUX_VER}

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.