update-readmes 1.08 KB
Newer Older
1 2 3 4 5 6 7
#!/bin/bash
#
# update-readmes
#
# Updates a module's README and MAINTAINERS files from the copy in the
# common submodule.

8
README_FILES="README README.static-linking MAINTAINERS"
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

if [ ! -f "common/update-readmes" -o ! -f configure.ac ]; then
  echo "Run ./common/update-readmes from the top-level source directory of a GStreamer module";
  exit 1;
fi

MAJOR_VERSION=`grep '^AC_INIT' configure.ac | sed -e 's/[^0-9]*\([0-9]\)\.\([0-9]*\).*/\1/'`
MINOR_VERSION=`grep '^AC_INIT' configure.ac | sed -e 's/[^0-9]*\([0-9]\)\.\([0-9]*\).*/\2/'`

if test x$MAJOR_VERSION = x -o x$MINOR_VERSION = x ; then
  echo "Failed to extract major/minor version";
  exit 1;
fi

let m=$MINOR_VERSION%2
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 34 35 36
   echo "Failed to update $f"
   exit 1;
 }
done
37

38 39
sed -i "s/@SERIES_VERSION@/$SERIES_VERSION/g" README

40 41 42
if test x$1 = "x--run-git-add"; then
  git add $README_FILES;
fi