Commit 587db331 authored by Eric Timmons's avatar Eric Timmons
Browse files

Handle *FETCH-REPO-AUTOMATICALLY* more sanely

parent 306b38a9
Loading
Loading
Loading
Loading
+4 −8
Original line number Diff line number Diff line
@@ -80,8 +80,7 @@
  "Given a clpmfile instance, install all releases from its lock file, creating
the lock file if necessary."
  (with-bundle-session (clpmfile)
    (let* ((*fetch-repo-automatically* (not (config-value :local)))
           (clpmfile (get-clpmfile clpmfile))
    (let* ((clpmfile (get-clpmfile clpmfile))
           (lockfile-pathname (clpmfile-lockfile-pathname clpmfile))
           (lockfile nil)
           (changedp nil))
@@ -112,8 +111,7 @@ the lock file if necessary."
(defun bundle-source-registry (&key clpmfile with-client-p ignore-missing-releases)
  (with-bundle-session (clpmfile)
    (with-sources-using-installed-only ()
      (let* ((*fetch-repo-automatically* nil)
             (lockfile-pathname (clpmfile-lockfile-pathname clpmfile))
      (let* ((lockfile-pathname (clpmfile-lockfile-pathname clpmfile))
             (*vcs-project-override-fun* (make-vcs-override-fun (clpmfile-pathname clpmfile)))
             lockfile)
        (unless (probe-file lockfile-pathname)
@@ -134,8 +132,7 @@ the lock file if necessary."
                        update-projects (validate (constantly t))
                        update-systems)
  (with-bundle-session (clpmfile)
    (let* ((*fetch-repo-automatically* (not (config-value :local)))
           (clpmfile (get-clpmfile clpmfile))
    (let* ((clpmfile (get-clpmfile clpmfile))
           (lockfile-pathname (clpmfile-lockfile-pathname clpmfile))
           (*vcs-project-override-fun* (make-vcs-override-fun (clpmfile-pathname clpmfile)))
           (lockfile nil)
@@ -180,8 +177,7 @@ If WITH-CLIENT-P is non-NIL, the clpm-client system is available."
    (error "COMMAND must be a string."))
  (with-bundle-session (clpmfile)
    (with-sources-using-installed-only ()
      (let* ((*fetch-repo-automatically* nil)
             (clpmfile-pathname (clpmfile-pathname clpmfile))
      (let* ((clpmfile-pathname (clpmfile-pathname clpmfile))
             (lockfile-pathname (clpmfile-lockfile-pathname clpmfile))
             (lockfile (load-lockfile lockfile-pathname))
             (cl-source-registry-form (context-to-asdf-source-registry-form lockfile
+3 −1
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@
          #:alexandria
          #:clpm/archives
          #:clpm/cache
          #:clpm/config
          #:clpm/http-client
          #:clpm/log
          #:clpm/repos/defs
@@ -226,13 +227,14 @@ ref is present locally, fetching or cloning the repo as necessary."
         (when (and (or (eql ref-type :branch)
                        (starts-with-subseq "refs/heads/" ref-name)
                        (not (ref-present-p repo ref)))
                    (not (config-value :local))
                    *fetch-repo-automatically*)
           (with-retries (:max 10 :sleep 5)
             (fetch-repo! repo))
           ;; Make sure the ref is actually present, raising an error otherwise.
           (unless (ref-present-p repo ref)
             (error "ref ~S is not present" ref))))
        (*fetch-repo-automatically*
        ((and (not (config-value :local)) *fetch-repo-automatically*)
         ;; Repo is not present at all, need to clone it.
         (with-retries (:max 10 :sleep 5)
           (clone-repo! repo)
+3 −1
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@
    (:use #:cl
          #:alexandria
          #:clpm/config
          #:clpm/repos/defs
          #:clpm/sources/clpi
          #:clpm/sources/defs
          #:clpm/sources/fs
@@ -39,7 +40,8 @@
(defvar *sources-use-installed-only-p* nil)

(defun call-with-sources-using-installed-only (thunk)
  (let ((*sources-use-installed-only-p* t))
  (let ((*sources-use-installed-only-p* t)
        (*fetch-repo-automatically* nil))
    (funcall thunk)))

(defmacro with-sources-using-installed-only (() &body body)