annotate admin/admin.el @ 64782:d54a27bfea5d

*** empty log message ***
author Thien-Thi Nguyen <ttn@gnuvola.org>
date Mon, 08 Aug 2005 00:20:19 +0000
parents c53a9463c31a
children ffd4e3fb1637 f9a65d7ebd29
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
40063
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1 ;;; admin.el --- utilities for Emacs administration
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
2
61547
1926d92f781e (add-release-logs): Fix require call.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
3 ;; Copyright (C) 2001, 2005 Free Software Foundation, Inc.
40063
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
4
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
5 ;; This file is part of GNU Emacs.
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
6
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
7 ;; GNU Emacs is free software; you can redistribute it and/or modify
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
8 ;; it under the terms of the GNU General Public License as published by
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
9 ;; the Free Software Foundation; either version 2, or (at your option)
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
10 ;; any later version.
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
11
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
12 ;; GNU Emacs is distributed in the hope that it will be useful,
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
15 ;; GNU General Public License for more details.
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
16
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
17 ;; You should have received a copy of the GNU General Public License
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
18 ;; along with GNU Emacs; see the file COPYING. If not, write to the
64079
c53a9463c31a Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 63217
diff changeset
19 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
c53a9463c31a Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 63217
diff changeset
20 ;; Boston, MA 02110-1301, USA.
40063
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
21
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
22 ;;; Commentary:
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
23
61547
1926d92f781e (add-release-logs): Fix require call.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
24 ;; add-release-logs Add ``Version X released'' change log entries.
1926d92f781e (add-release-logs): Fix require call.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
25 ;; set-version Change Emacs version number in source tree.
40063
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
26
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
27 ;;; Code:
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
28
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
29 (defun process-lines (program &rest args)
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
30 "Execute PROGRAM with ARGS, returning its output as a list of lines.
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
31 Signal an error if the program returns with a non-zero exit status."
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
32 (with-temp-buffer
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
33 (let ((status (apply 'call-process program nil (current-buffer) nil args)))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
34 (unless (eq status 0)
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
35 (error "%s exited with status %s" program status))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
36 (goto-char (point-min))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
37 (let (lines)
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
38 (while (not (eobp))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
39 (setq lines (cons (buffer-substring-no-properties
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
40 (line-beginning-position)
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
41 (line-end-position))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
42 lines))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
43 (forward-line 1))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
44 (nreverse lines)))))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
45
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
46 (defun add-release-logs (root version)
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
47 "Add \"Version VERSION released.\" change log entries in ROOT.
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
48 Root must be the root of an Emacs source tree."
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
49 (interactive "DEmacs root directory: \nNVersion number: ")
49298
bb7bf9ff7c97 (add-release-logs): Expand the directory name before calling find(1).
Francesco Potortì <pot@gnu.org>
parents: 40161
diff changeset
50 (setq root (expand-file-name root))
40063
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
51 (unless (file-exists-p (expand-file-name "src/emacs.c" root))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
52 (error "%s doesn't seem to be the root of an Emacs source tree" root))
61547
1926d92f781e (add-release-logs): Fix require call.
Lute Kamstra <lute@gnu.org>
parents: 52401
diff changeset
53 (require 'add-log)
40063
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
54 (let* ((logs (process-lines "find" root "-name" "ChangeLog"))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
55 (entry (format "%s %s <%s>\n\n\t* Version %s released.\n\n"
49298
bb7bf9ff7c97 (add-release-logs): Expand the directory name before calling find(1).
Francesco Potortì <pot@gnu.org>
parents: 40161
diff changeset
56 (funcall add-log-time-format)
bb7bf9ff7c97 (add-release-logs): Expand the directory name before calling find(1).
Francesco Potortì <pot@gnu.org>
parents: 40161
diff changeset
57 (or add-log-full-name (user-full-name))
bb7bf9ff7c97 (add-release-logs): Expand the directory name before calling find(1).
Francesco Potortì <pot@gnu.org>
parents: 40161
diff changeset
58 (or add-log-mailing-address user-mail-address)
bb7bf9ff7c97 (add-release-logs): Expand the directory name before calling find(1).
Francesco Potortì <pot@gnu.org>
parents: 40161
diff changeset
59 version)))
40063
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
60 (dolist (log logs)
40084
1f20d08b9da5 (add-release-logs): Put the log entry in lispref, too.
Gerd Moellmann <gerd@gnu.org>
parents: 40063
diff changeset
61 (unless (string-match "/gnus/" log)
40063
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
62 (find-file log)
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
63 (goto-char (point-min))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
64 (insert entry)))))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
65
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
66 (defun set-version-in-file (root file version rx)
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
67 (find-file (expand-file-name file root))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
68 (goto-char (point-min))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
69 (unless (re-search-forward rx nil t)
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
70 (error "Version not found in %s" file))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
71 (replace-match (format "%s" version) nil nil nil 1))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
72
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
73 (defun set-version (root version)
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
74 "Set Emacs version to VERSION in relevant files under ROOT.
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
75 Root must be the root of an Emacs source tree."
40161
795c8ca09f8b (set-version): Use `s' interactive spec for
Gerd Moellmann <gerd@gnu.org>
parents: 40084
diff changeset
76 (interactive "DEmacs root directory: \nsVersion number: ")
40063
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
77 (unless (file-exists-p (expand-file-name "src/emacs.c" root))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
78 (error "%s doesn't seem to be the root of an Emacs source tree" root))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
79 (set-version-in-file root "lisp/version.el" version
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
80 (rx (and "emacs-version" (0+ space)
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
81 ?\" (submatch (1+ (not (in ?\")))) ?\")))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
82 (set-version-in-file root "README" version
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
83 (rx (and "version" (1+ space)
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
84 (submatch (1+ (in "0-9."))))))
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
85 (set-version-in-file root "man/emacs.texi" version
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
86 (rx (and "EMACSVER" (1+ space)
63217
3ef574f6b152 (set-version): Set version in lisp manual too.
Lute Kamstra <lute@gnu.org>
parents: 61547
diff changeset
87 (submatch (1+ (in "0-9."))))))
3ef574f6b152 (set-version): Set version in lisp manual too.
Lute Kamstra <lute@gnu.org>
parents: 61547
diff changeset
88 (set-version-in-file root "lispref/elisp.texi" version
3ef574f6b152 (set-version): Set version in lisp manual too.
Lute Kamstra <lute@gnu.org>
parents: 61547
diff changeset
89 (rx (and "EMACSVER" (1+ space)
40063
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
90 (submatch (1+ (in "0-9.")))))))
49298
bb7bf9ff7c97 (add-release-logs): Expand the directory name before calling find(1).
Francesco Potortì <pot@gnu.org>
parents: 40161
diff changeset
91
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49298
diff changeset
92 ;;; arch-tag: 4ea83636-2293-408b-884e-ad64f22a3bf5
40063
9b5a774d579b *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
93 ;; admin.el ends here.