GNU bug report logs - #73073
[PATCH 0/6] Allow origin with label as inputs.

Previous Next

Package: guix-patches;

Reported by: Simon Tournier <zimon.toutoune <at> gmail.com>

Date: Fri, 6 Sep 2024 15:52:01 UTC

Severity: normal

Tags: moreinfo, patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #97 received at 73073 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: 73073 <at> debbugs.gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>,
 Simon Tournier <zimon.toutoune <at> gmail.com>
Subject: [PATCH v3 1/8] packages: Use origin file names as their input labels.
Date: Wed,  4 Dec 2024 18:54:22 +0100
* 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.
* 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 <at> gmail.com>
---
 gnu/packages/base.scm | 19 +++++++++++--------
 gnu/packages/tex.scm  | 21 ++++++++++++---------
 guix/packages.scm     |  3 +++
 tests/packages.scm    | 10 +++++++++-
 4 files changed, 35 insertions(+), 18 deletions(-)

diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index b3f54798c4..a5a05e32f0 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -1778,14 +1778,17 @@ (define-public tzdata
                      (delete-file-recursively
                       (string-append out "/share/zoneinfo-leaps")))))
                (delete 'configure))))
-    (inputs (list (origin
-                    (method url-fetch)
-                    (uri (string-append
-                          "https://data.iana.org/time-zones/releases/tzcode"
-                          version ".tar.gz"))
-                    (sha256
-                     (base32
-                      "07hn7hn2klw4dfyr673ril2nrk18198hbfv25gljsvc833hzk9g9")))))
+    (inputs `(("_"
+               ;; Note: The "_" label above is here to avoid a full rebuild.
+               ;; TODO: Remove it on next rebuild cycle.
+               ,(origin
+                  (method url-fetch)
+                  (uri (string-append
+                        "https://data.iana.org/time-zones/releases/tzcode"
+                        version ".tar.gz"))
+                  (sha256
+                   (base32
+                    "07hn7hn2klw4dfyr673ril2nrk18198hbfv25gljsvc833hzk9g9"))))))
     (home-page "https://www.iana.org/time-zones")
     (synopsis "Database of current and historical time zones")
     (description "The Time Zone Database (often called tz or zoneinfo)
diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm
index 0444b9270d..9104b079a2 100644
--- a/gnu/packages/tex.scm
+++ b/gnu/packages/tex.scm
@@ -706,14 +706,15 @@ (define-public texlive-hyphen-complete
                      (string-append "File.join(\"" ptex "\"")))
                   (invoke "ruby" "generate-ptex-patterns.rb"))))))))
     (native-inputs
-     (list ruby-2.7
-           ruby-hydra-minimal/pinned
-           ;; Build phase requires "docstrip.tex" from TEXLIVE-LATEX.
-           ;; However, adding this package to native inputs would initiate
-           ;; a circular dependency.  To work around this, use TEXLIVE-LATEX
-           ;; source, then add "docstrip.tex" to TEXINPUTS before build.
-           (package-source texlive-latex)
-           texlive-tex))
+     ;; TODO: Remove input labels on next rebuild cycle.
+     `(("ruby" ,ruby-2.7)
+       ("ruby-hydra-minimal" ,ruby-hydra-minimal/pinned)
+       ;; Build phase requires "docstrip.tex" from TEXLIVE-LATEX.
+       ;; However, adding this package to native inputs would initiate
+       ;; a circular dependency.  To work around this, use TEXLIVE-LATEX
+       ;; source, then add "docstrip.tex" to TEXINPUTS before build.
+       ("_" ,(package-source texlive-latex))
+       ("texlive-tex" ,texlive-tex)))
     (home-page "https://ctan.org/pkg/hyph-utf8")
     (synopsis "Hyphenation patterns expressed in UTF-8")
     (description
@@ -65048,7 +65049,9 @@ (define-public texlive-newverbs
                                                "tex/generic/ydoc/ydocstrip.tex")
                             "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")
     (synopsis "Define new versions of @code{\\verb}")
     (description
diff --git a/guix/packages.scm b/guix/packages.scm
index 0ce3276051..84f2c6f838 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -678,6 +678,9 @@ (define (add-input-label input)
               "_")
          ,obj
          ,@(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))))
 
diff --git a/tests/packages.scm b/tests/packages.scm
index 7c28e75c45..1d901505aa 100644
--- a/tests/packages.scm
+++ b/tests/packages.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012-2023 Ludovic Courtès <ludo <at> gnu.org>
+;;; Copyright © 2012-2024 Ludovic Courtès <ludo <at> gnu.org>
 ;;; Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke <at> gnu.org>
 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
 ;;; Copyright © 2021 Maxime Devos <maximedevos <at> telenet.be>
@@ -2051,6 +2051,14 @@ (define compressors '(("gzip"  . "gz")
    (dummy-package "a"
      (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"
   coreutils
   ;; Replace an input; notice that the label in unchanged.
-- 
2.46.0





This bug report was last modified 237 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.