From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Thomas Fitzsimmons <fitzsim@fitzsim.org>
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 10:10:26 -0500 [thread overview]
Message-ID: <jwv4mgjmjrg.fsf-monnier+emacsdiffs@gnu.org> (raw)
In-Reply-To: <m3io4z74ol.fsf@fitzsim.org> (Thomas Fitzsimmons's message of "Wed, 18 Nov 2015 09:39:06 -0500")
> How about the attached?
Looks like a good start, thank you.
> @@ -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")))
I'd use
(let ((src (expand-file-name (concat pkg ".el") dir)))
(funcall (if (file-symlink-p src) #'copy-file #'rename-file)
src (concat pkg "-" vers ".el")))
to avoid redundancy.
> (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."
The function name would need to be correspondingly adjusted ;-)
> - (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)))
I don't have a Windows system to test it, but if possible I'd rather
have something like
(if (fboundp 'make-symbolic-link) ...)
or
(condition-case nil
(make-symbolic-link absolute-core-file-name
absolute-package-file-name t)
(<the-error-signalled-by-make-symbolic-link>
(copy-file absolute-core-file-name absolute-package-file-name)))
We'd also want to try and fix the directory-deletion code accordingly,
so it's less trigger happy.
Stefan "who also got caught by this directory deletion code"
next prev parent reply other threads:[~2015-11-18 15:10 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
2015-11-18 15:10 ` Stefan Monnier [this message]
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=jwv4mgjmjrg.fsf-monnier+emacsdiffs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=emacs-devel@gnu.org \
--cc=fgallina@gnu.org \
--cc=fitzsim@fitzsim.org \
/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.