Commit 40d8287b authored by Eric Timmons's avatar Eric Timmons
Browse files

Update version computation for tags

parent 40a69563
Pipeline #2976 canceled with stages
in 19 minutes and 43 seconds
......@@ -58,44 +58,50 @@ NIL until an image is dumped and is set by ~cache-full-version~.")
(parse-integer (clpm-git '("rev-list" "--count" "HEAD" "--not" "origin/master")
:output '(:string :stripped t))))
(defun get-git-tag-p ()
(zerop (nth-value 2
(clpm-git '("describe" "--tags" "--exact-match" "HEAD")
:ignore-error-status t))))
(defun get-git-tag ()
(multiple-value-bind (stdout stderr code)
(clpm-git '("describe" "--tags" "--exact-match" "--match" "v*" "HEAD")
:ignore-error-status t
:output '(:string :stripped t))
(declare (ignore stderr))
(values (zerop code)
stdout)))
(defun get-full-version ()
(if (git-exists-p)
(let ((git-branch (get-git-branch))
(git-describe (get-git-describe))
(git-dirty-p (get-git-dirty-p)))
(if (get-git-tag-p)
;; This is a tagged version, just return the base version number.
(base-version)
;; Here's the fun part, assemble the entire version string.
(let* ((version (cl-semver:read-version-from-string (base-version)))
(primary-version (list (cl-semver:version-major version)
(cl-semver:version-minor version)
(cl-semver:version-patch version)))
(prerelease-category (cl-semver:version-pre-release-identifiers version)))
(unless prerelease-category
(setf prerelease-category '(0)))
(if (equal git-branch "master")
(format nil "~{~A~^.~}-~{~A~^.~}.~A+~A~:[~;-dirty~]"
primary-version
prerelease-category
(second git-describe)
(third git-describe)
git-dirty-p)
(let* ((ancestor (get-git-common-ancestor))
(ancestor-describe (get-git-describe ancestor))
(distance-from-master (get-git-distance-from-master)))
(format nil "~{~A~^.~}-~{~A~^.~}.~A.0.~A.~A+~A~:[~;-dirty~]"
primary-version prerelease-category
(second ancestor-describe)
git-branch
distance-from-master
(multiple-value-bind (git-tag-p git-tag) (get-git-tag)
(if git-tag-p
;; This is a tagged version, just return the tag without a leading
;; v.
(subseq git-tag 1)
;; Here's the fun part, assemble the entire version string.
(let* ((version (cl-semver:read-version-from-string (base-version)))
(primary-version (list (cl-semver:version-major version)
(cl-semver:version-minor version)
(cl-semver:version-patch version)))
(prerelease-category (cl-semver:version-pre-release-identifiers version)))
(unless prerelease-category
(setf prerelease-category '(0)))
(if (equal git-branch "master")
(format nil "~{~A~^.~}-~{~A~^.~}.~A+~A~:[~;-dirty~]"
primary-version
prerelease-category
(second git-describe)
(third git-describe)
git-dirty-p))))))
git-dirty-p)
(let* ((ancestor (get-git-common-ancestor))
(ancestor-describe (get-git-describe ancestor))
(distance-from-master (get-git-distance-from-master)))
(format nil "~{~A~^.~}-~{~A~^.~}.~A.0.~A.~A+~A~:[~;-dirty~]"
primary-version prerelease-category
(second ancestor-describe)
git-branch
distance-from-master
(third git-describe)
git-dirty-p)))))))
;; We don't have git... Best we can currently do is return the base
;; version number.
(base-version)))
......
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