all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* elpa/packages/archive-contents
@ 2011-04-20 15:50 Stefan Monnier
  2011-04-22  3:23 ` elpa/packages/archive-contents Chong Yidong
  2011-04-26  3:29 ` elpa/packages/archive-contents Ted Zlatanov
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Monnier @ 2011-04-20 15:50 UTC (permalink / raw)
  To: emacs-devel

I've just written the little Elisp script below which auto-generates
the <foo>-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 <monnier@iro.umontreal.ca>
;; 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 <http://www.gnu.org/licenses/>.

;;; 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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: elpa/packages/archive-contents
  2011-04-20 15:50 elpa/packages/archive-contents Stefan Monnier
@ 2011-04-22  3:23 ` Chong Yidong
  2011-04-26  3:29 ` elpa/packages/archive-contents Ted Zlatanov
  1 sibling, 0 replies; 3+ messages in thread
From: Chong Yidong @ 2011-04-22  3:23 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> I've just written the little Elisp script below which auto-generates
> the <foo>-readme.txt and archive-contents file

Thanks.

> Could someone figure out what to do with package-update.sh and ideally
> remove all the *-readme.txt (and the archive-contents) files?

Done.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: elpa/packages/archive-contents
  2011-04-20 15:50 elpa/packages/archive-contents Stefan Monnier
  2011-04-22  3:23 ` elpa/packages/archive-contents Chong Yidong
@ 2011-04-26  3:29 ` Ted Zlatanov
  1 sibling, 0 replies; 3+ messages in thread
From: Ted Zlatanov @ 2011-04-26  3:29 UTC (permalink / raw)
  To: emacs-devel

On Wed, 20 Apr 2011 12:50:26 -0300 Stefan Monnier <monnier@iro.umontreal.ca> wrote: 

SM> I'm not sure under which circumstances package-update.sh is run

Chong and I left it as a manual process so we can commit changes and
review them before deploying, IIRC.  The only automatic process is the
org-mode nightly synch, which runs as a cron job.

Ted




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-04-26  3:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-20 15:50 elpa/packages/archive-contents Stefan Monnier
2011-04-22  3:23 ` elpa/packages/archive-contents Chong Yidong
2011-04-26  3:29 ` elpa/packages/archive-contents Ted Zlatanov

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.