ia64/xen-unstable

changeset 1789:91ce6ba4ab3e

bitkeeper revision 1.1087 (40f56a0eJ3YluUqh_hXolLsP2iLy0w)

Add mkbuildtree script to prepare a Linux 2.6 build tree.
author cl349@freefall.cl.cam.ac.uk
date Wed Jul 14 17:14:54 2004 +0000 (2004-07-14)
parents 61599b006364
children b0c6d5d450ad
files .rootkeys linux-2.6.7-xen-sparse/mkbuildtree
line diff
     1.1 --- a/.rootkeys	Wed Jul 14 17:08:11 2004 +0000
     1.2 +++ b/.rootkeys	Wed Jul 14 17:14:54 2004 +0000
     1.3 @@ -246,6 +246,7 @@ 40f5623cb_pJrLt3h_nAzvJsjsV0rQ linux-2.6
     1.4  40f5623cndVUFlkxpf7Lfx7xu8madQ linux-2.6.7-xen-sparse/include/asm-xen/multicall.h
     1.5  40f5623cTZ80EwjWUBlh44A9F9i_Lg linux-2.6.7-xen-sparse/include/asm-xen/netif.h
     1.6  40f5623cBiQhPHILVLrl3xa6bDBaRg linux-2.6.7-xen-sparse/include/asm-xen/xen.h
     1.7 +40f56a0ddHCSs3501MY4hRf22tctOw linux-2.6.7-xen-sparse/mkbuildtree
     1.8  40e1b09db5mN69Ijj0X_Eol-S7dXiw tools/Make.defs
     1.9  3f776bd1Hy9rn69ntXBhPReUFw9IEA tools/Makefile
    1.10  401d7e160vaxMBAUSLSicuZ7AQjJ3w tools/examples/Makefile
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/linux-2.6.7-xen-sparse/mkbuildtree	Wed Jul 14 17:14:54 2004 +0000
     2.3 @@ -0,0 +1,103 @@
     2.4 +#!/bin/sh
     2.5 +
     2.6 +# mkbuildtree <build tree>
     2.7 +#
     2.8 +# Creates symbolic links in <build tree> for the sparse tree
     2.9 +# in the current directory.
    2.10 +
    2.11 +# Script to determine the relative path between two directories.
    2.12 +# Copyright (c) D. J. Hawkey Jr. 2002
    2.13 +# Fixed for Xen project by K. Fraser in 2003.  
    2.14 +abs_to_rel ()
    2.15 +{
    2.16 +	local CWD SRCPATH
    2.17 +                
    2.18 +	if [ "$1" != "/" -a "${1##*[^/]}" = "/" ]; then
    2.19 +		SRCPATH=${1%?}
    2.20 +	else
    2.21 +		SRCPATH=$1
    2.22 +	fi
    2.23 +	if [ "$2" != "/" -a "${2##*[^/]}" = "/" ]; then
    2.24 +		DESTPATH=${2%?}
    2.25 +	else
    2.26 +		DESTPATH=$2
    2.27 +	fi
    2.28 +
    2.29 +	CWD=$PWD
    2.30 +	[ "${1%%[^/]*}" != "/" ] && cd $1 && SRCPATH=$PWD
    2.31 +	[ "${2%%[^/]*}" != "/" ] && cd $2 && DESTPATH=$PWD
    2.32 +	[ "$CWD" != "$PWD" ] && cd $CWD
    2.33 +
    2.34 +	BASEPATH=$SRCPATH
    2.35 +
    2.36 +	[ "$SRCPATH" = "$DESTPATH" ] && DESTPATH="." && return
    2.37 +	[ "$SRCPATH" = "/" ] && DESTPATH=${DESTPATH#?} && return
    2.38 +
    2.39 +	while [ "$BASEPATH/" != "${DESTPATH%${DESTPATH#$BASEPATH/}}" ]; do
    2.40 +          BASEPATH=${BASEPATH%/*}
    2.41 +	done
    2.42 +
    2.43 +	SRCPATH=${SRCPATH#$BASEPATH}
    2.44 +        DESTPATH=${DESTPATH#$BASEPATH}
    2.45 +        DESTPATH=${DESTPATH#?}
    2.46 +	while [ -n "$SRCPATH" ]; do
    2.47 +		SRCPATH=${SRCPATH%/*}
    2.48 +		DESTPATH="../$DESTPATH"
    2.49 +	done
    2.50 +
    2.51 +	[ -z "$BASEPATH" ] && BASEPATH="/"
    2.52 +	[ "${DESTPATH##*[^/]}" = "/" ] && DESTPATH=${DESTPATH%?}
    2.53 +}
    2.54 +
    2.55 +# relative_lndir <target_dir>
    2.56 +# Creates a tree of symlinks in the current working directory that mirror
    2.57 +# real files in <target_dir>. <target_dir> should be relative to the current
    2.58 +# working directory. Symlinks in <target_dir> are ignored. Source-control files
    2.59 +# are ignored.
    2.60 +relative_lndir ()
    2.61 +{
    2.62 +  local SYMLINK_DIR REAL_DIR pref i j
    2.63 +  SYMLINK_DIR=$PWD
    2.64 +  REAL_DIR=$1
    2.65 +  (
    2.66 +  cd $REAL_DIR
    2.67 +  for i in `find . -type d | grep -v SCCS`; do
    2.68 +    [ -d $SYMLINK_DIR/$i ] || mkdir -p $SYMLINK_DIR/$i
    2.69 +    (
    2.70 +    cd $i
    2.71 +    pref=`echo $i | sed -e 's#/[^/]*#../#g' -e 's#^\.##'`
    2.72 +    for j in `find . -type f -o -type l -maxdepth 1`; do
    2.73 +      ln -sf ${pref}${REAL_DIR}/$i/$j ${SYMLINK_DIR}/$i/$j
    2.74 +    done
    2.75 +    )
    2.76 +  done
    2.77 +  )
    2.78 +}
    2.79 +
    2.80 +[ "$1" == "" ] && { echo "Syntax: $0 <linux tree to xenify>"; exit 1; }
    2.81 +
    2.82 +# Get absolute path to the destination directory
    2.83 +pushd . >/dev/null
    2.84 +cd ${1}
    2.85 +AD=$PWD
    2.86 +popd >/dev/null
    2.87 +  
    2.88 +# Get absolute path to the source directory
    2.89 +AS=`pwd`
    2.90 +
    2.91 +# Get path to source, relative to destination
    2.92 +abs_to_rel ${AD} ${AS}
    2.93 +RS=$DESTPATH
    2.94 +
    2.95 +# Remove old copies of files and directories at the destination
    2.96 +for i in `find . -type f -o -type l` ; do rm -f ${AD}/${i#./} ; done
    2.97 +
    2.98 +# We now work from the destination directory
    2.99 +cd ${AD}
   2.100 +
   2.101 +# Remove old symlinks
   2.102 +for i in `find . -type l`; do rm -f $i; done
   2.103 +
   2.104 +# Create symlinks of files and directories which exist in the sparse source
   2.105 +relative_lndir ${RS}
   2.106 +rm -f mkbuildtree