scripts: add some more modules to git-update.sh
[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 touch $ERROR_LOG
32 ERROR_RETURN=255
33
34 for m in $CORE $MODULES $EXTRA_MODULES; do
35   if test -d $m; then
36     echo "+ updating $m"
37     cd $m
38
39     git pull origin master
40     if test $? -ne 0
41     then
42       echo "$m: update (trying stash, pull, stash apply)" >> $ERROR_LOG
43       git stash
44       git pull origin master
45       if test $? -ne 0
46       then 
47         echo "$m: update" >> $ERROR_LOG
48         cd ..
49         continue
50       fi
51       git stash apply
52     fi
53
54     git submodule update
55     if test $? -ne 0
56     then
57       echo "$m: update (submodule)" >> $ERROR_LOG
58       cd ..
59       continue
60     fi
61     cd ..
62   fi
63 done
64
65 build()
66 {
67   if test -d $1; then
68     cd $1
69     if test ! -e Makefile
70     then
71       if test -e autoregen.sh
72       then
73         echo "+ $1: autoregen.sh"
74         ./autoregen.sh > "$tmp/$1-regen.log" 2>&1
75         if test $? -ne 0
76         then
77           echo "$1: autoregen.sh [$tmp/$1-regen.log]" >> $ERROR_LOG
78           cd ..
79           return $ERROR_RETURN
80         fi
81         echo "+ $1: autoregen.sh done"
82       else
83         echo "+ $1: autogen.sh"
84         ./autogen.sh > "$tmp/$1-gen.log" 2>&1
85         if test $? -ne 0
86         then
87           echo "$1: autogen.sh [$tmp/$1-gen.log]" >> $ERROR_LOG
88           cd ..
89           return $ERROR_RETURN
90         fi
91         echo "+ $1: autogen.sh done"
92       fi
93     fi
94
95     echo "+ $1: make"
96     make > "$tmp/$1-make.log" 2>&1
97     if test $? -ne 0
98     then
99       echo "$1: make [$tmp/$1-make.log]" >> $ERROR_LOG
100       cd ..
101       return $ERROR_RETURN
102     fi
103     echo "+ $1: make done"
104
105     if test "x$CHECK" != "x"; then
106       echo "+ $1: make check"
107       make check > "$tmp/$1-check.log" 2>&1
108       if test $? -ne 0
109       then
110         echo "$1: check [$tmp/$1-check.log]" >> $ERROR_LOG
111         cd ..
112         return
113       fi
114       echo "+ $1: make check done"
115     fi
116     cd ..
117   fi
118 }
119
120 beach()
121 {
122 if test -e $ERROR_LOG;  then
123   echo "Failures:"
124   echo
125   cat $ERROR_LOG
126 else
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