summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMarius Bakke <marius@gnu.org>2021-09-04 19:07:52 +0200
committerMarius Bakke <marius@gnu.org>2021-09-08 18:03:50 +0200
commit16ef7b4938b14e68f8ca7504c9614f84530572ed (patch)
tree8e301c083c414d41875c4ab171bd90c7ee328b20 /tests
parent1dc3825e9940de44c1f170add7bd26d61830ce34 (diff)
downloadguix-16ef7b4938b14e68f8ca7504c9614f84530572ed.tar.gz
transformations: Git tags and 'git describe' style IDs are used as version.
* guix/transformations.scm (commit->version-string): New procedure.  Use git
tags and 'git describe' style identifiers directly.
(transform-package-source-commit): Adjust accordingly.
* tests/transformations.scm
("options->transformation, with-commit, version transformation"): New test.
* doc/guix.texi (Package Transformation Options): Mention the 'git describe'
style.
Diffstat (limited to 'tests')
-rw-r--r--tests/transformations.scm21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/transformations.scm b/tests/transformations.scm
index 3417c994ec..09839dc1c5 100644
--- a/tests/transformations.scm
+++ b/tests/transformations.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2016, 2017, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2021 Marius Bakke <marius@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -235,6 +236,26 @@
                    (string=? (package-name dep2) "chbouib")
                    (package-source dep2))))))))
 
+(test-equal "options->transformation, with-commit, version transformation"
+  '("1.0" "1.0-rc1-2-gabc123" "git.abc123")
+  (map (lambda (commit)
+         (let* ((p (dummy-package "guix.scm"
+                     (inputs `(("foo" ,(dummy-package "chbouib"
+                                         (source (origin
+                                                   (method git-fetch)
+                                                   (uri (git-reference
+                                                         (url "https://example.org")
+                                                         (commit "cabba9e")))
+                                                   (sha256 #f)))))))))
+                (t (options->transformation
+                    `((with-commit . ,(string-append "chbouib=" commit))))))
+           (let ((new (t p)))
+             (and (not (eq? new p))
+                  (match (package-inputs new)
+                    ((("foo" dep1))
+                     (package-version dep1)))))))
+       '("v1.0" "1.0-rc1-2-gabc123" "abc123")))
+
 (test-equal "options->transformation, with-git-url"
   (let ((source (git-checkout (url "https://example.org")
                               (recursive? #t))))