- "Clone and sync Emacs repository."
- (let ((reference (expand-file-name
- (or (getenv "EMACS_CLONE_REFERENCE") "../emacs/master")))
- (emacs-repo-root (expand-file-name "emacs")))
- (when (and (file-exists-p emacs-repo-root)
- (not (file-exists-p
- (expand-file-name "README" emacs-repo-root))))
- (message "Cleaning stalled Emacs clone: %s" emacs-repo-root)
- (delete-directory emacs-repo-root t))
- (cond ((file-exists-p emacs-repo-root)
- (let ((default-directory emacs-repo-root))
- (message "Running git pull in %S" default-directory)
- (call-process "git" nil t nil "pull")))
- ((file-exists-p reference)
- (message "Emacs repository reference found: %s" reference)
- (call-process
- "git" nil t nil
- "clone" archive--emacs-git-url
- "--reference" reference
- emacs-repo-root))
- (t
- (error
- (concat "Emacs repository not found at: %s\n"
- "Point EMACS_CLONE_REFERENCE environment variable to an "
- "existing checkout.") reference)))))
-
-(defun archive--cleanup-packages (externals-list)
+ "Sync Emacs repository, if applicable.
+Return non-nil if there's an \"emacs\" repository present."
+ ;; Support for :core packages is important for elpa.gnu.org, but for other
+ ;; cases such as "in-place installation", it's rather secondary since
+ ;; those users can just as well use a development version of Emacs to get
+ ;; those packages.
+ ;; So make the handling of :core packages depend on whether or not the user
+ ;; has setup a clone of Emacs under the "emacs" subdirectory.
+ (let ((emacs-repo-root (expand-file-name "emacs")))
+ (if (not (file-directory-p emacs-repo-root))
+ (progn (message "No \"emacs\" subdir: will skip :core packages")
+ nil)
+ (archive--pull emacs-repo-root)
+ t)))
+
+(defun archive--find-non-trivial-file (dir)
+ (catch 'found-important-file
+ (dolist (file (directory-files-recursively dir ".*"))
+ (unless (or (member file '("." ".."))
+ (string-match "\\.elc\\'" file)
+ (string-match "-autoloads.el\\'" file)
+ (string-match "-pkg.el\\'" file)
+ (file-symlink-p file))
+ (throw 'found-important-file file)))
+ nil))
+
+(defun archive--cleanup-packages (externals-list with-core)