Commit 98ebd0d5 authored by Eric Timmons's avatar Eric Timmons
Browse files

VCS projects keep track of visible releases

They are cleared when resolving requirements. This helps prevent the resolver
from trying to install deleted commits.
parent 79c65603
...@@ -101,6 +101,7 @@ ...@@ -101,6 +101,7 @@
set of installed releases is updated to be the minimum set that satisfies all set of installed releases is updated to be the minimum set that satisfies all
the requirements." the requirements."
(with-sources ((context-sources context)) (with-sources ((context-sources context))
(vcs-source-clear-visible-releases (context-vcs-source context))
(let* ((*releases-sort-function* (unless (eql update-projects t) (let* ((*releases-sort-function* (unless (eql update-projects t)
(make-result-sorter context update-projects))) (make-result-sorter context update-projects)))
(reqs (rewrite-vcs-reqs (context-requirements context) context update-projects)) (reqs (rewrite-vcs-reqs (context-requirements context) context update-projects))
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#:vcs-release-commit #:vcs-release-commit
#:vcs-remote-release #:vcs-remote-release
#:vcs-source #:vcs-source
#:vcs-source-clear-visible-releases
#:vcs-source-register-project! #:vcs-source-register-project!
#:vcs-system)) #:vcs-system))
...@@ -72,6 +73,12 @@ source using VCS-SOURCE-REGISTER_PROJECT!.")) ...@@ -72,6 +73,12 @@ source using VCS-SOURCE-REGISTER_PROJECT!."))
(destructuring-bind (project-name . repo-form) project (destructuring-bind (project-name . repo-form) project
(vcs-source-register-project! source (make-repo-from-description repo-form) project-name)))) (vcs-source-register-project! source (make-repo-from-description repo-form) project-name))))
(defun vcs-source-clear-visible-releases (vcs-source)
(maphash (lambda (k v)
(declare (ignore k))
(setf (vcs-project-visible-releases v) nil))
(vcs-source-projects-by-name vcs-source)))
(defun vcs-source-register-project! (vcs-source repo project-name) (defun vcs-source-register-project! (vcs-source repo project-name)
"Registers a project with the vcs source and returns it." "Registers a project with the vcs source and returns it."
(let ((projects-by-name (vcs-source-projects-by-name vcs-source))) (let ((projects-by-name (vcs-source-projects-by-name vcs-source)))
...@@ -163,12 +170,15 @@ local override when requesting a VCS release.") ...@@ -163,12 +170,15 @@ local override when requesting a VCS release.")
(repo (repo
:initarg :repo :initarg :repo
:reader project-repo) :reader project-repo)
(visible-releases
:initform nil
:accessor vcs-project-visible-releases)
(releases-by-spec (releases-by-spec
:initform (make-hash-table :test 'equal) :initform (make-hash-table :test 'equal)
:accessor vcs-project-releases-by-spec))) :accessor vcs-project-releases-by-spec)))
(defmethod project-releases ((project vcs-project)) (defmethod project-releases ((project vcs-project))
(hash-table-values (vcs-project-releases-by-spec project))) (vcs-project-visible-releases project))
(defmethod project-release ((project vcs-project) (version string) &optional (error t)) (defmethod project-release ((project vcs-project) (version string) &optional (error t))
"A release named by a string is assumed to refer to a commit." "A release named by a string is assumed to refer to a commit."
...@@ -178,9 +188,6 @@ local override when requesting a VCS release.") ...@@ -178,9 +188,6 @@ local override when requesting a VCS release.")
(declare (ignore error)) (declare (ignore error))
(apply #'project-vcs-release project version)) (apply #'project-vcs-release project version))
(defmethod project-releases ((project vcs-project))
(hash-table-values (vcs-project-releases-by-spec project)))
(defmethod project-vcs-release ((project vcs-project) &key commit branch tag ref) (defmethod project-vcs-release ((project vcs-project) &key commit branch tag ref)
(let* ((ref (cond (let* ((ref (cond
(commit `(:commit ,commit)) (commit `(:commit ,commit))
...@@ -189,6 +196,7 @@ local override when requesting a VCS release.") ...@@ -189,6 +196,7 @@ local override when requesting a VCS release.")
(ref `(:ref ,ref)))) (ref `(:ref ,ref))))
(release (ensure-gethash ref (vcs-project-releases-by-spec project) (release (ensure-gethash ref (vcs-project-releases-by-spec project)
(make-vcs-release (project-source project) project ref)))) (make-vcs-release (project-source project) project ref))))
(pushnew release (vcs-project-visible-releases project))
(unless commit (unless commit
(setf release (ensure-gethash `(:commit ,(vcs-release-commit release)) (vcs-project-releases-by-spec project) (setf release (ensure-gethash `(:commit ,(vcs-release-commit release)) (vcs-project-releases-by-spec project)
release))) release)))
......
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