packages: Use origin file names as their input labels.

* guix/packages.scm (add-input-label): Rely on 'origin-actual-file-name' for
internal inputs labels.
* tests/packages.scm ("this-package-input, origin"): New test.
* doc/guix.texi (package Reference): Mention origin lookup for
‘lookup-package-input’ & co.
* gnu/packages/base.scm (tzdata)[inputs]: Reintroduce label.
* gnu/packages/tex.scm (texlive-hyphen-complete)[inputs]: Likewise.
(texlive-newverbs)[native-inputs]: Likewise.

Change-Id: I6ba5352b1b1b8ab810da3730b09cb9db61d6429c
Co-authored-by: Simon Tournier <zimon.toutoune@gmail.com>
This commit is contained in:
Ludovic Courtès 2024-12-04 18:26:07 +01:00
parent e9e4b2fafd
commit f8f005815e
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
5 changed files with 41 additions and 20 deletions

View file

@ -8061,8 +8061,8 @@ inputs.
Look up @var{name} among @var{package}'s inputs (or native, propagated, Look up @var{name} among @var{package}'s inputs (or native, propagated,
or direct inputs). Return it if found, @code{#f} otherwise. or direct inputs). Return it if found, @code{#f} otherwise.
@var{name} is the name of a package depended on. Here's how you might @var{name} is the name of a package or the file name of an origin
use it: depended on. Here's how you might use it:
@lisp @lisp
(use-modules (guix packages) (gnu packages base)) (use-modules (guix packages) (gnu packages base))
@ -8073,6 +8073,10 @@ use it:
In this example we obtain the @code{gmp} package that is among the In this example we obtain the @code{gmp} package that is among the
direct inputs of @code{coreutils}. direct inputs of @code{coreutils}.
When looking up an origin, use the name that appears in the origin's
@code{file-name} field or its default file name---e.g.,
@code{"foo-1.2.tar.gz"}.
@end deffn @end deffn
@cindex development inputs, of a package @cindex development inputs, of a package

View file

@ -1778,14 +1778,17 @@ (define-public tzdata
(delete-file-recursively (delete-file-recursively
(string-append out "/share/zoneinfo-leaps"))))) (string-append out "/share/zoneinfo-leaps")))))
(delete 'configure)))) (delete 'configure))))
(inputs (list (origin (inputs `(("_"
(method url-fetch) ;; Note: The "_" label above is here to avoid a full rebuild.
(uri (string-append ;; TODO: Remove it on next rebuild cycle.
"https://data.iana.org/time-zones/releases/tzcode" ,(origin
version ".tar.gz")) (method url-fetch)
(sha256 (uri (string-append
(base32 "https://data.iana.org/time-zones/releases/tzcode"
"07hn7hn2klw4dfyr673ril2nrk18198hbfv25gljsvc833hzk9g9"))))) version ".tar.gz"))
(sha256
(base32
"07hn7hn2klw4dfyr673ril2nrk18198hbfv25gljsvc833hzk9g9"))))))
(home-page "https://www.iana.org/time-zones") (home-page "https://www.iana.org/time-zones")
(synopsis "Database of current and historical time zones") (synopsis "Database of current and historical time zones")
(description "The Time Zone Database (often called tz or zoneinfo) (description "The Time Zone Database (often called tz or zoneinfo)

View file

@ -706,14 +706,15 @@ (define-public texlive-hyphen-complete
(string-append "File.join(\"" ptex "\""))) (string-append "File.join(\"" ptex "\"")))
(invoke "ruby" "generate-ptex-patterns.rb")))))))) (invoke "ruby" "generate-ptex-patterns.rb"))))))))
(native-inputs (native-inputs
(list ruby-2.7 ;; TODO: Remove input labels on next rebuild cycle.
ruby-hydra-minimal/pinned `(("ruby" ,ruby-2.7)
;; Build phase requires "docstrip.tex" from TEXLIVE-LATEX. ("ruby-hydra-minimal" ,ruby-hydra-minimal/pinned)
;; However, adding this package to native inputs would initiate ;; Build phase requires "docstrip.tex" from TEXLIVE-LATEX.
;; a circular dependency. To work around this, use TEXLIVE-LATEX ;; However, adding this package to native inputs would initiate
;; source, then add "docstrip.tex" to TEXINPUTS before build. ;; a circular dependency. To work around this, use TEXLIVE-LATEX
(package-source texlive-latex) ;; source, then add "docstrip.tex" to TEXINPUTS before build.
texlive-tex)) ("_" ,(package-source texlive-latex))
("texlive-tex" ,texlive-tex)))
(home-page "https://ctan.org/pkg/hyph-utf8") (home-page "https://ctan.org/pkg/hyph-utf8")
(synopsis "Hyphenation patterns expressed in UTF-8") (synopsis "Hyphenation patterns expressed in UTF-8")
(description (description
@ -65048,7 +65049,9 @@ (define-public texlive-newverbs
"tex/generic/ydoc/ydocstrip.tex") "tex/generic/ydoc/ydocstrip.tex")
"build/") "build/")
(setenv "TEXINPUTS" (string-append (getcwd) "/build:"))))))) (setenv "TEXINPUTS" (string-append (getcwd) "/build:")))))))
(native-inputs (list (package-source texlive-ydoc))) (native-inputs
;; TODO: Remove input label on next rebuild cycle.
`(("_" ,(package-source texlive-ydoc))))
(home-page "https://ctan.org/pkg/newverbs") (home-page "https://ctan.org/pkg/newverbs")
(synopsis "Define new versions of @code{\\verb}") (synopsis "Define new versions of @code{\\verb}")
(description (description

View file

@ -678,6 +678,9 @@ (define (add-input-label input)
"_") "_")
,obj ,obj
,@(if (string=? output "out") '() (list output))))) ,@(if (string=? output "out") '() (list output)))))
((? origin? origin)
;; Allow references to origins by their file name.
(list (or (origin-actual-file-name origin) "_") origin))
(x (x
`("_" ,x)))) `("_" ,x))))

View file

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012-2023 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2012-2024 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> ;;; Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com> ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be> ;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
@ -2051,6 +2051,14 @@ (define (list->set* lst)
(dummy-package "a" (dummy-package "a"
(arguments (this-package-native-input "hello"))))) (arguments (this-package-native-input "hello")))))
(test-equal "this-package-input, origin"
"http://example.org/foo.tar.gz"
(origin-uri
(package-arguments
(dummy-package "a"
(inputs (list (dummy-origin (uri "http://example.org/foo.tar.gz"))))
(arguments (this-package-input "foo.tar.gz"))))))
(test-eq "modify-inputs, replace" (test-eq "modify-inputs, replace"
coreutils coreutils
;; Replace an input; notice that the label in unchanged. ;; Replace an input; notice that the label in unchanged.