annotate lisp/package-info.el @ 278:90d73dddcdc4 r21-0b37

Import from CVS: tag r21-0b37
author cvs
date Mon, 13 Aug 2007 10:31:29 +0200
parents 51092a27c943
children 972bbb6d6ca2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
235
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
1 ;;; package-info.el --- Generate information about an XEmacs package
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
2
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
3 ;; Copyright (C) 1998 by Free Software Foundation, Inc.
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
4
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
5 ;; Author: SL Baur <steve@altair.xemacs.org>
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
6 ;; Keywords: internal
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
7
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
8 ;; This file is part of XEmacs.
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
9
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
10 ;; XEmacs is free software; you can redistribute it and/or modify it
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
11 ;; under the terms of the GNU General Public License as published by
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
13 ;; any later version.
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
14
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
15 ;; XEmacs is distributed in the hope that it will be useful, but
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
18 ;; General Public License for more details.
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
19
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
21 ;; along with XEmacs; see the file COPYING. If not, write to the Free
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
22 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
23 ;; 02111-1307, USA.
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
24
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
25 ;;; Synched up with: Not in FSF
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
26
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
27 ;;; Commentary:
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
28
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
29 ;; This file is used for building package distributions.
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
30
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
31 ;;; Change Log:
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
32
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
33 ;;; Code:
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
34
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
35 (defvar package-info "package-info"
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
36 "File used to write out Package info")
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
37
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
38 (defvar package-info-template "package-info.in"
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
39 "Template file for package-get info.")
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
40
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
41 ;; Loses with Mule
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
42 ;(defun pi-md5sum (file)
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
43 ; (let (result)
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
44 ; (with-temp-buffer
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
45 ; (let ((buffer-file-coding-system-for-read 'binary))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
46 ; (insert-file-contents-literally file))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
47 ; ;; (write-file "/tmp/x.x")
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
48 ; (setq result (md5 (current-buffer))))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
49 ; result))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
50
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
51 (defun pi-md5sum (file)
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
52 (with-temp-buffer
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
53 (call-process "md5sum" file t)
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
54 (goto-char (point-min))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
55 (looking-at "[a-z0-9]+")
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
56 (buffer-substring (match-beginning 0) (match-end 0))))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
57
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
58 (defun pi-update-key (key value)
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
59 (save-excursion
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
60 (goto-char (point-min))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
61 (let ((case-fold-search nil))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
62 (when (search-forward key)
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
63 (replace-match value t)))))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
64
245
51092a27c943 Import from CVS: tag r20-5b21
cvs
parents: 241
diff changeset
65 (defun pi-author-version (author-version)
51092a27c943 Import from CVS: tag r20-5b21
cvs
parents: 241
diff changeset
66 (if (> (length author-version) 0)
51092a27c943 Import from CVS: tag r20-5b21
cvs
parents: 241
diff changeset
67 (format "\"%s\"" author-version)
51092a27c943 Import from CVS: tag r20-5b21
cvs
parents: 241
diff changeset
68 (format "\"%d.%d%s\"" emacs-major-version emacs-minor-version
51092a27c943 Import from CVS: tag r20-5b21
cvs
parents: 241
diff changeset
69 (if (and (boundp 'xemacs-betaname) xemacs-betaname)
51092a27c943 Import from CVS: tag r20-5b21
cvs
parents: 241
diff changeset
70 (progn
51092a27c943 Import from CVS: tag r20-5b21
cvs
parents: 241
diff changeset
71 (string-match "[0-9]+" xemacs-betaname)
51092a27c943 Import from CVS: tag r20-5b21
cvs
parents: 241
diff changeset
72 (concat "b" (match-string 0 xemacs-betaname)))
51092a27c943 Import from CVS: tag r20-5b21
cvs
parents: 241
diff changeset
73 ""))))
51092a27c943 Import from CVS: tag r20-5b21
cvs
parents: 241
diff changeset
74
51092a27c943 Import from CVS: tag r20-5b21
cvs
parents: 241
diff changeset
75 (defun pi-last-mod-date ()
51092a27c943 Import from CVS: tag r20-5b21
cvs
parents: 241
diff changeset
76 (condition-case nil
51092a27c943 Import from CVS: tag r20-5b21
cvs
parents: 241
diff changeset
77 (save-excursion
51092a27c943 Import from CVS: tag r20-5b21
cvs
parents: 241
diff changeset
78 (with-temp-buffer
51092a27c943 Import from CVS: tag r20-5b21
cvs
parents: 241
diff changeset
79 (insert-file-contents-literally "ChangeLog")
51092a27c943 Import from CVS: tag r20-5b21
cvs
parents: 241
diff changeset
80 (goto-char (point-min))
51092a27c943 Import from CVS: tag r20-5b21
cvs
parents: 241
diff changeset
81 (looking-at "[-0-9]+")
51092a27c943 Import from CVS: tag r20-5b21
cvs
parents: 241
diff changeset
82 (format "\"%s\""
51092a27c943 Import from CVS: tag r20-5b21
cvs
parents: 241
diff changeset
83 (buffer-substring (match-beginning 0)
51092a27c943 Import from CVS: tag r20-5b21
cvs
parents: 241
diff changeset
84 (match-end 0)))))
51092a27c943 Import from CVS: tag r20-5b21
cvs
parents: 241
diff changeset
85 ;; Fallback on current date if no valid ChangeLog entry
51092a27c943 Import from CVS: tag r20-5b21
cvs
parents: 241
diff changeset
86 (t (format-time-string "\"%Y-%m-%d\""))))
51092a27c943 Import from CVS: tag r20-5b21
cvs
parents: 241
diff changeset
87
235
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
88 (defun batch-update-package-info ()
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
89 "Generate a package-info file for use by package-get.el.
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
90 Parameters are:
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
91 version -- Package version number
245
51092a27c943 Import from CVS: tag r20-5b21
cvs
parents: 241
diff changeset
92 filename -- Filename of tarball to generate info for.
51092a27c943 Import from CVS: tag r20-5b21
cvs
parents: 241
diff changeset
93 requires -- Packages necessary for bytecompiling.
51092a27c943 Import from CVS: tag r20-5b21
cvs
parents: 241
diff changeset
94 author-version -- The original Author's version #.
51092a27c943 Import from CVS: tag r20-5b21
cvs
parents: 241
diff changeset
95 maintainer -- The package maintainer.
51092a27c943 Import from CVS: tag r20-5b21
cvs
parents: 241
diff changeset
96 category -- The build category."
235
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
97 (unless noninteractive
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
98 (error "`batch-update-package-info' is to be used only with -batch"))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
99 (let ((version (nth 0 command-line-args-left))
241
f955c73f5258 Import from CVS: tag r20-5b19
cvs
parents: 237
diff changeset
100 (filename (nth 1 command-line-args-left))
245
51092a27c943 Import from CVS: tag r20-5b21
cvs
parents: 241
diff changeset
101 (requires (nth 2 command-line-args-left))
51092a27c943 Import from CVS: tag r20-5b21
cvs
parents: 241
diff changeset
102 (author-version (nth 3 command-line-args-left))
51092a27c943 Import from CVS: tag r20-5b21
cvs
parents: 241
diff changeset
103 (maintainer (nth 4 command-line-args-left))
51092a27c943 Import from CVS: tag r20-5b21
cvs
parents: 241
diff changeset
104 (category (nth 5 command-line-args-left)))
241
f955c73f5258 Import from CVS: tag r20-5b19
cvs
parents: 237
diff changeset
105 (unless requires
f955c73f5258 Import from CVS: tag r20-5b19
cvs
parents: 237
diff changeset
106 (setq requires ""))
235
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
107 (find-file package-info)
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
108 (erase-buffer)
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
109 (insert-file-contents-literally package-info-template)
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
110 (goto-char (point-min))
237
89ec2bb86eea Import from CVS: tag r20-5b17
cvs
parents: 235
diff changeset
111 (pi-update-key "VERSION" (format "\"%s\"" version))
235
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
112 (pi-update-key "MD5SUM" (format "\"%s\""
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
113 (pi-md5sum filename)))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
114 (pi-update-key "FILENAME" (format "\"%s\""
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
115 (file-name-nondirectory filename)))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
116 (pi-update-key "SIZE" (format "%d"
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
117 (nth 7 (file-attributes filename))))
241
f955c73f5258 Import from CVS: tag r20-5b19
cvs
parents: 237
diff changeset
118 (pi-update-key "REQUIRES" requires)
245
51092a27c943 Import from CVS: tag r20-5b21
cvs
parents: 241
diff changeset
119 (pi-update-key "AUTHOR_VERSION" (pi-author-version author-version))
51092a27c943 Import from CVS: tag r20-5b21
cvs
parents: 241
diff changeset
120 (pi-update-key "MAINTAINER" (format "\"%s\"" maintainer))
51092a27c943 Import from CVS: tag r20-5b21
cvs
parents: 241
diff changeset
121 (pi-update-key "CATEGORY" (format "\"%s\"" category))
51092a27c943 Import from CVS: tag r20-5b21
cvs
parents: 241
diff changeset
122 (pi-update-key "BUILD_DATE" (format-time-string "\"%Y-%m-%d\""))
51092a27c943 Import from CVS: tag r20-5b21
cvs
parents: 241
diff changeset
123 (pi-update-key "DATE" (pi-last-mod-date))
235
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
124 (save-buffers-kill-emacs 0)))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
125
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
126 (provide 'package-info)
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
127
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
128 ;;; package-info.el ends here