Update snapshot_history
[platform/upstream/iotivity.git] / build-vd-tv-tizen30.sh
1 #!/bin/bash
2
3 ###### Please specify below ######
4 BUILD_CMD="bash ./gbsbuild.sh"
5 CONF_CMD="cp ./tools/tizen/.gbs.vd.tv.tizen30.conf ./tools/tizen/.gbs.conf"
6 SPEC_CMD="cp ./tools/tizen/iotivity-vd-tv-tizen30.spec ./tools/tizen/iotivity.spec"
7
8 # For Git
9 CLONE_CMD="git clone http://suprem.sec.samsung.net/gerrit/IoTivity samsung_iotivity"
10 FETCH_CMD="git fetch -p"
11 CHECKOUT_CMD="git checkout -f "
12 CHERRYPICK_PREFIX="git fetch http://suprem.sec.samsung.net/gerrit/IoTivity"
13 CHERRYPICK_CMD="git cherry-pick FETCH_HEAD"
14
15 msg_hello()
16 {
17     echo "***********************************************************************"
18     echo "*                                                                     *"
19     echo "*                         IoTivity Build Start.                       *"
20     echo "*                                                                     *"
21     echo "***********************************************************************"
22 }
23
24 msg_error()
25 {
26     echo ---------------------------------------------------------------------
27     echo "Fail to Build, Check Last Step. [$_STEP]"
28     echo ---------------------------------------------------------------------
29     exit 2
30 }
31
32 error_check()
33 {
34     if [ $? != 0 ]
35     then
36        msg_error
37     fi
38 }
39
40 # Check commit_info
41 _STEP=COMMIT
42 if [ "" = "$1" ];then
43     msg_error
44 fi
45 COMMIT_ID=$(awk '/^commit_id:/{print $2}' "$1")
46 echo COMMIT ID is $COMMIT_ID
47 error_check
48 if [ 0 == ${#COMMIT_ID} ];then
49     msg_error
50 fi
51
52 # Cherry pick_info
53 _STEP=CHERRYPICK
54 CHERRYPICK_ID=$(awk '/^cherrypick_cmd_id:/{print $5}' "$1")
55 for cherry_pic_arr in $CHERRYPICK_ID
56 do
57     echo CHERRY_PICK_ID is $cherry_pic_arr
58     error_check
59 done
60
61 # Check Source Code
62 _STEP=INIT
63 msg_hello
64 if [ ! -d resource/csdk ];then
65     if [ ! -d samsung_iotivity ];then
66         echo $CLONE_CMD
67         $CLONE_CMD
68         error_check
69     fi
70     cd ./samsung_iotivity
71 fi
72 error_check
73
74 _STEP=FETCH
75 echo $FETCH_CMD
76 $FETCH_CMD
77 error_check
78
79 _STEP=CHECKOUT
80 echo $CHECKOUT_CMD $COMMIT_ID
81 $CHECKOUT_CMD $COMMIT_ID
82 error_check
83
84 _STEP=CHERRYPICK
85 for arr_cherry_pick_cmd in $CHERRYPICK_ID; do
86     echo $CHERRYPICK_PREFIX $arr_cherry_pick_cmd
87     $CHERRYPICK_PREFIX $arr_cherry_pick_cmd
88     error_check
89     echo $CHERRYPICK_CMD
90     $CHERRYPICK_CMD
91     error_check
92 done
93
94 _STEP=CONF
95 echo $CONF_CMD
96 $CONF_CMD
97 echo $SPEC_CMD
98 $SPEC_CMD
99 error_check
100
101 _STEP=CLEAN
102 rm -rf out
103
104 _STEP=BUILD
105 echo $BUILD_CMD
106 $BUILD_CMD
107 error_check