diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2026-03-04 21:48:22 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2026-03-10 22:53:54 +0100 |
| commit | 78ddf62bfe2264c0085fdce4b2cbcad07f6eaf16 (patch) | |
| tree | 480f058d1672b0578e4aacac6de77b992bf63eaa /tests/style.scm | |
| parent | feb52586ecabbde4c5003e106e0a8dd4b9a3add9 (diff) | |
style: git-source: Handle more URLs.
* guix/import/utils.scm (tarball-url->git-repository-url): New procedure.
* guix/scripts/style.scm (url-fetch->git-fetch)[transform-source]: Add
‘repository-url’ parameter.
Use ‘tarball-url->git-repository-url’ when ‘home-page’ is not a Git URL.
(transform-to-git-fetch): Rename ‘home-page’ to ‘repository-url’.
* tests/import/utils.scm ("tarball-url->git-repository-url, guile"): New test.
* tests/style.scm ("url-fetch->git-fetch, mirror:// URL"): New test.
Change-Id: I4f8ca7c67a58f917d69380678b62c00962b0f9cd
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'tests/style.scm')
| -rw-r--r-- | tests/style.scm | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/tests/style.scm b/tests/style.scm index bc918a68bbd..350feed22b0 100644 --- a/tests/style.scm +++ b/tests/style.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2021-2024 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2021-2024, 2026 Ludovic Courtès <ludo@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -669,6 +669,41 @@ (cut string-contains <> "patches"))))))) "1")) +(unless (false-if-exception + (getaddrinfo "https.git.savannah.gnu.org" "https")) + (test-skip 1)) +(test-equal "url-fetch->git-fetch, mirror:// URL" + '(origin + (method git-fetch) + (uri (git-reference + (url "https://https.git.savannah.gnu.org/git/sed.git") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "00p6v3aa22jz365scmifr06fspkylzrvbqda0waz4x06q5qv0263"))) + (call-with-test-package + '((version "4.9") + (source + (origin + (method url-fetch) + (uri (string-append "mirror://gnu/sed/sed-" + version ".tar.gz")) + (sha256 + (base32 "0000000000000000000000000000000000000000000000000000"))))) + (lambda (directory) + (define file + (string-append directory "/my-packages-1.scm")) + + ;; Note: This ends up cloning the 'sed' repository on Savannah. + (system* "guix" "style" "-L" directory "-S" "git-source" "my-coreutils-1") + + (load file) + (call-with-input-string (read-package-field + (@ (my-packages-1) my-coreutils-1) 'source 8) + read)) + "1")) + (test-assert "url-fetch->git-fetch, non-git home-page unchanged" (call-with-test-package '((home-page "https://www.example.com") |
