[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/package+vc 432252c23f 7/9: Extend package-vc heuristics to multi
From: |
Philip Kaludercic |
Subject: |
feature/package+vc 432252c23f 7/9: Extend package-vc heuristics to multiple source forges |
Date: |
Sat, 8 Oct 2022 05:58:49 -0400 (EDT) |
branch: feature/package+vc
commit 432252c23f9855d9f43dabd600415305ab0c8b91
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>
Extend package-vc heuristics to multiple source forges
* package-vc.el (package-vc-probable-repository-regexp): Rename to
'package-vc-heusitic-alist'.
(package-vc-heusitic-alist): Add support for multiple VC backends.
(package-vc-sourced-packages-list): Use 'package-vc-heusitic-alist'
---
lisp/emacs-lisp/package-vc.el | 66 +++++++++++++++++++++++++++----------------
1 file changed, 41 insertions(+), 25 deletions(-)
diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index 2d3769448d..d9903b3ca3 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -50,24 +50,44 @@
:group 'package
:version "29.1")
-(defcustom package-vc-probable-repository-regexp
- (rx bos "http" (? "s") "://"
- (or (: (? "www.") "github.com"
- "/" (+ (or alnum "-" "." "_"))
- "/" (+ (or alnum "-" "." "_")))
- (: "codeberg.org"
- "/" (+ (or alnum "-" "." "_"))
- "/" (+ (or alnum "-" "." "_")))
- (: (? "www.") "gitlab" (+ "." (+ alnum))
- "/" (+ (or alnum "-" "." "_"))
- "/" (+ (or alnum "-" "." "_")))
- (: "git.sr.ht"
- "/~" (+ (or alnum "-" "." "_"))
- "/" (+ (or alnum "-" "." "_"))))
- (or (? "/") ".git") eos)
- "Regular expression matching URLs that are repositories."
- :version "29.1"
- :type 'regex)
+(defcustom package-vc-heusitic-alist
+ `((,(rx bos "http" (? "s") "://"
+ (or (: (? "www.") "github.com"
+ "/" (+ (or alnum "-" "." "_"))
+ "/" (+ (or alnum "-" "." "_")))
+ (: "codeberg.org"
+ "/" (+ (or alnum "-" "." "_"))
+ "/" (+ (or alnum "-" "." "_")))
+ (: (? "www.") "gitlab" (+ "." (+ alnum))
+ "/" (+ (or alnum "-" "." "_"))
+ "/" (+ (or alnum "-" "." "_")))
+ (: "git.sr.ht"
+ "/~" (+ (or alnum "-" "." "_"))
+ "/" (+ (or alnum "-" "." "_")))
+ (: "git." (or "savannah" "sv") "." (? "non") "gnu.org/"
+ (or "r" "git") "/"
+ (+ (or alnum "-" "." "_")) (? "/")))
+ (or (? "/") ".git") eos)
+ . Git)
+ (,(rx bos "http" (? "s") "://"
+ (or (: "hg.sr.ht"
+ "/~" (+ (or alnum "-" "." "_"))
+ "/" (+ (or alnum "-" "." "_")))
+ (: "hg." (or "savannah" "sv") "." (? "non") "gnu.org/hgweb/"
+ (+ (or alnum "-" "." "_")) (? "/")))
+ eos)
+ . Hg)
+ (,(rx bos "http" (? "s") "://"
+ (or (: "bzr." (or "savannah" "sv") "." (? "non") "gnu.org/r/"
+ (+ (or alnum "-" "." "_")) (? "/")))
+ eos)
+ . Bzr))
+ "Heuristic mapping URL regular expressions to VC backends."
+ :type `(alist :key-type (regexp :tag "Regular expression matching URLs")
+ :value-type (choice :tag "VC Backend"
+ ,@(mapcar (lambda (b) `(const ,b))
+ vc-handled-backends)))
+ :version "29.1")
(defun package-vc-commit (pkg)
"Extract the commit of a development package PKG."
@@ -223,14 +243,10 @@ The output is written out into PKG-FILE."
;; heuristic and use the URL header, that might already be
;; pointing towards a repository, and use that as a backup
(and-let* ((url (alist-get :url extras))
- ((string-match-p package-vc-probable-repository-regexp
- url)))
- ;; XXX: Currently `package-vc-probable-repository-regexp'
- ;; only contains Git repositories, so we can infer the
- ;; repository type. This might work for now, but is not a
- ;; particularly resilient approach.
+ (backend (alist-get url package-vc-heusitic-alist
+ nil nil #'string-match-p)))
(setf (alist-get :vc (package-desc-extras (cadr pkg)))
- (list 'Git url))
+ (list backend url))
t))))
package-archive-contents))
- feature/package+vc updated (bb2bd2ed91 -> a4a825df82), Philip Kaludercic, 2022/10/08
- feature/package+vc effe1f20f5 3/9: Extract package maintainer guessing code into a separate function, Philip Kaludercic, 2022/10/08
- feature/package+vc e75994f2ff 2/9: Add an inline procedure for checking for source packages, Philip Kaludercic, 2022/10/08
- feature/package+vc a4a825df82 9/9: Clone packages into a separate directory, Philip Kaludercic, 2022/10/08
- feature/package+vc 077c1533df 6/9: ; * package-vc.el (package-vc-read-pkg): Return package description, Philip Kaludercic, 2022/10/08
- feature/package+vc f9065c7951 5/9: Use 'package-vc-p' in package-vc.el, Philip Kaludercic, 2022/10/08
- feature/package+vc 8cfeb8a9e0 1/9: Merge branch 'master' into feature/package+vc, Philip Kaludercic, 2022/10/08
- feature/package+vc e092e60f15 4/9: Add a package-vc command for submitting ptches, Philip Kaludercic, 2022/10/08
- feature/package+vc 7c66223dfb 8/9: * lisp/emacs-lisp/package.el (package-report-bug): Use 'file-in-directory-p', Philip Kaludercic, 2022/10/08
- feature/package+vc 432252c23f 7/9: Extend package-vc heuristics to multiple source forges,
Philip Kaludercic <=