]> code.delx.au - gnu-emacs/blobdiff - admin/update_autogen
Update copyright year to 2016
[gnu-emacs] / admin / update_autogen
index ad7eb5735cf95883e9b9c2bf3ffa6ec65bd0f5ba..199a3aad093d633da209681429210f8571f9e762 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/bash
 ### update_autogen - update some auto-generated files in the Emacs tree
 
-## Copyright (C) 2011-2015 Free Software Foundation, Inc.
+## Copyright (C) 2011-2016 Free Software Foundation, Inc.
 
 ## Author: Glenn Morris <rgm@gnu.org>
 
@@ -69,6 +69,7 @@ Options:
     commit them (caution).
 -q: be quiet; only give error messages, not status messages.
 -A: only update autotools files, copying into specified dir.
+-H: also update ChangeLog.${changelog_n}
 -I: also update info/dir.
 -L: also update ldefs-boot.el.
 -C: start from a clean state.  Slower, but more correct.
@@ -87,10 +88,13 @@ autogendir=                     # was "autogen"
 ldefs_flag=1
 lboot_flag=
 info_flag=
+changelog_flag=
 
 ## Parameters.
 ldefs_in=lisp/loaddefs.el
 ldefs_out=lisp/ldefs-boot.el
+changelog_n=$(sed -n 's/CHANGELOG_HISTORY_INDEX_MAX *= *//p' Makefile.in)
+changelog_files="ChangeLog.$changelog_n"
 sources="configure.ac lib/Makefile.am"
 ## Files to copy into autogendir.
 ## Everything:
@@ -113,7 +117,7 @@ tempfile=/tmp/$PN.$$
 trap "rm -f $tempfile 2> /dev/null" EXIT
 
 
-while getopts ":hcfqA:CIL" option ; do
+while getopts ":hcfqA:HCIL" option ; do
     case $option in
         (h) usage ;;
 
@@ -129,6 +133,8 @@ while getopts ":hcfqA:CIL" option ; do
 
         (C) clean=1 ;;
 
+        (H) changelog_flag=1 ;;
+
         (I) info_flag=1 ;;
 
         (L) lboot_flag=1 ;;
@@ -228,7 +234,7 @@ commit ()
 
     echo "Committing..."
 
-    $vcs commit -m "Auto-commit of $type files." "$@" || return $?
+    $vcs commit -m "Auto-commit of $type files." "$@" || return $?
 
     [ "$vcs" = "git" ] && {
         $vcs push || return $?
@@ -305,9 +311,6 @@ EOF
 
     modified=$(status $basegen) || die
 
-    ## bzr status output is always relative to top-level, not PWD.
-    [ "$vcs" = "bzr" ] && cd $oldpwd
-
     commit "generated" $modified || die "commit error"
 
     exit 0
@@ -322,15 +325,20 @@ EOF
 
 echo "Finding loaddef targets..."
 
-sed -n -e '/^AUTOGEN_VCS/,/^$/p' lisp/Makefile.in | \
-    sed -e '/AUTOGEN_VCS/d' -e '/^$/d' -e 's/\\//' \
-    >| $tempfile || die "sed error"
+find lisp -name '*.el' -exec grep '^;.*generated-autoload-file:' {} + | \
+    sed -e '/loaddefs\|esh-groups/d' -e 's|/[^/]*: "|/|' -e 's/"//g' \
+    >| $tempfile || die "Error finding targets"
 
 genfiles=
 
 while read genfile; do
 
-    [ -r lisp/$genfile ] || die "Unable to read $genfile"
+    ## Or we can just use sort -u when making tempfile...
+    case " $genfiles " in
+        *" $genfile "*) continue ;;
+    esac
+
+    [ -r $genfile ] || die "Unable to read $genfile"
 
     genfiles="$genfiles $genfile"
 done < $tempfile
@@ -369,21 +377,23 @@ make -C lisp "$@" autoloads EMACS=../src/bootstrap-emacs || die "make src error"
     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.
-modified=$(status $genfiles ${ldefs_out#lisp/}) || die
+modified=$(status $genfiles $ldefs_out) || die
 
 
-## bzr status output is always relative to top-level, not PWD.
-[ "$vcs" = "bzr" ] && cd ../
+commit "loaddefs" $modified || die "commit error"
 
 
-commit "loaddefs" $modified || die "commit error"
+## Less important than the other stuff, so do it last.
+[ ! "$changelog_flag" ] || {
+    make change-history-nocommit || die "make change-history error"
+    modified=$(status $changelog_files) || die
+    commit "ChangeLog" $modified || die "commit error"
+}
 
 
 exit 0