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