all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Thomas Fitzsimmons <fitzsim@fitzsim.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: "Fabián E. Gallina" <fgallina@gnu.org>, emacs-devel@gnu.org
Subject: Re: [elpa] master 872014e: Prevent accidental deletion of .git
Date: Wed, 18 Nov 2015 09:39:06 -0500	[thread overview]
Message-ID: <m3io4z74ol.fsf@fitzsim.org> (raw)
In-Reply-To: <jwvoaf3ix7u.fsf-monnier+emacsdiffs@gnu.org> (Stefan Monnier's message of "Mon, 09 Nov 2015 00:03:34 -0500")

[-- Attachment #1: Type: text/plain, Size: 398 bytes --]

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

[...]

> No, we should change to code to use symlinks instead of
> file-copies first (and at the same time change it as I suggested,
> i.e. to only delete symlinks and empty directories).

How about the attached?  I've only tested it on a single-file package
(ntlm.el).  I could extend it to directories if the approach is what you
want.

Thomas


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Use-symbolic-links-for-core-packages.patch --]
[-- Type: text/x-patch, Size: 3099 bytes --]

From 73978a3d5c49c59e02b42000de6c8d9337e6c83b Mon Sep 17 00:00:00 2001
From: Thomas Fitzsimmons <fitzsim@fitzsim.org>
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


  parent reply	other threads:[~2015-11-18 14:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20151109013124.17711.29422@vcs.savannah.gnu.org>
     [not found] ` <E1ZvbIq-0004cL-VV@vcs.savannah.gnu.org>
2015-11-09  1:58   ` [elpa] master 872014e: Prevent accidental deletion of .git Stefan Monnier
2015-11-09  4:49     ` Thomas Fitzsimmons
2015-11-09  5:03       ` Stefan Monnier
2015-11-09 16:07         ` Eli Zaretskii
2015-11-09 16:38           ` Artur Malabarba
2015-11-09 16:45             ` Eli Zaretskii
2015-11-09 20:20               ` Stefan Monnier
2015-11-18 14:39         ` Thomas Fitzsimmons [this message]
2015-11-18 15:10           ` Stefan Monnier
2015-11-18 16:44             ` Stephen Leake
2015-11-18 17:35             ` Eli Zaretskii
2015-11-26  3:08             ` Thomas Fitzsimmons
2015-11-26  3:55               ` Stefan Monnier
2015-11-26 14:34                 ` Thomas Fitzsimmons
2015-11-26 15:42                   ` Stefan Monnier
2015-11-27  6:58                     ` Thomas Fitzsimmons
2015-11-27 15:27                       ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3io4z74ol.fsf@fitzsim.org \
    --to=fitzsim@fitzsim.org \
    --cc=emacs-devel@gnu.org \
    --cc=fgallina@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.