diff options
| author | Glenn Morris | 2013-12-11 19:37:38 -0800 |
|---|---|---|
| committer | Glenn Morris | 2013-12-11 19:37:38 -0800 |
| commit | f9405d87cdbb4e2072b6c53ee9c5c01ca14d41de (patch) | |
| tree | b903740ea85ca4487048efb8db12bfa23c1c6010 /admin/update_autogen | |
| parent | d5ccb7be025ddc5a6ac8c5291d89596b78d9745c (diff) | |
| download | emacs-f9405d87cdbb4e2072b6c53ee9c5c01ca14d41de.tar.gz emacs-f9405d87cdbb4e2072b6c53ee9c5c01ca14d41de.zip | |
Add support for auto-generating info/dir
* admin/update_autogen: Add option to generate info/dir.
(Usage): Add -I.
(info_flag): New variable.
(-I): New option.
(doc): Maybe check its status.
(info_dir): New function.
* admin/dir_top: New file.
* doc/emacs/emacs.texi:
* doc/lispintro/emacs-lisp-intro.texi:
* doc/lispref/elisp.texi:
* doc/misc/autotype.texi, doc/misc/cc-mode.texi, doc/misc/ediff.texi:
* doc/misc/ert.texi, doc/misc/htmlfontify.texi, doc/misc/ido.texi:
* doc/misc/octave-mode.texi, doc/misc/org.texi, doc/misc/srecode.texi:
* doc/misc/todo-mode.texi, doc/misc/tramp.texi:
Sync direntry with info/dir version.
Diffstat (limited to 'admin/update_autogen')
| -rwxr-xr-x | admin/update_autogen | 78 |
1 files changed, 75 insertions, 3 deletions
diff --git a/admin/update_autogen b/admin/update_autogen index 316c9330b62..d7deaaf46be 100755 --- a/admin/update_autogen +++ b/admin/update_autogen | |||
| @@ -51,7 +51,7 @@ cd ../ | |||
| 51 | usage () | 51 | usage () |
| 52 | { | 52 | { |
| 53 | cat 1>&2 <<EOF | 53 | cat 1>&2 <<EOF |
| 54 | Usage: ${PN} [-f] [-c] [-q] [-A dir] [-L] [-C] [-- make-flags] | 54 | Usage: ${PN} [-f] [-c] [-q] [-A dir] [-I] [-L] [-C] [-- make-flags] |
| 55 | Update some auto-generated files in the Emacs tree. | 55 | Update some auto-generated files in the Emacs tree. |
| 56 | By default, only does the versioned loaddefs-like files in lisp/. | 56 | By default, only does the versioned loaddefs-like files in lisp/. |
| 57 | This requires a build. Passes any non-option args to make (eg -- -j2). | 57 | This requires a build. Passes any non-option args to make (eg -- -j2). |
| @@ -61,6 +61,7 @@ Options: | |||
| 61 | commit them (caution). | 61 | commit them (caution). |
| 62 | -q: be quiet; only give error messages, not status messages. | 62 | -q: be quiet; only give error messages, not status messages. |
| 63 | -A: only update autotools files, copying into specified dir. | 63 | -A: only update autotools files, copying into specified dir. |
| 64 | -I: also update info/dir. | ||
| 64 | -L: also update ldefs-boot.el. | 65 | -L: also update ldefs-boot.el. |
| 65 | -C: start from a clean state. Slower, but more correct. | 66 | -C: start from a clean state. Slower, but more correct. |
| 66 | EOF | 67 | EOF |
| @@ -77,6 +78,7 @@ clean= | |||
| 77 | autogendir= # was "autogen" | 78 | autogendir= # was "autogen" |
| 78 | ldefs_flag=1 | 79 | ldefs_flag=1 |
| 79 | lboot_flag= | 80 | lboot_flag= |
| 81 | info_flag= | ||
| 80 | 82 | ||
| 81 | ## Parameters. | 83 | ## Parameters. |
| 82 | ldefs_in=lisp/loaddefs.el | 84 | ldefs_in=lisp/loaddefs.el |
| @@ -103,7 +105,7 @@ tempfile=/tmp/$PN.$$ | |||
| 103 | trap "rm -f $tempfile 2> /dev/null" EXIT | 105 | trap "rm -f $tempfile 2> /dev/null" EXIT |
| 104 | 106 | ||
| 105 | 107 | ||
| 106 | while getopts ":hcfqA:CL" option ; do | 108 | while getopts ":hcfqA:CIL" option ; do |
| 107 | case $option in | 109 | case $option in |
| 108 | (h) usage ;; | 110 | (h) usage ;; |
| 109 | 111 | ||
| @@ -119,6 +121,8 @@ while getopts ":hcfqA:CL" option ; do | |||
| 119 | 121 | ||
| 120 | (C) clean=1 ;; | 122 | (C) clean=1 ;; |
| 121 | 123 | ||
| 124 | (I) info_flag=1 ;; | ||
| 125 | |||
| 122 | (L) lboot_flag=1 ;; | 126 | (L) lboot_flag=1 ;; |
| 123 | 127 | ||
| 124 | (\?) die "Bad option -$OPTARG" ;; | 128 | (\?) die "Bad option -$OPTARG" ;; |
| @@ -138,7 +142,8 @@ OPTIND=1 | |||
| 138 | 142 | ||
| 139 | echo "Running bzr status..." | 143 | echo "Running bzr status..." |
| 140 | 144 | ||
| 141 | bzr status -S ${autogendir:+$sources} ${ldefs_flag:+lisp} >| $tempfile || \ | 145 | bzr status -S ${autogendir:+$sources} ${ldefs_flag:+lisp} \ |
| 146 | ${info_flag:+doc} >| $tempfile || \ | ||
| 142 | die "bzr status error for input files" | 147 | die "bzr status error for input files" |
| 143 | 148 | ||
| 144 | ## The lisp portion could be more permissive, eg only care about .el files. | 149 | ## The lisp portion could be more permissive, eg only care about .el files. |
| @@ -207,6 +212,70 @@ commit () | |||
| 207 | } # function commit | 212 | } # function commit |
| 208 | 213 | ||
| 209 | 214 | ||
| 215 | ## FIXME use standard tools for this, generate info/dir at build time | ||
| 216 | ## if needed, stop keeping in the repo. | ||
| 217 | info_dir () | ||
| 218 | { | ||
| 219 | local basefile=admin/dir_top outfile=info/dir | ||
| 220 | |||
| 221 | echo "Regenerating info/dir..." | ||
| 222 | |||
| 223 | ## Header contains non-printing characters, so this is more | ||
| 224 | ## reliable than using echo. | ||
| 225 | rm -f $outfile | ||
| 226 | cp $basefile $outfile | ||
| 227 | |||
| 228 | local topic file dircat dirent | ||
| 229 | |||
| 230 | ## FIXME inefficient looping. | ||
| 231 | for topic in "Texinfo documentation system" "Emacs" "GNU Emacs Lisp" \ | ||
| 232 | "Emacs editing modes" "Emacs network features" "Emacs misc features" \ | ||
| 233 | "Emacs lisp libraries"; do | ||
| 234 | |||
| 235 | cat - <<EOF >> $outfile | ||
| 236 | |||
| 237 | $topic | ||
| 238 | EOF | ||
| 239 | ## Bit faster than doc/*/*.texi. | ||
| 240 | for file in doc/emacs/emacs.texi doc/lispintro/*.texi \ | ||
| 241 | doc/lispref/elisp.texi doc/misc/*.texi; do | ||
| 242 | |||
| 243 | ## FIXME do not ignore w32 if OS is w32. | ||
| 244 | case $file in | ||
| 245 | *-xtra.texi|*efaq-w32.texi) continue ;; | ||
| 246 | esac | ||
| 247 | |||
| 248 | dircat=`sed -n -e 's/@value{emacsname}/Emacs/' -e 's/^@dircategory //p' $file` | ||
| 249 | |||
| 250 | ## TODO warn about unknown topics. | ||
| 251 | [ "$dircat" = "$topic" ] || continue | ||
| 252 | |||
| 253 | sed -n -e 's/@value{emacsname}/Emacs/' \ | ||
| 254 | -e 's/@acronym{\([A-Z]*\)}/\1/' \ | ||
| 255 | -e '/^@direntry/,/^@end direntry/ s/^\([^@]\)/\1/p' \ | ||
| 256 | $file >> $outfile | ||
| 257 | |||
| 258 | done | ||
| 259 | done | ||
| 260 | |||
| 261 | bzr status -S $outfile >| $tempfile || \ | ||
| 262 | die "bzr status error for generated $outfile" | ||
| 263 | |||
| 264 | local modified | ||
| 265 | |||
| 266 | while read stat file; do | ||
| 267 | |||
| 268 | [ "$stat" != "M" ] && \ | ||
| 269 | die "Unexpected status ($stat) for generated $file" | ||
| 270 | |||
| 271 | modified="$modified $file" | ||
| 272 | |||
| 273 | done < $tempfile | ||
| 274 | |||
| 275 | commit "generated" $modified || die "bzr commit error" | ||
| 276 | } # function info_dir | ||
| 277 | |||
| 278 | |||
| 210 | [ "$autogendir" ] && { | 279 | [ "$autogendir" ] && { |
| 211 | 280 | ||
| 212 | oldpwd=$PWD | 281 | oldpwd=$PWD |
| @@ -239,6 +308,9 @@ commit () | |||
| 239 | } # $autogendir | 308 | } # $autogendir |
| 240 | 309 | ||
| 241 | 310 | ||
| 311 | [ "$info_flag" ] && info_dir | ||
| 312 | |||
| 313 | |||
| 242 | [ "$ldefs_flag" ] || exit 0 | 314 | [ "$ldefs_flag" ] || exit 0 |
| 243 | 315 | ||
| 244 | 316 | ||