Subject: [bug#73073] [PATCH v2 1/8] guix: packages: Allow origin inside inputs with "new style".

From: Simon Tournier <[email-masked]>
Date: Mon, 16 Sep 2024 22:42:51 +0200

Hi Ludo,

On Mon, 16 Sep 2024 at 22:19, Ludovic Courtès <[email-masked]> wrote:
> Simon Tournier <[email-masked]> skribis:
>
>> * guix/packages.scm (add-input-label): Rely on 'origin-actual-file-name' for
>> internal inputs labels.
>> (maybe-add-input-labels): Special case to avoid world rebuild.
>>
>> Change-Id: I6ba5352b1b1b8ab810da3730b09cb9db61d6429c
>
> [...]
>
>> @@ -444,6 +444,9 @@ (define (maybe-add-input-labels inputs)
>>          ((and (pair? (car inputs))
>>                (string? (caar inputs)))
>>           inputs)
>> +        ((and (origin? (car inputs))    ;XXXX: Remove next world rebuild
>> +              (null? (cdr inputs)))     ;special case tzdata
>> +         (list (list "_" (car inputs))))
>
> I would rather have this hack in ‘tzdata’ itself, along the lines of
> what I sent in a previous message.

Yes, indeed tzdata can temporarily transformed into the old style.  It
avoids the world rebuild and it’s a modification easier to change than
the one about maybe-add-input-labels.  I agree that’s better.

>> @@ -676,6 +679,13 @@ (define (add-input-label input)
>>                "_")
>>           ,obj
>>           ,@(if (string=? output "out") '() (list output)))))
>> +    ((? origin? origin)                 ;XXXX: Remove next world rebuild
>> +     (let ((texlive (package-source
>> +                     (module-ref (resolve-interface '(gnu packages tex))
>> +                                 'texlive-latex))))
>> +       (if (eq? input texlive)
>> +           (list "_" origin)
>> +           (list (or (origin-actual-file-name origin) "_") origin))))
>
> I think this should be avoided, but what is it that causes a rebuild in
> this case?

It’s about the package texlive-hyphen-complete; it leads to a world
rebuild – as pointed in the cover letter of v2 ;-)

It reads:

    (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))

then:

          (add-before 'build 'include-docstrip.tex
            (lambda* (#:key inputs native-inputs #:allow-other-keys)
              (let ((docstrip.tex
                     (search-input-file (or native-inputs inputs)
                                        "tex/latex/base/docstrip.tex")))

Well, we can apply the same hack as tzdata: temporarily revert to the
old style.

Cheers,
simon