Mercurial > hg > xemacs-beta
annotate lisp/package-info.el @ 5740:00a421d2b2ba
Fix no-Mule build.
* paragraphs.el (sentence-end): Use octal, not Unicode, escapes.
* (sentence-end-base): Use non-ASCII only in Mule.
| author | Stephen J. Turnbull <stephen@xemacs.org> |
|---|---|
| date | Fri, 21 Jun 2013 18:45:06 +0900 |
| parents | 308d34e9f07d |
| children |
| rev | line source |
|---|---|
| 428 | 1 ;;; package-info.el --- Generate information about an XEmacs package |
| 2 | |
| 3 ;; Copyright (C) 1998 by Free Software Foundation, Inc. | |
| 4 | |
| 5 ;; Author: SL Baur <steve@xemacs.org> | |
| 6 ;; Keywords: internal | |
| 7 | |
| 8 ;; This file is part of XEmacs. | |
| 9 | |
|
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
1410
diff
changeset
|
10 ;; XEmacs is free software: you can redistribute it and/or modify it |
|
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
1410
diff
changeset
|
11 ;; under the terms of the GNU General Public License as published by the |
|
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
1410
diff
changeset
|
12 ;; Free Software Foundation, either version 3 of the License, or (at your |
|
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
1410
diff
changeset
|
13 ;; option) any later version. |
| 428 | 14 |
|
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
1410
diff
changeset
|
15 ;; XEmacs is distributed in the hope that it will be useful, but WITHOUT |
|
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
1410
diff
changeset
|
16 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
1410
diff
changeset
|
17 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
1410
diff
changeset
|
18 ;; for more details. |
| 428 | 19 |
| 20 ;; You should have received a copy of the GNU General Public License | |
|
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
1410
diff
changeset
|
21 ;; along with XEmacs. If not, see <http://www.gnu.org/licenses/>. |
| 428 | 22 |
| 23 ;;; Synched up with: Not in FSF | |
| 24 | |
| 25 ;;; Commentary: | |
| 26 | |
| 27 ;; This file is used for building package distributions. | |
| 28 | |
| 29 ;;; Change Log: | |
| 30 | |
| 31 ;;; Code: | |
| 32 | |
| 33 (defvar package-info "package-info" | |
| 34 "File used to write out Package info") | |
| 35 | |
| 36 (defvar package-info-template "package-info.in" | |
| 37 "Template file for package-get info.") | |
| 38 | |
| 39 ;; Loses with Mule | |
| 40 ;(defun pi-md5sum (file) | |
| 41 ; (let (result) | |
| 42 ; (with-temp-buffer | |
| 43 ; (let ((buffer-file-coding-system-for-read 'binary)) | |
| 44 ; (insert-file-contents-literally file)) | |
| 45 ; ;; (write-file "/tmp/x.x") | |
| 46 ; (setq result (md5 (current-buffer)))) | |
| 47 ; result)) | |
| 48 | |
| 442 | 49 ;;; APA: Stolen from package-get in package-get.el |
| 428 | 50 (defun pi-md5sum (file) |
| 51 (with-temp-buffer | |
| 442 | 52 (insert-file-contents-literally file) |
| 53 (md5 (current-buffer)))) | |
| 428 | 54 |
| 55 (defun pi-update-key (key value) | |
| 56 (save-excursion | |
| 57 (goto-char (point-min)) | |
| 58 (let ((case-fold-search nil)) | |
| 59 (when (search-forward key) | |
| 60 (replace-match value t))))) | |
| 61 | |
| 62 (defun pi-author-version (author-version) | |
| 63 (if (> (length author-version) 0) | |
| 64 (format "\"%s\"" author-version) | |
| 65 (format "\"%d.%d%s\"" emacs-major-version emacs-minor-version | |
| 66 (if (and (boundp 'xemacs-betaname) xemacs-betaname) | |
| 67 (progn | |
| 68 (string-match "[0-9]+" xemacs-betaname) | |
| 69 (concat "b" (match-string 0 xemacs-betaname))) | |
| 70 "")))) | |
| 71 | |
| 72 (defun pi-last-mod-date () | |
| 73 (condition-case nil | |
| 74 (save-excursion | |
| 75 (with-temp-buffer | |
| 76 (insert-file-contents-literally "ChangeLog") | |
| 77 (goto-char (point-min)) | |
| 78 (looking-at "[-0-9]+") | |
| 79 (format "\"%s\"" | |
| 80 (buffer-substring (match-beginning 0) | |
| 81 (match-end 0))))) | |
| 82 ;; Fallback on current date if no valid ChangeLog entry | |
| 83 (t (format-time-string "\"%Y-%m-%d\"")))) | |
| 84 | |
| 85 (defun batch-update-package-info () | |
| 86 "Generate a package-info file for use by package-get.el. | |
| 87 Parameters are: | |
| 88 version -- Package version number | |
| 89 filename -- Filename of tarball to generate info for. | |
| 90 requires -- Packages necessary for bytecompiling. | |
| 91 author-version -- The original Author's version #. | |
| 92 maintainer -- The package maintainer. | |
| 93 category -- The build category." | |
| 94 (unless noninteractive | |
| 1410 | 95 (error 'invalid-operation |
| 96 "`batch-update-package-info' is to be used only with -batch")) | |
| 428 | 97 (let ((version (nth 0 command-line-args-left)) |
| 98 (filename (nth 1 command-line-args-left)) | |
| 99 (requires (nth 2 command-line-args-left)) | |
| 100 (author-version (nth 3 command-line-args-left)) | |
| 101 (maintainer (nth 4 command-line-args-left)) | |
| 102 (category (nth 5 command-line-args-left))) | |
| 103 (unless requires | |
| 104 (setq requires "")) | |
| 105 (find-file package-info) | |
| 106 (erase-buffer) | |
| 107 (insert-file-contents-literally package-info-template) | |
| 108 (goto-char (point-min)) | |
| 109 (pi-update-key "VERSION" (format "\"%s\"" version)) | |
| 110 (pi-update-key "MD5SUM" (format "\"%s\"" | |
| 111 (pi-md5sum filename))) | |
| 112 (pi-update-key "FILENAME" (format "\"%s\"" | |
| 113 (file-name-nondirectory filename))) | |
| 114 (pi-update-key "SIZE" (format "%d" | |
| 115 (nth 7 (file-attributes filename)))) | |
| 116 (pi-update-key "REQUIRES" requires) | |
| 117 (pi-update-key "AUTHOR_VERSION" (pi-author-version author-version)) | |
| 118 (pi-update-key "MAINTAINER" (format "\"%s\"" maintainer)) | |
| 119 (pi-update-key "CATEGORY" (format "\"%s\"" category)) | |
| 120 (pi-update-key "BUILD_DATE" (format-time-string "\"%Y-%m-%d\"")) | |
| 121 (pi-update-key "DATE" (pi-last-mod-date)) | |
| 122 (save-buffers-kill-emacs 0))) | |
| 123 | |
| 124 (provide 'package-info) | |
| 125 | |
| 126 ;;; package-info.el ends here |
