Skip to content
This repository was archived by the owner on Jul 21, 2021. It is now read-only.

Commit 8cb0f1a

Browse files
committed
Fix an error in update-release which occurs when no source.txt exists.
1 parent ccad946 commit 8cb0f1a

File tree

1 file changed

+46
-40
lines changed

1 file changed

+46
-40
lines changed

src/release.lisp

Lines changed: 46 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -89,58 +89,64 @@
8989
(check-type release string)
9090
;; The directory structure has been changed since Aug 13 (quicklisp-2015-09-24).
9191
;; All project directories are in "projects/" directory now.
92-
(merge-pathnames (format nil "projects/~A/source.txt" release)
93-
(asdf:system-relative-pathname :quickdocs-updater
94-
#P"modules/quicklisp-projects/")))
92+
(let ((file
93+
(merge-pathnames (format nil "projects/~A/source.txt" release)
94+
(asdf:system-relative-pathname :quickdocs-updater
95+
#P"modules/quicklisp-projects/"))))
96+
(when (probe-file file)
97+
file)))
9598

9699
(defun project-source-info (release)
97100
(check-type release string)
98101
(flet ((chomp (str)
99102
(subseq str 0 (1+ (position #\Newline str :test #'char/= :from-end t)))))
100-
(let ((data (uiop:read-file-string (project-source-txt release))))
101-
(destructuring-bind (type source-url)
102-
(split-sequence #\Space data :count 2)
103-
(values type (chomp source-url))))))
103+
(let ((source.txt (project-source-txt release)))
104+
(when source.txt
105+
(let ((data (uiop:read-file-string source.txt)))
106+
(destructuring-bind (type source-url)
107+
(split-sequence #\Space data :count 2)
108+
(values type (chomp source-url))))))))
104109

105110
(defun release-homepage-url (release)
106111
(check-type release string)
107112
(multiple-value-bind (type source-url)
108113
(project-source-info release)
109-
(ignore-some-conditions (quri:uri-error)
110-
(let* ((uri (quri:uri source-url))
111-
(domain (quri:uri-domain uri)))
112-
(cond
113-
((string= domain "common-lisp.net")
114-
(let ((match (nth-value 1 (ppcre:scan-to-strings "://common-lisp\\.net/project/([^\\/]+)" source-url))))
115-
(format nil "http://common-lisp.net/project/~A"
116-
(quri:url-encode
117-
(if match
118-
(aref match 0)
119-
release)
120-
:encoding :utf-8))))
121-
((or (string= domain "weitz.de")
122-
(string= type "ediware-http"))
123-
(format nil "http://weitz.de/~A/"
124-
(quri:url-encode release :encoding :utf-8))))))))
114+
(when type
115+
(ignore-some-conditions (quri:uri-error)
116+
(let* ((uri (quri:uri source-url))
117+
(domain (quri:uri-domain uri)))
118+
(cond
119+
((string= domain "common-lisp.net")
120+
(let ((match (nth-value 1 (ppcre:scan-to-strings "://common-lisp\\.net/project/([^\\/]+)" source-url))))
121+
(format nil "http://common-lisp.net/project/~A"
122+
(quri:url-encode
123+
(if match
124+
(aref match 0)
125+
release)
126+
:encoding :utf-8))))
127+
((or (string= domain "weitz.de")
128+
(string= type "ediware-http"))
129+
(format nil "http://weitz.de/~A/"
130+
(quri:url-encode release :encoding :utf-8)))))))))
125131

126132
(defun release-repos-url (release)
127133
(check-type release string)
128134
(multiple-value-bind (type source-url)
129135
(project-source-info release)
130-
(declare (ignore type))
131-
(ignore-some-conditions (quri:uri-error)
132-
(let* ((uri (quri:uri source-url))
133-
(domain (quri:uri-domain uri)))
134-
(cond
135-
((string= domain "github.com")
136-
(let ((repos-id (ppcre:scan-to-strings "/[^/]+/[a-zA-Z0-9-_.]+" (quri:uri-path uri))))
137-
(concatenate 'string
138-
"https://github.com"
139-
repos-id)))
140-
((string= domain "bitbucket.org")
141-
source-url)
142-
((string= domain "gitlab.common-lisp.net")
143-
(let ((repos-id (ppcre:scan-to-strings "/[^/]+/[a-zA-Z0-9-_.]+" (quri:uri-path uri))))
144-
(concatenate 'string
145-
"http://gitlab.common-lisp.net"
146-
repos-id))))))))
136+
(when type
137+
(ignore-some-conditions (quri:uri-error)
138+
(let* ((uri (quri:uri source-url))
139+
(domain (quri:uri-domain uri)))
140+
(cond
141+
((string= domain "github.com")
142+
(let ((repos-id (ppcre:scan-to-strings "/[^/]+/[a-zA-Z0-9-_.]+" (quri:uri-path uri))))
143+
(concatenate 'string
144+
"https://github.com"
145+
repos-id)))
146+
((string= domain "bitbucket.org")
147+
source-url)
148+
((string= domain "gitlab.common-lisp.net")
149+
(let ((repos-id (ppcre:scan-to-strings "/[^/]+/[a-zA-Z0-9-_.]+" (quri:uri-path uri))))
150+
(concatenate 'string
151+
"http://gitlab.common-lisp.net"
152+
repos-id)))))))))

0 commit comments

Comments
 (0)