Skip to content
This repository
Browse code

Verify results of 'newest-voom-ver-by-spec against 'get-voom-version

  • Loading branch information...
commit c51fe50bada18cb87e3db87ba72b249c0c643027 1 parent b52aa2e
Chris Houser Chouser authored

Showing 1 changed file with 19 additions and 5 deletions. Show diff stats Hide diff stats

  1. +19 5 src/leiningen/voom.clj
24 src/leiningen/voom.clj
@@ -461,6 +461,8 @@
461 461
462 462 (declare newest-voom-ver-by-spec)
463 463
  464 +(def verify-newest? true)
  465 +
464 466 (defn print-repo-infos
465 467 [repo-infos]
466 468 (->> repo-infos
@@ -469,7 +471,9 @@
469 471 (dissoc :gitdir)
470 472 (update-in [:sha] #(subs (str % "--------") 0 7)))))
471 473 (sort-by :ctime)
472   - (print-table [:repo :path :proj :version :branch :ctime :sha]))
  474 + (print-table (-> [:repo :path :proj :version :branch :ctime :sha]
  475 + (->/when verify-newest?
  476 + (conj :verify)))))
473 477 (newline))
474 478
475 479 (defn fresh-version [repo-dbs [prj ver :as dep]]
@@ -477,14 +481,17 @@
477 481 (let [voom-meta (merge {:allow-snaps false, :freshen true} voom-meta)]
478 482 (if (not (:freshen voom-meta))
479 483 dep
480   - (let [groups (->> (newest-voom-ver-by-spec repo-dbs prj voom-meta)
  484 + (let [infos (newest-voom-ver-by-spec repo-dbs prj voom-meta)
  485 + groups (->> infos
481 486 (map #(assoc % :voom-ver (format-voom-ver %)))
482 487 (group-by :voom-ver))]
483 488 (case (count groups)
484 489 0 (do (println "No matching version found for:" prj
485 490 (pr-str voom-meta))
486 491 dep)
487   - 1 (assoc dep 1 (key (first groups)))
  492 + 1 (do
  493 + (assert (contains? #{nil :ok} (:verify (first infos))))
  494 + (assoc dep 1 (first infos)))
488 495 (do (print "\nMultiple bump resolutions for:"
489 496 prj (pr-str voom-meta))
490 497 (print-repo-infos (map #(first (val %)) groups))
@@ -615,7 +622,8 @@
615 622 (sh "rm" "-rf" checkout))))
616 623
617 624 (defn box-repo-add
618   - [{:keys [repo gitdir branch sha proj path]}]
  625 + [{:keys [repo gitdir branch sha proj path verify]}]
  626 + (assert (contains? #{nil :ok} verify))
619 627 (if-let [bdir (find-box)]
620 628 (let [sha (str sha)
621 629 pname (-> (str proj)
@@ -1119,7 +1127,13 @@
1119 1127 candidates-g (remove #(seq (sha-successors shabam (:sha %) shas-f))
1120 1128 candidates-f)]
1121 1129 {:keys [sha ctime]} candidates-g]
1122   - {:sha sha
  1130 + {:verify (when verify-newest?
  1131 + (git {:gitdir gitdir} "checkout" (str sha))
  1132 + (let [check-sha (sha/mk (:sha (get-voom-version found-path :gitdir gitdir)))]
  1133 + (if (= check-sha sha)
  1134 + :ok
  1135 + check-sha)))
  1136 + :sha sha
1123 1137 :ctime ctime
1124 1138 :version max-ver-e
1125 1139 :path found-path

0 comments on commit c51fe50

Please sign in to comment.
Something went wrong with that request. Please try again.