emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r103836: Make update_autogen handle l


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r103836: Make update_autogen handle loaddefs-like files as well.
Date: Tue, 05 Apr 2011 19:13:16 -0700
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 103836
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Tue 2011-04-05 19:13:16 -0700
message:
  Make update_autogen handle loaddefs-like files as well.
  
  * autogen/update_autogen: (usage): Add -l, -C.
  (clean, ldefs_flag, ldefs_in, ldefs_out): New variables.
  With -l, check status of lisp/ as well.
  With -C, clean before building.
  (autoreconf): Only pass -f in the `clean' case.
  (commit): New function.
  
  * lisp/Makefile.in (AUTOGEN_VCS): New variable.
  (autoloads): Use $AUTOGEN_VCS.
  
  * .bzrignore: Tighten up ignore patterns (for autogen/).
modified:
  .bzrignore
  ChangeLog
  autogen/update_autogen
  lisp/ChangeLog
  lisp/Makefile.in
=== modified file '.bzrignore'
--- a/.bzrignore        2011-03-25 07:14:31 +0000
+++ b/.bzrignore        2011-04-06 02:13:16 +0000
@@ -13,25 +13,25 @@
 *.dSYM
 *.elc
 *.exe
-aclocal.m4
+./aclocal.m4
 autom4te.cache
-compile
+./compile
 confdefs.h
-config.guess
-config.sub
-configure
+./config.guess
+./config.sub
+./configure
 configure.lineno
 conftest*
 core
-depcomp
+./depcomp
 DOC
 DOC-*
 emacs-*/
-install-sh
+./install-sh
 makefile
 Makefile
 Makefile.c
-missing
+./missing
 stamp-h1
 stamp_BLD
 subdirs.el
@@ -80,6 +80,7 @@
 lib-src/test-distrib
 lib-src/update-game-score
 lisp/**/*-loaddefs.el
+!lisp/emacs-lisp/cl-loaddefs.el
 lisp/**/loaddefs.el
 lisp/cus-load.el
 lisp/eshell/esh-groups.el

=== modified file 'ChangeLog'
--- a/ChangeLog 2011-03-31 04:24:03 +0000
+++ b/ChangeLog 2011-04-06 02:13:16 +0000
@@ -1,3 +1,13 @@
+2011-04-06  Glenn Morris  <address@hidden>
+
+       * autogen/update_autogen: Handle loaddefs-like files as well.
+       (usage): Add -l, -C.
+       (clean, ldefs_flag, ldefs_in, ldefs_out): New variables.
+       With -l, check status of lisp/ as well.
+       With -C, clean before building.
+       (autoreconf): Only pass -f in the `clean' case.
+       (commit): New function.
+
 2011-03-28  Glenn Morris  <address@hidden>
 
        * autogen/update_autogen: Pass -f to autoreconf.

=== modified file 'autogen/update_autogen'
--- a/autogen/update_autogen    2011-03-28 01:03:57 +0000
+++ b/autogen/update_autogen    2011-04-06 02:13:16 +0000
@@ -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,16 @@
 usage ()
 {
     cat 1>&2 <<EOF
-Usage: ${PN} [-f] [-c] [-q]
+Usage: ${PN} [-f] [-c] [-q] [-l] [-C] [-- make-flags]
 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.
+-l: also update the versioned loaddefs-like files in lisp/.
+This requires a build.  Passes any non-option args to make (eg -- -j2).
+-C: start from a clean state.  Slower, but more correct.
 EOF
     exit 1
 }
@@ -65,8 +71,12 @@
 force=
 commit=
 quiet=
+clean=
+ldefs_flag=
 
 ## Parameters.
+ldefs_in=lisp/loaddefs.el
+ldefs_out=lisp/ldefs-boot.el
 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"
 
@@ -81,7 +91,7 @@
 trap "rm -f $tempfile 2> /dev/null" EXIT
 
 
-while getopts ":hcfq" option ; do
+while getopts ":hcflqC" option ; do
     case $option in
         (h) usage ;;
 
