Commit d9bd0354 authored by Eric Timmons's avatar Eric Timmons
Browse files

Implement BUNDLE-INSTALL with WITH-CONTEXT

parent 0baaec5a
......@@ -80,32 +80,25 @@
(defun bundle-install (&key clpmfile (validate (constantly t)) no-resolve)
"Given a clpmfile instance, install all releases from its lock file, creating
the lock file if necessary."
(with-bundle-session (clpmfile)
(let* ((clpmfile (get-clpmfile clpmfile))
(lockfile-pathname (clpmfile-lockfile-pathname clpmfile))
(lockfile nil)
(changedp nil))
(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))))
(if (probe-file lockfile-pathname)
(setf lockfile (load-lockfile lockfile-pathname))
(setf lockfile (create-empty-lockfile clpmfile)))
(if no-resolve
(mapc #'install-release (context-releases lockfile))
(progn
;; Nuke the lockfile's requirements so that we pick up deletions from the
;; clpmfile.
;; 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))
(setf lockfile (install-requirements (context-requirements clpmfile)
:context lockfile
:validate (lambda (diff)
(aprog1 (funcall validate diff)
(setf changedp it)))
:update-projects (config-table-keys :bundle :local)))
(when changedp
(save-context lockfile))))
:validate validate
:update-projects (config-table-keys :bundle :local)
:save-context-p t)))))
lockfile)))
......
......@@ -158,7 +158,7 @@ can be named, global contexts, or anonymous."))
(defun call-with-context (thunk context-designator)
(if (context-anonymous-p context-designator)
(let* ((context-name context-designator)
(let* ((context-name (context-name context-designator))
(*default-pathname-defaults* (uiop:pathname-directory-pathname context-name))
(*vcs-project-override-fun* (make-vcs-override-fun *default-pathname-defaults*)))
(with-config-source (:pathname (merge-pathnames ".clpm/bundle.conf"
......@@ -346,8 +346,11 @@ in place with the same name. Return the new requirement if it was modified."
;; * Deserializing
(defun load-anonymous-context-from-pathname (pn)
(if (probe-file pn)
(with-open-file (s pn)
(load-context-from-stream s pn)))
(load-context-from-stream s pn))
(make-instance 'context
:name pn)))
(defun context-downselect-sources (name sources)
(let ((allowed-source-names (config-value :contexts name :sources)))
......
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