comparison scripts/build_pd_heavy.sh @ 481:def3b8cf9749 prerelease

build_pd_heavy: Parametrized hvresources path, looking for changes in hvresources as well
author Giulio Moro <giuliomoro@yahoo.it>
date Tue, 21 Jun 2016 14:26:33 +0100
parents bfc60429cca6
children 441c8429f27c
comparison
equal deleted inserted replaced
480:4ff80956c27a 481:def3b8cf9749
21 RUN_WITHOUT_SCREEN=1 21 RUN_WITHOUT_SCREEN=1
22 BELA_PYTHON27= 22 BELA_PYTHON27=
23 23
24 SCRIPTDIR=$(dirname "$0") 24 SCRIPTDIR=$(dirname "$0")
25 [ -z $SCRIPTDIR ] && SCRIPTDIR="./" || SCRIPTDIR=$SCRIPTDIR/ 25 [ -z $SCRIPTDIR ] && SCRIPTDIR="./" || SCRIPTDIR=$SCRIPTDIR/
26 [ -z $HVRESOURCES_DIR ] && HVRESOURCES_DIR=$SCRIPTDIR/hvresources/
26 . $SCRIPTDIR.bela_common || { echo "You must be in Bela/scripts to run these scripts" | exit 1; } 27 . $SCRIPTDIR.bela_common || { echo "You must be in Bela/scripts to run these scripts" | exit 1; }
27 28
28 if [ -z "$BELA_PYTHON27" ]; then 29 if [ -z "$BELA_PYTHON27" ]; then
29 for PY in python python2.7 ; do 30 for PY in python python2.7 ; do
30 python --version 2>&1 | grep "2\.7" >/dev/null 2>&1 31 python --version 2>&1 | grep "2\.7" >/dev/null 2>&1
116 do 117 do
117 rm -rf "$projectpath"/$file 118 rm -rf "$projectpath"/$file
118 done 119 done
119 120
120 # invoke the online compiler 121 # invoke the online compiler
121 "$BELA_PYTHON27" $SCRIPTDIR/hvresources/uploader.py "$pdpath"/ -n $ENZIENAUDIO_COM_PATCH_NAME -g c -o "$projectpath" $RELEASE_STRING ||\ 122 "$BELA_PYTHON27" $HVRESOURCES_DIR/uploader.py "$pdpath"/ -n $ENZIENAUDIO_COM_PATCH_NAME -g c -o "$projectpath" $RELEASE_STRING ||\
122 { echo "ERROR: an error occurred while executing the uploader.py script"; exit 1; } 123 { echo "ERROR: an error occurred while executing the uploader.py script"; exit 1; }
123 fi; 124 fi;
124 125
125 echo ""; 126 echo "";
126 127
128 # TODO: find a more reliable way of doing this. e.g.: have uploader.py fail with a non-zero error code. 129 # TODO: find a more reliable way of doing this. e.g.: have uploader.py fail with a non-zero error code.
129 for file in $HEAVY_FILES; 130 for file in $HEAVY_FILES;
130 do 131 do
131 ls "$projectpath"/$file >/dev/null 2>&1 || { echo "The online compiler failed, please try again."; exit 1; } 132 ls "$projectpath"/$file >/dev/null 2>&1 || { echo "The online compiler failed, please try again."; exit 1; }
132 done 133 done
134
133 # Apply any Bela-specific patches here 135 # Apply any Bela-specific patches here
134 cp "$SCRIPTDIR/hvresources/HvUtils.h" $projectpath/ || exit 1; 136 cp "$HVRESOURCES_DIR/HvUtils.h" $projectpath/ || exit 1;
135 137
136 BBB_PROJECT_FOLDER=$BBB_PROJECT_HOME"/"$BBB_PROJECT_NAME #make sure there is no trailing slash here 138 BBB_PROJECT_FOLDER=$BBB_PROJECT_HOME"/"$BBB_PROJECT_NAME #make sure there is no trailing slash here
137 BBB_NETWORK_TARGET_FOLDER=$BBB_ADDRESS:$BBB_PROJECT_FOLDER 139 BBB_NETWORK_TARGET_FOLDER=$BBB_ADDRESS:$BBB_PROJECT_FOLDER
138 140
139 # check how to copy/sync render.cpp file... 141 # check how to copy/sync render.cpp file...
143 if [ -f "$CUSTOM_RENDER_SOURCE_PATH" ]; then 145 if [ -f "$CUSTOM_RENDER_SOURCE_PATH" ]; then
144 echo "Found custom heavy/render.cpp file in input folder, using that one instead of the default one."; 146 echo "Found custom heavy/render.cpp file in input folder, using that one instead of the default one.";
145 cp "$CUSTOM_RENDER_SOURCE_PATH" "$projectpath/render.cpp" || exit 1 147 cp "$CUSTOM_RENDER_SOURCE_PATH" "$projectpath/render.cpp" || exit 1
146 else 148 else
147 echo "Using default heavy/render.cpp" 149 echo "Using default heavy/render.cpp"
148 cp "$SCRIPTDIR/hvresources/heavy_render.cpp" "$projectpath/render.cpp" || exit 1 150 cp "$HVRESOURCES_DIR/heavy_render.cpp" "$projectpath/render.cpp" || exit 1
149 fi 151 fi
150 152
151 echo "Updating files on board..." 153 echo "Updating files on board..."
152 # HvContext* files tend to hang when transferring with rsync because they are very large and -c checksum takes a lot, I guess 154 # HvContext* files tend to hang when transferring with rsync because they are very large and -c checksum takes a lot, I guess
153 155
203 205
204 if [ $WATCH -ne 0 ]; then 206 if [ $WATCH -ne 0 ]; then
205 BACK_NO_UPLOAD=$NO_UPLOAD 207 BACK_NO_UPLOAD=$NO_UPLOAD
206 while true 208 while true
207 do 209 do
210 # actually we are watching multiple paths : $pdpath and $HVRESOURCES_DIR
211 # so that it is easier to edit hvresources code without risk of being
212 # overwritten, but we avoid mentioning it to the end user, otherwise they
213 # get confused.
208 echo "Waiting for changes in $pdpath, or press ctrl-c to terminate" 214 echo "Waiting for changes in $pdpath, or press ctrl-c to terminate"
209 wait_for_change "$pdpath" "$reference_time_file" 215 while sleep 1
216 do
217 folder_has_changed "$pdpath" "$reference_time_file" && {
218 echo "Content of $pdpath has changed"
219 break
220 }
221 folder_has_changed "$HVRESOURCES_DIR" "$reference_time_file" && {
222 echo "Content of $pdpath has changed"
223 break
224 }
225 done
210 echo "Files changed" 226 echo "Files changed"
211 # if .pd files did not change, no point in re-uploading 227 # if .pd files did not change, no point in re-uploading
212 folder_has_changed "$pdpath" "$reference_time_file" "\.pd" &&\ 228 folder_has_changed "$pdpath" "$reference_time_file" "\.pd" &&\
213 NO_UPLOAD=$BACK_NO_UPLOAD || NO_UPLOAD=1 229 NO_UPLOAD=$BACK_NO_UPLOAD || NO_UPLOAD=1
214 uploadBuildRun 230 uploadBuildRun