From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: elpa/packages/archive-contents Date: Wed, 20 Apr 2011 12:50:26 -0300 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1303314651 28409 80.91.229.12 (20 Apr 2011 15:50:51 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 20 Apr 2011 15:50:51 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 20 17:50:40 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QCZfp-0000iG-DO for ged-emacs-devel@m.gmane.org; Wed, 20 Apr 2011 17:50:37 +0200 Original-Received: from localhost ([::1]:54241 helo=lists2.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QCZfo-0004ER-AY for ged-emacs-devel@m.gmane.org; Wed, 20 Apr 2011 11:50:36 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:46792) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QCZfk-0004Du-C7 for emacs-devel@gnu.org; Wed, 20 Apr 2011 11:50:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QCZfj-00071f-5g for emacs-devel@gnu.org; Wed, 20 Apr 2011 11:50:32 -0400 Original-Received: from fencepost.gnu.org ([140.186.70.10]:48266) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QCZfj-00071b-2a for emacs-devel@gnu.org; Wed, 20 Apr 2011 11:50:31 -0400 Original-Received: from 121-249-126-200.fibertel.com.ar ([200.126.249.121]:49346 helo=ceviche.home) by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1QCZfi-0004at-EI; Wed, 20 Apr 2011 11:50:30 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id E046F6610E; Wed, 20 Apr 2011 12:50:26 -0300 (ART) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.10 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:138588 Archived-At: I've just written the little Elisp script below which auto-generates the -readme.txt and archive-contents file and found one problem with the current setup: This script can't find the description of the org package because it's not installed in elpa/packages. So if we remove the foo-readme.txt and archive-contents from the Bzr and then rebuild those files during package-update.sh we're all set, but if we want to keep those files in the Bzr it's a bit more cumbersome. I'm not sure under which circumstances package-update.sh is run, so since it currently doesn't run Emacs, I haven't changed it to run batch-make-archive-contents. Could someone figure out what to do with package-update.sh and ideally remove all the *-readme.txt (and the archive-contents) files? Stefan ;;; archive-contents.el --- Auto-generate the `archive-contents' file -*- lexical-binding: t -*- ;; Copyright (C) 2011 Stefan Monnier ;; Author: Stefan Monnier ;; Keywords: ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . ;;; Commentary: ;;; Code: (require 'lisp-mnt) (defun batch-make-archive-contents () (let ((packages '(1))) ;I think this is the format-version. (dolist (file (directory-files default-directory)) (pcase file ((or `"." `".." `"elpa.rss" `"archive-contents") nil) ((pred file-directory-p) (if (not (string-match "-[0-9.]+\\'" file)) (message "Unknown package directory name format %s" file) (let* ((pkg (substring file 0 (match-beginning 0))) (vers (substring file (1+ (match-beginning 0)))) (exp (with-temp-buffer (insert-file-contents (expand-file-name (concat pkg "-pkg.el") file)) (goto-char (point-min)) (read (current-buffer))))) (copy-file (expand-file-name "README" file) (concat pkg "-readme.txt") 'ok-if-already-exists) (unless (equal (nth 1 exp) pkg) (message "Package name %s doesn't match file name %s" (nth 1 exp) file)) (unless (equal (nth 2 exp) vers) (message "Package version %s doesn't match file name %s" (nth 2 exp) file)) (push (cons (intern pkg) (vector (version-to-list vers) nil ;?? (nth 3 exp) 'tar)) packages)))) ((pred (string-match "\\.el\\'")) (if (not (string-match "-\\([0-9.]+\\)\\.el\\'" file)) (message "Unknown package file name format %s" file) (let* ((pkg (substring file 0 (match-beginning 0))) (vers (match-string 1 file)) (desc (with-temp-buffer (insert-file-contents file) (goto-char (point-min)) (if (not (looking-at ";;;.*---[ \t]*\\(.*\\)\\(-\\*-.*-\\*-[ \t]*\\)?$")) (message "Incorrectly formatted header in %s" file) (prog1 (match-string 1) (let ((commentary (lm-commentary))) (with-current-buffer (find-file-noselect (concat pkg "-readme.txt")) (erase-buffer) (emacs-lisp-mode) (insert commentary) (goto-char (point-min)) (while (looking-at ";+[ \t]*\\(commentary[: \t]*\\)?\n") (delete-region (match-beginning 0) (match-end 0))) (uncomment-region (point-min) (point-max)) (goto-char (point-max)) (while (progn (forward-line -1) (looking-at "[ \t]*\n")) (delete-region (match-beginning 0) (match-end 0))) (save-buffer)))))))) (push (cons (intern pkg) (vector (version-to-list vers) nil ;?? desc 'single)) packages)))) ((pred (string-match "\\.elc\\'")) nil) ((pred (string-match "-readme\\.txt\\'")) nil) (t (message "Unknown file %s" file)))) (with-current-buffer (find-file-noselect "archive-contents") (erase-buffer) (pp (nreverse packages) (current-buffer)) (save-buffer)))) (provide 'archive-contents) ;;; archive-contents.el ends here