GNU bug report logs - #58367
`package-install-file' rejects some .tar files (tentative patch)

Previous Next

Package: emacs;

Reported by: Richard Hopkins <emacs <at> unbit.co.uk>

Date: Fri, 7 Oct 2022 21:17:02 UTC

Severity: normal

Tags: patch

Full log


Message #19 received at 58367 <at> debbugs.gnu.org (full text, mbox):

From: Richard Hopkins <emacs <at> unbit.co.uk>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 58367 <at> debbugs.gnu.org
Subject: Re: bug#58367: `package-install-file' rejects some .tar files
 (tentative patch)
Date: Sat, 08 Oct 2022 23:45:11 +0100
On 2022-10-08 17:25, Stefan Monnier wrote:
> Thanks for the tarballs for the tests, they were very helpful.
> The patch also pointed in the right direction.
> 
> I installed the patch below (plus regression tests) into `master`.

Great, thanks for taking a look at this and also fixing the top level
lookup for v7-withsub-0.1.tar.  I've pulled the latest changes and all
the original tar files now install.

I've managed to get the ustar-withsub-0.1 to install from a directory
and include the sub directories by using `copy-directory' instead of
only copying the .el files in the top level.  As more inspiration...

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index d619142d64..4144a12718 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -947,14 +947,10 @@ package-unpack
          (pkg-dir (expand-file-name dirname package-user-dir)))
     (pcase (package-desc-kind pkg-desc)
       ('dir
-       (make-directory pkg-dir t)
        (let ((file-list
-              (directory-files
-               default-directory 'full "\\`[^.].*\\.el\\'" 'nosort)))
-         (dolist (source-file file-list)
-           (let ((target-el-file
-                  (expand-file-name (file-name-nondirectory 
source-file) pkg-dir)))
-             (copy-file source-file target-el-file t)))
+              (directory-files-recursively
+               default-directory "." t)))
+         (copy-directory default-directory pkg-dir nil t 
'copy-contents)
          ;; Now that the files have been installed, this package is
          ;; indistinguishable from a `tar' or a `single'. Let's make
          ;; things simple by ensuring we're one of them.




This bug report was last modified 2 years and 312 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.