From 16ef7b4938b14e68f8ca7504c9614f84530572ed Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Sat, 4 Sep 2021 19:07:52 +0200 Subject: 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. --- tests/transformations.scm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'tests') 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 +;;; Copyright © 2021 Marius Bakke ;;; ;;; 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)))) -- cgit 1.4.1