From 5b1ba8732013bd5b27c1a7b85df6ad250ad4e5ed Mon Sep 17 00:00:00 2001 From: Yu Yang Date: Thu, 17 Nov 2016 14:25:05 +0800 Subject: [PATCH] Add version check for paddle --- paddle/scripts/submit_local.sh.in | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/paddle/scripts/submit_local.sh.in b/paddle/scripts/submit_local.sh.in index 213cf2f1c..583bf9b83 100644 --- a/paddle/scripts/submit_local.sh.in +++ b/paddle/scripts/submit_local.sh.in @@ -28,6 +28,25 @@ function version(){ echo " with_predict_sdk: @WITH_PREDICT_SDK@" } +function ver2num() { + printf "%03d%03d%03d%03d" \ + $(echo $1 | sed 's#v##g' | tr '.' ' ' \ + | tr 'a' ' 0 ' | tr 'b' ' 1 ' | tr 'rc' ' 2 ') +} + +PADDLE_CONF_HOME="$HOME/.config/paddle" +mkdir -p ${PADDLE_CONF_HOME} + +if [ -z "${PADDLE_NO_STAT+x}" ]; then + SERVER_VER=`curl -m 5 -X POST --data content="{ version: \"@PADDLE_VERSION@\" }"\ + -b ${PADDLE_CONF_HOME}/paddle.cookie \ + -c ${PADDLE_CONF_HOME}/paddle.cookie \ + http://api.paddlepaddle.org/version 2>/dev/null` + if [ $? -eq 0 ] && [ "$(ver2num @PADDLE_VERSION@)" -lt $(ver2num $SERVER_VER) ]; then + echo "Paddle release a new version ${SERVER_VER}, you can get the install package in http://www.paddlepaddle.org" + fi +fi + MYDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -- GitLab