Skip to content

Commit 26f750b

Browse files
quicklispxach
authored andcommitted
Add gitlab upstream
1 parent a6fdd27 commit 26f750b

File tree

2 files changed

+49
-9
lines changed

2 files changed

+49
-9
lines changed

quicklisp-controller.asd

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,24 @@
1212
#:drakma
1313
#:yason
1414
#:function-cache
15-
#:trivial-utf-8
15+
#:trivial-utf-8
1616
#:ironclad
1717
#:lparallel
18-
#:cl-who
18+
#:cl-who
1919
#:githappy
2020
#:project-info
21-
#:westbrook)
21+
#:westbrook)
2222
:serial t
2323
:components ((:file "tarhash")
24-
(:file "github-issues")
24+
(:file "github-issues")
2525
(:file "package")
2626
(:file "config")
2727
(:file "logical-host")
2828
(:file "commands")
2929
(:file "utils")
3030
(:file "setup")
3131
(:file "upstream")
32-
(:file "system-file-magic-cache")
32+
(:file "system-file-magic-cache")
3333
(:file "dist-cache")
3434
(:file "upstream-vcs")
3535
(:file "upstream-http")
@@ -38,6 +38,7 @@
3838
(:file "upstream-darcs")
3939
(:file "upstream-git")
4040
(:file "upstream-github")
41+
(:file "upstream-gitlab")
4142
(:file "upstream-mercurial")
4243
(:file "upstream-svn")
4344
(:file "upstream-bzr")
@@ -51,11 +52,12 @@
5152
(:file "update-client-version")
5253
(:file "descriptions")
5354
(:file "ng-indexes")
54-
(:file "git")
55-
(:file "html-failure-report")
56-
(:file "rss-failure-feeds")
55+
(:file "git")
56+
(:file "html-failure-report")
57+
(:file "rss-failure-feeds")
5758
(:file "recrank")
58-
(:file "irepl")))
59+
(:file "irepl")
60+
(:file "submit-bug-report")))
5961

6062
(defpackage #:quicklisp-controller-config
6163
(:use)

upstream-gitlab.lisp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
;;;; upstream-gitlab.lisp
2+
;;;;
3+
;;;; Fetch some basic info about a source from gitlab
4+
;;;;
5+
6+
(in-package #:quicklisp-controller)
7+
8+
(defun gitlab-project-id (url)
9+
(ppcre:register-groups-bind (user project)
10+
("gitlab.com/(.*?)/(.*?)(.git)?$" url)
11+
(when user
12+
(format nil "~A%2F~A" user project))))
13+
14+
(defun gitlab-project-release-json (url)
15+
(let* ((uri (format nil "https://gitlab.com/api/v4/projects/~A/releases"
16+
(gitlab-project-id url)))
17+
(request (make-instance 'githappy::request
18+
:uri uri))
19+
(response (githappy::submit request))
20+
(json (yason:parse (githappy::utf8-string (githappy::body response)))))
21+
json))
22+
23+
(defun gitlab-latest-tag-info (url)
24+
(let ((json (gitlab-project-release-json url)))
25+
(when json
26+
(let ((tag-data (githappy:jref json '(0 "tag_name")))
27+
(sources (githappy:jref json '(0 "assets" "sources"))))
28+
(dolist (source sources)
29+
(when (equal (githappy:jref source "format") "tar.gz")
30+
(return (list :tag tag-data
31+
:url (githappy:jref source "url")))))))))
32+
33+
34+
(defclass latest-gitlab-release-source (latest-github-release-source)
35+
())
36+
37+
(defmethod github-info-plist ((source latest-gitlab-release-source))
38+
(gitlab-latest-tag-info (location source)))

0 commit comments

Comments
 (0)