mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-13 14:40:21 -05:00
import: print: Improve origin method name guesswork.
Fixes <https://bugs.gnu.org/47375>. Reported by Léo Le Bouter <lle-bout@zaclys.net>. * guix/import/print.scm (package->code): For METHOD, use 'variable-name' preferably, and call 'procedure-name' as a last resort.
This commit is contained in:
parent
4ac3e010c9
commit
96aa98b6ca
1 changed files with 10 additions and 1 deletions
|
@ -79,7 +79,16 @@ (define (source->code source version)
|
||||||
(file-name (origin-file-name source))
|
(file-name (origin-file-name source))
|
||||||
(patches (origin-patches source)))
|
(patches (origin-patches source)))
|
||||||
`(origin
|
`(origin
|
||||||
(method ,(procedure-name method))
|
;; Since 'procedure-name' returns the procedure name within the
|
||||||
|
;; module where it's defined, not its public name. Thus, try hard to
|
||||||
|
;; find its public name and use 'procedure-name' as a last resort.
|
||||||
|
(method ,(or (any (lambda (module)
|
||||||
|
(variable-name method module))
|
||||||
|
'((guix download)
|
||||||
|
(guix git-download)
|
||||||
|
(guix hg-download)
|
||||||
|
(guix svn-download)))
|
||||||
|
(procedure-name method)))
|
||||||
(uri (string-append ,@(match (factorize-uri uri version)
|
(uri (string-append ,@(match (factorize-uri uri version)
|
||||||
((? string? uri) (list uri))
|
((? string? uri) (list uri))
|
||||||
(factorized factorized))))
|
(factorized factorized))))
|
||||||
|
|
Loading…
Reference in a new issue