;;; archive-contents.el --- Auto-generate an Emacs Lisp package archive. -*- lexical-binding:t -*-
-;; Copyright (C) 2011-2014 Free Software Foundation, Inc
+;; Copyright (C) 2011-2015 Free Software Foundation, Inc
;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
(cond
((member file '("." ".." "elpa.rss" "index.html" "archive-contents")))
((string-match "\\.html\\'" file))
+ ((string-match "\\.sig\\'" file))
((string-match "-readme\\.txt\\'" file)
(let ((name (substring file 0 (match-beginning 0))))
(puthash name (gethash name packages) packages)))
"existing checkout.") reference)))))
(defun archive--cleanup-packages (externals-list)
- "Cleanup packages not registered in the EXTERNALS-LIST."
+ "Remove subdirectories of `packages/' that do not correspond to known packages.
+This is any subdirectory inside `packages/' that's not under
+version control nor listed in EXTERNALS-LIST."
(let ((default-directory (expand-file-name "packages/")))
(dolist (dir (directory-files "."))
(cond
+ ((or (not (file-directory-p dir)) (file-symlink-p dir))
+ ;; We only add/remove plain directories in elpa/packages (not symlinks).
+ nil)
((member dir '("." "..")) nil)
((assoc dir externals-list) nil)
((file-directory-p (expand-file-name (format "%s/.git" dir)))
(progn (delete-directory dir 'recursive t)
(message "Deleted all of %s" dir))
(message "Keeping leftover unclean %s:\n%s" dir status))))
+ ;; Check if `dir' is under version control.
((not (zerop (call-process "git" nil nil nil
"ls-files" "--error-unmatch" dir)))
(message "Deleted untracked package %s" dir)
(pcase file-pattern
((pred (stringp)) (cons file-pattern ""))
(`(,file ,dest . ,_) (cons file dest))
- (t (error "Unrecognized file format for package %s: %S"
+ (_ (error "Unrecognized file format for package %s: %S"
name file-pattern))))
(if (stringp file-patterns)
;; Files may be just a string, normalize.
file dest emacs-repo-root package-root exclude-regexp))))))
(defun archive-add/remove/update-externals ()
+ "Remove non-package directories and fetch external packages."
(let ((externals-list
(with-current-buffer (find-file-noselect "externals-list")
(read (buffer-string)))))