Implement prerequisites auto-update.

JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
This commit is contained in:
Ruben Ayrapetyan 2015-08-27 15:13:21 +03:00
parent 2ed18491df
commit 264a832cc4
2 changed files with 35 additions and 9 deletions

View File

@ -308,14 +308,10 @@ clean:
$(Q) rm -rf $(BUILD_DIR_PREFIX)* $(OUT_DIR)
.PHONY: prerequisites
prerequisites: $(PREREQUISITES_STATE_DIR)/.prerequisites
$(PREREQUISITES_STATE_DIR)/.prerequisites:
@ echo "Setting up prerequisites... (log file: $(PREREQUISITES_STATE_DIR)/prerequisites.log)"
prerequisites:
$(Q) mkdir -p $(PREREQUISITES_STATE_DIR)
$(Q) (./tools/prerequisites.sh $(PREREQUISITES_STATE_DIR)/.prerequisites 2>&1 | tee $(PREREQUISITES_STATE_DIR)/prerequisites.log $(QLOG) ; ( exit $${PIPESTATUS[0]} ) ) || \
(echo "Prerequisites setup failed. See $(PREREQUISITES_STATE_DIR)/prerequisites.log for details."; exit 1;)
@ echo "Prerequisites setup succeeded"
.PHONY: prerequisites_clean
prerequisites_clean:

View File

@ -14,11 +14,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
FLAG_FILE="$1"
PREREQUISITES_INSTALLED_LIST_FILE="$1"
shift
rm -f $FLAG_FILE
if [ "$1" == "clean" ]
then
CLEAN_MODE=yes
@ -66,6 +64,14 @@ function setup_from_zip() {
FAIL_MSG="Failed to setup '$NAME' prerequisite"
if [ "$CLEAN_MODE" == "no" ]
then
echo "$CHECKSUM $NAME" >> $TMP_DIR/.prerequisites
grep -q "^$CHECKSUM $NAME\$" $TMP_DIR/.prerequisites.prev && return 0
echo "Setting up $NAME prerequisite"
fi
if [ -e "$DEST" ]
then
chmod -R u+w "$DEST" || fail_msg "$FAIL_MSG. Failed to add write permission to '$DEST' directory contents."
@ -108,6 +114,14 @@ function setup_cppcheck() {
FAIL_MSG="Failed to setup '$NAME' prerequisite"
if [ "$CLEAN_MODE" == "no" ]
then
echo "$CHECKSUM $NAME" >> $TMP_DIR/.prerequisites
grep -q "^$CHECKSUM $NAME\$" $TMP_DIR/.prerequisites.prev && return 0
echo "Setting up $NAME prerequisite"
fi
if [ -e "$DEST" ]
then
chmod -R u+w "$DEST" || fail_msg "$FAIL_MSG. Failed to add write permission to '$DEST' directory contents."
@ -155,6 +169,14 @@ function setup_vera() {
FAIL_MSG="Failed to setup '$NAME' prerequisite"
if [ "$CLEAN_MODE" == "no" ]
then
echo "$CHECKSUM $NAME" >> $TMP_DIR/.prerequisites
grep -q "^$CHECKSUM $NAME\$" $TMP_DIR/.prerequisites.prev && return 0
echo "Setting up $NAME prerequisite"
fi
if [ -e "$DEST" ]
then
chmod -R u+w "$DEST" || fail_msg "$FAIL_MSG. Failed to add write permission to '$DEST' directory contents."
@ -187,6 +209,14 @@ function setup_vera() {
TMP_DIR=`mktemp -d --tmpdir=./`
if [ "$CLEAN_MODE" == "yes" ]
then
rm -f $PREREQUISITES_INSTALLED_LIST_FILE
else
touch $PREREQUISITES_INSTALLED_LIST_FILE || fail_msg "Failed to create '$PREREQUISITES_INSTALLED_LIST_FILE'."
mv $PREREQUISITES_INSTALLED_LIST_FILE $TMP_DIR/.prerequisites.prev
fi
setup_from_zip "stm32f3" \
"./third-party/STM32F3-Discovery_FW_V1.1.0" \
"http://www.st.com/st-web-ui/static/active/en/st_prod_software_internet/resource/technical/software/firmware/stm32f3discovery_fw.zip" \
@ -211,7 +241,7 @@ setup_vera "vera++-1.2.1" \
if [ "$CLEAN_MODE" == "no" ]
then
touch $FLAG_FILE || fail_msg "Failed to create flag file '$FLAG_FILE'."
mv $TMP_DIR/.prerequisites $PREREQUISITES_INSTALLED_LIST_FILE || fail_msg "Failed to write '$PREREQUISITES_INSTALLED_LIST_FILE'"
fi
clean_on_exit "OK"