help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

correct usage of package-upload-file for multi-file package?


From: Sam Halliday
Subject: correct usage of package-upload-file for multi-file package?
Date: Thu, 24 Dec 2015 14:58:26 -0800 (PST)
User-agent: G2/1.0

Dear Emacs users,

(X-posted to https://emacs.stackexchange.com/questions/19068/)

At my work (Windows 7, GNU Emacs 24.5), we don't have access to elpa or melpa, 
but we have a network drive which contains emacs packages that have been 
manually downloaded and approved.

Using code similar to the following (heavily based on 
http://emacs.stackexchange.com/a/17408/5142) Emacs users are able to have a 
MELPA-like experience.

    (require 'package)
    (setq myelpa-msde "//network/fsf/emacs-plugins/"
          myelpa (expand-file-name "myelpa/" user-emacs-directory)
          package-archives `(("myelpa" . ,myelpa))
          use-package-always-ensure t)
    (package-initialize)
    (unless (file-exists-p myelpa)
      (require 'package-x)
      (setq package-archive-upload-base myelpa)
      (mkdir myelpa)
      (dolist (file (directory-files myelpa-msde 'fqn "\\.*[.]\\(el\\|tar\\)"))
        (message "Preparing %s" file)
        (package-upload-file file)
        (when (string= (file-name-extension file) "tar")
          (copy-file file myelpa 'force)))
      (package-refresh-contents)
      (package-install 'use-package))
    (require 'use-package)

However, look at that again

        (when (string= (file-name-extension file) "tar")
          (copy-file file myelpa 'force)))

without this hack, any tar file that gets uploaded to the "myelpa" local 
repository is corrupt (it seems to be a file containing just the directory 
listing of the original tar). The package index is updated correctly, so I was 
able to apply this workaround by just force copying the tarball again.

Is this a bug in Emacs or am I doing it wrong? According to 
https://www.gnu.org/software/emacs/manual/html_node/elisp/Package-Archives.html 
I would have thought this would be considered a "multi file package" and just 
work.

Best regards,
Sam


reply via email to

[Prev in Thread] Current Thread [Next in Thread]