In some weird, yet unknown cases, the build folder might be messed up. Lets make sure we clean that up first prior to cloning or updating the folder. This seems to happen when we force via jenkins to abort a running job, leaving the system in a weird state on the remote build machine. It is not clear what specifically is going on in the sequence, but lets add some diagnostics on if any errant processes are sticking around in the previous process (VM cleanup etc) that prevented a proper system cleanup.
Signed-off-by: Nishanth Menon <n...@ti.com> --- lib/oesdk/config-build-env | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/lib/oesdk/config-build-env b/lib/oesdk/config-build-env index 058823562693..885fbcfb50d9 100644 --- a/lib/oesdk/config-build-env +++ b/lib/oesdk/config-build-env @@ -15,7 +15,7 @@ fi # conditions apply: # 1. The checkout creates the final directory of BUILD_ROOT # 2. If a git repo already exists then do a git pull -# 3. If the directory is not empty and is not a git repo then bail +# 3. If the directory is not empty and is not a git repo, then cleanup if unused checkout_layer_scripts() { cd `dirname $BUILD_ROOT` @@ -28,18 +28,27 @@ checkout_layer_scripts() { exit 1 fi - if [ ! -d $name ] - then + # If the scripts folder exists and is not a git repo, cleanup. + if [ -e $name -a ! -d $name/.git ]; then + echo "The $BUILD_ROOT directory is present and is not a git repo - attempting to wipe it off" + users=`lsof "$BUILD_ROOT"|wc -l` + if [ $users -gt 0 ]; then + echo "ERROR:: We have users for $BUILD_ROOT folder: Aborting!!!" + lsof $BUILD_ROOT + pstree -aplG + exit 1 + fi + rm -rvf "$BUILD_ROOT" || exit 1 + fi + + + if [ ! -d $name ]; then git clone "$TI_SDK_OELAYER_SETUP" $name - elif [ -d $name/.git ] - then - #This looks to be a git repo. Hopefully it is the right one :) + else + # This looks to be a git repo. Hopefully it is the right one :) cd $BUILD_ROOT git fetch git reset --hard origin - else - echo "The $BUILD_ROOT directory is not empty and is not a git repo" - exit 1 fi } -- 2.32.0 _______________________________________________ meta-arago mailing list meta-arago@arago-project.org http://arago-project.org/cgi-bin/mailman/listinfo/meta-arago