mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2026-04-06 13:10:33 +02:00
style: Add git-source rule.
* guix/scripts/style.scm (transform-to-git-fetch) (url-fetch->git-fetch): New procedures. * doc/guix.texi: Add entry for git-source. * tests/style.scm: Add tests for url-fetch->git-fetch. Change-Id: I6192fba4d84619b81fbc75850542b9dbd2326d4a Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
committed by
Ludovic Courtès
parent
0533284354
commit
a1b0fde434
@@ -15801,6 +15801,49 @@ Note that changes made by the @code{arguments} rule do not entail a
|
||||
rebuild of the affected packages. Furthermore, if a package definition
|
||||
happens to be using G-expressions already, @command{guix style} leaves
|
||||
it unchanged.
|
||||
|
||||
@item git-source
|
||||
If the @code{home-page} is a Git repository (as per
|
||||
@code{git-repository-url?}), and the actual Git repository is tagged
|
||||
with @code{version} or @code{(string-append ``v'' version)}, change the
|
||||
package origin to the @code{git-fetch} method
|
||||
(@pxref{origin Reference}). Consider this example:
|
||||
|
||||
@lisp
|
||||
(define-public guile-json-4
|
||||
(package
|
||||
(inherit guile-json-3)
|
||||
(name "guile-json")
|
||||
(version "4.7.3")
|
||||
(source (origin
|
||||
(method url-fetch)
|
||||
(uri (string-append "mirror://savannah/guile-json/guile-json-"
|
||||
version ".tar.gz"))
|
||||
(sha256
|
||||
(base32
|
||||
"127k2xc07w1gnyqs40z4865l8p3ra5xgpcn569dz04lxsa709fiq"))))))
|
||||
@end lisp
|
||||
|
||||
@noindent
|
||||
Running @command{guix style -S git-source} on this package would rewrite
|
||||
its @code{source} field like to:
|
||||
|
||||
@lisp
|
||||
(define-public guile-json-4
|
||||
(package
|
||||
(inherit guile-json-3)
|
||||
(name "guile-json")
|
||||
(version "4.7.3")
|
||||
(source (origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference (url
|
||||
"https://github.com/aconchillo/guile-json")
|
||||
(commit version)))
|
||||
(file-name (git-file-name name version))
|
||||
(sha256 (base32
|
||||
"0akhm8xjv8fl55fyq0w6c9c6hi5j7mifjx01w07np7qg1cjl9f06"))))))
|
||||
@end lisp
|
||||
|
||||
@end table
|
||||
|
||||
@item --list-stylings
|
||||
|
||||
Reference in New Issue
Block a user