summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2026-03-04 21:48:22 +0100
committerLudovic Courtès <ludo@gnu.org>2026-03-10 22:53:54 +0100
commit78ddf62bfe2264c0085fdce4b2cbcad07f6eaf16 (patch)
tree480f058d1672b0578e4aacac6de77b992bf63eaa /tests
parentfeb52586ecabbde4c5003e106e0a8dd4b9a3add9 (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')
-rw-r--r--tests/import/utils.scm9
-rw-r--r--tests/style.scm37
2 files changed, 45 insertions, 1 deletions
diff --git a/tests/import/utils.scm b/tests/import/utils.scm
index b631ba23268..c82fef78ec7 100644
--- a/tests/import/utils.scm
+++ b/tests/import/utils.scm
@@ -344,4 +344,13 @@ error procedure has been called."
344 (let ((sexp error-called? (test-generate-git-source "1.0.0" "2.0.0"))) 344 (let ((sexp error-called? (test-generate-git-source "1.0.0" "2.0.0")))
345 error-called?)) 345 error-called?))
346 346
347(test-equal "tarball-url->git-repository-url, guile"
348 '("https://https.git.savannah.gnu.org/git/guile.git"
349 "https://gitlab.gnome.org/GNOME/brasero.git"
350 "https://github.com/aide/aide")
351 (map tarball-url->git-repository-url
352 '("mirror://gnu/guile/guile-3.0.11.tar.gz"
353 "mirror://gnome/sources/brasero/3.12/brasero-3.12.3.tar.xz"
354 "https://github.com/aide/aide/releases/download/v0.19.3/aide-0.19.3.tar.gz")))
355
347(test-end "import-utils") 356(test-end "import-utils")
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 @@
1;;; GNU Guix --- Functional package management for GNU 1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2021-2024 Ludovic Courtès <ludo@gnu.org> 2;;; Copyright © 2021-2024, 2026 Ludovic Courtès <ludo@gnu.org>
3;;; 3;;;
4;;; This file is part of GNU Guix. 4;;; This file is part of GNU Guix.
5;;; 5;;;
@@ -669,6 +669,41 @@
669 (cut string-contains <> "patches"))))))) 669 (cut string-contains <> "patches")))))))
670 "1")) 670 "1"))
671 671
672(unless (false-if-exception
673 (getaddrinfo "https.git.savannah.gnu.org" "https"))
674 (test-skip 1))
675(test-equal "url-fetch->git-fetch, mirror:// URL"
676 '(origin
677 (method git-fetch)
678 (uri (git-reference
679 (url "https://https.git.savannah.gnu.org/git/sed.git")
680 (commit (string-append "v" version))))
681 (file-name (git-file-name name version))
682 (sha256
683 (base32
684 "00p6v3aa22jz365scmifr06fspkylzrvbqda0waz4x06q5qv0263")))
685 (call-with-test-package
686 '((version "4.9")
687 (source
688 (origin
689 (method url-fetch)
690 (uri (string-append "mirror://gnu/sed/sed-"
691 version ".tar.gz"))
692 (sha256
693 (base32 "0000000000000000000000000000000000000000000000000000")))))
694 (lambda (directory)
695 (define file
696 (string-append directory "/my-packages-1.scm"))
697
698 ;; Note: This ends up cloning the 'sed' repository on Savannah.
699 (system* "guix" "style" "-L" directory "-S" "git-source" "my-coreutils-1")
700
701 (load file)
702 (call-with-input-string (read-package-field
703 (@ (my-packages-1) my-coreutils-1) 'source 8)
704 read))
705 "1"))
706
672(test-assert "url-fetch->git-fetch, non-git home-page unchanged" 707(test-assert "url-fetch->git-fetch, non-git home-page unchanged"
673 (call-with-test-package 708 (call-with-test-package
674 '((home-page "https://www.example.com") 709 '((home-page "https://www.example.com")