From 75e5560e081b71549505e1841b446c9472bde5d8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Stefan=20Br=C3=BCns?= Date: Sun, 19 Jul 2015 16:20:13 +0200 Subject: [PATCH] use correct dir for creation of icecream env MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit /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 Signed-off-by: Julien Isorce --- build | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/build b/build index 68acb06..80571bf 100755 --- a/build +++ b/build @@ -489,8 +489,12 @@ setupccache() 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/var/run/icecream" + rm -rf "$BUILD_ROOT$icecreamdir" rm -f "$BUILD_ROOT/etc/profile.d/build_icecream.sh" return fi @@ -509,7 +513,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? @@ -521,8 +525,8 @@ 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" + 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 @@ -534,9 +538,11 @@ setupicecream() false return 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 -- 2.34.1