Commit 1fad6268 authored by Eric Timmons's avatar Eric Timmons
Browse files

Implement BUNDLE-UPDATE with WITH-CONTEXT

parent d9bd0354
......@@ -109,37 +109,30 @@ the lock file if necessary."
(defun bundle-update (&key clpmfile
update-projects (validate (constantly t))
update-systems)
(with-bundle-session (clpmfile)
(let* ((clpmfile (get-clpmfile clpmfile))
(lockfile-pathname (clpmfile-lockfile-pathname clpmfile))
(lockfile nil)
(changedp nil))
(unless (probe-file lockfile-pathname)
;; There is no lock file currently. Just fall back to BUNDLE-INSTALL.
(return-from bundle-update
(bundle-install :clpmfile clpmfile :validate validate)))
;; Load the existing lockfile
(setf lockfile (load-lockfile lockfile-pathname))
(unless (config-value :local)
(dolist (s (context-sources clpmfile))
(unless (source-can-lazy-sync-p s)
(sync-source s))))
;; Map all update systems to their projects.
(dolist (system update-systems)
(when-let* ((system-release (find system (context-system-releases lockfile)
:key (compose #'system-name #'system-release-system)
:test #'equal))
(release (system-release-release system-release))
(project-name (project-name (release-project release))))
(pushnew project-name update-projects :test #'equal)))
(setf lockfile (install-requirements (context-requirements clpmfile)
:context lockfile
:validate (lambda (diff)
(aprog1 (funcall validate diff)
(setf changedp it)))
:update-projects (or update-projects t)))
(when changedp
(save-context lockfile)))))
(with-clpm-session ()
(with-context (lockfile (clpmfile-pathname clpmfile))
(let ((clpmfile (get-clpmfile clpmfile)))
(unless (config-value :local)
(dolist (s (context-sources clpmfile))
(unless (source-can-lazy-sync-p s)
(sync-source s))))
;; Map all update systems to their projects.
(dolist (system update-systems)
(when-let* ((system-release (find system (context-system-releases lockfile)
:key (compose #'system-name #'system-release-system)
:test #'equal))
(release (system-release-release system-release))
(project-name (project-name (release-project release))))
(pushnew project-name update-projects :test #'equal)))
;; Nuke the lockfile's requirements so that we pick up deletions
;; from the clpmfile.
(setf (context-requirements lockfile) nil)
(setf (context-user-sources lockfile) (context-user-sources clpmfile))
(install-requirements (context-requirements clpmfile)
:context lockfile
:validate validate
:update-projects (or update-projects t)
:save-context-p t)))))
(defun bundle-exec (command args &key clpmfile
with-client-p)
......
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