@@ -89,8 +99,12 @@
 
         (f) force=1 ;;
 
+        (l) ldefs_flag=1 ;;
+
         (q) quiet=1 ;;
 
+        (C) clean=1 ;;
+
         (\?) die "Bad option -$OPTARG" ;;
 
         (:) die "Option -$OPTARG requires an argument" ;;
@@ -101,16 +115,17 @@
 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 +139,21 @@
 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 -f -i -I m4 2>| $tempfile
+autoreconf ${clean:+-f} -i -I m4 2>| $tempfile
 
 retval=$?
 
@@ -162,27 +189,110 @@
 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..."
+
+    ./configure || die "configure error"
 }
 
-echo "Modified file(s): $modified"
-
-[ "$commit" ] || exit 0
-
-
-echo "Committing..."
-
-## bzr status output is annoyingly always relative to top-level, not PWD.
+
+## 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"
+
+
+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
+
+
 cd ../
 
-bzr commit -m "Auto-commit of generated files." $modified || \
-    die "bzr commit error"
-
-
-echo "Committed files: $modified"
-
-exit
+
+commit "loaddefs" $modified || die "bzr commit error"
+
+
+exit 0
 
 ### update_autogen ends here

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-04-06 02:05:45 +0000
+++ b/lisp/ChangeLog    2011-04-06 02:13:16 +0000
@@ -1,5 +1,8 @@
 2011-04-06  Glenn Morris  <address@hidden>
 
+       * Makefile.in (AUTOGEN_VCS): New variable.
+       (autoloads): Use $AUTOGEN_VCS.
+
        * calendar/cal-move.el (calendar-scroll-toolkit-scroll): New function.
        * calendar/calendar.el (calendar-mode-map):
        Check for toolkit scroll bars.  (Bug#8305)

=== modified file 'lisp/Makefile.in'
--- a/lisp/Makefile.in  2011-04-01 15:16:50 +0000
+++ b/lisp/Makefile.in  2011-04-06 02:13:16 +0000
@@ -70,6 +70,18 @@
        cedet/ede/loaddefs.el \
        cedet/srecode/loaddefs.el
 
+# Versioned files that are the value of someone's `generated-autoload-file'.
+# Note that update_loaddefs parses this.
+AUTOGEN_VCS = \
+       ps-print.el \
+       emulation/tpu-edt.el \
+       emacs-lisp/cl-loaddefs.el \
+       mail/rmail.el \
+       dired.el \
+       ibuffer.el \
+       htmlfontify.el \
+       emacs-lisp/eieio.el
+
 # Value of max-lisp-eval-depth when compiling initially.
 # During bootstrapping the byte-compiler is run interpreted when compiling
 # itself, and uses more stack than usual.
@@ -153,13 +165,9 @@
        echo Directories: $$wins; \
        $(emacs) -l finder --eval '(setq generated-finder-keywords-file 
"$(lisp)/finder-inf.el")' -f finder-compile-keywords-make-dist $$wins
 
-# The chmod +w is to handle env var CVSREAD=1.  Files named
-# are identified by being the value of `generated-autoload-file'.
+# The chmod +w is to handle env var CVSREAD=1.
 autoloads: $(LOADDEFS) doit
-       chmod +w $(lisp)/ps-print.el $(lisp)/emulation/tpu-edt.el \
-         $(lisp)/emacs-lisp/cl-loaddefs.el $(lisp)/mail/rmail.el \
-         $(lisp)/dired.el $(lisp)/ibuffer.el $(lisp)/htmlfontify.el \
-         $(lisp)/emacs-lisp/eieio.el
+       cd $(lisp) && chmod +w $(AUTOGEN_VCS)
        cd $(lisp); $(setwins_almost); \
        echo Directories: $$wins; \
        $(emacs) -l autoload --eval '(setq generated-autoload-file 
"$(lisp)/loaddefs.el")' -f batch-update-autoloads $$wins


reply via email to

[Prev in Thread] Current Thread [Next in Thread]