emacs-devel
[Top][All Lists]
Advanced

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

Re: feature/package+vc 04c4c578c7 3/4: Allow for packages to be installe


From: Philip Kaludercic
Subject: Re: feature/package+vc 04c4c578c7 3/4: Allow for packages to be installed directly from VCS
Date: Sun, 16 Oct 2022 22:18:18 +0000

Here is a patch that would add all the necessary metadata for package-vc
to work to ELPA:

>From 98ac710ca97ebca5be1f9bf49b40a701c541b21d Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk@posteo.net>
Date: Mon, 17 Oct 2022 00:05:17 +0200
Subject: [PATCH] Add 'package-vc' to package metadata

* elpa-admin.el (elpaa--metadata): Add :upstream property.
---
 elpa-admin.el | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/elpa-admin.el b/elpa-admin.el
index 054c9bda86..f22c345cd9 100644
--- a/elpa-admin.el
+++ b/elpa-admin.el
@@ -1074,6 +1074,18 @@ PKG is the name of the package and DIR is the directory 
where it is."
           (unless found-url
             ;; Provide a good default URL.
             (push (cons :url (elpaa--default-url pkg)) extras))
+          ;; Add `package-vc' data
+          (let ((spec (cdr pkg-spec))
+                (ups (list :upstream 'Git nil nil nil)))
+            (if (null (plist-get spec :url))
+                (setf (nth 2 ups) (concat "https://git.savannah.gnu.org/git/";
+                                          elpaa--gitrepo)
+                      (nth 3 ups) (plist-get spec :lisp-dir)
+                      (nth 4 ups) (concat elpaa--branch-prefix pkg))
+              (setf (nth 2 ups) (plist-get spec :url)
+                    (nth 3 ups) (plist-get spec :lisp-dir)
+                    (nth 4 ups) (plist-get spec :branch)))
+            (push ups extras))
           (list simple
                (package-version-join version)
                (package-desc-summary pkg-desc)
-- 
2.38.0

This does not special optimisation to minimise the data.  I guess this
is also a good point to hear objections to the current way the VC data
is handled.  Here is an example entry from "archive-contents", note the
new `:upstream' entry in the metadata field (the last element of the
vector):

--8<---------------cut here---------------start------------->8---
 (setup .
        [(1 3 0)
         ((emacs
           (26 1)))
         "Helpful Configuration Macro" tar
         ((:url . "https://git.sr.ht/~pkal/setup";)
          (:keywords "lisp" "local")
          (:maintainer "Philip Kaludercic" . "~pkal/public-inbox@lists.sr.ht")
          (:authors
-->        ("Philip Kaludercic" . "philipk@posteo.net"))
          (:upstream Git "https://git.sr.ht/~pkal/setup"; nil nil)
          (:commit . "eece09d1151fd641f31d738b8c62742918993e95"))])
--8<---------------cut here---------------end--------------->8---

or

--8<---------------cut here---------------start------------->8---
 (smalltalk-mode .
                 [(4 0)
                  nil "Major mode for the GNU Smalltalk programming language" 
tar
                  ((:maintainer "Derek Zhou" . "derek@3qin.us")
                   (:url . "https://elpa.gnu.org/packages/smalltalk-mode.html";)
-->                (:upstream Git 
"https://git.savannah.gnu.org/git/emacs/elpa.git"; nil 
"externals/smalltalk-mode")
                   (:commit . "570b705db9a02bb48cd61652639401715f419447"))])
--8<---------------cut here---------------end--------------->8---

The value corresponding to :upstream is a list of the form

    (VC-BACKEND REPOSITORY-URL SUBDIRECTORY BRANCH)

I have been wondering if it would be better to use a {a,p}list instead,
which would be more flexible if changes would become necessary in the
future.  Perhaps I am even missing something right now?

At the same time I don't mean to burden the ELPA server by increasing
the size of the file that is regularly queried.  Perhaps REPOSITORY-URL
could have special values such as `:url' to indicate that the package
URL is the same as the repository and `:elpa'/`:nongnu' to indicate that
the default repository is being used.  Or is this just premature
optimisation?

reply via email to

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