New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Versions out of order #210

Closed
arrdem opened this Issue Jul 1, 2015 · 2 comments

Comments

Projects
None yet
2 participants
@arrdem
Contributor

arrdem commented Jul 1, 2015

http://conj.io/store/v1/org.clojure/clojure

Consequently the "LATEST" tag is going to an old version. Fixit.

@arrdem arrdem added the bug label Jul 1, 2015

@arrdem arrdem self-assigned this Jul 1, 2015

@arrdem arrdem added this to the 0.4.21 milestone Jul 1, 2015

@jafingerhut

This comment has been minimized.

Show comment
Hide comment
@jafingerhut

jafingerhut Jul 9, 2015

Steal this code if it is useful:

;; (require '[clojure.string :as str])

;; user=> (sort-by f ["1.7.0" "1.5.1" "1.5.0" "1.5.0-beta15" "1.5.0-beta14" "1.7.0-RC2"])
;; ("1.5.0-beta14" "1.5.0-beta15" "1.5.0" "1.5.1" "1.7.0-RC2" "1.7.0")

(defn clojure-version-cmp-key
  "Create a comparison key from a Clojure version string, as returned
from function clojure.core/clojure-version.  The key is a vector of
integers and strings, and two such keys may be compared via
clojure.core/compare to get the correct relative order of the two
Clojure versions.

Makes simplifying assumption that x.y.z-alpha<n> < x.y.z-beta<m> <
x.y.z-RC<p> < x.y.z.  Note that this was not the time order of release
for some 1.5.0-beta and 1.5.0-RC releases, historically, as they
switched from 1.5.0-RC releases back to 1.5.0-beta, and then back to
1.5.0-RC again.  Hopefully that will not happen again."
  [version-str]
  (let [to-long (fn [^String s] (Long/parseLong s))
        [major minor x] (str/split version-str #"\." -1)
        [incremental x] (str/split x #"-" -1)
        ;; qual1 will be one of "alpha" "beta" "rc", or "zfinal" if
        ;; version-str is of the form "x.y.z".  It will always be
        ;; lower case so that normal alphabetic order comparison is
        ;; used, without weirdness of upper case letters being sorted
        ;; earlier than lower case letters.
        [qual1 qual2] (if x
                        (if-let [[_ a b] (re-matches #"^(?i)(alpha|beta|rc)(\d+)$" x)]
                          [(str/lower-case a) (to-long b)]
                          ;; TBD: Is this an error?
                          )
                        ["zfinal" nil])]
    [(to-long major) (to-long minor) (to-long incremental) qual1 qual2]))

jafingerhut commented Jul 9, 2015

Steal this code if it is useful:

;; (require '[clojure.string :as str])

;; user=> (sort-by f ["1.7.0" "1.5.1" "1.5.0" "1.5.0-beta15" "1.5.0-beta14" "1.7.0-RC2"])
;; ("1.5.0-beta14" "1.5.0-beta15" "1.5.0" "1.5.1" "1.7.0-RC2" "1.7.0")

(defn clojure-version-cmp-key
  "Create a comparison key from a Clojure version string, as returned
from function clojure.core/clojure-version.  The key is a vector of
integers and strings, and two such keys may be compared via
clojure.core/compare to get the correct relative order of the two
Clojure versions.

Makes simplifying assumption that x.y.z-alpha<n> < x.y.z-beta<m> <
x.y.z-RC<p> < x.y.z.  Note that this was not the time order of release
for some 1.5.0-beta and 1.5.0-RC releases, historically, as they
switched from 1.5.0-RC releases back to 1.5.0-beta, and then back to
1.5.0-RC again.  Hopefully that will not happen again."
  [version-str]
  (let [to-long (fn [^String s] (Long/parseLong s))
        [major minor x] (str/split version-str #"\." -1)
        [incremental x] (str/split x #"-" -1)
        ;; qual1 will be one of "alpha" "beta" "rc", or "zfinal" if
        ;; version-str is of the form "x.y.z".  It will always be
        ;; lower case so that normal alphabetic order comparison is
        ;; used, without weirdness of upper case letters being sorted
        ;; earlier than lower case letters.
        [qual1 qual2] (if x
                        (if-let [[_ a b] (re-matches #"^(?i)(alpha|beta|rc)(\d+)$" x)]
                          [(str/lower-case a) (to-long b)]
                          ;; TBD: Is this an error?
                          )
                        ["zfinal" nil])]
    [(to-long major) (to-long minor) (to-long incremental) qual1 qual2]))
@arrdem

This comment has been minimized.

Show comment
Hide comment
@arrdem

arrdem Jul 9, 2015

Contributor

Consider it stolen. Thanks Andy.

Contributor

arrdem commented Jul 9, 2015

Consider it stolen. Thanks Andy.

arrdem added a commit that referenced this issue Jul 9, 2015

Merge tag '0.4.22' into develop
Vist 0.4.22 upon the world

 - Fix #210 with a newer lib-grimoire
 - Use clojure 1.7

@arrdem arrdem closed this in d0ae456 Jul 9, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment