Pavel Raiskup 58eeb7
#!/bin/bash
Pavel Raiskup 58eeb7
Pavel Raiskup 58eeb7
die() { echo >&2 "$@"; exit 1; }
Pavel Raiskup 58eeb7
Pavel Raiskup 58eeb7
lines=`git status --porcelain | grep -v ^?? | wc -l`
Pavel Raiskup 58eeb7
test "$lines" != "0" && die "stash the git changes"
Pavel Raiskup 58eeb7
Pavel Raiskup 58eeb7
if test -d config; then
Pavel Raiskup 58eeb7
    cd config
Pavel Raiskup 58eeb7
    git pull
Pavel Raiskup 58eeb7
    cd ..
Pavel Raiskup 58eeb7
else
Pavel Raiskup 58eeb7
    git clone git://git.savannah.gnu.org/config.git
Pavel Raiskup 58eeb7
fi
Pavel Raiskup 58eeb7
Pavel Raiskup 58eeb7
Pavel Raiskup 58eeb7
cp config/config.guess .
Pavel Raiskup 58eeb7
cp config/config.sub .
Pavel Raiskup 58eeb7
Pavel Raiskup 58eeb7
lines=`git status --porcelain config.guess config.sub | wc -l`
Pavel Raiskup 58eeb7
if test "$lines" = "0"; then
Pavel Raiskup 58eeb7
    echo "no upstream change"
Pavel Raiskup 58eeb7
    exit 0
Pavel Raiskup 58eeb7
fi
Pavel Raiskup 58eeb7
Pavel Raiskup 58eeb7
make -C config check || die "make check failed"
Pavel Raiskup 58eeb7
Pavel Raiskup 58eeb7
rpmdev-bumpspec automake.spec \
Pavel Raiskup 58eeb7
        -c "update config.{guess,sub} to gnuconfig git HEAD" \
Pavel Raiskup 58eeb7
    || die "can not bump spec"
Pavel Raiskup 58eeb7
Pavel Raiskup 58eeb7
git add -f config.sub config.guess automake.spec
Pavel Raiskup 58eeb7
git commit -m "gnuconfig: sync with upstream git" --no-verify