summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Brüns <stefan.bruens@rwth-aachen.de>2015-07-19 16:20:13 +0200
committerSoonKyu Park <sk7.park@samsung.com>2016-09-26 10:34:20 +0900
commitaf9ad6b54cbf011308e1cdade2d92666ef3f564f (patch)
treefea769f872513ae85e51352604ba3869688cd809
parentbb2a3cc363850d2751058d34c90d5fe00bc80cbc (diff)
downloadbuild-af9ad6b54cbf011308e1cdade2d92666ef3f564f.tar.gz
build-af9ad6b54cbf011308e1cdade2d92666ef3f564f.tar.bz2
build-af9ad6b54cbf011308e1cdade2d92666ef3f564f.zip
use correct dir for creation of icecream env
/var/run might point to the absolute path /run. Thus any commands referencing $BUILD_ROOT/var/run are actually using the hosts /run directory, whereas the "cd" tries to change to the nonexisting /run/icecream directory and fails. This is a cherry-pick from upstream: https://github.com/openSUSE/obs-build/commit/21359a6ebcbacdb1754a7c4339a7cca7e496e52f Change-Id: Ibb87b525f115c5f9435c18db9c72773ca058d8ff Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Signed-off-by: Julien Isorce <j.isorce@samsung.com>
-rwxr-xr-xbuild35
1 files changed, 21 insertions, 14 deletions
diff --git a/build b/build
index 3ad644a..c94f365 100755
--- a/build
+++ b/build
@@ -423,9 +423,14 @@ setupccache() {
fi
}
-setupicecream() {
- if test "$icecream" -eq 0 ; then
- rm -rf "$BUILD_ROOT/var/run/icecream"
+setupicecream()
+{
+ local icecreamdir="/var/run/icecream"
+ if test `readlink "$BUILD_ROOT/var/run"` = '/run' ; then
+ icecreamdir="/run/icecream"
+ fi
+ if [ "$icecream" -eq 0 ]; then
+ rm -rf "$BUILD_ROOT$icecreamdir"
rm -f "$BUILD_ROOT/etc/profile.d/build_icecream.sh"
return 0
fi
@@ -443,7 +448,7 @@ setupicecream() {
echo 'export CCACHE_PATH=/usr/lib/icecc/bin:/opt/icecream/bin' > "$BUILD_ROOT"/etc/profile.d/build_icecream.sh
fi
- local icecc_vers=(`shopt -s nullglob; echo $BUILD_ROOT/var/run/icecream/*.tar.{bz2,gz}`)
+ local icecc_vers=(`shopt -s nullglob; echo $BUILD_ROOT$icecreamdir/*.tar.{bz2,gz}`)
icecc_vers=${icecc_vers//$BUILD_ROOT/}
# XXX use changelog like autobuild does instead?
@@ -455,21 +460,23 @@ setupicecream() {
-o "$BUILD_ROOT/usr/bin/as" -nt "$BUILD_ROOT/$icecc_vers" \
-o "$BUILD_ROOT/lib/libc.so.6" -nt "$BUILD_ROOT/$icecc_vers"
then
- rm -rf "$BUILD_ROOT/var/run/icecream"
- mkdir -p "$BUILD_ROOT/var/run/icecream"
- if test -e "$BUILD_ROOT"/usr/bin/create-env ; then
- createenv=/usr/bin/create-env
- elif test -e "$BUILD_ROOT"/usr/lib/icecc/icecc-create-env ; then
- createenv="/usr/lib/icecc/icecc-create-env /usr/bin/gcc /usr/bin/g++" # XXX
- elif test -e "$BUILD_ROOT"/usr/lib64/icecc/icecc-create-env ; then
- createenv="/usr/lib64/icecc/icecc-create-env /usr/bin/gcc /usr/bin/g++" # XXX
+ rm -rf "$BUILD_ROOT$icecreamdir"
+ mkdir -p "$BUILD_ROOT$icecreamdir"
+ if [ -e "$BUILD_ROOT"/usr/bin/create-env ]; then
+ createenv=/usr/bin/create-env
+ elif [ -e "$BUILD_ROOT"/usr/lib/icecc/icecc-create-env ]; then
+ createenv="/usr/lib/icecc/icecc-create-env /usr/bin/gcc /usr/bin/g++" # XXX
+ elif [ -e "$BUILD_ROOT"/usr/lib64/icecc/icecc-create-env ]; then
+ createenv="/usr/lib64/icecc/icecc-create-env /usr/bin/gcc /usr/bin/g++" # XXX
else
echo "create-env not found"
return 1
fi
- chroot $BUILD_ROOT bash -c "cd /var/run/icecream; $createenv" || cleanup_and_exit 1
- icecc_vers=(`shopt -s nullglob; echo $BUILD_ROOT/var/run/icecream/*.tar.{bz2,gz}`)
+ echo "creating new env in '$icecreamdir'"
+ chroot $BUILD_ROOT bash -c "cd $icecreamdir; $createenv" || cleanup_and_exit 1
+ icecc_vers=(`shopt -s nullglob; echo $BUILD_ROOT/$icecreamdir/*.tar.{bz2,gz}`)
icecc_vers=${icecc_vers//$BUILD_ROOT/}
+ echo "created icecream environment $icecc_vers"
else
echo "reusing existing icecream environment $icecc_vers"
fi