Subject: Re: bug#54090: [PATCH 0/2] gnu: Add tessen.

From: Tanguy LE CARROUR <[email-masked]>
Date: Sun, 06 Mar 2022 19:40:45 +0100

Hi Ludo’

Thanks for reviewing!

Quoting Ludovic Courtès (2022-03-03 23:30:23)
> Tanguy Le Carrour <[email-masked]> skribis:
> 
> > * gnu/packages/password-utils.scm (tessen): New variable.
> 
> [...]
> 
> > +     (origin
> > +       (method url-fetch)
> > +       (uri
> > +        (string-append "https://raw.githubusercontent.com/ayushnix/tessen/"
> > +                       "v" version "/tessen"))
> 
> Is this a stable URL?

As stable as it can get, nowadays?! ^_^'
Anyway, might not be a problem any more once you've reached the end of
this email…

> > +       #:builder
> > +       (begin
> > +         (use-modules (guix build utils))
> > +         (let ((source (string-append (assoc-ref %build-inputs "source")))
> > +               (script "tessen")
> > +               (out (assoc-ref %outputs "out")))
> 
> Could you change that to use a gexp, along these lines:
> 
>   #:builder #~(begin
>                 …
>                 (let ((source #$(package-source this-package))
>                       (out    #$output)
>                       …)
>                   …))

Mmmm… I tried, but could not get anything to work! I ended up with:

```
#:builder #~(begin
             (use-modules (guix build utils))
             (let ((source #$(package-source this-package))
                   (out    #$output)
                   (wtype  #$(this-package-input "wtype"))
                   (script "tessen"))
               (copy-file source script)
               (chmod script #o555)
               (substitute* script
                 (("wtype") (string-append wtype "/bin/wtype")))
               (install-file script (string-append out "/bin"))))
```

But it failed with:

```
ERROR: In procedure %resolve-variable:
Unbound variable: gexp
```

> > +    (propagated-inputs
> > +     (list wtype))
> 
> Could you substitute* the absolute file name of ‘wtype’ in the script
> instead of propagating?

This, at least, I think I did properly! Without the Gexp, I wrote
something that works:

```
(begin
 (use-modules (guix build utils))
 (let ((source (string-append (assoc-ref %build-inputs "source")))
       (script "tessen")
       (out (assoc-ref %outputs "out")))
       (out    (assoc-ref %outputs "out"))
       (wtype  (assoc-ref %build-inputs "wtype"))
       (script "tessen"))
   (copy-file source script)
   (chmod script #o555)
   (install-file script (string-append out "/bin"))))))
```

But actually, I figured out that Tessen was not "just" a Bash script and
could be "properly" `make install`-ed. So, I'll try to rewrite a proper
package definition, fetching the source from Git and installing it the
good old way! I can then use a more familiar `modify-phases` to
substitute `wtype` in the script.

Sounds like a plan to you?!

Regards,

-- 
Tanguy