X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/1658b4014f884a5bee07acdebc02774780957735..c38918db05bb8df4619bff27d04a0dc48202b647:/autogen/update_autogen diff --git a/autogen/update_autogen b/autogen/update_autogen index d8b451c370..c134609356 100755 --- a/autogen/update_autogen +++ b/autogen/update_autogen @@ -25,6 +25,9 @@ ## 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. +## +## With the -l option, it also updates the versioned loaddefs-like +## files in lisp/. These include ldefs-boot, cl-loaddefs, rmail, etc. ### Code: @@ -48,13 +51,17 @@ cd ../ usage () { cat 1>&2 < /dev/null" EXIT -while getopts ":hcfq" option ; do +while getopts ":hcflqCL" option ; do case $option in (h) usage ;; @@ -89,8 +101,14 @@ while getopts ":hcfq" option ; do (f) force=1 ;; + (l) ldefs_flag=1 ;; + (q) quiet=1 ;; + (C) clean=1 ;; + + (L) lboot_flag=1 ;; + (\?) die "Bad option -$OPTARG" ;; (:) die "Option -$OPTARG requires an argument" ;; @@ -101,16 +119,17 @@ done shift $(( --OPTIND )) OPTIND=1 -[ $# -eq 0 ] || die "Wrong number of arguments" - +## Does not work 100% because a lot of Emacs batch output comes on stderr (?). [ "$quiet" ] && exec 1> /dev/null echo "Running bzr status..." -bzr status -S $sources >| $tempfile || die "bzr status error for sources" +bzr status -S $sources ${ldefs_flag:+lisp} >| $tempfile || \ + die "bzr status error for sources" +## The lisp portion could be more permissive, eg only care about .el files. while read stat file; do case $stat in @@ -124,9 +143,21 @@ while read stat file; do done < $tempfile +## Probably this is overkill, and there's no need to "bootstrap" just +## for making autoloads. +[ "$clean" ] && { + + echo "Running 'make maintainer-clean'..." + + make maintainer-clean #|| die "Cleaning error" + + rm -f $ldefs_in +} + + echo "Running autoreconf..." -autoreconf -i -I m4 2>| $tempfile +autoreconf ${clean:+-f} -i -I m4 2>| $tempfile retval=$? @@ -162,27 +193,114 @@ while read stat file; do done < $tempfile -[ "$modified" ] || { - echo "No files were modified" - exit 0 +cd ../ + + +## Uses global $commit. +commit () +{ + local type=$1 + shift + + [ $# -gt 0 ] || { + echo "No files were modified" + return 0 + } + + echo "Modified file(s): $@" + + [ "$commit" ] || return 0 + + echo "Committing..." + + ## bzr status output is always relative to top-level, not PWD. + bzr commit -m "Auto-commit of $type files." "$@" || return $? + + echo "Committed files: $@" +} # function commit + + +commit "generated" $modified || die "bzr commit error" + + +[ "$ldefs_flag" ] || exit 0 + + +echo "Finding loaddef targets..." + +sed -n -e '/^AUTOGEN_VCS/,/^$/ s/\\//p' lisp/Makefile.in | \ + sed '/AUTOGEN_VCS/d' >| $tempfile || die "sed error" + +genfiles= + +while read genfile; do + + [ -r lisp/$genfile ] || die "Unable to read $genfile" + + genfiles="$genfiles $genfile" +done < $tempfile + + +[ "$genfiles" ] || die "Error setting genfiles" + + +[ -e Makefile ] || { + echo "Running ./configure..." + + ## Minimize required packages. + ./configure --without-x || die "configure error" } -echo "Modified file(s): $modified" -[ "$commit" ] || exit 0 +## Build the minimum needed to get the autoloads. +echo "Running lib/ make..." + +make -C lib "$@" all || die "make lib error" + + +echo "Running src/ make..." + +make -C src "$@" bootstrap-emacs || die "make src error" + + +echo "Running lisp/ make..." + +make -C lisp "$@" autoloads EMACS=../src/bootstrap-emacs || die "make src error" + +## Ignore comment differences. +[ ! "$lboot_flag" ] || \ + diff -q -I '^;' $ldefs_in $ldefs_out || \ + cp $ldefs_in $ldefs_out || die "cp ldefs_boot error" + + +cd lisp + +echo "Checking status of loaddef files..." + +## It probably would be fine to just check+commit lisp/, since +## making autoloads should not effect any other files. But better +## safe than sorry. +bzr status -S $genfiles ${ldefs_out#lisp/} >| $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 -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" +commit "loaddefs" $modified || die "bzr commit error" -echo "Committed files: $modified" -exit +exit 0 ### update_autogen ends here