Commit 05f6de1b authored by Eric Timmons's avatar Eric Timmons
Browse files

Let sources throw errors if a project release does not exist.

Additionally, specify a restart for syncing the source and trying again.
parent d1a35cb8
......@@ -48,9 +48,11 @@
......@@ -76,6 +78,12 @@
(in-package #:clpm/sources/defs)
;; * Conditions
(define-condition source-no-such-object ()
;; * Sources
......@@ -135,8 +143,11 @@ initargs and a :type as a keyword."))
(:documentation "Return an instance of CLPM-PROJECT or NIL if the project is
not located in the source."))
(defgeneric source/project-release (source project-name version-string)
(:documentation "Return a release object for the specified project and version."))
(defgeneric source/project-release (source project-name version-string &optional error)
"Return a release object for the specified project and version. If error is
t (default), a ~source-no-such-object~ error is signaled. If possible, the
source implementation should provide a ~sync-and-retry~ restart."))
(defgeneric source/system (source system-name)
(:documentation "Return an instance of CLPM-SYSTEM or NIL if the system is not
......@@ -130,11 +130,23 @@
,@(split-sequence #\/ (uri-path (source/url source)) :remove-empty-subseqs t))
:ensure-directory t))
(defmethod source/project-release ((source quicklisp-source) project-name version-string)
(defun %source/project-release (source project-name version-string
&optional (error t))
(with-source-connection (source)
(find-dao 'ql-release
:project-name project-name
:dist-version-id version-string)))
(or (find-dao 'ql-release
:project-name project-name
:dist-version-id version-string)
(when error
(error 'source-no-such-object)))))
(defmethod source/project-release ((source quicklisp-source) project-name version-string
&optional (error t))
(%source/project-release source project-name version-string error)
(sync-and-retry ()
:report "Sync source and try again."
(sync-source source)
(%source/project-release source project-name version-string error))))
(defmethod source/project ((source quicklisp-source) project-name)
(with-source-connection (source)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment