direct-io.hg

view linux-2.6-xen-sparse/mkbuildtree @ 8343:1dc393b65019

Change the way domain configuration is handled in xm-test.
This will simplify the way we differentiate between HV and PV domains,
as well as make it easier to run normal tests in either HV or PV mode.

This patch has been modified by Ewan Mellor, to match his recent changes to
remove the nics= configuration option.

Signed-off-by: Dan Smith <danms@us.ibm.com>
Signed-off-by: Dan Stekloff <dsteklof@us.ibm.com>
author emellor@leeni.uk.xensource.com
date Tue Dec 13 16:26:24 2005 +0000 (2005-12-13)
parents 62d815160f01
children fd9b2c1bb577
line source
1 #!/bin/bash
3 # mkbuildtree <build tree>
4 #
5 # Creates symbolic links in <build tree> for the sparse tree
6 # in the current directory.
8 # Script to determine the relative path between two directories.
9 # Copyright (c) D. J. Hawkey Jr. 2002
10 # Fixed for Xen project by K. Fraser in 2003.
11 abs_to_rel ()
12 {
13 local CWD SRCPATH
15 if [ "$1" != "/" -a "${1##*[^/]}" = "/" ]; then
16 SRCPATH=${1%?}
17 else
18 SRCPATH=$1
19 fi
20 if [ "$2" != "/" -a "${2##*[^/]}" = "/" ]; then
21 DESTPATH=${2%?}
22 else
23 DESTPATH=$2
24 fi
26 CWD=$PWD
27 [ "${1%%[^/]*}" != "/" ] && cd $1 && SRCPATH=$PWD
28 [ "${2%%[^/]*}" != "/" ] && cd $2 && DESTPATH=$PWD
29 [ "$CWD" != "$PWD" ] && cd $CWD
31 BASEPATH=$SRCPATH
33 [ "$SRCPATH" = "$DESTPATH" ] && DESTPATH="." && return
34 [ "$SRCPATH" = "/" ] && DESTPATH=${DESTPATH#?} && return
36 while [ "$BASEPATH/" != "${DESTPATH%${DESTPATH#$BASEPATH/}}" ]; do
37 BASEPATH=${BASEPATH%/*}
38 done
40 SRCPATH=${SRCPATH#$BASEPATH}
41 DESTPATH=${DESTPATH#$BASEPATH}
42 DESTPATH=${DESTPATH#?}
43 while [ -n "$SRCPATH" ]; do
44 SRCPATH=${SRCPATH%/*}
45 DESTPATH="../$DESTPATH"
46 done
48 [ -z "$BASEPATH" ] && BASEPATH="/"
49 [ "${DESTPATH##*[^/]}" = "/" ] && DESTPATH=${DESTPATH%?}
50 }
52 # relative_lndir <target_dir>
53 # Creates a tree of symlinks in the current working directory that mirror
54 # real files in <target_dir>. <target_dir> should be relative to the current
55 # working directory. Symlinks in <target_dir> are ignored. Source-control files
56 # are ignored.
57 relative_lndir ()
58 {
59 local SYMLINK_DIR REAL_DIR pref i j
60 SYMLINK_DIR=$PWD
61 REAL_DIR=$1
62 (
63 cd $REAL_DIR
64 for i in `find . -type d | grep -v SCCS`; do
65 [ -d $SYMLINK_DIR/$i ] || mkdir -p $SYMLINK_DIR/$i
66 (
67 cd $i
68 pref=`echo $i | sed -e 's#/[^/]*#../#g' -e 's#^\.##'`
69 for j in `find . -maxdepth 1 -type f -o -type l`; do
70 ln -sf ${pref}${REAL_DIR}/$i/$j ${SYMLINK_DIR}/$i/$j
71 done
72 )
73 done
74 )
75 }
77 [ "$1" == "" ] && { echo "Syntax: $0 <linux tree to xenify>"; exit 1; }
79 # Get absolute path to the destination directory
80 pushd . >/dev/null
81 cd ${1} || { echo "cannot cd to ${1}"; exit 1; }
82 AD=$PWD
83 popd >/dev/null
85 # Get absolute path to the source directory
86 AS=`pwd`
88 # Get path to source, relative to destination
89 abs_to_rel ${AD} ${AS}
90 RS=$DESTPATH
92 # Arch-specific pre-processing
93 if [ -x arch/${LINUX_ARCH}/xen-mkbuildtree-pre ]; then
94 arch/${LINUX_ARCH}/xen-mkbuildtree-pre
95 fi
97 # Remove old copies of files and directories at the destination
98 for i in `find . -type f -o -type l` ; do rm -f ${AD}/${i#./} ; done
100 # We now work from the destination directory
101 cd ${AD} || { echo "cannot cd to ${AD}"; exit 1; }
103 # Remove old symlinks
104 for i in `find . -type l`; do rm -f $i; done
106 # Create symlinks of files and directories which exist in the sparse source
107 relative_lndir ${RS}
108 rm -f mkbuildtree
110 # Create links to the shared definitions of the Xen interfaces.
111 rm -rf ${AD}/include/asm-xen/xen-public
112 mkdir ${AD}/include/asm-xen/xen-public
113 cd ${AD}/include/asm-xen/xen-public
114 relative_lndir ../../../${RS}/../xen/include/public
116 # Arch-specific post-processing
117 cd ${AD}
118 if [ -x arch/${LINUX_ARCH}/xen-mkbuildtree-post ]; then
119 arch/${LINUX_ARCH}/xen-mkbuildtree-post
120 fi