File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,34 @@ function version(){
28
28
echo " with_predict_sdk: @WITH_PREDICT_SDK@"
29
29
}
30
30
31
+ function ver2num() {
32
+ # convert version to number.
33
+ if [ -z " $1 " ]; then # empty argument
34
+ printf " %03d%03d%03d%03d%03d" 0
35
+ else
36
+ local VERN=$( echo $1 | sed ' s#v##g' | sed ' s#\.# #g' \
37
+ | sed ' s#a# 0 #g' | sed ' s#b# 1 #g' | sed ' s#rc# 2 #g' )
38
+ if [ ` echo $VERN | wc -w` -eq 3 ] ; then
39
+ printf " %03d%03d%03d%03d%03d" $VERN 999 999
40
+ else
41
+ printf " %03d%03d%03d%03d%03d" $VERN
42
+ fi
43
+ fi
44
+ }
45
+
46
+ PADDLE_CONF_HOME=" $HOME /.config/paddle"
47
+ mkdir -p ${PADDLE_CONF_HOME}
48
+
49
+ if [ -z " ${PADDLE_NO_STAT+x} " ]; then
50
+ SERVER_VER=` curl -m 5 -X POST --data content=" { \" version\" : \" @PADDLE_VERSION@\" }" \
51
+ -b ${PADDLE_CONF_HOME} /paddle.cookie \
52
+ -c ${PADDLE_CONF_HOME} /paddle.cookie \
53
+ http://api.paddlepaddle.org/version 2> /dev/null`
54
+ if [ $? -eq 0 ] && [ " $( ver2num @PADDLE_VERSION@) " -lt $( ver2num $SERVER_VER ) ]; then
55
+ echo " Paddle release a new version ${SERVER_VER} , you can get the install package in http://www.paddlepaddle.org"
56
+ fi
57
+ fi
58
+
31
59
32
60
MYDIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd ) "
33
61
You can’t perform that action at this time.
0 commit comments