diff options
author | Maxime Devos <maximedevos@telenet.be> | 2021-09-07 13:24:24 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2021-09-18 19:43:00 +0200 |
commit | 808f9ffbd3106da4c92d2367b118b98196c9e81e (patch) | |
tree | d04e6d7e45fab4c7c4a1c0d29ff9950b086e1361 | |
parent | 8480a2a5bb360b432877dd33dca80a61c5a698eb (diff) | |
download | guix-808f9ffbd3106da4c92d2367b118b98196c9e81e.tar.gz |
import: minetest: Strip "v" prefixes from the version number.
This fixes one of the issues noted at <https://issues.guix.gnu.org/50425#4>. * guix/import/minetest.scm (release-version): New procedure. (%minetest->guix-package): Call new procedure instead of release-title. * tests/minetest.scm (make-package-sexp): Allow overriding the version number. (make-releases-json): Allow overriding the release title. ("conventional version number") ("v-prefixed version number") ("dates as version number"): New tests. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
-rw-r--r-- | guix/import/minetest.scm | 10 | ||||
-rw-r--r-- | tests/minetest.scm | 23 |
2 files changed, 27 insertions, 6 deletions
diff --git a/guix/import/minetest.scm b/guix/import/minetest.scm index c8209aba79..29bf12d123 100644 --- a/guix/import/minetest.scm +++ b/guix/import/minetest.scm @@ -337,6 +337,14 @@ official Minetest forum and the Git repository (if any)." (and=> (package-forums package) topic->url-sexp) (package-repository package))) +(define (release-version release) + "Guess the version of RELEASE from the release title." + (define title (release-title release)) + (if (string-prefix? "v" title) + ;; Remove "v" prefix from release titles like ‘v1.0.1’. + (substring title 1) + title)) + ;; If the default sort key is changed, make sure to modify 'show-help' ;; in (guix scripts import minetest) appropriately as well. (define %default-sort-key "score") @@ -436,7 +444,7 @@ list of AUTHOR/NAME strings." (define important-upstream-dependencies (important-dependencies dependencies author/name #:sort sort)) (values (make-minetest-sexp author/name - (release-title release) ; version + (release-version release) (package-repository package) (release-commit release) important-upstream-dependencies diff --git a/tests/minetest.scm b/tests/minetest.scm index 80e2697a3d..6998c9a70b 100644 --- a/tests/minetest.scm +++ b/tests/minetest.scm @@ -33,6 +33,10 @@ (define* (make-package-sexp #:key (guix-name "minetest-foo") + ;; This is not a proper version number but + ;; ContentDB often does not include version + ;; numbers. + (version "2021-07-25") (home-page "https://example.org/foo") (repo "https://example.org/foo.git") (synopsis "synopsis") @@ -44,9 +48,7 @@ #:allow-other-keys) `(package (name ,guix-name) - ;; This is not a proper version number but ContentDB does not include - ;; version numbers. - (version "2021-07-25") + (version ,version) (source (origin (method git-fetch) @@ -106,14 +108,14 @@ author "/" name "/download/")) ("website" . ,website))) -(define* (make-releases-json #:key (commit #f) (title "") #:allow-other-keys) +(define* (make-releases-json #:key (commit #f) (title "2021-07-25") #:allow-other-keys) `#((("commit" . ,commit) ("downloads" . 469) ("id" . 8614) ("max_minetest_version" . null) ("min_minetest_version" . null) ("release_date" . "2021-07-25T01:10:23.207584") - ("title" . "2021-07-25")))) + ("title" . ,title)))) (define* (make-dependencies-json #:key (author "Author") (name "foo") @@ -293,6 +295,17 @@ during a dynamic extent where that package is available on ContentDB." #:repo 'null) +;; Determining the version number + +(test-package "conventional version number" #:version "1.2.3" #:title "1.2.3") +;; See e.g. orwell/basic_trains +(test-package "v-prefixed version number" #:version "1.2.3" #:title "v1.2.3") +;; Many mods on ContentDB use dates as release titles. In that case, the date +;; will have to do. +(test-package "dates as version number" + #:version "2021-01-01" #:title "2021-01-01") + + ;; Dependencies (test-package* "minetest->guix-package, unambigious dependency" |