gst-uninstalled: add new -bad mpegts lib
[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     gnonlin"
21
22 tmp=${TMPDIR-/tmp}
23 tmp=$tmp/git-update.$(date +%Y%m%d-%H%M-).$RANDOM.$RANDOM.$RANDOM.$$
24
25 (umask 077 && mkdir "$tmp") || {
26   echo "Could not create temporary directory! Exiting." 1>&2
27   exit 1
28 }
29
30 ERROR_LOG="$tmp/failures.log"
31 ERROR_RETURN=255
32
33 for m in $CORE $MODULES $EXTRA_MODULES; do
34   if test -d $m; then
35     echo "+ updating $m"
36     cd $m
37
38     git pull origin master
39     if test $? -ne 0
40     then
41       echo "$m: update (trying stash, pull, stash apply)" >> $ERROR_LOG
42       git stash
43       git pull origin master
44       if test $? -ne 0
45       then 
46         echo "$m: update" >> $ERROR_LOG
47         cd ..
48         continue
49       fi
50       git stash apply
51     fi
52
53     git submodule update
54     if test $? -ne 0
55     then
56       echo "$m: update (submodule)" >> $ERROR_LOG
57       cd ..
58       continue
59     fi
60     cd ..
61   fi
62 done
63
64 build()
65 {
66   if test -d $1; then
67     cd $1
68     if test ! -e Makefile
69     then
70       if test -e autoregen.sh
71       then
72         echo "+ $1: autoregen.sh"
73         ./autoregen.sh > "$tmp/$1-regen.log" 2>&1
74         if test $? -ne 0
75         then
76           echo "$1: autoregen.sh [$tmp/$1-regen.log]" >> $ERROR_LOG
77           cd ..
78           return $ERROR_RETURN
79         fi
80         echo "+ $1: autoregen.sh done"
81       else
82         echo "+ $1: autogen.sh"
83         ./autogen.sh > "$tmp/$1-gen.log" 2>&1
84         if test $? -ne 0
85         then
86           echo "$1: autogen.sh [$tmp/$1-gen.log]" >> $ERROR_LOG
87           cd ..
88           return $ERROR_RETURN
89         fi
90         echo "+ $1: autogen.sh done"
91       fi
92     fi
93
94     echo "+ $1: make"
95     make > "$tmp/$1-make.log" 2>&1
96     if test $? -ne 0
97     then
98       echo "$1: make [$tmp/$1-make.log]" >> $ERROR_LOG
99       cd ..
100       return $ERROR_RETURN
101     fi
102     echo "+ $1: make done"
103
104     if test "x$CHECK" != "x"; then
105       echo "+ $1: make check"
106       make check > "$tmp/$1-check.log" 2>&1
107       if test $? -ne 0
108       then
109         echo "$1: check [$tmp/$1-check.log]" >> $ERROR_LOG
110         cd ..
111         return
112       fi
113       echo "+ $1: make check done"
114     fi
115     cd ..
116   fi
117 }
118
119 beach()
120 {
121 if test -e $ERROR_LOG;  then
122   echo "Failures:"
123   echo
124   cat $ERROR_LOG
125 else
126   echo "Update done"
127   rm -rf "$tmp"
128 fi
129 exit
130 }
131
132 # build core and base plugins sequentially
133 # exit if build fails (excluding checks)
134 for m in $CORE; do
135   build $m
136   if [ $? -eq $ERROR_RETURN ]; then
137   beach
138   fi
139 done
140
141 # build other modules in parallel
142 for m in $MODULES; do
143   build $m &
144   PIDS="$PIDS $!"
145 done
146 wait $PIDS
147
148 beach
149