Mercurial > hg > xemacs-beta
comparison lisp/package-info.el @ 245:51092a27c943 r20-5b21
Import from CVS: tag r20-5b21
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:17:54 +0200 |
parents | f955c73f5258 |
children | 972bbb6d6ca2 |
comparison
equal
deleted
inserted
replaced
244:78d4f1140794 | 245:51092a27c943 |
---|---|
60 (goto-char (point-min)) | 60 (goto-char (point-min)) |
61 (let ((case-fold-search nil)) | 61 (let ((case-fold-search nil)) |
62 (when (search-forward key) | 62 (when (search-forward key) |
63 (replace-match value t))))) | 63 (replace-match value t))))) |
64 | 64 |
65 (defun pi-author-version (author-version) | |
66 (if (> (length author-version) 0) | |
67 (format "\"%s\"" author-version) | |
68 (format "\"%d.%d%s\"" emacs-major-version emacs-minor-version | |
69 (if (and (boundp 'xemacs-betaname) xemacs-betaname) | |
70 (progn | |
71 (string-match "[0-9]+" xemacs-betaname) | |
72 (concat "b" (match-string 0 xemacs-betaname))) | |
73 "")))) | |
74 | |
75 (defun pi-last-mod-date () | |
76 (condition-case nil | |
77 (save-excursion | |
78 (with-temp-buffer | |
79 (insert-file-contents-literally "ChangeLog") | |
80 (goto-char (point-min)) | |
81 (looking-at "[-0-9]+") | |
82 (format "\"%s\"" | |
83 (buffer-substring (match-beginning 0) | |
84 (match-end 0))))) | |
85 ;; Fallback on current date if no valid ChangeLog entry | |
86 (t (format-time-string "\"%Y-%m-%d\"")))) | |
87 | |
65 (defun batch-update-package-info () | 88 (defun batch-update-package-info () |
66 "Generate a package-info file for use by package-get.el. | 89 "Generate a package-info file for use by package-get.el. |
67 Parameters are: | 90 Parameters are: |
68 version -- Package version number | 91 version -- Package version number |
69 filename -- Filename of tarball to generate info for." | 92 filename -- Filename of tarball to generate info for. |
93 requires -- Packages necessary for bytecompiling. | |
94 author-version -- The original Author's version #. | |
95 maintainer -- The package maintainer. | |
96 category -- The build category." | |
70 (unless noninteractive | 97 (unless noninteractive |
71 (error "`batch-update-package-info' is to be used only with -batch")) | 98 (error "`batch-update-package-info' is to be used only with -batch")) |
72 (let ((version (nth 0 command-line-args-left)) | 99 (let ((version (nth 0 command-line-args-left)) |
73 (filename (nth 1 command-line-args-left)) | 100 (filename (nth 1 command-line-args-left)) |
74 (requires (nth 2 command-line-args-left))) | 101 (requires (nth 2 command-line-args-left)) |
102 (author-version (nth 3 command-line-args-left)) | |
103 (maintainer (nth 4 command-line-args-left)) | |
104 (category (nth 5 command-line-args-left))) | |
75 (unless requires | 105 (unless requires |
76 (setq requires "")) | 106 (setq requires "")) |
77 (find-file package-info) | 107 (find-file package-info) |
78 (erase-buffer) | 108 (erase-buffer) |
79 (insert-file-contents-literally package-info-template) | 109 (insert-file-contents-literally package-info-template) |
84 (pi-update-key "FILENAME" (format "\"%s\"" | 114 (pi-update-key "FILENAME" (format "\"%s\"" |
85 (file-name-nondirectory filename))) | 115 (file-name-nondirectory filename))) |
86 (pi-update-key "SIZE" (format "%d" | 116 (pi-update-key "SIZE" (format "%d" |
87 (nth 7 (file-attributes filename)))) | 117 (nth 7 (file-attributes filename)))) |
88 (pi-update-key "REQUIRES" requires) | 118 (pi-update-key "REQUIRES" requires) |
119 (pi-update-key "AUTHOR_VERSION" (pi-author-version author-version)) | |
120 (pi-update-key "MAINTAINER" (format "\"%s\"" maintainer)) | |
121 (pi-update-key "CATEGORY" (format "\"%s\"" category)) | |
122 (pi-update-key "BUILD_DATE" (format-time-string "\"%Y-%m-%d\"")) | |
123 (pi-update-key "DATE" (pi-last-mod-date)) | |
89 (save-buffers-kill-emacs 0))) | 124 (save-buffers-kill-emacs 0))) |
90 | 125 |
91 (provide 'package-info) | 126 (provide 'package-info) |
92 | 127 |
93 ;;; package-info.el ends here | 128 ;;; package-info.el ends here |