1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-29 07:58:28 +00:00
emacs/autogen/update_autogen
Glenn Morris f6ca84c095 Remove some files that autoreconf can supply.
Ref: http://lists.gnu.org/archive/html/emacs-devel/2011-03/msg00863.html

* compile, config.guess, config.sub, depcomp, install-sh, missing:
Remove; autoreconf can supply them.

* Makefile.in (sync-from-gnulib): Don't sync config.sub,
config.guess, install-sh.  Pass -i to autoreconf.

* autogen/update_autogen (genfiles): Add compile, config.guess,
config.sub, depcomp, install-sh, missing.  Pass -i to autoreconf.
Discard non-error output from autoreconf in -q case.

* autogen/compile, autogen/config.guess, autogen/config.sub:
* autogen/depcomp, autogen/install-sh, autogen/missing: New files.

* autogen/copy_autogen: Add compile, config.guess, config.sub, depcomp,
install-sh, missing.

* autogen/README: Add compile, config.guess, config.sub, depcomp,
install-sh, missing.

* INSTALL.BZR, admin/make-tarball.txt: Add -i to autoreconf args.

* .bzrignore: Add compile, config.guess, config.sub, depcomp,
install-sh, missing.
2011-03-25 00:14:31 -07:00

189 lines
3.9 KiB
Bash
Executable File

#!/bin/bash
### update_autogen - update the generated files in Emacs autogen/ directory
## Copyright (C) 2011 Free Software Foundation, Inc.
## Author: Glenn Morris <rgm@gnu.org>
## This file is part of GNU Emacs.
## GNU Emacs is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
## GNU Emacs is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
## You should have received a copy of the GNU General Public License
## along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
### Commentary:
## This is a helper script to update the pre-built generated files in
## the autogen/ directory. This is suitable for running from cron.
## Only Emacs maintainers need use this, so it uses bash features.
### Code:
function die () # write error to stderr and exit
{
[ $# -gt 0 ] && echo "$PN: $@" >&2
exit 1
}
PN=${0##*/} # basename of script
PD=${0%/*}
[ "$PD" = "$0" ] && PD=. # if PATH includes PWD
## This should be the autogen directory.
cd $PD
cd ../
[ -d autogen ] || die "Could not locate autogen directory"
function usage ()
{
cat 1>&2 <<EOF
Usage: ${PN} [-f] [-c] [-q]
Update the generated files in the Emacs autogen/ directory.
Options:
-f: force an update even if the source files are locally modified.
-c: if the update succeeds and the generated files are modified,
commit them (caution).
-q: be quiet; only give error messages, not status messages.
EOF
exit 1
}
## Defaults.
force=
commit=
quiet=
## Parameters.
sources="configure.in lib/Makefile.am"
genfiles="configure aclocal.m4 src/config.in lib/Makefile.in compile config.guess config.sub depcomp install-sh missing"
for g in $genfiles; do
basegen="$basegen ${g##*/}"
done
[ "$basegen" ] || die "internal error"
tempfile=/tmp/$PN.$$
trap "rm -f $tempfile 2> /dev/null" EXIT
while getopts ":hcfq" option ; do
case $option in
(h) usage ;;
(c) commit=1 ;;
(f) force=1 ;;
(q) quiet=1 ;;
(\?) die "Bad option -$OPTARG" ;;
(:) die "Option -$OPTARG requires an argument" ;;
(*) die "getopts error" ;;
esac
done
shift $(( --OPTIND ))
OPTIND=1
[ $# -eq 0 ] || die "Wrong number of arguments"
[ "$quiet" ] && exec 1> /dev/null
echo "Running bzr status..."
bzr status -S $sources >| $tempfile || die "bzr status error for sources"
while read stat file; do
case $stat in
M)
echo "Locally modified: $file"
[ "$force" ] || die "There are local modifications"
;;
*) die "Unexpected status ($stat) for $file" ;;
esac
done < $tempfile
echo "Running autoreconf..."
autoreconf -i -I m4 2>| $tempfile
retval=$?
## Annoyingly, autoreconf puts the "installing `./foo' messages on stderr.
if [ "$quiet" ]; then
grep -v 'installing `\.' $tempfile 1>&2
else
cat "$tempfile" 1>&2
fi
[ $retval -ne 0 ] && die "autoreconf error"
cp $genfiles autogen/
cd autogen
echo "Checking status of generated files..."
bzr status -S $basegen >| $tempfile || \
die "bzr status error for generated files"
modified=
while read stat file; do
[ "$stat" != "M" ] && die "Unexpected status ($stat) for generated $file"
modified="$modified $file"
done < $tempfile
[ "$modified" ] || {
echo "No files were modified"
exit 0
}
echo "Modified file(s): $modified"
[ "$commit" ] || exit 0
echo "Committing..."
## bzr status output is annoyingly always relative to top-level, not PWD.
cd ../
bzr commit -m "Auto-commit of generated files." $modified || \
die "bzr commit error"
echo "Committed files: $modified"
exit
### update_autogen ends here