aboutsummaryrefslogtreecommitdiffstats
path: root/bootstrap.bash
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2016-03-22 14:08:17 -0700
committerDan Willemsen <dwillemsen@google.com>2016-03-22 19:53:36 -0700
commit6ac18ecb84332b6e84f498434812541f58a64ed4 (patch)
treeaf18bd7447c199f1c99fe0dc9b880aeb30dc8b3a /bootstrap.bash
parent7253e0b8a486797347b8bdec43aa98ce135f3ad7 (diff)
downloadbuild_soong-6ac18ecb84332b6e84f498434812541f58a64ed4.tar.gz
build_soong-6ac18ecb84332b6e84f498434812541f58a64ed4.tar.bz2
build_soong-6ac18ecb84332b6e84f498434812541f58a64ed4.zip
Improve BUILDDIR handling with symlinks
If BUILDDIR is a local symlink to another directory in the same parent directory (out -> out.angler), then using out and .. as relative paths to get back and forth work. But if BUILDDIR is a symlink to another directory altogether (out -> /mnt/sdd/out.master), then we shouldn't be relying on relative paths (so that the source directory can still be moved). Change-Id: I946c8116090410ab2b935eafba9b6e96f5f2f1dd
Diffstat (limited to 'bootstrap.bash')
-rwxr-xr-xbootstrap.bash12
1 files changed, 2 insertions, 10 deletions
diff --git a/bootstrap.bash b/bootstrap.bash
index c4c7e35c..62c429c5 100755
--- a/bootstrap.bash
+++ b/bootstrap.bash
@@ -8,11 +8,7 @@ if [[ "$ORIG_SRCDIR" != "." ]]; then
echo "error: To use BUILDDIR, run from the source directory"
exit 1
fi
- if [[ ${ORIG_SRCDIR:0:1} == '/' ]]; then
- export BUILDDIR=$PWD
- else
- export BUILDDIR=$(python -c "import os; print os.path.relpath('.', '$ORIG_SRCDIR')")
- fi
+ export BUILDDIR=$("${ORIG_SRCDIR}/build/soong/reverse_path.py" "$ORIG_SRCDIR")
cd $ORIG_SRCDIR
fi
if [[ -z "$BUILDDIR" ]]; then
@@ -49,11 +45,7 @@ if [[ $# -eq 0 ]]; then
exit 1
fi
- if [[ ${BUILDDIR:0:1} == '/' ]]; then
- export SRCDIR_FROM_BUILDDIR=$PWD
- else
- export SRCDIR_FROM_BUILDDIR=$(python -c "import os; print os.path.relpath('.', '$BUILDDIR')")
- fi
+ export SRCDIR_FROM_BUILDDIR=$(build/soong/reverse_path.py "$BUILDDIR")
sed -e "s|@@BuildDir@@|${BUILDDIR}|" \
-e "s|@@SrcDirFromBuildDir@@|${SRCDIR_FROM_BUILDDIR}|" \