mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2026-04-06 21:20:33 +02:00
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>
This commit is contained in:
@@ -344,4 +344,13 @@ error procedure has been called."
|
||||
(let ((sexp error-called? (test-generate-git-source "1.0.0" "2.0.0")))
|
||||
error-called?))
|
||||
|
||||
(test-equal "tarball-url->git-repository-url, guile"
|
||||
'("https://https.git.savannah.gnu.org/git/guile.git"
|
||||
"https://gitlab.gnome.org/GNOME/brasero.git"
|
||||
"https://github.com/aide/aide")
|
||||
(map tarball-url->git-repository-url
|
||||
'("mirror://gnu/guile/guile-3.0.11.tar.gz"
|
||||
"mirror://gnome/sources/brasero/3.12/brasero-3.12.3.tar.xz"
|
||||
"https://github.com/aide/aide/releases/download/v0.19.3/aide-0.19.3.tar.gz")))
|
||||
|
||||
(test-end "import-utils")
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user