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

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

Re: package-vc.el should not fetch all commits.


From: Philip Kaludercic
Subject: Re: package-vc.el should not fetch all commits.
Date: Fri, 01 Mar 2024 13:33:42 +0000

"amano.kenji" <amano.kenji@proton.me> writes:

> package-vc-install fetches all commits for a VCS emacs package.
>
> I just want the latest.
>
> package-vc-upgrade and package-vc-upgrade-all should prune everything except 
> the latest commit.
>
> I don't want VCS packages to grow in size over time.

That is not really what package-vc is about (the intention /is/ to have
the revision history available, so that you can contribute patches).
That being said, if you say you are only interested in packages from
Git, you can use this quick hack:

--8<---------------cut here---------------start------------->8---
(require 'package)
(require 'vc-git)
(defun package-install-once-from-vc (url name)
  (interactive
   (let* ((url (read-string "URL: "))
          (name (file-name-base (directory-file-name url))))
     (list url (read-string "Name: " name))))
  (let* ((tmp (make-temp-file "package" t))
         (dir (expand-file-name name tmp)))
    (make-directory dir)
    (unless (vc-git--out-ok "clone" "--depth" "1" url dir)
      (error "Failed to install %s from %s" name url))
    (let ((desc (package-install-file dir)))
      (message "Package `%s' installed at version %s"
               (package-desc-name desc)
               (package-version-join
                (package-desc-version desc)))
      desc)))
--8<---------------cut here---------------end--------------->8---

This is still missing some of the conveniences of package-vc, such as
building manuals, resolving dependencies, etc. but you could integrate
`package-vc--unpack-1' into the mix to get that to work as well.  As is
the case with vc-packages in general, updating is difficult.

-- 
        Philip Kaludercic on peregrine



reply via email to

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