annotate lisp/package-info.el @ 237:89ec2bb86eea r20-5b17

Import from CVS: tag r20-5b17
author cvs
date Mon, 13 Aug 2007 10:15:03 +0200
parents 85a06df23a9a
children f955c73f5258
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
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
65 (defun batch-update-package-info ()
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
66 "Generate a package-info file for use by package-get.el.
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
67 Parameters are:
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
68 version -- Package version number
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
69 filename -- Filename of tarball to generate info for."
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
70 (unless noninteractive
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
71 (error "`batch-update-package-info' is to be used only with -batch"))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
72 (let ((version (nth 0 command-line-args-left))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
73 (filename (nth 1 command-line-args-left)))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
74 (find-file package-info)
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
75 (erase-buffer)
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
76 (insert-file-contents-literally package-info-template)
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
77 (goto-char (point-min))
237
89ec2bb86eea Import from CVS: tag r20-5b17
cvs
parents: 235
diff changeset
78 (pi-update-key "VERSION" (format "\"%s\"" version))
235
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
79 (pi-update-key "MD5SUM" (format "\"%s\""
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
80 (pi-md5sum filename)))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
81 (pi-update-key "FILENAME" (format "\"%s\""
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
82 (file-name-nondirectory filename)))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
83 (pi-update-key "SIZE" (format "%d"
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
84 (nth 7 (file-attributes filename))))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
85 (save-buffers-kill-emacs 0)))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
86
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
87 (provide 'package-info)
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
88
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents:
diff changeset
89 ;;; package-info.el ends here