>From 73978a3d5c49c59e02b42000de6c8d9337e6c83b Mon Sep 17 00:00:00 2001 From: Thomas Fitzsimmons Date: Sun, 15 Nov 2015 21:25:04 -0500 Subject: [PATCH] Use symbolic links for core packages * admin/archive-contents.el (archive--process-simple-package): Copy file if it is a symlink to prevent deletion of target source file. (archive--core-package-copy-file): Create symbolic links for core files. (archive--core-package-sync): Change message to indicate linking. --- admin/archive-contents.el | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/admin/archive-contents.el b/admin/archive-contents.el index 74e473e..4f3aee9 100755 --- a/admin/archive-contents.el +++ b/admin/archive-contents.el @@ -207,8 +207,11 @@ (defun archive--process-simple-package (dir pkg vers desc req extras) "Deploy the contents of DIR into the archive as a simple package. Rename DIR/PKG.el to PKG-VERS.el, delete DIR, and return the descriptor." ;; Write DIR/foo.el to foo-VERS.el and delete DIR - (rename-file (expand-file-name (concat pkg ".el") dir) - (concat pkg "-" vers ".el")) + (if (file-symlink-p (expand-file-name (concat pkg ".el") dir)) + (copy-file (expand-file-name (concat pkg ".el") dir) + (concat pkg "-" vers ".el")) + (rename-file (expand-file-name (concat pkg ".el") dir) + (concat pkg "-" vers ".el"))) ;; Add the content of the ChangeLog. (let ((cl (expand-file-name "ChangeLog" dir))) (with-current-buffer (find-file-noselect (concat pkg "-" vers ".el")) @@ -647,7 +650,7 @@ (defun archive--core-package-empty-dest-p (dest) (defun archive--core-package-copy-file (source dest emacs-repo-root package-root exclude-regexp) - "Copy file from SOURCE to DEST ensuring subdirectories." + "Link file from SOURCE to DEST ensuring subdirectories." (unless (string-match-p exclude-regexp source) (let* ((absolute-package-file-name (expand-file-name dest package-root)) @@ -656,7 +659,10 @@ (defun archive--core-package-copy-file (directory (file-name-directory absolute-package-file-name))) (unless (file-directory-p directory) (make-directory directory t)) - (copy-file absolute-core-file-name absolute-package-file-name)) + (if (memq system-type '(windows-nt ms-dos)) + (copy-file absolute-core-file-name absolute-package-file-name) + (make-symbolic-link absolute-core-file-name + absolute-package-file-name t))) (message " %s -> %s" source (if (archive--core-package-empty-dest-p dest) (file-name-nondirectory source) dest)))) @@ -711,7 +717,7 @@ (defun archive--core-package-sync (definition) ;; Files may be just a string, normalize. (list file-patterns) file-patterns)))) - (message "Copying files for package: %s" name) + (message "Linking files for package: %s" name) (when (file-directory-p package-root) (delete-directory package-root t)) (make-directory package-root t) -- 2.4.3