scripts: Remove gnonlin from the scripts
[platform/upstream/gstreamer.git] / scripts / git-update.sh
1 #!/bin/bash
2
3 # update all known gstreamer modules
4 # build them one by one
5 # report failures at the end
6 # run this from a directory that contains the checkouts for each of the
7 # modules
8
9 PIDS=
10
11 CORE="\
12     gstreamer gst-plugins-base"
13 MODULES="\
14     gst-plugins-good gst-plugins-ugly gst-plugins-bad \
15     gst-libav"
16 EXTRA_MODULES="\
17     gst-editing-services \
18     gst-rtsp-server \
19     gst-python"
20
21 tmp=${TMPDIR-/tmp}
22 tmp=$tmp/git-update.$(date +%Y%m%d-%H%M-).$RANDOM.$RANDOM.$RANDOM.$$
23
24 (umask 077 && mkdir "$tmp") || {
25   echo "Could not create temporary directory! Exiting." 1>&2
26   exit 1
27 }
28
29 ERROR_LOG="$tmp/failures.log"
30 ERROR_RETURN=255
31
32 for m in $CORE $MODULES $EXTRA_MODULES; do
33   if test -d $m; then
34     echo "+ updating $m"
35     cd $m
36
37     git pull --rebase
38     if test $? -ne 0
39     then
40       echo "$m: update (trying stash, pull, stash apply)" >> $ERROR_LOG
41       git stash
42       git pull --rebase
43       if test $? -ne 0
44       then 
45         echo "$m: update" >> $ERROR_LOG
46         cd ..
47         continue
48       fi
49       git stash apply
50     fi
51
52     git submodule update
53     if test $? -ne 0
54     then
55       echo "$m: update (submodule)" >> $ERROR_LOG
56       cd ..
57       continue
58     fi
59     cd ..
60   fi
61 done
62
63 build()
64 {
65   if test -d $1; then
66     cd $1
67     if test ! -e Makefile
68     then
69       if test -e autoregen.sh
70       then
71         echo "+ $1: autoregen.sh"
72         ./autoregen.sh > "$tmp/$1-regen.log" 2>&1
73         if test $? -ne 0
74         then
75           echo "$1: autoregen.sh [$tmp/$1-regen.log]" >> $ERROR_LOG
76           cd ..
77           return $ERROR_RETURN
78         fi
79         echo "+ $1: autoregen.sh done"
80       else
81         echo "+ $1: autogen.sh"
82         ./autogen.sh > "$tmp/$1-gen.log" 2>&1
83         if test $? -ne 0
84         then
85           echo "$1: autogen.sh [$tmp/$1-gen.log]" >> $ERROR_LOG
86           cd ..
87           return $ERROR_RETURN
88         fi
89         echo "+ $1: autogen.sh done"
90       fi
91     fi
92
93     echo "+ $1: make"
94     make > "$tmp/$1-make.log" 2>&1
95     if test $? -ne 0
96     then
97       echo "$1: make [$tmp/$1-make.log]" >> $ERROR_LOG
98       cd ..
99       return $ERROR_RETURN
100     fi
101     echo "+ $1: make done"
102
103     if test "x$CHECK" != "x"; then
104       echo "+ $1: make check"
105       make check > "$tmp/$1-check.log" 2>&1
106       if test $? -ne 0
107       then
108         echo "$1: check [$tmp/$1-check.log]" >> $ERROR_LOG
109         cd ..
110         return
111       fi
112       echo "+ $1: make check done"
113     fi
114     cd ..
115   fi
116 }
117
118 beach()
119 {
120 if test -e $ERROR_LOG;  then
121   echo "Failures:"
122   echo
123   cat $ERROR_LOG
124 else
125   echo "Update done"
126   rm -rf "$tmp"
127 fi
128 exit
129 }
130
131 # build core and base plugins sequentially
132 # exit if build fails (excluding checks)
133 for m in $CORE; do
134   build $m
135   if [ $? -eq $ERROR_RETURN ]; then
136   beach
137   fi
138 done
139
140 # build other modules in parallel
141 for m in $MODULES; do
142   build $m &
143   PIDS="$PIDS $!"
144 done
145 wait $PIDS
146
147 beach
148