update-common: generate autogen.sh for gst-libav and gst-editing-services as well
[platform/upstream/gst-common.git] / update-readmes
1 #!/bin/bash
2 #
3 # update-readmes
4 #
5 # Updates a module's README and MAINTAINERS files from the copy in the
6 # common submodule.
7
8 README_FILES="README README.static-linking MAINTAINERS"
9
10 if [ ! -f "common/update-readmes" -o ! -f configure.ac ]; then
11   echo "Run ./common/update-readmes from the top-level source directory of a GStreamer module";
12   exit 1;
13 fi
14
15 MAJOR_VERSION=`grep '^AC_INIT' configure.ac | sed -e 's/[^0-9]*\([0-9]\)\.\([0-9]*\).*/\1/'`
16 MINOR_VERSION=`grep '^AC_INIT' configure.ac | sed -e 's/[^0-9]*\([0-9]\)\.\([0-9]*\).*/\2/'`
17
18 if test x$MAJOR_VERSION = x -o x$MINOR_VERSION = x ; then
19   echo "Failed to extract major/minor version";
20   exit 1;
21 fi
22
23 let m=$MINOR_VERSION%2
24 if test $m = 0; then
25   SERIES_VERSION="$MAJOR_VERSION.$MINOR_VERSION.x stable series"
26 else
27   SERIES_VERSION="$MAJOR_VERSION.$MINOR_VERSION.x development series"
28 fi
29 #echo "$SERIES_VERSION"
30
31 for f in $README_FILES ; do
32  cp --preserve "common/$f" $f || {
33    echo "Failed to update $f"
34    exit 1;
35  }
36 done
37
38 sed -i "s/@SERIES_VERSION@/$SERIES_VERSION/g" README
39
40 if test x$1 = "x--run-git-add"; then
41   git add $README_FILES;
42 fi